[gnome-chess] Add Keyboard Shortcuts overlay



commit 26eb0d6b71289b0a3910cb5fe3fd491f78f6b59a
Author: Jeremy Bicha <jbicha ubuntu com>
Date:   Sat Dec 8 18:12:37 2018 -0500

    Add Keyboard Shortcuts overlay

 data/gnome-chess.ui     |   4 ++
 data/help-overlay.ui    | 121 ++++++++++++++++++++++++++++++++++++++++++++++++
 src/chess.gresource.xml |  10 ++--
 src/meson.build         |   1 +
 4 files changed, 132 insertions(+), 4 deletions(-)
---
diff --git a/data/gnome-chess.ui b/data/gnome-chess.ui
index 9514df1..952c282 100644
--- a/data/gnome-chess.ui
+++ b/data/gnome-chess.ui
@@ -7,6 +7,10 @@
         <attribute name="label" translatable="yes">_Preferences</attribute>
         <attribute name="action">app.preferences</attribute>
       </item>
+      <item>
+        <attribute name="label" translatable="yes">_Keyboard Shortcuts</attribute>
+        <attribute name="action">win.show-help-overlay</attribute>
+      </item>
       <item>
         <attribute name="label" translatable="yes">_Help</attribute>
         <attribute name="action">app.help</attribute>
diff --git a/data/help-overlay.ui b/data/help-overlay.ui
new file mode 100644
index 0000000..8d5da56
--- /dev/null
+++ b/data/help-overlay.ui
@@ -0,0 +1,121 @@
+<?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">&lt;Ctrl&gt;O</property>
+                <property name="title" translatable="yes" context="shortcut window">Open a saved 
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;S</property>
+                <property name="title" translatable="yes" context="shortcut window">Save the game</property>
+              </object>
+            </child>
+            <child>
+              <object class="GtkShortcutsShortcut">
+                <property name="visible">1</property>
+                <property name="accelerator">&lt;Shift&gt;&lt;Ctrl&gt;S</property>
+                <property name="title" translatable="yes" context="shortcut window">Save the game with a 
different name</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 move</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">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>
+        <child>
+          <object class="GtkShortcutsGroup">
+            <property name="title" translatable="yes" context="shortcut window">History</property>
+            <property name="visible">1</property>
+            <child>
+              <object class="GtkShortcutsShortcut">
+                <property name="visible">1</property>
+                <property name="accelerator">&lt;Shift&gt;&lt;Alt&gt;Left</property>
+                <property name="title" translatable="yes" context="shortcut window">Rewind to the game 
start</property>
+              </object>
+            </child>
+            <child>
+              <object class="GtkShortcutsShortcut">
+                <property name="visible">1</property>
+                <property name="accelerator">&lt;Alt&gt;Left</property>
+                <property name="title" translatable="yes" context="shortcut window">Show the previous 
move</property>
+              </object>
+            </child>
+            <child>
+              <object class="GtkShortcutsShortcut">
+                <property name="visible">1</property>
+                <property name="accelerator">&lt;Alt&gt;Right</property>
+                <property name="title" translatable="yes" context="shortcut window">Show the next 
move</property>
+              </object>
+            </child>
+            <child>
+              <object class="GtkShortcutsShortcut">
+                <property name="visible">1</property>
+                <property name="accelerator">&lt;Shift&gt;&lt;Alt&gt;Right</property>
+                <property name="title" translatable="yes" context="shortcut window">Show the current 
move</property>
+              </object>
+            </child>
+              </object>
+            </child>
+      </object>
+    </child>
+  </object>
+</interface>
diff --git a/src/chess.gresource.xml b/src/chess.gresource.xml
index a07423a..22228c7 100644
--- a/src/chess.gresource.xml
+++ b/src/chess.gresource.xml
@@ -1,9 +1,11 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <gresources>
   <gresource prefix="/org/gnome/chess/ui">
-    <file preprocess="xml-stripblanks" alias="gnome-chess.ui">../data/gnome-chess.ui</file>
-    <file preprocess="xml-stripblanks" alias="preferences.ui">../data/preferences.ui</file>
-    <file preprocess="xml-stripblanks" 
alias="promotion-type-selector.ui">../data/promotion-type-selector.ui</file>
+    <file preprocess="xml-stripblanks" alias="gnome-chess.ui">gnome-chess.ui</file>
+    <file preprocess="xml-stripblanks" alias="preferences.ui">preferences.ui</file>
+    <file preprocess="xml-stripblanks" alias="promotion-type-selector.ui">promotion-type-selector.ui</file>
+  </gresource>
+  <gresource prefix="/org/gnome/chess/gtk">
+    <file preprocess="xml-stripblanks">help-overlay.ui</file>
   </gresource>
 </gresources>
-
diff --git a/src/meson.build b/src/meson.build
index db2ab9d..67b87e5 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -1,6 +1,7 @@
 # The resource file
 resource_files = files('chess.gresource.xml')
 resources = gnome.compile_resources('org.gnome.chess', resource_files,
+  source_dir: '../data',
   c_name: 'resources'
 )
 


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