[gthumb] convert and resize: allow to specify a destination folder even when the images are from a catalog
- From: Paolo Bacchilega <paobac src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gthumb] convert and resize: allow to specify a destination folder even when the images are from a catalog
- Date: Tue, 28 Dec 2010 17:24:00 +0000 (UTC)
commit 81c3c2bb5d91f36340ecdd654df830f50305ce91
Author: Paolo Bacchilega <paobac src gnome org>
Date: Tue Dec 28 17:09:29 2010 +0100
convert and resize: allow to specify a destination folder even when the images are from a catalog
.../convert_format/data/ui/convert-format.ui | 36 ++++++++++++++-----
extensions/convert_format/dlg-convert-format.c | 37 +++++++++++++++-----
extensions/resize_images/data/ui/resize-images.ui | 32 ++++++++++++++---
extensions/resize_images/dlg-resize-images.c | 35 ++++++++++++++----
4 files changed, 109 insertions(+), 31 deletions(-)
---
diff --git a/extensions/convert_format/data/ui/convert-format.ui b/extensions/convert_format/data/ui/convert-format.ui
index 6190d51..8540048 100644
--- a/extensions/convert_format/data/ui/convert-format.ui
+++ b/extensions/convert_format/data/ui/convert-format.ui
@@ -11,18 +11,15 @@
<child internal-child="vbox">
<object class="GtkVBox" id="dialog-vbox8">
<property name="visible">True</property>
- <property name="orientation">vertical</property>
<property name="spacing">12</property>
<child>
<object class="GtkVBox" id="vbox61">
<property name="visible">True</property>
<property name="border_width">6</property>
- <property name="orientation">vertical</property>
<property name="spacing">12</property>
<child>
<object class="GtkVBox" id="vbox63">
<property name="visible">True</property>
- <property name="orientation">vertical</property>
<property name="spacing">6</property>
<child>
<object class="GtkLabel" id="label106">
@@ -75,7 +72,6 @@
<child>
<object class="GtkVBox" id="saving_box">
<property name="visible">True</property>
- <property name="orientation">vertical</property>
<property name="spacing">6</property>
<child>
<object class="GtkLabel" id="label1">
@@ -97,12 +93,34 @@
<property name="visible">True</property>
<property name="left_padding">12</property>
<child>
- <object class="GtkFileChooserButton" id="destination_filechooserbutton">
+ <object class="GtkVBox" id="vbox1">
<property name="visible">True</property>
- <property name="create_folders">False</property>
- <property name="local_only">False</property>
- <property name="action">select-folder</property>
- <property name="title" translatable="yes">Choose destination folder</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkFileChooserButton" id="destination_filechooserbutton">
+ <property name="visible">True</property>
+ <property name="create_folders">False</property>
+ <property name="action">select-folder</property>
+ <property name="local_only">False</property>
+ <property name="title" translatable="yes">Choose destination folder</property>
+ </object>
+ <packing>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkCheckButton" id="use_destination_checkbutton">
+ <property name="label" translatable="yes">_Use the original image folder</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_underline">True</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
</object>
</child>
</object>
diff --git a/extensions/convert_format/dlg-convert-format.c b/extensions/convert_format/dlg-convert-format.c
index 5f95786..9895ccc 100644
--- a/extensions/convert_format/dlg-convert-format.c
+++ b/extensions/convert_format/dlg-convert-format.c
@@ -117,12 +117,24 @@ ok_button_clicked_cb (GtkWidget *widget,
}
+static void
+use_destination_checkbutton_toggled_cb (GtkToggleButton *button,
+ gpointer user_data)
+{
+ DialogData *data = user_data;
+
+ data->use_destination = ! gtk_toggle_button_get_active (button);
+ gtk_widget_set_sensitive (GET_WIDGET ("destination_filechooserbutton"), data->use_destination);
+}
+
+
void
dlg_convert_format (GthBrowser *browser,
GList *file_list)
{
- DialogData *data;
- GArray *savers;
+ DialogData *data;
+ GArray *savers;
+ GthFileData *first_file_data;
if (gth_browser_get_dialog (browser, "convert_format") != NULL) {
gtk_window_present (GTK_WINDOW (gth_browser_get_dialog (browser, "convert_format")));
@@ -133,7 +145,7 @@ dlg_convert_format (GthBrowser *browser,
data->browser = browser;
data->builder = _gtk_builder_new_from_file ("convert-format.ui", "convert_format");
data->file_list = gth_file_data_list_dup (file_list);
- data->use_destination = GTH_IS_FILE_SOURCE_VFS (gth_browser_get_location_source (browser));
+ data->use_destination = TRUE;
/* Get the widgets. */
@@ -182,12 +194,10 @@ dlg_convert_format (GthBrowser *browser,
g_free (default_mime_type);
}
- if (data->use_destination) {
- gtk_file_chooser_set_file (GTK_FILE_CHOOSER (GET_WIDGET ("destination_filechooserbutton")), gth_browser_get_location (browser), NULL);
- gtk_widget_show (GET_WIDGET ("saving_box"));
- }
- else
- gtk_widget_hide (GET_WIDGET ("saving_box"));
+ first_file_data = (GthFileData *) data->file_list->data;
+ gtk_file_chooser_set_file (GTK_FILE_CHOOSER (GET_WIDGET ("destination_filechooserbutton")),
+ first_file_data->file,
+ NULL);
/* Set the signals handlers. */
@@ -207,9 +217,18 @@ dlg_convert_format (GthBrowser *browser,
"clicked",
G_CALLBACK (gtk_widget_destroy),
G_OBJECT (data->dialog));
+ g_signal_connect (GET_WIDGET ("use_destination_checkbutton"),
+ "toggled",
+ G_CALLBACK (use_destination_checkbutton_toggled_cb),
+ data);
/* Run dialog. */
+ if (GTH_IS_FILE_SOURCE_VFS (gth_browser_get_location_source (browser)))
+ gtk_widget_hide (GET_WIDGET ("use_destination_checkbutton"));
+ else
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (GET_WIDGET ("use_destination_checkbutton")), TRUE);
+
gtk_window_set_transient_for (GTK_WINDOW (data->dialog), GTK_WINDOW (browser));
gtk_window_set_modal (GTK_WINDOW (data->dialog), FALSE);
gtk_widget_show (data->dialog);
diff --git a/extensions/resize_images/data/ui/resize-images.ui b/extensions/resize_images/data/ui/resize-images.ui
index 89522cc..76f0e87 100644
--- a/extensions/resize_images/data/ui/resize-images.ui
+++ b/extensions/resize_images/data/ui/resize-images.ui
@@ -216,12 +216,34 @@
<property name="visible">True</property>
<property name="left_padding">12</property>
<child>
- <object class="GtkFileChooserButton" id="destination_filechooserbutton">
+ <object class="GtkVBox" id="vbox1">
<property name="visible">True</property>
- <property name="local_only">False</property>
- <property name="create_folders">False</property>
- <property name="action">select-folder</property>
- <property name="title" translatable="yes">Choose destination folder</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkFileChooserButton" id="destination_filechooserbutton">
+ <property name="visible">True</property>
+ <property name="create_folders">False</property>
+ <property name="action">select-folder</property>
+ <property name="local_only">False</property>
+ <property name="title" translatable="yes">Choose destination folder</property>
+ </object>
+ <packing>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkCheckButton" id="use_destination_checkbutton">
+ <property name="label" translatable="yes">_Use the original image folder</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_underline">True</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
</object>
</child>
</object>
diff --git a/extensions/resize_images/dlg-resize-images.c b/extensions/resize_images/dlg-resize-images.c
index 992f3b5..2d2670b 100644
--- a/extensions/resize_images/dlg-resize-images.c
+++ b/extensions/resize_images/dlg-resize-images.c
@@ -191,11 +191,23 @@ unit_combobox_changed_cb (GtkComboBox *combobox,
}
+static void
+use_destination_checkbutton_toggled_cb (GtkToggleButton *button,
+ gpointer user_data)
+{
+ DialogData *data = user_data;
+
+ data->use_destination = ! gtk_toggle_button_get_active (button);
+ gtk_widget_set_sensitive (GET_WIDGET ("destination_filechooserbutton"), data->use_destination);
+}
+
+
void
dlg_resize_images (GthBrowser *browser,
GList *file_list)
{
- DialogData *data;
+ DialogData *data;
+ GthFileData *first_file_data;
if (gth_browser_get_dialog (browser, "resize_images") != NULL) {
gtk_window_present (GTK_WINDOW (gth_browser_get_dialog (browser, "resize_images")));
@@ -206,7 +218,7 @@ dlg_resize_images (GthBrowser *browser,
data->browser = browser;
data->builder = _gtk_builder_new_from_file ("resize-images.ui", "resize_images");
data->file_list = gth_file_data_list_dup (file_list);
- data->use_destination = GTH_IS_FILE_SOURCE_VFS (gth_browser_get_location_source (browser));
+ data->use_destination = TRUE;
/* Get the widgets. */
@@ -222,12 +234,10 @@ dlg_resize_images (GthBrowser *browser,
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (GET_WIDGET ("keep_ratio_checkbutton")), eel_gconf_get_boolean (PREF_RESIZE_IMAGES_KEEP_RATIO, TRUE));
update_sensitivity (data);
- if (data->use_destination) {
- gtk_file_chooser_set_file (GTK_FILE_CHOOSER (GET_WIDGET ("destination_filechooserbutton")), gth_browser_get_location (browser), NULL);
- gtk_widget_show (GET_WIDGET ("saving_box"));
- }
- else
- gtk_widget_hide (GET_WIDGET ("saving_box"));
+ first_file_data = (GthFileData *) data->file_list->data;
+ gtk_file_chooser_set_file (GTK_FILE_CHOOSER (GET_WIDGET ("destination_filechooserbutton")),
+ first_file_data->file,
+ NULL);
/* Set the signals handlers. */
@@ -251,9 +261,18 @@ dlg_resize_images (GthBrowser *browser,
"changed",
G_CALLBACK (unit_combobox_changed_cb),
data);
+ g_signal_connect (GET_WIDGET ("use_destination_checkbutton"),
+ "toggled",
+ G_CALLBACK (use_destination_checkbutton_toggled_cb),
+ data);
/* Run dialog. */
+ if (GTH_IS_FILE_SOURCE_VFS (gth_browser_get_location_source (browser)))
+ gtk_widget_hide (GET_WIDGET ("use_destination_checkbutton"));
+ else
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (GET_WIDGET ("use_destination_checkbutton")), TRUE);
+
gtk_window_set_transient_for (GTK_WINDOW (data->dialog), GTK_WINDOW (browser));
gtk_window_set_modal (GTK_WINDOW (data->dialog), FALSE);
gtk_widget_show (data->dialog);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]