[gnome-mahjongg] Add F10 shortcut dialog.
- From: Arnaud B. <arnaudb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-mahjongg] Add F10 shortcut dialog.
- Date: Fri, 9 Oct 2020 14:52:27 +0000 (UTC)
commit 8e628bf3ff6dd736767e1cdf2c1c1df6c5b76ea9
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date: Fri Oct 9 16:51:48 2020 +0200
Add F10 shortcut dialog.
Closes #19.
data/help-overlay.ui | 8 ++++++++
src/gnome-mahjongg.vala | 10 +++++++++-
2 files changed, 17 insertions(+), 1 deletion(-)
---
diff --git a/data/help-overlay.ui b/data/help-overlay.ui
index 61e7010..afc63dc 100644
--- a/data/help-overlay.ui
+++ b/data/help-overlay.ui
@@ -58,6 +58,14 @@
<!-- Translators: title of a section in the Keyboard Shortcuts window; contains "Show Keyboard
Shortcuts", "Show Help", "Quit"... -->
<property name="title" translatable="yes" context="shortcut window">Generic</property>
<property name="visible">1</property>
+ <child>
+ <object class="GtkShortcutsShortcut">
+ <property name="visible">1</property>
+ <property name="accelerator">F10</property>
+ <!-- Translators: F10 shortcut description in the Keyboard Shortcuts dialog, section
Generic; show the main ("hamburger") menu -->
+ <property name="title" translatable="yes" context="shortcut window">Toggle main
menu</property>
+ </object>
+ </child>
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">1</property>
diff --git a/src/gnome-mahjongg.vala b/src/gnome-mahjongg.vala
index 77127d8..28ed6c8 100644
--- a/src/gnome-mahjongg.vala
+++ b/src/gnome-mahjongg.vala
@@ -18,6 +18,7 @@ public class Mahjongg : Gtk.Application
private Gtk.ApplicationWindow window;
private Gtk.Label title;
+ private Gtk.MenuButton menu_button;
private int window_width;
private int window_height;
private bool is_maximized;
@@ -47,6 +48,7 @@ public class Mahjongg : Gtk.Application
{ "preferences", preferences_cb },
{ "help", help_cb },
{ "about", about_cb },
+ { "hamburger", hamburger_cb },
{ "quit", quit_cb }
};
@@ -71,6 +73,7 @@ public class Mahjongg : Gtk.Application
set_accels_for_action ("app.help", { "F1" });
set_accels_for_action ("app.quit", { "<Primary>q",
"<Primary>w" });
+ set_accels_for_action ("app.hamburger", { "F10" });
settings = new Settings ("org.gnome.Mahjongg");
@@ -156,7 +159,7 @@ public class Mahjongg : Gtk.Application
menu.append_section (/* no title */ null, section);
menu.freeze ();
- var menu_button = new Gtk.MenuButton ();
+ menu_button = new Gtk.MenuButton ();
menu_button.valign = Gtk.Align.CENTER;
menu_button.set_menu_model (menu);
menu_button.set_image (new Gtk.Image.from_icon_name ("open-menu-symbolic", Gtk.IconSize.BUTTON));
@@ -560,6 +563,11 @@ public class Mahjongg : Gtk.Application
game_view.game.shuffle_remaining ();
}
+ private inline void hamburger_cb ()
+ {
+ menu_button.active = !menu_button.active;
+ }
+
private void about_cb ()
{
string[] authors =
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]