Commit 54ac315b authored by Jeremy Bicha's avatar Jeremy Bicha 🎹

Add Keyboard Shortcuts overlay

Closes: #10
parent c5e57647
......@@ -11,6 +11,7 @@ src/board-noclutter.c
src/conf.c
src/game.c
src/game-names.h
[type: gettext/glade]src/help-overlay.ui
src/lib/ar-card.c
src/lib/ar-help.c
src/lib/ar-runtime.c
......
......@@ -103,7 +103,8 @@ EXTRA_DIST = \
$(schema_in_files) \
aisleriot-ui.xml \
aisleriot-debug-ui.xml \
game-names.h
game-names.h \
help-overlay.ui
CLEANFILES = \
$(BUILT_SOURCES) \
......
......@@ -31,6 +31,7 @@
<menu action="HelpMenu">
<menuitem action="Contents"/>
<menuitem action="HelpGame"/>
<menuitem action="KeyboardShortcuts"/>
<menuitem action="About"/>
</menu>
</menubar>
......
......@@ -22,4 +22,7 @@
<file alias="ui/menus.xml">@srcdir@/aisleriot-ui.xml</file>
<file alias="ui/debug-menus.xml">@srcdir@/aisleriot-debug-ui.xml</file>
</gresource>
<gresource prefix="/org/gnome/aisleriot/gtk">
<file alias="help-overlay.ui" preprocess="xml-stripblanks" compressed="true">@srcdir@/help-overlay.ui</file>
</gresource>
</gresources>
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright © 2019 Christian Persch
This program 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, or (at your option)
any later version.
This program is distributed in the hope conf 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 this program. If not, see <http://www.gnu.org/licenses/>.
-->
<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;Primary&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;Primary&gt;D</property>
<property name="title" translatable="yes" context="shortcut window">Deal</property>
</object>
</child>
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">1</property>
<property name="accelerator">&lt;Primary&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;Primary&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;Shift&gt;F1</property>
<property name="title" translatable="yes" context="shortcut window">Show Help for this game</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>
......@@ -489,6 +489,13 @@ help_on_game_cb (GtkAction *action,
aisleriot_show_help (GTK_WIDGET (window), game_module);
}
static void
help_overlay_cb (GSimpleAction *action,
AisleriotWindow *window)
{
g_action_group_activate_action (G_ACTION_GROUP (window), "show-help-overlay", NULL);
}
static void
close_window_cb (GtkAction *action,
AisleriotWindow *window)
......@@ -1848,6 +1855,10 @@ aisleriot_window_init (AisleriotWindow *window)
{ "About", GTK_STOCK_ABOUT, NULL, NULL,
N_("About this game"),
G_CALLBACK (help_about_cb) },
{ "KeyboardShortcuts", NULL, N_("_Keyboard Shortcuts"),
NULL,
NULL,
G_CALLBACK (help_overlay_cb) },
{ "InstallThemes", NULL, N_("Install card themes…"), NULL,
N_("Install new card themes from the distribution packages repositories"),
G_CALLBACK (install_themes_cb) },
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment