[iagno] Add F10 shortcut to hamburger menu.
- From: Arnaud B. <arnaudb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [iagno] Add F10 shortcut to hamburger menu.
- Date: Mon, 7 Jan 2019 17:34:00 +0000 (UTC)
commit 2d3d312d2319370dae6262ac6b152ddbc84319f8
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date: Mon Jan 7 18:28:14 2019 +0100
Add F10 shortcut to hamburger menu.
data/iagno.ui | 2 +-
src/game-window.vala | 15 ++++++++++++++-
src/iagno.vala | 11 ++++++-----
3 files changed, 21 insertions(+), 7 deletions(-)
---
diff --git a/data/iagno.ui b/data/iagno.ui
index fa899b4..5717f1d 100644
--- a/data/iagno.ui
+++ b/data/iagno.ui
@@ -54,7 +54,7 @@
</object>
</child>
<child>
- <object class="GtkMenuButton" id="menu_button">
+ <object class="GtkMenuButton" id="info_button">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="menu-model">primary-menu</property>
diff --git a/src/game-window.vala b/src/game-window.vala
index 7fe133c..146a75c 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/iagno.vala b/src/iagno.vala
index 52beaae..732860b 100644
--- a/src/iagno.vala
+++ b/src/iagno.vala
@@ -189,11 +189,12 @@ public class Iagno : Gtk.Application
/* Actions and preferences */
add_action_entries (app_actions, this);
- 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" });
add_action (settings.create_action ("sound"));
add_action (settings.create_action ("color"));
add_action (settings.create_action ("num-players"));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]