From f3810d9243773b4432072980daa10f657d70a8c1 Mon Sep 17 00:00:00 2001 From: Andrea Zagli Date: Mon, 10 Aug 2020 16:07:04 +0200 Subject: [PATCH] Added function ::get_stringify. --- src/form.c | 19 +++++++++++++++++++ src/form.h | 3 +++ 2 files changed, 22 insertions(+) diff --git a/src/form.c b/src/form.c index f2fb3b5..19d80c8 100644 --- a/src/form.c +++ b/src/form.c @@ -256,6 +256,25 @@ const gchar return ret; } +const gchar +*zak_form_json_provider_get_stringify (ZakFormJsonProvider *provider) +{ + const gchar *ret; + + JsonGenerator *generator; + + ZakFormJsonProviderPrivate *priv = zak_form_json_provider_get_instance_private (provider); + + generator = json_generator_new (); + json_generator_set_root (generator, priv->root); + + ret = json_generator_to_data (generator, NULL); + + g_object_unref (generator); + + return ret; +} + /* PRIVATE */ static void zak_form_json_provider_set_property (GObject *object, diff --git a/src/form.h b/src/form.h index 5be56e6..4dfb1aa 100644 --- a/src/form.h +++ b/src/form.h @@ -38,6 +38,9 @@ ZakFormJsonProvider *zak_form_json_provider_new_from_data (const gchar *data, gs void zak_form_json_provider_set_filename (ZakFormJsonProvider *provider, const gchar *filename); const gchar *zak_form_json_provider_get_filename (ZakFormJsonProvider *provider); +const gchar *zak_form_json_provider_get_stringify (ZakFormJsonProvider *provider); + + G_END_DECLS -- 2.49.0