diff --git a/data/gtk.glade b/data/gtk.glade index 7cb5af0..e5d20d3 100644 --- a/data/gtk.glade +++ b/data/gtk.glade @@ -1307,4 +1307,49 @@ + + False + False + True + center + dialog + center + appwindow + CoverGrid + 0.6 + CoverGrid is a client for the Music Player Daemon, focused on albums instead of single tracks. + http://www.coderkun.de/codes/mcg + mcg.svg + gpl-3-0 + + + False + vertical + 2 + + + False + end + + + + + + + + + False + False + 0 + + + + + + + + + + + diff --git a/data/menu.ui b/data/menu.ui index 0dcb74e..ca672e9 100644 --- a/data/menu.ui +++ b/data/menu.ui @@ -47,6 +47,11 @@
+ + app.info + Info + <Primary>i + app.quit _Quit diff --git a/mcg/application.py b/mcg/application.py index 49a38e7..931a5e1 100644 --- a/mcg/application.py +++ b/mcg/application.py @@ -32,7 +32,8 @@ class Application(Gtk.Application): def __init__(self): Gtk.Application.__init__(self, application_id=Application.ID, flags=Gio.ApplicationFlags.FLAGS_NONE) self._window = None - self._verbosity = self._verbosity = logging.WARNING + self._info_dialog = None + self._verbosity = logging.WARNING self.add_main_option_entries([ Application._get_option("v", "verbose", "Be verbose: show info messages"), Application._get_option("d", "debug", "Enable debugging: show debug messages") @@ -67,6 +68,12 @@ class Application(Gtk.Application): self._window.present() + def on_menu_info(self, action, value): + if not self._info_dialog: + self._info_dialog = widgets.InfoDialog(self._builder) + self._info_dialog.run() + + def on_menu_quit(self, action, value): self.quit() @@ -112,6 +119,9 @@ class Application(Gtk.Application): def _setup_actions(self): + action = Gio.SimpleAction.new("info", None) + action.connect('activate', self.on_menu_info) + self.add_action(action) action = Gio.SimpleAction.new("quit", None) action.connect('activate', self.on_menu_quit) self.add_action(action) diff --git a/mcg/widgets.py b/mcg/widgets.py index 170f318..3185dc7 100644 --- a/mcg/widgets.py +++ b/mcg/widgets.py @@ -24,6 +24,38 @@ from mcg.zeroconf import ZeroconfProvider +class InfoDialog(): + + + def __init__(self, builder): + self._logger = logging.getLogger(__name__) + + # Widgets + self._info_dialog = builder.get_object('info-dialog') + self._resize_logo() + + + def get(self): + return self._info_dialog + + + def run(self): + self._info_dialog.run() + self._info_dialog.hide() + + + def _resize_logo(self): + try: + logo_pixbuf = self._info_dialog.get_logo() + self._info_dialog.set_logo( + logo_pixbuf.scale_simple(256, 256, GdkPixbuf.InterpType.HYPER) + ) + except: + self._logger.warn("Failed to resize logo") + + + + class Window(): SETTING_HOST = 'host' SETTING_PORT = 'port'