[simple-scan] Use Gtk.FileChooserNative for save dialog so works in sandboxed environments



commit b6ee8e4694cecc8ff88cd673fc04809e45b4ccf5
Author: Robert Ancell <robert ancell canonical com>
Date:   Mon Oct 29 10:57:53 2018 +1300

    Use Gtk.FileChooserNative for save dialog so works in sandboxed environments

 src/app-window.vala | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)
---
diff --git a/src/app-window.vala b/src/app-window.vala
index 2878e3a..c7f727d 100644
--- a/src/app-window.vala
+++ b/src/app-window.vala
@@ -104,7 +104,7 @@ public class AppWindow : Gtk.ApplicationWindow
     private bool have_devices = false;
     private string? missing_driver = null;
 
-    private Gtk.FileChooserDialog? save_dialog;
+    private Gtk.FileChooserNative? save_dialog;
 
     public Book book { get; private set; }
     private bool book_needs_saving;
@@ -290,13 +290,12 @@ public class AppWindow : Gtk.ApplicationWindow
         if (directory == null || directory == "")
             directory = Environment.get_user_special_dir (UserDirectory.DOCUMENTS);
 
-        save_dialog = new Gtk.FileChooserDialog (/* Save dialog: Dialog title */
+        save_dialog = new Gtk.FileChooserNative (/* Save dialog: Dialog title */
                                                  _("Save As…"),
                                                  this,
                                                  Gtk.FileChooserAction.SAVE,
-                                                 _("_Cancel"), Gtk.ResponseType.CANCEL,
-                                                 _("_Save"), Gtk.ResponseType.ACCEPT,
-                                                 null);
+                                                 _("_Save"),
+                                                 _("_Cancel"));
         save_dialog.local_only = false;
         if (book_uri != null)
             save_dialog.set_uri (book_uri);
@@ -442,7 +441,7 @@ public class AppWindow : Gtk.ApplicationWindow
             else
                 files.append (File.new_for_uri (uri));
 
-            if (check_overwrite (save_dialog, files))
+            if (check_overwrite (save_dialog.transient_for, files))
                 break;
         }
 


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