]> saetta.ns0.it Git - zakform/json/commitdiff
Added function ::new.
authorAndrea Zagli <azagli@libero.it>
Wed, 9 Sep 2020 13:13:43 +0000 (15:13 +0200)
committerAndrea Zagli <azagli@libero.it>
Wed, 9 Sep 2020 13:13:43 +0000 (15:13 +0200)
src/form.c
src/form.h

index ddd5b48e4660fa29ae5540e54b584c995c5a4bfa..ecf05494a1f0775376831c66fafbe7534ac40b38 100644 (file)
@@ -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:
index 4dfb1aa2b2f4f556b91d49e8e12cde79b12aa351..20263f9dcd43db2dc00db2ada0f5d0bfe7bef523 100644 (file)
@@ -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);