From 87786099ea84cdd655be46ef077b73f5045997ec Mon Sep 17 00:00:00 2001 From: Martin Wagner Date: Sat, 24 Apr 2021 11:03:46 +0200 Subject: [PATCH] provide settings button on connection error --- bin/mpdevil | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/bin/mpdevil b/bin/mpdevil index a7868ee..0509ea7 100755 --- a/bin/mpdevil +++ b/bin/mpdevil @@ -1266,7 +1266,7 @@ class PlaylistSettings(Gtk.Box): self._save_permutation() class SettingsDialog(Gtk.Dialog): - def __init__(self, parent, client, settings): + def __init__(self, parent, client, settings, tab="general"): use_csd=settings.get_boolean("use-csd") if use_csd: super().__init__(title=_("Settings"), transient_for=parent, use_header_bar=True) @@ -1300,6 +1300,10 @@ class SettingsDialog(Gtk.Dialog): vbox.set_property("border-width", 6) vbox.pack_start(tabs, True, True, 0) self.show_all() + if use_csd: + stack.set_visible_child_name(tab) + else: + tabs.set_current_page({"general": 0, "profiles": 1, "playlist": 2}[tab]) ################# # other dialogs # @@ -3651,6 +3655,8 @@ class ConnectionNotify(Gtk.Revealer): close_button=Gtk.Button(image=Gtk.Image.new_from_icon_name("window-close-symbolic", Gtk.IconSize.BUTTON)) close_button.set_relief(Gtk.ReliefStyle.NONE) connect_button=Gtk.Button(label=_("Connect")) + settings_button=Gtk.Button(label=_("Settings")) + settings_button.set_action_name("win.profile-settings") # connect close_button.connect("clicked", self._on_close_button_clicked) @@ -3664,6 +3670,7 @@ class ConnectionNotify(Gtk.Revealer): box.pack_start(self._label, False, True, 6) box.pack_end(close_button, False, True, 0) box.pack_end(connect_button, False, True, 0) + box.pack_end(settings_button, False, True, 0) self.add(box) def _on_connection_error(self, *args): @@ -3704,7 +3711,7 @@ class MainWindow(Gtk.ApplicationWindow): # actions simple_actions_data=( - "settings","stats","help","menu", + "settings","profile-settings","stats","help","menu", "toggle-lyrics","back-to-current-album","toggle-search", "profile-next","profile-prev","show-info","append","play","enqueue" ) @@ -3843,6 +3850,11 @@ class MainWindow(Gtk.ApplicationWindow): settings.run() settings.destroy() + def _on_profile_settings(self, action, param): + settings=SettingsDialog(self, self._client, self._settings, "profiles") + settings.run() + settings.destroy() + def _on_stats(self, action, param): stats=ServerStats(self, self._client, self._settings) stats.destroy()