]> saetta.ns0.it Git - libgtkform/commitdiff
Bugfixes and adjustments.
authorAndrea Zagli <azagli@libero.it>
Sat, 5 Sep 2009 15:05:28 +0000 (17:05 +0200)
committerAndrea Zagli <azagli@libero.it>
Sat, 5 Sep 2009 15:05:28 +0000 (17:05 +0200)
src/fielddatetime.c
src/form.c

index 6cc2bc156dc033168bd360e4dde3e64950f25a87..9bbe44a0787fc030de2d288057f5cfa984951a32 100644 (file)
@@ -371,7 +371,7 @@ gtk_form_field_datetime_set_from_datamodel (GtkFormField *field, GdaDataModel *d
 
                        format = gtk_form_field_datetime_get_str_format (GTK_FORM_FIELD_DATETIME (field));
 
-                       priv->original_value = gtk_form_field_datetime_get_tm_from_str (value, format);
+                       priv->original_value = g_memdup (datetime, sizeof (struct tm));
                }
        else
                {
@@ -403,6 +403,7 @@ struct tm
        guint len_strv;
        guint len_formatv;
        guint i;
+       guint i_to;
 
        g_return_val_if_fail (str != NULL, NULL);
 
@@ -415,7 +416,7 @@ struct tm
        new_format = g_strstrip (g_strdup (format));
        if (g_strcmp0 (new_format, "") == 0)
                {
-                       new_format = g_strdup ("%Y-%m-%d %H-%M-%S");
+                       new_format = g_strdup ("%Y-%m-%d %H:%M:%S");
                }
 
        /* removes format identifiers to find delimiters */
@@ -449,7 +450,8 @@ struct tm
        ret = g_malloc0 (sizeof (struct tm));
        ret->tm_mday = 1;
 
-       for (i = 0; i < MIN (len_strv, len_formatv); i++)
+       i_to = MIN (len_strv, len_formatv);
+       for (i = 0; i < i_to; i++)
                {
                        if (g_strcmp0 (format_tokens[i], "%Y") == 0)
                                {
index 9370a183bc84212864082391da9bfa6c8192c7a8..2cd115e1ea402fded4a6969a187e3025a1f033b7 100644 (file)
@@ -381,12 +381,12 @@ GtkForm
                                                                                                                                                                {
                                                                                                                                                                        if (g_strcmp0 (type, "datetime") == 0)
                                                                                                                                                                                {
-                                                                                                                                                                                       if (g_strcmp0 (prop, "date"))
+                                                                                                                                                                                       if (g_strcmp0 (prop, "date") == 0)
                                                                                                                                                                                                {
                                                                                                                                                                                                        g_object_set (G_OBJECT (field), "type", GTK_FORM_FIELD_DATETIME_TYPE_DATE, NULL);
                                                                                                                                                                                                
                                                                                                                                                                                                }
-                                                                                                                                                                                       else if (g_strcmp0 (prop, "time"))
+                                                                                                                                                                                       else if (g_strcmp0 (prop, "time") == 0)
                                                                                                                                                                                                {
                                                                                                                                                                                                        g_object_set (G_OBJECT (field), "type", GTK_FORM_FIELD_DATETIME_TYPE_TIME, NULL);