[four-in-a-row] Add help overlay.



commit 02a18e73d4a1cdf070fdbc04498460b20b4f932e
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date:   Thu Dec 19 04:32:16 2019 +0100

    Add help overlay.

 data/ui/help-overlay.ui         | 154 ++++++++++++++++++++++++++++++++++++++++
 src/four-in-a-row.gresource.xml |   3 +
 src/four-in-a-row.vala          |  10 ++-
 3 files changed, 164 insertions(+), 3 deletions(-)
---
diff --git a/data/ui/help-overlay.ui b/data/ui/help-overlay.ui
new file mode 100644
index 0000000..0c6a757
--- /dev/null
+++ b/data/ui/help-overlay.ui
@@ -0,0 +1,154 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+   This file is part of GNOME Four-in-a-row.
+
+   Copyright © 2019 Arnaud Bonatti
+
+   GNOME Four-in-a-row 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.
+
+   GNOME Four-in-a-row 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 GNOME Four-in-a-row.  If not, see <https://www.gnu.org/licenses/>.
+-->
+<interface domain="iagno">
+  <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">8</property>
+        <child>
+          <object class="GtkShortcutsGroup">
+            <property name="visible">True</property>
+            <!-- Translators: section of the Keyboard Shortcuts window; contains shortcuts available during 
a game: "New game", "Undo last move"... -->
+            <property name="title" translatable="yes" context="shortcut window">During a game</property>
+            <child>
+              <object class="GtkShortcutsShortcut">
+                <property name="visible">True</property>
+                <!-- Translators: in the Keyboard Shortcuts window, section "During a game" -->
+                <property name="title" translatable="yes" context="shortcut window">New game</property>
+                <property name="accelerator">&lt;Primary&gt;n</property>
+              </object>
+            </child>
+            <child>
+              <object class="GtkShortcutsShortcut">
+                <property name="visible">True</property>
+                <!-- Translators: in the Keyboard Shortcuts window, section "During a game" -->
+                <property name="title" translatable="yes" context="shortcut window">Undo last move</property>
+                <property name="accelerator">&lt;Primary&gt;z</property>
+              </object>
+            </child>
+            <child>
+              <object class="GtkShortcutsShortcut">
+                <property name="visible">True</property>
+                <!-- Translators: in the Keyboard Shortcuts window, section "During a game" -->
+                <property name="title" translatable="yes" context="shortcut window">Show a hint</property>
+                <property name="accelerator">&lt;Primary&gt;h</property>
+              </object>
+            </child>
+          </object>
+        </child>
+        <child>
+          <object class="GtkShortcutsGroup">
+            <property name="visible">True</property>
+            <!-- Translators: section of the Keyboard Shortcuts window; contains shortucts for playing: 
Left/Right/Down -->
+            <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"; using 
arrows is the usual way select where to play -->
+                <property name="title" translatable="yes" context="shortcut window">Select where to 
play</property>
+                <property name="accelerator">Left Right</property>
+              </object>
+            </child>
+            <child><!-- TODO make visible -->
+              <object class="GtkShortcutsShortcut">
+                <property name="visible">False</property>
+                <!-- Translators: in the Keyboard Shortcuts window, section "Play with keyboard"; hitting 
number moves directly to the nth column -->
+                <property name="title" translatable="yes" context="shortcut window">Select the given 
column</property>
+                <property name="accelerator">1...7</property>
+              </object>
+            </child>
+            <child>
+              <object class="GtkShortcutsShortcut">
+                <property name="visible">True</property>
+                <!-- Translators: in the Keyboard Shortcuts window, section "Play with keyboard"; shortcut 
for dropping the tile -->
+                <property name="title" translatable="yes" context="shortcut window">Play in selected 
column</property>
+                <property name="accelerator">Down</property><!-- TODO Return space -->
+              </object>
+            </child>
+          </object>
+        </child>
+        <child>
+          <object class="GtkShortcutsGroup">
+            <property name="visible">True</property>
+            <!-- Translators: section of the Keyboard Shortcuts window; contains shortcuts available when 
configuring a new game -->
+            <property name="title" translatable="yes" context="shortcut window">During game 
selection</property>
+            <child>
+              <object class="GtkShortcutsShortcut">
+                <property name="visible">True</property>
+                <!-- Translators: in the Keyboard Shortcuts window, section "During game selection"; how to 
launch a new game -->
+                <property name="title" translatable="yes" context="shortcut window">Start new game</property>
+                <property name="accelerator">&lt;Primary&gt;&lt;Shift&gt;n</property>
+              </object>
+            </child>
+            <child>
+              <object class="GtkShortcutsShortcut">
+                <property name="visible">True</property>
+                <!-- Translators: in the Keyboard Shortcuts window, section "During game selection"; how to 
go back to a running game, if any -->
+                <property name="title" translatable="yes" context="shortcut window">Go back</property>
+                <property name="accelerator">Escape</property>
+              </object>
+            </child>
+          </object>
+        </child>
+        <child>
+          <object class="GtkShortcutsGroup">
+            <property name="visible">True</property>
+            <!-- Translators: section of the Keyboard Shortcuts window; contains "Help", "About", "Quit"... 
-->
+            <property name="title" translatable="yes" context="shortcut window">Generic</property>
+            <child><!-- TODO make visible -->
+              <object class="GtkShortcutsShortcut">
+                <property name="visible">False</property>
+                <!-- Translators: in the Keyboard Shortcuts window, section "Generic" -->
+                <property name="title" translatable="yes" context="shortcut window">Keyboard 
shortcuts</property>
+                <property name="accelerator">&lt;Primary&gt;question &lt;Primary&gt;F1</property>
+              </object>
+            </child>
+            <child>
+              <object class="GtkShortcutsShortcut">
+                <property name="visible">True</property>
+                <!-- Translators: in the Keyboard Shortcuts window, section "Generic" -->
+                <property name="title" translatable="yes" context="shortcut window">Help</property>
+                <property name="accelerator">F1</property>
+              </object>
+            </child>
+            <child>
+              <object class="GtkShortcutsShortcut">
+                <property name="visible">True</property>
+                <!-- Translators: in the Keyboard Shortcuts window, section "Generic" -->
+                <property name="title" translatable="yes" context="shortcut window">About</property>
+                <property name="accelerator">&lt;Shift&gt;F1</property>
+              </object>
+            </child>
+            <child>
+              <object class="GtkShortcutsShortcut">
+                <property name="visible">True</property>
+                <!-- Translators: in the Keyboard Shortcuts window, section "Generic" -->
+                <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/src/four-in-a-row.gresource.xml b/src/four-in-a-row.gresource.xml
index eb7ef77..7f9b5f5 100644
--- a/src/four-in-a-row.gresource.xml
+++ b/src/four-in-a-row.gresource.xml
@@ -17,4 +17,7 @@
     <file preprocess="xml-stripblanks" compressed="true" 
alias="game-actionbar-placeholder.ui">../data/ui/game-actionbar-placeholder.ui</file>
     <file preprocess="xml-stripblanks" compressed="true" 
alias="history-button.ui">../data/ui/history-button.ui</file>
   </gresource>
+  <gresource prefix="/org/gnome/Four-in-a-row/gtk">
+    <file preprocess="xml-stripblanks" alias="help-overlay.ui">../data/ui/help-overlay.ui</file>
+  </gresource>
 </gresources>
diff --git a/src/four-in-a-row.vala b/src/four-in-a-row.vala
index 8149bf1..ce37add 100644
--- a/src/four-in-a-row.vala
+++ b/src/four-in-a-row.vala
@@ -155,17 +155,21 @@ private class FourInARow : Gtk.Application
         app_menu.append_section (null, section);
 
         section = new GLib.Menu ();
-        /* Translators: hamburger menu entry; opens the Scores dialog */
+        /* Translators: hamburger menu entry; opens the Scores dialog (with a mnemonic that appears pressing 
Alt) */
         section.append (_("_Scores"), "app.scores");
         section.freeze ();
         app_menu.append_section (null, section);
 
         section = new GLib.Menu ();
-        /* Translators: hamburger menu entry; opens the application help */
+        /* Translators: hamburger menu entry; opens the Keyboard Shortcuts dialog (with a mnemonic that 
appears pressing Alt) */
+        section.append (_("_Keyboard Shortcuts"), "win.show-help-overlay");
+
+
+        /* Translators: hamburger menu entry; opens the application help (with a mnemonic that appears 
pressing Alt) */
         section.append (_("_Help"), "app.help");
 
 
-        /* Translators: hamburger menu entry; opens the About dialog */
+        /* Translators: hamburger menu entry; opens the About dialog (with a mnemonic that appears pressing 
Alt) */
         section.append (_("_About Four-in-a-row"), "app.about");
         section.freeze ();
         app_menu.append_section (null, section);


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