[gimp] app: fix folder when showing again the export dialog.



commit 5ae7bb6aa28c5f60119f1fb89df1e13c9c590bd9
Author: Jehan <jehan girinstud io>
Date:   Tue Apr 6 22:18:03 2021 +0200

    app: fix folder when showing again the export dialog.
    
    This should not be necessary and I could not find the bug in GIMP. It
    might be in GTK. In any case, after hiding, then showing back the export
    dialog, the file name is right but not the output folder (apparently
    revert to current working directory?).
    With this, we force it to be the same folder as we left the dialog.

 app/dialogs/file-save-dialog.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)
---
diff --git a/app/dialogs/file-save-dialog.c b/app/dialogs/file-save-dialog.c
index 3886de897a..5a51c1a873 100644
--- a/app/dialogs/file-save-dialog.c
+++ b/app/dialogs/file-save-dialog.c
@@ -266,7 +266,19 @@ file_save_dialog_response (GtkWidget *dialog,
         else
           {
             if (dialog)
-              gtk_widget_show (dialog);
+              {
+                GFile *parent_dir = g_file_get_parent (file);
+
+                /* XXX Not sure why, but after reshowing the file
+                 * chooser dialog, the displayed name is correct, but
+                 * the parent directory is the current working dir.
+                 * Force it to be the expected folder.
+                 */
+                gtk_file_chooser_set_current_folder_file (GTK_FILE_CHOOSER (dialog),
+                                                          parent_dir, NULL);
+                gtk_widget_show (dialog);
+                g_object_unref (parent_dir);
+              }
           }
 
         g_object_unref (file);


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