[shotwell/wip/phako/enhanced-faces: 126/136] Use GtkFileChooserNative



commit 9232871ff6b7351e2ce9eeaeb0dc28d5f9ef9fc4
Author: Jens Georg <mail jensge org>
Date:   Wed Oct 10 11:07:25 2018 +0200

    Use GtkFileChooserNative
    
    Make proper use of portals in the flatpak

 src/Dialogs.vala                | 14 ++++++--------
 src/direct/DirectPhotoPage.vala |  7 +++----
 src/library/LibraryWindow.vala  |  7 +++----
 3 files changed, 12 insertions(+), 16 deletions(-)
---
diff --git a/src/Dialogs.vala b/src/Dialogs.vala
index d99ac9f3..d5c8f80a 100644
--- a/src/Dialogs.vala
+++ b/src/Dialogs.vala
@@ -73,9 +73,8 @@ public File? choose_file(string current_file_basename) {
     string file_chooser_title = VideoReader.is_supported_video_filename(current_file_basename) ?
         _("Export Video") : _("Export Photo");
         
-    Gtk.FileChooserDialog chooser = new Gtk.FileChooserDialog(file_chooser_title,
-        AppWindow.get_instance(), Gtk.FileChooserAction.SAVE, Resources.CANCEL_LABEL, 
-        Gtk.ResponseType.CANCEL, Resources.SAVE_LABEL, Gtk.ResponseType.ACCEPT, null);
+    var chooser = new Gtk.FileChooserNative(file_chooser_title,
+        AppWindow.get_instance(), Gtk.FileChooserAction.SAVE, Resources.SAVE_LABEL, Resources.CANCEL_LABEL);
     chooser.set_do_overwrite_confirmation(true);
     chooser.set_current_folder(current_export_dir.get_path());
     chooser.set_current_name(current_file_basename);
@@ -98,9 +97,8 @@ public File? choose_dir(string? user_title = null) {
     if (user_title == null)
         user_title = _("Export Photos");
 
-    Gtk.FileChooserDialog chooser = new Gtk.FileChooserDialog(user_title,
-        AppWindow.get_instance(), Gtk.FileChooserAction.SELECT_FOLDER, Resources.CANCEL_LABEL, 
-        Gtk.ResponseType.CANCEL, Resources.OK_LABEL, Gtk.ResponseType.ACCEPT, null);
+    var chooser = new Gtk.FileChooserNative(user_title,
+        AppWindow.get_instance(), Gtk.FileChooserAction.SELECT_FOLDER, Resources.OK_LABEL, 
Resources.CANCEL_LABEL);
     chooser.set_current_folder(current_export_dir.get_path());
     chooser.set_local_only(false);
     
@@ -582,9 +580,9 @@ public bool report_manifest(ImportManifest manifest, bool show_dest_id,
 }
 
 internal void save_import_results(Gtk.Window? chooser_dialog_parent, string results_log) {
-    Gtk.FileChooserDialog chooser_dialog = new Gtk.FileChooserDialog(
+    var chooser_dialog = new Gtk.FileChooserNative(
         ImportUI.SAVE_RESULTS_FILE_CHOOSER_TITLE, chooser_dialog_parent, Gtk.FileChooserAction.SAVE,
-        Resources.CANCEL_LABEL, Gtk.ResponseType.CANCEL, Resources.SAVE_AS_LABEL, Gtk.ResponseType.ACCEPT, 
null);
+        Resources.SAVE_AS_LABEL, Resources.CANCEL_LABEL);
     chooser_dialog.set_do_overwrite_confirmation(true);
     chooser_dialog.set_current_folder(Environment.get_home_dir());
     chooser_dialog.set_current_name("Shotwell Import Log.txt");
diff --git a/src/direct/DirectPhotoPage.vala b/src/direct/DirectPhotoPage.vala
index 8b31503f..4dddc00f 100644
--- a/src/direct/DirectPhotoPage.vala
+++ b/src/direct/DirectPhotoPage.vala
@@ -407,9 +407,8 @@ public class DirectPhotoPage : EditingHostPage {
             output_format_filter.add_pattern("*." + uppercase_extension);
         }
 
-        Gtk.FileChooserDialog save_as_dialog = new Gtk.FileChooserDialog(_("Save As"), 
-            AppWindow.get_instance(), Gtk.FileChooserAction.SAVE, Resources.CANCEL_LABEL, 
-            Gtk.ResponseType.CANCEL, Resources.OK_LABEL, Gtk.ResponseType.OK);
+        var save_as_dialog = new Gtk.FileChooserNative(_("Save As"), 
+            AppWindow.get_instance(), Gtk.FileChooserAction.SAVE, Resources.OK_LABEL, 
Resources.CANCEL_LABEL);
         save_as_dialog.set_select_multiple(false);
         save_as_dialog.set_current_name(filename);
         save_as_dialog.set_current_folder(current_save_dir.get_path());
@@ -418,7 +417,7 @@ public class DirectPhotoPage : EditingHostPage {
         save_as_dialog.set_local_only(false);
         
         int response = save_as_dialog.run();
-        if (response == Gtk.ResponseType.OK) {
+        if (response == Gtk.ResponseType.ACCEPT) {
             // flag to prevent asking user about losing changes to the old file (since they'll be
             // loaded right into the new one)
             drop_if_dirty = true;
diff --git a/src/library/LibraryWindow.vala b/src/library/LibraryWindow.vala
index b9acb221..312de905 100644
--- a/src/library/LibraryWindow.vala
+++ b/src/library/LibraryWindow.vala
@@ -523,9 +523,8 @@ public class LibraryWindow : AppWindow {
     }
 
     private void on_file_import() {
-        Gtk.FileChooserDialog import_dialog = new Gtk.FileChooserDialog(_("Import From Folder"), null,
-            Gtk.FileChooserAction.SELECT_FOLDER, Resources.CANCEL_LABEL, Gtk.ResponseType.CANCEL, 
-            Resources.OK_LABEL, Gtk.ResponseType.OK);
+        var import_dialog = new Gtk.FileChooserNative(_("Import From Folder"), null,
+            Gtk.FileChooserAction.SELECT_FOLDER, Resources.OK_LABEL, Resources.CANCEL_LABEL);
         import_dialog.set_local_only(false);
         import_dialog.set_select_multiple(true);
         import_dialog.set_current_folder(import_dir);
@@ -536,7 +535,7 @@ public class LibraryWindow : AppWindow {
         
         int response = import_dialog.run();
         
-        if (response == Gtk.ResponseType.OK) {
+        if (response == Gtk.ResponseType.ACCEPT) {
             import_dialog.hide();
             // force file linking if directory is inside current library directory
             Gtk.ResponseType copy_files_response =


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