]> saetta.ns0.it Git - zakform/gdaex/commitdiff
Use of libzakutils.
authorAndrea Zagli <azagli@libero.it>
Mon, 7 Dec 2015 08:36:07 +0000 (09:36 +0100)
committerAndrea Zagli <azagli@libero.it>
Mon, 7 Dec 2015 08:36:07 +0000 (09:36 +0100)
configure.ac
src/form.c

index e3d6521064cae3dea0f706b2e40e77cc9b81fc5d..9ff3bc7a84ef7de69ebb1f516eba6f714ec26773 100644 (file)
@@ -40,7 +40,8 @@ AM_GLIB_GNU_GETTEXT
 
 # Checks for libraries.
 PKG_CHECK_MODULES(ZAKFORMGDAEX, [libzakform
-                                libgdaex])
+                                libgdaex
+                                                                libzakutils])
 
 AC_SUBST(ZAKFORMGDAEX_CFLAGS)
 AC_SUBST(ZAKFORMGDAEX_LIBS)
index 9d024af3b55bab648b89d2192d56582ac1939a31..a0fd118bf0b947d327629fcea1371ca36afc3627 100644 (file)
@@ -21,6 +21,7 @@
 #endif
 
 #include <libzakform/libzakform.h>
+#include <libzakutils/libzakutils.h>
 
 #include "form.h"
 
@@ -179,26 +180,21 @@ static GValue
 {
        GValue *ret;
 
-       ret = g_new0 (GValue, 1);
        if (g_ascii_strcasecmp (type, "integer") == 0)
                {
-                       ret = g_value_init (ret, G_TYPE_INT);
-                       g_value_set_int (ret, strtol (value, NULL, 10));
+                       ret = zak_utils_gvalue_new_int (strtol (value, NULL, 10));
                }
        else if (g_ascii_strcasecmp (type, "float") == 0)
                {
-                       ret = g_value_init (ret, G_TYPE_FLOAT);
-                       g_value_set_float (ret, g_strtod (value, NULL));
+                       ret = zak_utils_gvalue_new_float (g_strtod (value, NULL));
                }
        else if (g_ascii_strcasecmp (type, "string") == 0)
                {
-                       ret = g_value_init (ret, G_TYPE_STRING);
-                       g_value_set_string (ret, value);
+                       ret = zak_utils_gvalue_new_string (value);
                }
        else if (g_ascii_strcasecmp (type, "boolean") == 0)
                {
-                       ret = g_value_init (ret, G_TYPE_BOOLEAN);
-                       g_value_set_boolean (ret, g_strcmp0 (value, "TRUE") == 0);
+                       ret = zak_utils_gvalue_new_boolean (g_strcmp0 (value, "TRUE") == 0);
                }
 
        return ret;
@@ -273,6 +269,10 @@ zak_form_gdaex_provider_load (ZakFormIProvider *provider, GPtrArray *elements)
                {
                        ret = FALSE;
                }
+       if (dm != NULL)
+               {
+                       g_object_unref (dm);
+               }
 
        return ret;
 }
@@ -330,8 +330,6 @@ zak_form_gdaex_provider_update (ZakFormIProvider *provider, GPtrArray *elements)
        GdaExSqlBuilder *sqlb;
        gboolean with_key;
 
-       GdaDataModel *dm;
-
        ZakFormGdaexProviderPrivate *priv = ZAK_FORM_GDAEX_PROVIDER_GET_PRIVATE (provider);
 
        g_return_val_if_fail (IS_GDAEX (priv->gdaex), FALSE);