[gnome-music/wip/jfelder/3-34-help-shortcut] application: Restore keyboard shortcut to open help



commit 04272762e2952ccf9986abaee03389c5aebca6c5
Author: Jean Felder <jfelder src gnome org>
Date:   Fri Jan 3 11:06:34 2020 +0100

    application: Restore keyboard shortcut to open help
    
    Since the removal of the application menu (commit 9aa739a9), it is no
    longer possible to open Help with the F1 shortcut.
    
    Restore this shortcut by adding the adding the corresponding
    accelerator.
    
    closes: #353

 gnomemusic/application.py | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
---
diff --git a/gnomemusic/application.py b/gnomemusic/application.py
index 53f6fd4c..b8f01cd3 100644
--- a/gnomemusic/application.py
+++ b/gnomemusic/application.py
@@ -132,14 +132,16 @@ class Application(Gtk.Application):
     @log
     def _build_app_menu(self):
         action_entries = [
-            ('about', self._about),
-            ('help', self._help)
+            ('about', self._about, None),
+            ("help", self._help, ("app.help", ["F1"]))
         ]
 
-        for action, callback in action_entries:
+        for action, callback, accel in action_entries:
             simple_action = Gio.SimpleAction.new(action, None)
             simple_action.connect('activate', callback)
             self.add_action(simple_action)
+            if accel is not None:
+                self.set_accels_for_action(*accel)
 
     @log
     def _help(self, action, param):


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]