[gthumb/gthumb-3-2] resize, convert: correctly set the destination folder



commit aec3db5126890c8e9bd77a4d7b8cca1b183d35d1
Author: Paolo Bacchilega <paobac src gnome org>
Date:   Tue Apr 30 18:52:09 2013 +0200

    resize, convert: correctly set the destination folder

 extensions/convert_format/dlg-convert-format.c |    6 +++---
 extensions/resize_images/dlg-resize-images.c   |    6 +++---
 gthumb/gtk-utils.c                             |   19 +++++++++++++++++++
 gthumb/gtk-utils.h                             |    3 +++
 4 files changed, 28 insertions(+), 6 deletions(-)
---
diff --git a/extensions/convert_format/dlg-convert-format.c b/extensions/convert_format/dlg-convert-format.c
index c8660de..ca46f02 100644
--- a/extensions/convert_format/dlg-convert-format.c
+++ b/extensions/convert_format/dlg-convert-format.c
@@ -199,9 +199,9 @@ dlg_convert_format (GthBrowser *browser,
        }
 
        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);
+       _gtk_file_chooser_set_file_parent (GTK_FILE_CHOOSER (GET_WIDGET ("destination_filechooserbutton")),
+                                          first_file_data->file,
+                                          NULL);
 
        /* Set the signals handlers. */
 
diff --git a/extensions/resize_images/dlg-resize-images.c b/extensions/resize_images/dlg-resize-images.c
index d8f05f6..8791e35 100644
--- a/extensions/resize_images/dlg-resize-images.c
+++ b/extensions/resize_images/dlg-resize-images.c
@@ -355,9 +355,9 @@ dlg_resize_images (GthBrowser *browser,
        /* Set widgets data. */
 
        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);
+       _gtk_file_chooser_set_file_parent (GTK_FILE_CHOOSER (GET_WIDGET ("destination_filechooserbutton")),
+                                          first_file_data->file,
+                                          NULL);
 
        unit = g_settings_get_enum (data->settings, PREF_RESIZE_IMAGES_UNIT);
        gtk_combo_box_set_active (GTK_COMBO_BOX (GET_WIDGET ("unit_combobox")), unit);
diff --git a/gthumb/gtk-utils.c b/gthumb/gtk-utils.c
index a5f8924..b92336c 100644
--- a/gthumb/gtk-utils.c
+++ b/gthumb/gtk-utils.c
@@ -1043,3 +1043,22 @@ _gtk_combo_box_add_image_sizes (GtkComboBox *combo_box,
        }
        gtk_combo_box_set_active (combo_box, active_index);
 }
+
+
+gboolean
+_gtk_file_chooser_set_file_parent (GtkFileChooser   *chooser,
+                                  GFile            *file,
+                                  GError          **error)
+{
+       GFile *parent;
+       gboolean result;
+
+       parent = g_file_get_parent (file);
+       result = gtk_file_chooser_set_file (chooser, parent, error);
+
+       if (parent != NULL)
+               g_object_unref (parent);
+
+       return result;
+}
+
diff --git a/gthumb/gtk-utils.h b/gthumb/gtk-utils.h
index 27664a3..4130ab3 100644
--- a/gthumb/gtk-utils.h
+++ b/gthumb/gtk-utils.h
@@ -133,6 +133,9 @@ GtkIconTheme *  _gtk_widget_get_icon_theme                 (GtkWidget        *wi
 void            _gtk_combo_box_add_image_sizes             (GtkComboBox      *combo_box,
                                                            int               active_width,
                                                            int               active_height);
+gboolean        _gtk_file_chooser_set_file_parent          (GtkFileChooser   *chooser,
+                                                           GFile            *file,
+                                                           GError          **error);
 
 G_END_DECLS
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]