[gnome-boxes/f10-opens-main-menu: 1/2] app-window, topbar: Pop main menu when pressing F10



commit d7aa5aeebd54b1eb0a40725787d0d5e5753ff8ba
Author: Felipe Borges <felipeborges gnome org>
Date:   Wed Jan 22 13:07:31 2020 +0100

    app-window, topbar: Pop main menu when pressing F10
    
    https://developer.gnome.org/hig/stable/keyboard-input.html.en
    
    Fixes #458

 src/app-window.vala         | 4 ++++
 src/collection-toolbar.vala | 2 +-
 src/topbar.vala             | 4 ++++
 3 files changed, 9 insertions(+), 1 deletion(-)
---
diff --git a/src/app-window.vala b/src/app-window.vala
index baae669c..03ec5243 100644
--- a/src/app-window.vala
+++ b/src/app-window.vala
@@ -405,6 +405,10 @@ public bool on_key_pressed (Widget widget, Gdk.EventKey event) {
         } else if (event.keyval == Gdk.Key.F1) {
             App.app.activate_action ("help", null);
 
+            return true;
+        } else if (event.keyval == Gdk.Key.F10) {
+            topbar.pop_main_menu ();
+
             return true;
         } else if (event.keyval == Gdk.Key.q &&
                    (event.state & default_modifiers) == Gdk.ModifierType.CONTROL_MASK) {
diff --git a/src/collection-toolbar.vala b/src/collection-toolbar.vala
index 6497dd7e..c62d12aa 100644
--- a/src/collection-toolbar.vala
+++ b/src/collection-toolbar.vala
@@ -18,7 +18,7 @@
     [GtkChild]
     private MenuButton downloads_hub_btn;
     [GtkChild]
-    private MenuButton hamburger_btn;
+    public MenuButton hamburger_btn;
     [GtkChild]
     private CollectionFilterSwitcher filter_switcher;
 
diff --git a/src/topbar.vala b/src/topbar.vala
index 05c3687d..41b283b8 100644
--- a/src/topbar.vala
+++ b/src/topbar.vala
@@ -45,6 +45,10 @@ public void click_search_button () {
             collection_toolbar.click_search_button ();
     }
 
+    public void pop_main_menu () {
+        collection_toolbar.hamburger_btn.clicked ();
+    }
+
     public string? _status;
     public string? status {
         get { return _status; }


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