From: Andrea Zagli Date: Mon, 7 Dec 2015 08:36:07 +0000 (+0100) Subject: Use of libzakutils. X-Git-Url: https://saetta.ns0.it/gitweb?a=commitdiff_plain;h=34a86e904a279ac52c747d2846b54f516f4e6163;p=zakform%2Fgdaex Use of libzakutils. --- diff --git a/configure.ac b/configure.ac index e3d6521..9ff3bc7 100644 --- a/configure.ac +++ b/configure.ac @@ -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) diff --git a/src/form.c b/src/form.c index 9d024af..a0fd118 100644 --- a/src/form.c +++ b/src/form.c @@ -21,6 +21,7 @@ #endif #include +#include #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);