]> saetta.ns0.it Git - libgtkform/commitdiff
Adjustments.
authorAndrea Zagli <azagli@libero.it>
Sun, 6 Sep 2009 13:47:19 +0000 (15:47 +0200)
committerAndrea Zagli <azagli@libero.it>
Sun, 6 Sep 2009 13:47:19 +0000 (15:47 +0200)
src/fielddatetime.c
src/fieldtext.c

index 9bbe44a0787fc030de2d288057f5cfa984951a32..253862113217a3983c80f639453e4287c792a3f2 100644 (file)
@@ -113,6 +113,10 @@ gtk_form_field_datetime_class_init (GtkFormFieldDateTimeClass *klass)
 static void
 gtk_form_field_datetime_init (GtkFormFieldDateTime *gtk_form_field)
 {
+       GtkFormFieldDateTimePrivate *priv = GTK_FORM_FIELD_DATETIME_GET_PRIVATE (gtk_form_field);
+
+       priv->default_value = NULL;
+       priv->original_value = NULL;
 }
 
 /**
@@ -309,6 +313,10 @@ gtk_form_field_datetime_is_changed (GtkFormField *field)
                                   || value->tm_min != priv->original_value->tm_min
                                   || value->tm_sec != priv->original_value->tm_sec);
                }
+       else if (value == NULL && priv->original_value != NULL)
+               {
+                       ret = TRUE;
+               }
 
        return ret;
 }
@@ -350,7 +358,6 @@ gtk_form_field_datetime_set_from_datamodel (GtkFormField *field, GdaDataModel *d
        gchar *field_name;
        struct tm *datetime;
        gchar *value;
-       gchar *format;
 
        g_return_val_if_fail (IS_GTK_FORM_FIELD_DATETIME (field), FALSE);
        g_return_val_if_fail (GDA_IS_DATA_MODEL (dm), FALSE);
@@ -369,8 +376,6 @@ gtk_form_field_datetime_set_from_datamodel (GtkFormField *field, GdaDataModel *d
 
                        ret = gtk_form_field_datetime_set_value_stringify (field, value);
 
-                       format = gtk_form_field_datetime_get_str_format (GTK_FORM_FIELD_DATETIME (field));
-
                        priv->original_value = g_memdup (datetime, sizeof (struct tm));
                }
        else
index d249d878f38be0a4f600ab902c3d42cfd4b30460..ec7019423b8a44eab644d533206e7d35d27e4950 100644 (file)
@@ -82,6 +82,9 @@ gtk_form_field_text_class_init (GtkFormFieldTextClass *klass)
 static void
 gtk_form_field_text_init (GtkFormFieldText *gtk_form_field)
 {
+       GtkFormFieldTextPrivate *priv = GTK_FORM_FIELD_TEXT_GET_PRIVATE (gtk_form_field);
+
+       priv->original_value = g_strdup ("");
 }
 
 /**