]> saetta.ns0.it Git - zakform/ini/commitdiff
Migration to gvalue. develop
authorAndrea Zagli <azagli@libero.it>
Sat, 17 Jun 2017 09:49:28 +0000 (11:49 +0200)
committerAndrea Zagli <azagli@libero.it>
Sat, 17 Jun 2017 09:49:28 +0000 (11:49 +0200)
src/form.c

index 6d748eb7fd139e5658a38ffb749579a025c9b25b..175987e32ad627d756090e4e4993b3a3fa688db5 100644 (file)
@@ -231,7 +231,7 @@ static gchar
 
        GString *key;
 
-       gchar *value;
+       GValue *value;
 
        guint i;
 
@@ -242,9 +242,9 @@ static gchar
 
                        if (zak_form_element_get_is_key (element))
                                {
-                                       value = zak_form_element_unformat (element, zak_form_element_get_value (element));
-                                       g_string_append_printf (key, "|%s", value);
-                                       g_free (value);
+                                       value = zak_form_element_unformat_gvalue (element, zak_form_element_get_value_gvalue (element));
+                                       g_string_append_printf (key, "|%s", g_value_get_string (value));
+                                       g_value_unset (value);
                                }
                }
 
@@ -302,7 +302,7 @@ zak_form_ini_provider_insert (ZakFormIProvider *provider, GPtrArray *elements)
 
        guint i;
 
-       gchar *value;
+       GValue *value;
        gchar *group;
 
        GError *error;
@@ -318,11 +318,11 @@ zak_form_ini_provider_insert (ZakFormIProvider *provider, GPtrArray *elements)
                        ZakFormElement *element = (ZakFormElement *)g_ptr_array_index (elements, i);
                        if (zak_form_element_get_to_save (element))
                                {
-                                       value = zak_form_element_unformat (element, zak_form_element_get_value (element));
+                                       value = zak_form_element_unformat_gvalue (element, zak_form_element_get_value_gvalue (element));
 
                                        g_key_file_set_string (priv->kfile, group,
                                                               zak_form_element_get_name (element),
-                                                              value);
+                                                              g_value_get_string (value));
 
                                        error = NULL;
                                        if (!g_key_file_save_to_file (priv->kfile, priv->filename, &error)
@@ -333,7 +333,7 @@ zak_form_ini_provider_insert (ZakFormIProvider *provider, GPtrArray *elements)
                                                                   error != NULL && error->message != NULL ? error->message : "no details");
                                                }
 
-                                       g_free (value);
+                                       g_value_unset (value);
                                }
                }