tuhi: use a Gtk.FileChooserNative dialog

This one hooks into the correct portal APIs, hopefully fixing the issue with
the Flatpak version not saving files correctly.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
pull/264/head
Peter Hutterer 2020-08-25 16:23:41 +10:00
parent ea5177027c
commit eef877d6ce
1 changed files with 4 additions and 6 deletions

View File

@ -112,11 +112,9 @@ class Drawing(Gtk.EventBox):
@Gtk.Template.Callback('_on_download_button_clicked')
def _on_download_button_clicked(self, button):
dialog = Gtk.FileChooserDialog(_('Please choose a file'),
None,
Gtk.FileChooserAction.SAVE,
(Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL,
Gtk.STOCK_SAVE, Gtk.ResponseType.OK))
dialog = Gtk.FileChooserNative()
dialog.set_action(Gtk.FileChooserAction.SAVE)
dialog.set_transient_for(self.get_toplevel())
dialog.set_do_overwrite_confirmation(True)
# Translators: the default filename to save to
@ -139,7 +137,7 @@ class Drawing(Gtk.EventBox):
dialog.add_filter(filter_any)
response = dialog.run()
if response == Gtk.ResponseType.OK:
if response == Gtk.ResponseType.ACCEPT:
import shutil
file = dialog.get_filename()