[gnome-mahjongg: 1/2] Add Keyboard Shortcuts overlay



commit c72a00a57597256a7b9d9fe8277e3d2be38fde0d
Author: Jeremy Bicha <jbicha ubuntu com>
Date:   Fri Dec 7 16:48:53 2018 -0500

    Add Keyboard Shortcuts overlay

 data/gnome-mahjongg.gresource.xml |  6 +++
 data/help-overlay.ui              | 87 +++++++++++++++++++++++++++++++++++++++
 po/POTFILES.in                    |  1 +
 src/gnome-mahjongg.vala           |  1 +
 src/meson.build                   |  6 ++-
 5 files changed, 100 insertions(+), 1 deletion(-)
---
diff --git a/data/gnome-mahjongg.gresource.xml b/data/gnome-mahjongg.gresource.xml
new file mode 100644
index 0000000..3c00fef
--- /dev/null
+++ b/data/gnome-mahjongg.gresource.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<gresources>
+  <gresource prefix="/org/gnome/gnome-mahjongg/gtk">
+    <file preprocess="xml-stripblanks">help-overlay.ui</file>
+  </gresource>
+</gresources>
diff --git a/data/help-overlay.ui b/data/help-overlay.ui
new file mode 100644
index 0000000..a986caa
--- /dev/null
+++ b/data/help-overlay.ui
@@ -0,0 +1,87 @@
+<?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="title" translatable="yes" context="shortcut window">General</property>
+            <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">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">&lt;Ctrl&gt;Z</property>
+                <property name="title" translatable="yes" context="shortcut window">Undo</property>
+              </object>
+            </child>
+            <child>
+              <object class="GtkShortcutsShortcut">
+                <property name="visible">1</property>
+                <property name="accelerator">&lt;Shift&gt;&lt;Ctrl&gt;Z</property>
+                <property name="title" translatable="yes" context="shortcut window">Redo</property>
+              </object>
+            </child>
+            <child>
+              <object class="GtkShortcutsShortcut">
+                <property name="visible">1</property>
+                <property name="accelerator">F11</property>
+                <property name="title" translatable="yes" context="shortcut window">Fullscreen</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>
+        <child>
+          <object class="GtkShortcutsGroup">
+            <property name="title" translatable="yes" context="shortcut window">Help</property>
+            <property name="visible">1</property>
+            <child>
+              <object class="GtkShortcutsShortcut">
+                <property name="visible">1</property>
+                <property name="accelerator">&lt;Ctrl&gt;H</property>
+                <property name="title" translatable="yes" context="shortcut window">Show a hint</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>
+          </object>
+        </child>
+      </object>
+    </child>
+  </object>
+</interface>
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 01810d9..fea5bcc 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -2,6 +2,7 @@
 # Please keep this file in alphabetical order.
 data/gnome-mahjongg.appdata.xml.in
 data/gnome-mahjongg.desktop.in
+data/help-overlay.ui
 data/org.gnome.mahjongg.gschema.xml
 data/translatable_game_names.h
 src/game.vala
diff --git a/src/gnome-mahjongg.vala b/src/gnome-mahjongg.vala
index 8beee8d..525b99b 100644
--- a/src/gnome-mahjongg.vala
+++ b/src/gnome-mahjongg.vala
@@ -146,6 +146,7 @@ public class Mahjongg : Gtk.Application
         mahjongg_menu.append (_("_Preferences"), "app.preferences");
         var help_menu = new Menu ();
         menu.append_section (null, help_menu);
+        help_menu.append (_("_Keyboard Shortcuts"), "win.show-help-overlay");
         help_menu.append (_("_Help"), "app.help");
         help_menu.append (_("_About Mahjongg"), "app.about");
 
diff --git a/src/meson.build b/src/meson.build
index 3ca963a..3c59028 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -1,3 +1,7 @@
+resources = gnome.compile_resources ('resources', '../data/gnome-mahjongg.gresource.xml',
+                                     source_dir: '../data',
+                                     c_name: 'resources')
+
 gnome_mahjongg = executable ('gnome-mahjongg',
                              [ 'config.vapi',
                                'game.vala',
@@ -5,7 +9,7 @@ gnome_mahjongg = executable ('gnome-mahjongg',
                                'gnome-mahjongg.vala',
                                'history.vala',
                                'map.vala',                               
-                               'score-dialog.vala'],
+                               'score-dialog.vala'] + resources,
                              dependencies: [ glib_dep,
                                              gtk_dep,
                                              librsvg_dep ],


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