if (value != NULL && priv->original_value != NULL)
{
ret = (g_date_time_get_year (value) != g_date_time_get_year (priv->original_value)
- || g_date_time_get_month (value) != g_date_time_get_month (priv->original_value)
- || g_date_time_get_day_of_month (value) != g_date_time_get_day_of_month (priv->original_value));
+ || g_date_time_get_month (value) != g_date_time_get_month (priv->original_value)
+ || g_date_time_get_day_of_month (value) != g_date_time_get_day_of_month (priv->original_value));
if (!ret && priv->type == GTK_FORM_FIELD_DATETIME_TYPE_DATETIME)
{
ret = (g_date_time_get_hour (value) != g_date_time_get_hour (priv->original_value)
value = gtk_form_field_datetime_get_gdatetime_from_str (gtk_form_field_datetime_get_value_stringify (field),
priv->display_format);
- priv->original_value = g_date_time_new_local (priv->type != GTK_FORM_FIELD_DATETIME_TYPE_TIME ? g_date_time_get_year (value) : 1,
- priv->type != GTK_FORM_FIELD_DATETIME_TYPE_TIME ?g_date_time_get_month (value) : 1,
- priv->type != GTK_FORM_FIELD_DATETIME_TYPE_TIME ?g_date_time_get_day_of_month (value) : 1,
- priv->type != GTK_FORM_FIELD_DATETIME_TYPE_DATE ? g_date_time_get_hour (value): 0,
- priv->type != GTK_FORM_FIELD_DATETIME_TYPE_DATE ? g_date_time_get_minute (value): 0,
- priv->type != GTK_FORM_FIELD_DATETIME_TYPE_DATE ? g_date_time_get_seconds (value): 0.0);
+ if (value == NULL)
+ {
+ priv->original_value = NULL;
+ }
+ else
+ {
+ priv->original_value = g_date_time_new_local (priv->type != GTK_FORM_FIELD_DATETIME_TYPE_TIME ? g_date_time_get_year (value) : 1,
+ priv->type != GTK_FORM_FIELD_DATETIME_TYPE_TIME ?g_date_time_get_month (value) : 1,
+ priv->type != GTK_FORM_FIELD_DATETIME_TYPE_TIME ?g_date_time_get_day_of_month (value) : 1,
+ priv->type != GTK_FORM_FIELD_DATETIME_TYPE_DATE ? g_date_time_get_hour (value): 0,
+ priv->type != GTK_FORM_FIELD_DATETIME_TYPE_DATE ? g_date_time_get_minute (value): 0,
+ priv->type != GTK_FORM_FIELD_DATETIME_TYPE_DATE ? g_date_time_get_seconds (value): 0.0);
+ }
g_date_time_unref (value);
}