Commit f8bbe5b8 authored by Björn Daase's avatar Björn Daase
Browse files

feat(dialogs): port Gtk.FileChooserDialog to Gtk.FileChooserNative

parent 5785cd6e
......@@ -213,17 +213,17 @@ class JournableWindow(Gtk.ApplicationWindow):
self.let_user_save_changes()
if not self.has_unsaved_changes:
file_chooser = Gtk.FileChooserDialog(
file_chooser = Gtk.FileChooserNative.new(
'Choose a file',
self,
Gtk.FileChooserAction.OPEN,
(Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL,
Gtk.STOCK_OPEN, Gtk.ResponseType.OK)
"_Open",
"_Cancel"
)
self.add_filters(file_chooser)
response = file_chooser.run()
if response == Gtk.ResponseType.OK:
if response == Gtk.ResponseType.ACCEPT:
filename = file_chooser.get_filename()
self.load_file_content(filename)
self.update_file_information(filename)
......@@ -232,16 +232,16 @@ class JournableWindow(Gtk.ApplicationWindow):
file_chooser.destroy()
def save_file_as(self):
file_chooser = Gtk.FileChooserDialog(
file_chooser = Gtk.FileChooserNative.new(
'Save as',
self,
Gtk.FileChooserAction.SAVE,
(Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL,
Gtk.STOCK_SAVE, Gtk.ResponseType.OK)
"_Save",
"_cancel"
)
self.add_filters(file_chooser)
response = file_chooser.run()
if response == Gtk.ResponseType.OK:
if response == Gtk.ResponseType.ACCEPT:
filename = file_chooser.get_filename()
if not filename.endswith('.json'):
filename += '.json'
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment