[aisleriot] Add Keyboard Shortcuts overlay
- From: Jeremy Bicha <jbicha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [aisleriot] Add Keyboard Shortcuts overlay
- Date: Mon, 21 Jan 2019 19:12:22 +0000 (UTC)
commit 54ac315bd3cba9551c146e7f79b358f26b616f2a
Author: Jeremy Bicha <jbicha ubuntu com>
Date: Sun Jan 6 09:37:43 2019 -0500
Add Keyboard Shortcuts overlay
Closes: https://gitlab.gnome.org/GNOME/aisleriot/issues/10
po/POTFILES.in | 1 +
src/Makefile.am | 3 +-
src/aisleriot-ui.xml | 1 +
src/aisleriot.gresource.xml.in | 3 ++
src/help-overlay.ui | 110 +++++++++++++++++++++++++++++++++++++++++
src/window.c | 11 +++++
6 files changed, 128 insertions(+), 1 deletion(-)
---
diff --git a/po/POTFILES.in b/po/POTFILES.in
index cc5d2194..a19df237 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -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
diff --git a/src/Makefile.am b/src/Makefile.am
index d6f29dfe..1a82bec2 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -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) \
diff --git a/src/aisleriot-ui.xml b/src/aisleriot-ui.xml
index d4f0e3c5..cf581f3e 100644
--- a/src/aisleriot-ui.xml
+++ b/src/aisleriot-ui.xml
@@ -31,6 +31,7 @@
<menu action="HelpMenu">
<menuitem action="Contents"/>
<menuitem action="HelpGame"/>
+ <menuitem action="KeyboardShortcuts"/>
<menuitem action="About"/>
</menu>
</menubar>
diff --git a/src/aisleriot.gresource.xml.in b/src/aisleriot.gresource.xml.in
index b59c9ab9..e5a96e1c 100644
--- a/src/aisleriot.gresource.xml.in
+++ b/src/aisleriot.gresource.xml.in
@@ -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>
diff --git a/src/help-overlay.ui b/src/help-overlay.ui
new file mode 100644
index 00000000..74a4f13b
--- /dev/null
+++ b/src/help-overlay.ui
@@ -0,0 +1,110 @@
+<?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"><Primary>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"><Primary>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"><Primary>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"><Shift><Primary>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"><Ctrl>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"><Ctrl>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"><Shift>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"><Primary>question <Primary>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/src/window.c b/src/window.c
index 78825b31..e74cd417 100644
--- a/src/window.c
+++ b/src/window.c
@@ -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) },
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]