]> saetta.ns0.it Git - zakform/gdaex/commitdiff
Migration to GValue for element value. gvalue
authorAndrea Zagli <azagli@libero.it>
Sat, 13 May 2017 09:41:09 +0000 (11:41 +0200)
committerAndrea Zagli <azagli@libero.it>
Sat, 13 May 2017 10:05:49 +0000 (12:05 +0200)
configure.ac
src/form.c

index 9ff3bc7a84ef7de69ebb1f516eba6f714ec26773..d48c8526af11c19239701a26464f76b7e03bb841 100644 (file)
@@ -40,8 +40,8 @@ AM_GLIB_GNU_GETTEXT
 
 # Checks for libraries.
 PKG_CHECK_MODULES(ZAKFORMGDAEX, [libzakform
-                                libgdaex
-                                                                libzakutils])
+                                 libgdaex
+                                 libzakutils])
 
 AC_SUBST(ZAKFORMGDAEX_CFLAGS)
 AC_SUBST(ZAKFORMGDAEX_LIBS)
index 7b35bbd61a6b0f8ebd0b8024d60f43d30c25ee67..41df4c576ff190873f130876c1ab8fb9f03067e8 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2015 Andrea Zagli <azagli@libero.it>
+ * Copyright (C) 2015-2017 Andrea Zagli <azagli@libero.it>
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -283,11 +283,11 @@ static GValue
 {
        GValue *ret;
 
-       gchar *value;
+       GValue *value;
        gchar *type;
        GHashTable *format;
 
-       value = zak_form_element_get_value (element);
+       value = zak_form_element_get_value_gvalue (element);
        type = zak_form_element_get_provider_type (element);
        format = zak_form_element_get_format (element);
 
@@ -298,7 +298,7 @@ static GValue
 
                        thousands_saparator = (gchar *)g_hash_table_lookup (format, "thousands_separator");
 
-                       unformatted = zak_utils_unformat_money_full (value, thousands_saparator, NULL);
+                       unformatted = zak_utils_unformat_money_full (g_value_get_string (value), thousands_saparator, NULL);
 
                        if (for_where && unformatted == 0.0)
                                {
@@ -318,7 +318,7 @@ static GValue
                        thousands_saparator = (gchar *)g_hash_table_lookup (format, "thousands_separator");
                        currency_symbol = (gchar *)g_hash_table_lookup (format, "currency_symbol");
 
-                       unformatted = zak_utils_unformat_money_full (value, thousands_saparator, currency_symbol);
+                       unformatted = zak_utils_unformat_money_full (g_value_get_string (value), thousands_saparator, currency_symbol);
 
                        if (for_where && unformatted == 0.0)
                                {
@@ -331,18 +331,18 @@ static GValue
                }
        else if (g_ascii_strcasecmp (type, "string") == 0)
                {
-                       if (for_where && g_strcmp0 (g_strstrip (g_strdup (value)), "") == 0)
+                       if (for_where && g_strcmp0 (g_strstrip (g_strdup (g_value_get_string (value))), "") == 0)
                                {
                                        ret = gda_value_new_null ();
                                }
                        else
                                {
-                                       ret = zak_utils_gvalue_new_string (value);
+                                       ret = zak_utils_gvalue_new_string (g_value_get_string (value));
                                }
                }
        else if (g_ascii_strcasecmp (type, "boolean") == 0)
                {
-                       ret = zak_utils_gvalue_new_boolean (zak_utils_string_to_boolean (value));
+                       ret = zak_utils_gvalue_new_boolean (zak_utils_string_to_boolean (g_value_get_string (value)));
                }
        else if (g_ascii_strcasecmp (type, "date") == 0)
                {
@@ -351,7 +351,7 @@ static GValue
                        gchar *datetime_format;
 
                        datetime_format = (gchar *)g_hash_table_lookup (format, "content");
-                       gdt = zak_utils_get_gdatetime_from_string (value, datetime_format);
+                       gdt = zak_utils_get_gdatetime_from_string (g_value_get_string (value), datetime_format);
 
                        if (gdt == NULL)
                                {
@@ -374,7 +374,7 @@ static GValue
                        gchar *datetime_format;
 
                        datetime_format = (gchar *)g_hash_table_lookup (format, "content");
-                       gdt = zak_utils_get_gdatetime_from_string (value, datetime_format);
+                       gdt = zak_utils_get_gdatetime_from_string (g_value_get_string (value), datetime_format);
 
                        if (gdt == NULL)
                                {
@@ -397,7 +397,7 @@ static GValue
                        gchar *datetime_format;
 
                        datetime_format = (gchar *)g_hash_table_lookup (format, "content");
-                       gdt = zak_utils_get_gdatetime_from_string (value, datetime_format);
+                       gdt = zak_utils_get_gdatetime_from_string (g_value_get_string (value), datetime_format);
 
                        if (gdt == NULL)
                                {