[gnome-taquin] Add F10 shortcut to hamburger menu.



commit 58476649a68bde6f64b595d2d44f18454a5256e9
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date:   Mon Jan 7 17:03:44 2019 +0100

    Add F10 shortcut to hamburger menu.

 data/taquin.ui       |  2 +-
 src/game-window.vala | 15 ++++++++++++++-
 src/taquin-main.vala | 11 ++++++-----
 3 files changed, 21 insertions(+), 7 deletions(-)
---
diff --git a/data/taquin.ui b/data/taquin.ui
index 26dee76..2b28a2d 100644
--- a/data/taquin.ui
+++ b/data/taquin.ui
@@ -36,7 +36,7 @@
           </packing>
         </child>
         <child>
-          <object class="GtkMenuButton">
+          <object class="GtkMenuButton" id="info_button">
             <property name="visible">True</property>
             <property name="can_focus">False</property>
             <property name="receives_default">False</property>
diff --git a/src/game-window.vala b/src/game-window.vala
index 8516dc4..7f89d0b 100644
--- a/src/game-window.vala
+++ b/src/game-window.vala
@@ -80,7 +80,9 @@ public class GameWindow : ApplicationWindow
 
         { "undo", undo_cb },
         { "redo", redo_cb },
-        { "hint", hint_cb }
+        { "hint", hint_cb },
+
+        { "toggle-hamburger", toggle_hamburger }
     };
 
     private SimpleAction back_action;
@@ -357,4 +359,15 @@ public class GameWindow : ApplicationWindow
             return;
         hint ();
     }
+
+    /*\
+    * * hamburger menu
+    \*/
+
+    [GtkChild] private MenuButton info_button;
+
+    private void toggle_hamburger (/* SimpleAction action, Variant? variant */)
+    {
+        info_button.active = !info_button.active;
+    }
 }
diff --git a/src/taquin-main.vala b/src/taquin-main.vala
index 9bf5f3b..a022493 100644
--- a/src/taquin-main.vala
+++ b/src/taquin-main.vala
@@ -142,11 +142,12 @@ public class Taquin : Gtk.Application
         window.undo.connect (undo_cb);
 
         // TODO use UI file?
-        set_accels_for_action ("win.new-game", {"<Primary>n"});
-        set_accels_for_action ("win.start-game", {"<Primary><Shift>n"});
-        set_accels_for_action ("win.undo", {"<Primary>z"});
-        set_accels_for_action ("win.redo", {"<Primary><Shift>z"});
-        set_accels_for_action ("win.back", {"Escape"});
+        set_accels_for_action ("win.new-game",          {        "<Primary>n"       });
+        set_accels_for_action ("win.start-game",        { "<Shift><Primary>n"       });
+        set_accels_for_action ("win.undo",              {        "<Primary>z"       });
+        set_accels_for_action ("win.redo",              { "<Shift><Primary>z"       });
+        set_accels_for_action ("win.back",              {                 "Escape"  });
+        set_accels_for_action ("win.toggle-hamburger",  {                 "F10"     });
 
         /* New-game screen signals */
         size_button = (MenuButton) builder.get_object ("size-button");


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