Skip to content

Commit

Permalink
window/fileview: use GtkFileChooserNative
Browse files Browse the repository at this point in the history
  • Loading branch information
knuxify committed Aug 1, 2022
1 parent 29bda84 commit c236497
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 14 deletions.
9 changes: 2 additions & 7 deletions src/fileview.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,20 +110,15 @@ def on_destroy(self, *args):
@Gtk.Template.Callback()
def show_cover_file_chooser(self, *args):
"""Shows the file chooser."""
self.file_chooser = Gtk.FileChooserDialog(
self.file_chooser = Gtk.FileChooserNative(
title=_("Select Album Cover Image"),
transient_for=self.get_native(),
action=Gtk.FileChooserAction.OPEN,
filter=self.image_file_filter
)
self.file_chooser.add_buttons(
_("_Cancel"), Gtk.ResponseType.CANCEL,
_("_Open"), Gtk.ResponseType.ACCEPT
)

self.file_chooser.connect('response', self.open_cover_file_from_dialog)

self.file_chooser.present()
self.file_chooser.show()

def open_cover_file_from_dialog(self, dialog, response):
"""
Expand Down
9 changes: 2 additions & 7 deletions src/window.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,20 +153,15 @@ def on_drag_drop(self, drop_target, value, *args):

def show_file_chooser(self):
"""Shows the file chooser."""
self.file_chooser = Gtk.FileChooserDialog(
self.file_chooser = Gtk.FileChooserNative(
title=_("Open File"),
transient_for=self,
action=Gtk.FileChooserAction.OPEN,
filter=self.audio_file_filter
)
self.file_chooser.add_buttons(
_("_Cancel"), Gtk.ResponseType.CANCEL,
_("_Open"), Gtk.ResponseType.ACCEPT
)

self.file_chooser.connect('response', self.open_file_from_dialog)

self.file_chooser.present()
self.file_chooser.show()

def load_file(self, path):
"""
Expand Down

0 comments on commit c236497

Please sign in to comment.