value = gtk_form_field_datetime_get_tm_from_str (gtk_form_field_datetime_get_value_stringify (field),
priv->display_format);
- if (value != NULL)
+ if (value != NULL && priv->original_value != NULL)
{
ret = (value->tm_year != priv->original_value->tm_year
|| value->tm_mon != priv->original_value->tm_mon
|| value->tm_min != priv->original_value->tm_min
|| value->tm_sec != priv->original_value->tm_sec);
}
- else if (value == NULL && priv->original_value != NULL)
+ else if ((value == NULL || priv->original_value == NULL)
+ && !(value == NULL && priv->original_value == NULL))
{
ret = TRUE;
}
return ret;
}
+/**
+ * gtk_form_field_datetime_get_now:
+ *
+ * Returns: a struct tm that represent the actual date and time.
+ */
+struct tm
+*gtk_form_field_datetime_get_now (void)
+{
+ struct tm *ret;
+ time_t tt;
+
+ tt = time (NULL);
+ ret = localtime (&tt);
+
+ return ret;
+}
+
/* PRIVATE */
static void
gtk_form_field_datetime_set_property (GObject *object,