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
{
guint len_strv;
guint len_formatv;
guint i;
+ guint i_to;
g_return_val_if_fail (str != NULL, NULL);
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 */
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)
{
{
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);