[gthumb] edit metadata: fixed deletion of the date
- From: Paolo Bacchilega <paobac src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gthumb] edit metadata: fixed deletion of the date
- Date: Wed, 20 Jul 2011 21:51:13 +0000 (UTC)
commit 95f06aa8f6b9f0884a6fe236b98a753ec03e49dd
Author: Paolo Bacchilega <paobac src gnome org>
Date: Wed Jul 20 12:36:58 2011 +0200
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.
extensions/edit_metadata/gth-edit-comment-page.c | 47 +++++++++++++---------
1 files changed, 28 insertions(+), 19 deletions(-)
---
diff --git a/extensions/edit_metadata/gth-edit-comment-page.c b/extensions/edit_metadata/gth-edit-comment-page.c
index 5ec72b8..90d4565 100644
--- a/extensions/edit_metadata/gth-edit-comment-page.c
+++ b/extensions/edit_metadata/gth-edit-comment-page.c
@@ -312,27 +312,36 @@ gth_edit_comment_page_real_update_info (GthEditMetadataPage *base,
/* date */
- if (gtk_combo_box_get_active (GTK_COMBO_BOX (self->priv->date_combobox)) != NO_CHANGE) {
- char *exif_date;
-
- if (gtk_combo_box_get_active (GTK_COMBO_BOX (self->priv->date_combobox)) == CURRENT_DATE)
- exif_date = _g_time_val_to_exif_date (&self->priv->current_date);
- else
- exif_date = get_date_from_option (self, gtk_combo_box_get_active (GTK_COMBO_BOX (self->priv->date_combobox)), info);
- 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))
+ switch (gtk_combo_box_get_active (GTK_COMBO_BOX (self->priv->date_combobox))) {
+ case NO_CHANGE:
+ break;
+ case NO_DATE:
+ g_file_info_remove_attribute (info, "general::datetime");
+ break;
+ default:
{
- 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);
+ char *exif_date;
+
+ if (gtk_combo_box_get_active (GTK_COMBO_BOX (self->priv->date_combobox)) == CURRENT_DATE)
+ exif_date = _g_time_val_to_exif_date (&self->priv->current_date);
+ else
+ exif_date = get_date_from_option (self, gtk_combo_box_get_active (GTK_COMBO_BOX (self->priv->date_combobox)), info);
+ 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 */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]