[gnome-music/wip/jfelder/application-quit: 2/2] window: Move quit shortcut to the application
- From: Jean Felder <jfelder src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-music/wip/jfelder/application-quit: 2/2] window: Move quit shortcut to the application
- Date: Mon, 11 Nov 2019 15:03:44 +0000 (UTC)
commit 37f24ddc25a82e6cd8b29cba3e1f8ec6c9a1d5df
Author: Jean Felder <jfelder src gnome org>
Date: Mon Nov 11 15:25:14 2019 +0100
window: Move quit shortcut to the application
In the Window, the keyboard shortcuts are enabled once the player view
is enabled. This seems like the best course of action because most of
the shortcuts are not relevant with an empty view. However, this also
means that GNOME Music cannot be left when the EmptyView is loaded.
Fix the issue by moving the quit shortcut to the Application.
gnomemusic/application.py | 7 ++++++-
gnomemusic/window.py | 2 --
2 files changed, 6 insertions(+), 3 deletions(-)
---
diff --git a/gnomemusic/application.py b/gnomemusic/application.py
index 40d58cf7..9415fe1d 100644
--- a/gnomemusic/application.py
+++ b/gnomemusic/application.py
@@ -158,10 +158,15 @@ class Application(Gtk.Application):
def do_startup(self):
Gtk.Application.do_startup(self)
+ quit_action = Gio.SimpleAction.new("quit", None)
+ quit_action.connect("activate", self._quit)
+ self.add_action(quit_action)
+ self.set_accels_for_action("app.quit", ["<Ctrl>Q"])
+
self._build_app_menu()
@log
- def quit(self, action=None, param=None):
+ def _quit(self, action=None, param=None):
self._window.destroy()
def do_activate(self):
diff --git a/gnomemusic/window.py b/gnomemusic/window.py
index 49681a54..a7750a65 100644
--- a/gnomemusic/window.py
+++ b/gnomemusic/window.py
@@ -351,8 +351,6 @@ class Window(Gtk.ApplicationWindow):
# Play next on Ctrl + N
if keyval == Gdk.KEY_n:
self._player.next()
- if keyval == Gdk.KEY_q:
- self.props.application.quit()
# Toggle repeat on Ctrl + R
if keyval == Gdk.KEY_r:
if self._player.props.repeat_mode == RepeatMode.SONG:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]