[fractal/wip/cdavis/use-filechoosernative] event_actions: Use GtkFileChooserNative for saving




commit c6edc58468158569d1e09e54ff04ef0318edcbde
Author: Christopher Davis <christopherdavis gnome org>
Date:   Tue Aug 2 20:47:03 2022 -0400

    event_actions: Use GtkFileChooserNative for saving
    
    Fractal does not have a full view of the filesystem, which
    means that we can't use GtkFileChooserDialog if we want users
    to be able to save anywhere. Instead, we need to use the
    file chooser portal via GtkFileChooserNative.
    
    Closes https://gitlab.gnome.org/GNOME/fractal/-/issues/1064

 src/session/room/event_actions.rs | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)
---
diff --git a/src/session/room/event_actions.rs b/src/session/room/event_actions.rs
index debb7e607..d9a2a4d13 100644
--- a/src/session/room/event_actions.rs
+++ b/src/session/room/event_actions.rs
@@ -266,18 +266,17 @@ where
                     }
                 };
 
-                let dialog = gtk::FileChooserDialog::new(
+                let dialog = gtk::FileChooserNative::new(
                     Some(&gettext("Save File")),
                     Some(&window),
                     gtk::FileChooserAction::Save,
-                    &[
-                        (&gettext("Save"), gtk::ResponseType::Accept),
-                        (&gettext("Cancel"), gtk::ResponseType::Cancel),
-                    ],
+                    Some(&gettext("Save")),
+                    Some(&gettext("Cancel")),
                 );
                 dialog.set_current_name(&filename);
 
                 let response = dialog.run_future().await;
+
                 if response == gtk::ResponseType::Accept {
                     if let Some(file) = dialog.file() {
                         file.replace_contents(
@@ -291,7 +290,7 @@ where
                     }
                 }
 
-                dialog.close();
+                dialog.destroy();
             })
         );
     }


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