diff --git a/libremsonic/ui/app.py b/libremsonic/ui/app.py index 63498ab..ab471ec 100644 --- a/libremsonic/ui/app.py +++ b/libremsonic/ui/app.py @@ -98,7 +98,7 @@ class LibremsonicApp(Gtk.Application): self.save_settings() # Update the window according to the new server configuration. - self.window.update(self.config) + self.window.update(self.config.servers[self.config.current_server]) def show_configure_servers_dialog(self): """Show the Connect to Server dialog.""" diff --git a/libremsonic/ui/main.py b/libremsonic/ui/main.py index 5e52906..5a972bf 100644 --- a/libremsonic/ui/main.py +++ b/libremsonic/ui/main.py @@ -1,10 +1,12 @@ +from typing import Optional + import gi gi.require_version('Gtk', '3.0') from gi.repository import Gio, Gtk from .albums import AlbumsPanel from .player_controls import PlayerControls -from libremsonic.config import AppConfiguration +from libremsonic.server import Server class MainWindow(Gtk.ApplicationWindow): @@ -35,16 +37,16 @@ class MainWindow(Gtk.ApplicationWindow): flowbox.pack_start(self.player_controls, False, True, 0) self.add(flowbox) - def update(self, config: AppConfiguration): + def update(self, server: Optional[Server]): # Update the Connected to label on the popup menu. - if config.current_server >= 0: - server_name = config.servers[config.current_server].name - self.connected_to_label.set_markup(f'Connected to {server_name}') + if server: + self.connected_to_label.set_markup(f'Connected to {server.name}') else: self.connected_to_label.set_markup( f'Not Connected to a Server') print(self.panels) + print(self.player_controls) def create_stack(self, **kwargs): stack = Gtk.Stack()