From 4f53f60ea848f64dbcea8eeae417cec4fb69c29c Mon Sep 17 00:00:00 2001 From: Andrea Zagli Date: Wed, 9 Sep 2020 15:13:43 +0200 Subject: [PATCH] Added function ::new. --- src/form.c | 20 ++++++++++++++++++++ src/form.h | 1 + 2 files changed, 21 insertions(+) diff --git a/src/form.c b/src/form.c index ddd5b48..ecf0549 100644 --- a/src/form.c +++ b/src/form.c @@ -88,6 +88,7 @@ zak_form_json_provider_init (ZakFormJsonProvider *zak_form_json_provider) ZakFormJsonProviderPrivate *priv = zak_form_json_provider_get_instance_private (zak_form_json_provider); priv->filename = NULL; + priv->root = NULL; } static void @@ -99,6 +100,25 @@ zak_form_iprovider_interface_init (ZakFormIProviderInterface *iface) iface->delete = zak_form_json_provider_delete; } +/** + * zak_form_json_provider_new: + * + * Returns: the newly created #ZakFormJsonProvider object. + */ +ZakFormJsonProvider +*zak_form_json_provider_new () +{ + ZakFormJsonProvider *zak_form_json_provider; + ZakFormJsonProviderPrivate *priv; + + zak_form_json_provider = ZAK_FORM_JSON_PROVIDER (g_object_new (zak_form_json_provider_get_type (), NULL)); + priv = zak_form_json_provider_get_instance_private (zak_form_json_provider); + + priv->root = zak_utils_json_node_new_array (); + + return zak_form_json_provider; +} + /** * zak_form_json_provider_new_from_file: * @filename: diff --git a/src/form.h b/src/form.h index 4dfb1aa..20263f9 100644 --- a/src/form.h +++ b/src/form.h @@ -32,6 +32,7 @@ G_BEGIN_DECLS G_DECLARE_FINAL_TYPE (ZakFormJsonProvider, zak_form_json_provider, ZAK_FORM_JSON, PROVIDER, GObject) +ZakFormJsonProvider *zak_form_json_provider_new (void); ZakFormJsonProvider *zak_form_json_provider_new_from_file (const gchar *filename); ZakFormJsonProvider *zak_form_json_provider_new_from_data (const gchar *data, gssize length); -- 2.49.0