provide settings button on connection error

This commit is contained in:
Martin Wagner 2021-04-24 11:03:46 +02:00
parent 60afc4e412
commit 87786099ea

View File

@ -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()