diff --git a/data/de.coderkun.mcg.gresource.xml b/data/de.coderkun.mcg.gresource.xml index f11ba02..cc74286 100644 --- a/data/de.coderkun.mcg.gresource.xml +++ b/data/de.coderkun.mcg.gresource.xml @@ -2,6 +2,7 @@ gtk.glade + menu.ui mcg.css noise-texture.png diff --git a/data/menu.ui b/data/menu.ui new file mode 100644 index 0000000..1c9d77a --- /dev/null +++ b/data/menu.ui @@ -0,0 +1,12 @@ + + + +
+ + app.quit + _Quit + <Primary>q + +
+
+
diff --git a/locale/de/LC_MESSAGES/mcg.mo b/locale/de/LC_MESSAGES/mcg.mo index 134b06a..5111d9e 100644 Binary files a/locale/de/LC_MESSAGES/mcg.mo and b/locale/de/LC_MESSAGES/mcg.mo differ diff --git a/locale/de/LC_MESSAGES/mcg.po b/locale/de/LC_MESSAGES/mcg.po index 5afbf78..7209ae9 100644 --- a/locale/de/LC_MESSAGES/mcg.po +++ b/locale/de/LC_MESSAGES/mcg.po @@ -1,8 +1,8 @@ msgid "" msgstr "" "Project-Id-Version: MPDCoverGrid\n" -"POT-Creation-Date: 2017-04-22 14:55+0200\n" -"PO-Revision-Date: 2017-04-22 14:55+0200\n" +"POT-Creation-Date: 2017-04-23 11:44+0200\n" +"PO-Revision-Date: 2017-04-23 11:44+0200\n" "Last-Translator: coderkun \n" "Language-Team: \n" "Language: de\n" @@ -14,6 +14,7 @@ msgstr "" "Plural-Forms: nplurals=2; plural=(n != 1);\n" "X-Poedit-SourceCharset: UTF-8\n" "X-Poedit-SearchPath-0: data/gtk.glade\n" +"X-Poedit-SearchPath-1: data/menu.ui\n" #: data/gtk.glade:21 msgid "Tracklist" @@ -55,50 +56,54 @@ msgstr "nach Titel" msgid "sort by year" msgstr "nach Jahr" -#: data/gtk.glade:435 +#: data/gtk.glade:436 msgid "Enter hostname or IP address" msgstr "Hostnamen oder IP-Adresse eingeben" -#: data/gtk.glade:447 +#: data/gtk.glade:448 msgid "Enter URL or local path" msgstr "URL oder lokalen Pfad eingeben" -#: data/gtk.glade:459 +#: data/gtk.glade:460 msgid "Enter password or leave blank" msgstr "Passwort eingeben oder leer lassen" -#: data/gtk.glade:484 +#: data/gtk.glade:485 msgid "Host:" msgstr "Host:" -#: data/gtk.glade:496 +#: data/gtk.glade:497 msgid "Port:" msgstr "Port:" -#: data/gtk.glade:508 +#: data/gtk.glade:509 msgid "Password:" msgstr "Passwort:" -#: data/gtk.glade:520 +#: data/gtk.glade:521 msgid "Image Directory:" msgstr "Bildordner:" -#: data/gtk.glade:544 data/gtk.glade:1200 +#: data/gtk.glade:545 data/gtk.glade:1201 msgid "Server" msgstr "Server" -#: data/gtk.glade:697 data/gtk.glade:1185 +#: data/gtk.glade:698 data/gtk.glade:1186 msgid "Cover" msgstr "Cover" -#: data/gtk.glade:808 data/gtk.glade:1234 +#: data/gtk.glade:809 data/gtk.glade:1235 msgid "Playlist" msgstr "Wiedergabeliste" -#: data/gtk.glade:835 +#: data/gtk.glade:836 msgid "search library" msgstr "durchsuche Bibliothek" -#: data/gtk.glade:976 data/gtk.glade:1289 +#: data/gtk.glade:977 data/gtk.glade:1290 msgid "Library" msgstr "Bibliothek" + +#: data/menu.ui:7 +msgid "_Quit" +msgstr "_Beenden" diff --git a/locale/en/LC_MESSAGES/mcg.mo b/locale/en/LC_MESSAGES/mcg.mo index 70a23a7..685ce84 100644 Binary files a/locale/en/LC_MESSAGES/mcg.mo and b/locale/en/LC_MESSAGES/mcg.mo differ diff --git a/locale/en/LC_MESSAGES/mcg.po b/locale/en/LC_MESSAGES/mcg.po index a238dce..aea4d94 100644 --- a/locale/en/LC_MESSAGES/mcg.po +++ b/locale/en/LC_MESSAGES/mcg.po @@ -1,8 +1,8 @@ msgid "" msgstr "" "Project-Id-Version: MPDCoverGrid\n" -"POT-Creation-Date: 2017-04-22 14:55+0200\n" -"PO-Revision-Date: 2017-04-22 14:56+0200\n" +"POT-Creation-Date: 2017-04-23 11:44+0200\n" +"PO-Revision-Date: 2017-04-23 11:44+0200\n" "Last-Translator: coderkun \n" "Language-Team: \n" "Language: en\n" @@ -13,6 +13,7 @@ msgstr "" "X-Poedit-Basepath: ../../..\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" "X-Poedit-SearchPath-0: data/gtk.glade\n" +"X-Poedit-SearchPath-1: data/menu.ui\n" #: data/gtk.glade:21 msgid "Tracklist" @@ -54,50 +55,54 @@ msgstr "by Title" msgid "sort by year" msgstr "by Year" -#: data/gtk.glade:435 +#: data/gtk.glade:436 msgid "Enter hostname or IP address" msgstr "Enter hostname or IP address" -#: data/gtk.glade:447 +#: data/gtk.glade:448 msgid "Enter URL or local path" msgstr "Enter URL or local path" -#: data/gtk.glade:459 +#: data/gtk.glade:460 msgid "Enter password or leave blank" msgstr "Enter password or leave blank" -#: data/gtk.glade:484 +#: data/gtk.glade:485 msgid "Host:" msgstr "Host:" -#: data/gtk.glade:496 +#: data/gtk.glade:497 msgid "Port:" msgstr "Port:" -#: data/gtk.glade:508 +#: data/gtk.glade:509 msgid "Password:" msgstr "Password:" -#: data/gtk.glade:520 +#: data/gtk.glade:521 msgid "Image Directory:" msgstr "Image Directory:" -#: data/gtk.glade:544 data/gtk.glade:1200 +#: data/gtk.glade:545 data/gtk.glade:1201 msgid "Server" msgstr "Server" -#: data/gtk.glade:697 data/gtk.glade:1185 +#: data/gtk.glade:698 data/gtk.glade:1186 msgid "Cover" msgstr "Cover" -#: data/gtk.glade:808 data/gtk.glade:1234 +#: data/gtk.glade:809 data/gtk.glade:1235 msgid "Playlist" msgstr "Playlist" -#: data/gtk.glade:835 +#: data/gtk.glade:836 msgid "search library" msgstr "search library" -#: data/gtk.glade:976 data/gtk.glade:1289 +#: data/gtk.glade:977 data/gtk.glade:1290 msgid "Library" msgstr "Library" + +#: data/menu.ui:7 +msgid "_Quit" +msgstr "_Quit" diff --git a/mcg/application.py b/mcg/application.py index d6770ab..38dba7a 100644 --- a/mcg/application.py +++ b/mcg/application.py @@ -56,6 +56,8 @@ class Application(Gtk.Application): self._load_css() self._setup_locale() self._load_ui() + self._setup_actions() + self._load_appmenu() def do_activate(self): @@ -65,6 +67,10 @@ class Application(Gtk.Application): self._window.present() + def on_quit(self, action, param): + self.quit() + + def _setup_logging(self): logging.basicConfig( level=self._verbosity, @@ -105,5 +111,18 @@ class Application(Gtk.Application): self._builder.add_from_resource(self._get_resource_path('gtk.glade')) + def _setup_actions(self): + action = Gio.SimpleAction.new("quit", None) + action.connect('activate', self.on_quit) + self.add_action(action) + + + def _load_appmenu(self): + builder = Gtk.Builder() + builder.set_translation_domain(Application.DOMAIN) + builder.add_from_resource(self._get_resource_path('menu.ui')) + self.set_app_menu(builder.get_object('app-menu')) + + def _get_resource_path(self, path): return "/{}/{}".format(Application.ID.replace('.', '/'), path)