replaced Gtk.FileChosserDialog with Gtk.FileChooserNative

This commit is contained in:
Martin Wagner 2020-12-28 13:02:38 +01:00
parent 36c25b54c4
commit d86a52d1d3

View File

@ -36,7 +36,7 @@ if os.path.isfile("/.flatpak-info"): # test for flatpak environment
gettext.bindtextdomain("mpdevil", "/app/share/locale") gettext.bindtextdomain("mpdevil", "/app/share/locale")
_=gettext.gettext _=gettext.gettext
VERSION="0.9.8" # sync with setup.py VERSION="0.9.8-dev" # sync with setup.py
COVER_REGEX=r"^\.?(album|cover|folder|front).*\.(gif|jpeg|jpg|png)$" COVER_REGEX=r"^\.?(album|cover|folder|front).*\.(gif|jpeg|jpg|png)$"
@ -1088,17 +1088,14 @@ class ProfileSettings(Gtk.Grid):
self._settings.array_modify("as", "regex", self._profiles_combo.get_active(), self._regex_entry.get_text()) self._settings.array_modify("as", "regex", self._profiles_combo.get_active(), self._regex_entry.get_text())
def _on_path_select_button_clicked(self, widget, parent): def _on_path_select_button_clicked(self, widget, parent):
dialog=Gtk.FileChooserDialog(title=_("Choose directory"), transient_for=parent, action=Gtk.FileChooserAction.SELECT_FOLDER) dialog=Gtk.FileChooserNative(title=_("Choose directory"), transient_for=parent, action=Gtk.FileChooserAction.SELECT_FOLDER)
dialog.add_buttons(Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL)
dialog.add_buttons(Gtk.STOCK_OK, Gtk.ResponseType.OK)
dialog.set_default_size(800, 400)
folder=self._settings.get_value("paths")[self._profiles_combo.get_active()] folder=self._settings.get_value("paths")[self._profiles_combo.get_active()]
if folder == "": if folder == "":
dialog.set_current_folder(GLib.get_user_special_dir(GLib.UserDirectory.DIRECTORY_MUSIC)) dialog.set_current_folder(GLib.get_user_special_dir(GLib.UserDirectory.DIRECTORY_MUSIC))
else: else:
dialog.set_current_folder(folder) dialog.set_current_folder(folder)
response=dialog.run() response=dialog.run()
if response == Gtk.ResponseType.OK: if response == Gtk.ResponseType.ACCEPT:
self._gui_modification=True self._gui_modification=True
self._settings.array_modify("as", "paths", self._profiles_combo.get_active(), dialog.get_filename()) self._settings.array_modify("as", "paths", self._profiles_combo.get_active(), dialog.get_filename())
self._path_entry.set_text(dialog.get_filename()) self._path_entry.set_text(dialog.get_filename())