[gthumb] Added option to erase comment tags upon import - bug 583466
- From: Michael J. Chudobiak <mjc src gnome org>
- To: svn-commits-list gnome org
- Subject: [gthumb] Added option to erase comment tags upon import - bug 583466
- Date: Thu, 4 Jun 2009 15:59:21 -0400 (EDT)
commit e1c42d0258be5c91861da722c350080c0618641c
Author: Michael J. Chudobiak <mjc avtechpulse com>
Date: Thu Jun 4 15:58:18 2009 -0400
Added option to erase comment tags upon import - bug 583466
---
data/glade/gthumb_camera.glade | 2 +-
data/gthumb.schemas.in | 13 +++++++++
libgthumb/preferences.h | 2 +
src/dlg-photo-importer.c | 56 ++++++++++++++++++++++++++++++++-------
4 files changed, 62 insertions(+), 11 deletions(-)
diff --git a/data/glade/gthumb_camera.glade b/data/glade/gthumb_camera.glade
index f4bb5c8..e6aecbd 100644
--- a/data/glade/gthumb_camera.glade
+++ b/data/glade/gthumb_camera.glade
@@ -540,7 +540,7 @@
<child>
<widget class="GtkCheckButton" id="reset_comment_tags_on_import_checkbutton">
<property name="visible">True</property>
- <property name="tooltip" translatable="yes">Some cameras automatically insert Exif ImageDescription or UserComment tags in the image metadata. gThumb will recognize these as comments. If you do not want to use the camera-generated comments, enable this checkbox.</property>
+ <property name="tooltip" translatable="yes">Some cameras automatically insert Exif ImageDescription or UserComment tags in the image metadata. gThumb will recognize these as comments. If you do not want to use the camera-generated comments, enable this checkbox. This only applies to JPEG files.</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">_Erase image description and user comment</property>
<property name="use_underline">True</property>
diff --git a/data/gthumb.schemas.in b/data/gthumb.schemas.in
index eed9293..562e014 100644
--- a/data/gthumb.schemas.in
+++ b/data/gthumb.schemas.in
@@ -2246,6 +2246,19 @@
</locale>
</schema>
+ <schema>
+ <key>/schemas/apps/gthumb/dialogs/photo_importer/reset_comment_tags_on_import</key>
+ <applyto>/apps/gthumb/dialogs/photo_importer/reset_comment_tags_on_import</applyto>
+ <owner>gthumb</owner>
+ <type>bool</type>
+ <default>TRUE</default>
+ <locale name="C">
+ <short></short>
+ <long>
+ </long>
+ </locale>
+ </schema>
+
<!-- Rotate Dialog -->
<schema>
diff --git a/libgthumb/preferences.h b/libgthumb/preferences.h
index 802edf4..59a5509 100644
--- a/libgthumb/preferences.h
+++ b/libgthumb/preferences.h
@@ -223,6 +223,8 @@
#define PREF_PHOTO_IMPORT_CUSTOM_FORMAT "/apps/gthumb/dialogs/photo_importer/custom_format_code"
#define PREF_PHOTO_IMPORT_DELETE "/apps/gthumb/dialogs/photo_importer/delete_from_camera"
#define PREF_PHOTO_IMPORT_RESET_EXIF_ORIENTATION "/apps/gthumb/dialogs/photo_importer/reset_exif_orientation_on_import"
+#define PREF_PHOTO_IMPORT_RESET_COMMENT_TAGS "/apps/gthumb/dialogs/photo_importer/reset_comment_tags_on_import"
+
#define PREF_PHOTO_IMPORT_MODEL "/apps/gthumb/dialogs/photo_importer/model"
#define PREF_PHOTO_IMPORT_PORT "/apps/gthumb/dialogs/photo_importer/port"
diff --git a/src/dlg-photo-importer.c b/src/dlg-photo-importer.c
index eb47e02..b24b86d 100644
--- a/src/dlg-photo-importer.c
+++ b/src/dlg-photo-importer.c
@@ -101,6 +101,7 @@ struct _DialogData {
GtkWidget *import_ok_button;
GtkWidget *i_commands_table;
GtkWidget *reset_exif_tag_on_import_checkbutton;
+ GtkWidget *reset_comment_tags_on_import_checkbutton;
GtkWidget *progress_info_image;
GtkWidget *progress_info_label;
@@ -120,6 +121,7 @@ struct _DialogData {
gboolean delete_from_camera;
gboolean adjust_orientation;
+ gboolean reset_comment_tags;
int image_n;
char *local_folder;
@@ -695,6 +697,7 @@ main_dialog_set_sensitive (DialogData *data,
gtk_widget_set_sensitive (data->import_delete_button, value);
gtk_widget_set_sensitive (data->i_commands_table, value);
gtk_widget_set_sensitive (data->reset_exif_tag_on_import_checkbutton, value);
+ gtk_widget_set_sensitive (data->reset_comment_tags_on_import_checkbutton, value);
}
@@ -1325,7 +1328,7 @@ save_image (DialogData *data,
/* Adjust the photo orientation based on the exif
orientation tag, if requested */
if (!error_found) {
- if (data->adjust_orientation)
+ if (data->adjust_orientation || data->reset_comment_tags)
data->adjust_orientation_list = g_list_prepend (data->adjust_orientation_list, g_strdup (final_dest_path));
if (data->delete_from_camera)
data->delete_list = g_list_prepend (data->delete_list, g_strdup (camera_path));
@@ -1452,16 +1455,31 @@ adjust_orientation__step (AsyncOperationData *aodata,
fd = file_data_new (uri);
file_data_update (fd);
+
+ if (data->adjust_orientation) {
+ if (data->msg_text != NULL)
+ g_free (data->msg_text);
+ data->msg_text = g_strdup_printf (_("Adjusting orientation of \'%s\'."), fd->utf8_name);
+
+ transform = get_orientation_from_fd (fd);
+ if (image_is_jpeg (uri))
+ success = apply_transformation_jpeg (fd, transform, JPEG_MCU_ACTION_DONT_TRIM, NULL);
+ else
+ success = apply_transformation_generic (fd, transform, NULL);
+ }
- if (data->msg_text != NULL)
- g_free (data->msg_text);
- data->msg_text = g_strdup_printf (_("Adjusting orientation of \'%s\'."), fd->utf8_name);
+ if (data->reset_comment_tags) {
+ if (data->msg_text != NULL)
+ g_free (data->msg_text);
+ data->msg_text = g_strdup_printf (_("Erasing comment tags in \'%s\'."), fd->utf8_name);
+
+ GList *add_metadata = NULL;
+ add_metadata = simple_add_metadata (add_metadata, "Exif.Photo.UserComment", "");
+ add_metadata = simple_add_metadata (add_metadata, "Exif.Image.ImageDescription", "");
+ update_and_save_metadata_fd (fd, fd, add_metadata);
+ free_metadata (add_metadata);
+ }
- transform = get_orientation_from_fd (fd);
- if (image_is_jpeg (uri))
- success = apply_transformation_jpeg (fd, transform, JPEG_MCU_ACTION_DONT_TRIM, NULL);
- else
- success = apply_transformation_generic (fd, transform, NULL);
file_data_unref (fd);
}
@@ -1608,6 +1626,7 @@ ok_clicked_cb (GtkButton *button,
data->delete_from_camera = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (data->delete_checkbutton));
data->adjust_orientation = eel_gconf_get_boolean (PREF_PHOTO_IMPORT_RESET_EXIF_ORIENTATION, TRUE);
+ data->reset_comment_tags = eel_gconf_get_boolean (PREF_PHOTO_IMPORT_RESET_COMMENT_TAGS, TRUE);
eel_gconf_set_boolean (PREF_PHOTO_IMPORT_DELETE, data->delete_from_camera);
@@ -1736,7 +1755,7 @@ choose_tags_cb (GtkButton *button,
static void
reset_exif_tag_on_import_cb (GtkButton *button,
- DialogData *data)
+ DialogData *data)
{
eel_gconf_set_boolean (PREF_PHOTO_IMPORT_RESET_EXIF_ORIENTATION,
gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (data->reset_exif_tag_on_import_checkbutton)));
@@ -1744,6 +1763,15 @@ reset_exif_tag_on_import_cb (GtkButton *button,
static void
+reset_comment_tags_on_import_cb (GtkButton *button,
+ DialogData *data)
+{
+ eel_gconf_set_boolean (PREF_PHOTO_IMPORT_RESET_COMMENT_TAGS,
+ gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (data->reset_comment_tags_on_import_checkbutton)));
+}
+
+
+static void
import_reload_cb (GtkButton *button,
DialogData *data)
{
@@ -2035,6 +2063,8 @@ dlg_photo_importer (GthBrowser *browser)
data->i_commands_table = glade_xml_get_widget (data->gui, "i_commands_table");
data->import_ok_button = glade_xml_get_widget (data->gui, "import_okbutton");
data->reset_exif_tag_on_import_checkbutton = glade_xml_get_widget (data->gui, "reset_exif_tag_on_import_checkbutton");
+ data->reset_comment_tags_on_import_checkbutton = glade_xml_get_widget (data->gui, "reset_comment_tags_on_import_checkbutton");
+
btn_cancel = glade_xml_get_widget (data->gui, "import_cancelbutton");
btn_help = glade_xml_get_widget (data->gui, "import_helpbutton");
@@ -2070,6 +2100,7 @@ dlg_photo_importer (GthBrowser *browser)
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (data->delete_checkbutton), eel_gconf_get_boolean (PREF_PHOTO_IMPORT_DELETE, FALSE));
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (data->reset_exif_tag_on_import_checkbutton), eel_gconf_get_boolean (PREF_PHOTO_IMPORT_RESET_EXIF_ORIENTATION, TRUE));
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (data->reset_comment_tags_on_import_checkbutton), eel_gconf_get_boolean (PREF_PHOTO_IMPORT_RESET_COMMENT_TAGS, TRUE));
default_path = eel_gconf_get_path (PREF_PHOTO_IMPORT_DESTINATION, NULL);
if ((default_path == NULL) || (*default_path == 0))
@@ -2138,6 +2169,11 @@ dlg_photo_importer (GthBrowser *browser)
G_CALLBACK (reset_exif_tag_on_import_cb),
data);
+ g_signal_connect (G_OBJECT (data->reset_comment_tags_on_import_checkbutton),
+ "clicked",
+ G_CALLBACK (reset_comment_tags_on_import_cb),
+ data);
+
g_signal_connect (G_OBJECT (data->subfolder_combobox),
"changed",
G_CALLBACK (subfolder_mode_changed_cb),
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]