[gnome-mines] Add Keyboard Shortcuts overlay



commit 25e2823e4f6ad3fc2b5800239a18803bb34ac46b
Author: Jeremy Bicha <jbicha ubuntu com>
Date:   Fri Dec 7 15:27:36 2018 -0500

    Add Keyboard Shortcuts overlay

 po/POTFILES.in                |  1 +
 src/gnome-mines.gresource.xml |  3 +++
 src/gnome-mines.vala          |  2 ++
 src/help-overlay.ui           | 59 +++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 65 insertions(+)
---
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 9b9b4fc..a9ac669 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -3,6 +3,7 @@
 data/gnome-mines.appdata.xml.in
 data/gnome-mines.desktop.in
 data/org.gnome.mines.gschema.xml
+src/help-overlay.ui
 src/interface.ui
 src/gnome-mines.vala
 src/minefield.vala
diff --git a/src/gnome-mines.gresource.xml b/src/gnome-mines.gresource.xml
index fbd44a1..5f11eb7 100644
--- a/src/gnome-mines.gresource.xml
+++ b/src/gnome-mines.gresource.xml
@@ -4,4 +4,7 @@
     <file preprocess="xml-stripblanks">interface.ui</file>
     <file>gnome-mines.css</file>
   </gresource>
+  <gresource prefix="/org/gnome/mines/gtk">
+    <file preprocess="xml-stripblanks">help-overlay.ui</file>
+  </gresource>
 </gresources>
diff --git a/src/gnome-mines.vala b/src/gnome-mines.vala
index 224a077..3cfe716 100644
--- a/src/gnome-mines.vala
+++ b/src/gnome-mines.vala
@@ -235,6 +235,7 @@ public class Mines : Gtk.Application
             section.append (_("_Use Question Flags"), "app.%s".printf (KEY_USE_QUESTION_MARKS));
             section = new Menu ();
             menu.append_section (null, section);
+            section.append (_("Keyboard Shortcuts"), "win.show-help-overlay");
             section.append (_("_Help"), "app.help");
             section.append (_("_About Mines"), "app.about");
             var menu_button = new Gtk.MenuButton ();
@@ -256,6 +257,7 @@ public class Mines : Gtk.Application
             mines_menu.append (_("_Quit"), "app.quit");
             var help_menu = new Menu ();
             menu.append_submenu (_("_Help"), help_menu);
+            help_menu.append (_("Keyboard Shortcuts"), "win.show-help-overlay");
             help_menu.append (_("_Contents"), "app.help");
             help_menu.append (_("_About Mines"), "app.about");
             set_menubar (menu);
diff --git a/src/help-overlay.ui b/src/help-overlay.ui
new file mode 100644
index 0000000..53050a8
--- /dev/null
+++ b/src/help-overlay.ui
@@ -0,0 +1,59 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+  <!-- interface-requires gtk+ 3.17 -->
+  <object class="GtkShortcutsWindow" id="help_overlay">
+    <property name="modal">1</property>
+    <child>
+      <object class="GtkShortcutsSection">
+        <property name="visible">1</property>
+        <child>
+          <object class="GtkShortcutsGroup">
+            <property name="visible">1</property>
+            <child>
+              <object class="GtkShortcutsShortcut">
+                <property name="visible">1</property>
+                <property name="accelerator">&lt;Ctrl&gt;N</property>
+                <property name="title" translatable="yes" context="shortcut window">Start a new 
game</property>
+              </object>
+            </child>
+            <child>
+              <object class="GtkShortcutsShortcut">
+                <property name="visible">1</property>
+                <property name="accelerator">&lt;Ctrl&gt;R</property>
+                <property name="title" translatable="yes" context="shortcut window">Start a new game with 
last used settings</property>
+              </object>
+            </child>
+            <child>
+              <object class="GtkShortcutsShortcut">
+                <property name="visible">1</property>
+                <property name="accelerator">Pause</property>
+                <property name="title" translatable="yes" context="shortcut window">Pause the game</property>
+              </object>
+            </child>
+            <child>
+              <object class="GtkShortcutsShortcut">
+                <property name="visible">1</property>
+                <property name="accelerator">F1</property>
+                <property name="title" translatable="yes" context="shortcut window">Show Help</property>
+              </object>
+            </child>
+            <child>
+              <object class="GtkShortcutsShortcut">
+                <property name="visible">1</property>
+                <property name="accelerator">&lt;Primary&gt;question &lt;Primary&gt;F1</property>
+                <property name="title" translatable="yes" context="shortcut window">Show Keyboard 
Shortcuts</property>
+              </object>
+            </child>
+            <child>
+              <object class="GtkShortcutsShortcut">
+                <property name="visible">1</property>
+                <property name="accelerator">&lt;Ctrl&gt;Q</property>
+                <property name="title" translatable="yes" context="shortcut window">Quit</property>
+              </object>
+            </child>
+          </object>
+        </child>
+      </object>
+    </child>
+  </object>
+</interface>


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