]> saetta.ns0.it Git - libgtkform/commitdiff
Bugfix on float to string conversion.
authorAndrea Zagli <azagli@libero.it>
Sat, 6 Mar 2010 10:24:06 +0000 (11:24 +0100)
committerAndrea Zagli <azagli@libero.it>
Sat, 6 Mar 2010 10:24:06 +0000 (11:24 +0100)
src/fieldfloat.c

index a8a5159761fb4a8b6ab1635994ed474c0c58a906..f0f2a1e1fb3a182dd8b4434f3091bcb17959bb20 100644 (file)
@@ -293,7 +293,7 @@ gtk_form_field_float_set_from_datamodel (GtkFormField *field, GdaDataModel *dm,
 {
        gboolean ret = FALSE;
        GtkFormFieldFloatPrivate *priv;
-       gchar *value;
+       gfloat value;
        gchar *field_name;
 
        g_return_val_if_fail (IS_GTK_FORM_FIELD_FLOAT (field), FALSE);
@@ -303,14 +303,14 @@ gtk_form_field_float_set_from_datamodel (GtkFormField *field, GdaDataModel *dm,
 
        field_name = gtk_form_field_get_field_name (field);
 
-       value = gdaex_data_model_get_field_value_stringify_at (dm, row, field_name);
+       value = gdaex_data_model_get_field_value_float_at (dm, row, field_name);
 
-       ret = gtk_form_field_float_set_value_stringify (field, value);
+       setlocale (LC_NUMERIC, "");
+       ret = gtk_form_field_float_set_value_stringify (field, g_strdup_printf ("%f", value));
 
-       priv->original_value = g_strtod (value, NULL);
+       priv->original_value = value;
 
        g_free (field_name);
-       g_free (value);
 
        return ret;
 }