[five-or-more/arnaudb/kill-preferences-dialog: 9/10] Add a Keyboard Shortcuts dialog.



commit d33815f9d63a39031bd80c6ee6e96a857c0e217f
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date:   Fri May 8 17:16:24 2020 +0200

    Add a Keyboard Shortcuts dialog.

 data/org.gnome.five-or-more.gresource.xml |   3 +
 data/ui/five-or-more.ui                   |   5 ++
 data/ui/help-overlay.ui                   | 113 ++++++++++++++++++++++++++++++
 po/POTFILES.in                            |   1 +
 4 files changed, 122 insertions(+)
---
diff --git a/data/org.gnome.five-or-more.gresource.xml b/data/org.gnome.five-or-more.gresource.xml
index a33baa7..bb2df18 100644
--- a/data/org.gnome.five-or-more.gresource.xml
+++ b/data/org.gnome.five-or-more.gresource.xml
@@ -3,4 +3,7 @@
   <gresource prefix="/org/gnome/five-or-more/ui">
     <file preprocess="xml-stripblanks" alias="five-or-more.ui">ui/five-or-more.ui</file>
   </gresource>
+  <gresource prefix="/org/gnome/five-or-more/gtk">
+    <file preprocess="xml-stripblanks" alias="help-overlay.ui">ui/help-overlay.ui</file>
+  </gresource>
 </gresources>
diff --git a/data/ui/five-or-more.ui b/data/ui/five-or-more.ui
index c1c1831..fd48bad 100644
--- a/data/ui/five-or-more.ui
+++ b/data/ui/five-or-more.ui
@@ -86,6 +86,11 @@
       </submenu>
     </section>
     <section>
+      <item>
+        <!-- Translators: entry of the hamburger menu (with a mnemonic that appears when pressing Alt); 
displays Keyboard Shortcuts dialog -->
+        <attribute name="label" translatable="yes">_Keyboard Shortcuts</attribute>
+        <attribute name="action">win.show-help-overlay</attribute>
+      </item>
       <item>
         <!-- Translators: entry of the hamburger menu (with a mnemonic that appears when pressing Alt); 
opens the help of the application -->
         <attribute name="label" translatable="yes">_Help</attribute>
diff --git a/data/ui/help-overlay.ui b/data/ui/help-overlay.ui
new file mode 100644
index 0000000..e70717b
--- /dev/null
+++ b/data/ui/help-overlay.ui
@@ -0,0 +1,113 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  This file is part of Five-or-More
+
+  Five-or-More is free software: you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation, either version 3 of the License, or
+  (at your option) any later version.
+
+  Five-or-More is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+
+  You should have received a copy of the GNU General Public License
+  along with Five-or-More.  If not, see <https://www.gnu.org/licenses/>.
+-->
+<interface>
+  <requires lib="gtk+" version="3.12"/>
+  <object class="GtkShortcutsWindow" id="help_overlay">
+    <child>
+      <object class="GtkShortcutsSection">
+        <property name="visible">True</property>
+        <property name="max-height">6</property>
+        <child>
+          <object class="GtkShortcutsGroup">
+            <property name="visible">True</property>
+            <!-- Translators: header of the "Start a new game" (only) shortcut section -->
+            <property name="title" translatable="yes" context="shortcut window">New game</property>
+            <child>
+              <object class="GtkShortcutsShortcut">
+                <property name="visible">True</property>
+                <!-- Translators: in the Keyboard Shortcuts window, section "New game"; action of the Ctrl-N 
shortcut -->
+                <property name="title" translatable="yes" context="shortcut window">Start a new 
game</property>
+                <property name="accelerator">&lt;Primary&gt;n</property>
+              </object>
+            </child>
+          </object>
+        </child>
+        <child>
+          <object class="GtkShortcutsGroup">
+            <property name="visible">True</property>
+            <!-- Translators: header of the "Play with keyboard" shortcut section -->
+            <property name="title" translatable="yes" context="shortcut window">Play with keyboard</property>
+            <child>
+              <object class="GtkShortcutsShortcut">
+                <property name="visible">True</property>
+                <!-- Translators: in the Keyboard Shortcuts window, section "Play with keyboard"; action of 
the arrows -->
+                <property name="title" translatable="yes" context="shortcut window">Move keyboard 
cursor</property>
+                <property name="accelerator">Left Up Right Down</property>
+              </object>
+            </child>
+            <child>
+              <object class="GtkShortcutsShortcut">
+                <property name="visible">True</property>
+                <!-- Translators: in the Keyboard Shortcuts window, section "Play with keyboard"; action of 
the return or space keys -->
+                <property name="title" translatable="yes" context="shortcut window">Select or drop 
tile</property>
+                <property name="accelerator">Return space</property>
+              </object>
+            </child>
+          </object>
+        </child>
+        <child>
+          <object class="GtkShortcutsGroup">
+            <property name="visible">True</property>
+            <!-- Translators: header of the "Toggle main menu," "Keyboard shortcuts," "About," "Quit," etc. 
shortcuts section -->
+            <property name="title" translatable="yes" context="shortcut window">Generic</property>
+            <child>
+              <object class="GtkShortcutsShortcut">
+                <property name="visible">True</property>
+                <!-- Translators: in the Keyboard Shortcuts window, section "Generic"; action of the F10 
shortcut; toggles the hamburger menu -->
+                <property name="title" translatable="yes" context="shortcut window">Toggle main 
menu</property>
+                <property name="accelerator">F10</property>
+              </object>
+            </child>
+            <child>
+              <object class="GtkShortcutsShortcut">
+                <property name="visible">True</property>
+                <!-- Translators: in the Keyboard Shortcuts window, section "Generic"; action of the 
Ctrl-Shift-? shortcut; opens the Keyboard Shortcuts dialog -->
+                <property name="title" translatable="yes" context="shortcut window">Keyboard 
shortcuts</property>
+                <property name="accelerator">&lt;Primary&gt;question</property> <!-- TODO &lt;Primary&gt;F1 
-->
+              </object>
+            </child>
+            <child>
+              <object class="GtkShortcutsShortcut">
+                <property name="visible">True</property>
+                <!-- Translators: in the Keyboard Shortcuts window, section "Generic"; action of the F1 
shortcut; opens the help of the application -->
+                <property name="title" translatable="yes" context="shortcut window">Help</property>
+                <property name="accelerator">F1</property>
+              </object>
+            </child>
+            <child>
+              <object class="GtkShortcutsShortcut">
+                <property name="visible">False</property>
+                <!-- Translators: future keyboard shortcut; action of the Shift-F1 shortcut; opens the About 
dialog -->
+                <property name="title" translatable="yes" context="shortcut window">About</property>
+                <property name="accelerator">&lt;Shift&gt;F1</property> <!-- TODO make this shortcuts work 
-->
+              </object>
+            </child>
+            <child>
+              <object class="GtkShortcutsShortcut">
+                <property name="visible">True</property>
+                <!-- Translators: in the Keyboard Shortcuts window, section "Generic"; action of the Ctrl-Q 
shortcut; quits the application -->
+                <property name="title" translatable="yes" context="shortcut window">Quit</property>
+                <property name="accelerator">&lt;Primary&gt;q</property>
+              </object>
+            </child>
+          </object>
+        </child>
+      </object>
+    </child>
+  </object>
+</interface>
diff --git a/po/POTFILES.in b/po/POTFILES.in
index e9d2289..02cb743 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -4,6 +4,7 @@ data/org.gnome.five-or-more.appdata.xml.in
 data/org.gnome.five-or-more.desktop.in
 data/org.gnome.five-or-more.gschema.xml
 data/ui/five-or-more.ui
+data/ui/help-overlay.ui
 src/game.vala
 src/main.vala
 src/window.vala


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