Commit 95f06aa8 authored by Paolo Bacchilega's avatar Paolo Bacchilega
Browse files

edit metadata: fixed deletion of the date

when the user selects "no date", delete the general::datetime attribute
instead of setting its value to a void string.
parent 74564d14
...@@ -312,27 +312,36 @@ gth_edit_comment_page_real_update_info (GthEditMetadataPage *base, ...@@ -312,27 +312,36 @@ gth_edit_comment_page_real_update_info (GthEditMetadataPage *base,
/* date */ /* date */
if (gtk_combo_box_get_active (GTK_COMBO_BOX (self->priv->date_combobox)) != NO_CHANGE) { switch (gtk_combo_box_get_active (GTK_COMBO_BOX (self->priv->date_combobox))) {
char *exif_date; case NO_CHANGE:
break;
if (gtk_combo_box_get_active (GTK_COMBO_BOX (self->priv->date_combobox)) == CURRENT_DATE) case NO_DATE:
exif_date = _g_time_val_to_exif_date (&self->priv->current_date); g_file_info_remove_attribute (info, "general::datetime");
else break;
exif_date = get_date_from_option (self, gtk_combo_box_get_active (GTK_COMBO_BOX (self->priv->date_combobox)), info); default:
if (! only_modified_fields
|| (gtk_combo_box_get_active (GTK_COMBO_BOX (self->priv->date_combobox)) == NO_DATE)
|| ! gth_file_data_attribute_equal (file_data, "general::datetime", exif_date))
{ {
metadata = g_object_new (GTH_TYPE_METADATA, char *exif_date;
"id", "general::datetime",
"raw", exif_date, if (gtk_combo_box_get_active (GTK_COMBO_BOX (self->priv->date_combobox)) == CURRENT_DATE)
"formatted", exif_date, exif_date = _g_time_val_to_exif_date (&self->priv->current_date);
NULL); else
g_file_info_set_attribute_object (info, "general::datetime", G_OBJECT (metadata)); exif_date = get_date_from_option (self, gtk_combo_box_get_active (GTK_COMBO_BOX (self->priv->date_combobox)), info);
g_object_unref (metadata); if (! only_modified_fields
|| ! gth_file_data_attribute_equal (file_data, "general::datetime", exif_date))
{
metadata = g_object_new (GTH_TYPE_METADATA,
"id", "general::datetime",
"raw", exif_date,
"formatted", exif_date,
NULL);
g_file_info_set_attribute_object (info, "general::datetime", G_OBJECT (metadata));
g_object_unref (metadata);
}
g_free (exif_date);
break;
} }
g_free (exif_date);
} }
/* tags */ /* tags */
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment