shell: Add a help overlay

This explains the various keyboard shortcuts that are available
in the control-center.

See https://wiki.gnome.org/Initiatives/GnomeGoals/ShortcutWindows

https://bugzilla.gnome.org/show_bug.cgi?id=759320
This commit is contained in:
Matthias Clasen 2015-12-10 20:49:59 -05:00
parent 85b440b622
commit fde96cc691
4 changed files with 77 additions and 0 deletions

View file

@ -109,10 +109,19 @@ completion_DATA = $(completion_in_files:.in=)
completions/gnome-control-center: completions/gnome-control-center.in list-panel.sh
$(AM_V_GEN) mkdir -p `dirname $@` && cat $< | sed "s,@PANELS@,`$(srcdir)/list-panel.sh $(top_srcdir)`," > $@
resource_files = $(shell glib-compile-resources --generate-dependencies --sourcedir=$(srcdir) gnome-control-center.gresource.xml)
resources.c: gnome-control-center.gresource.xml $(resource_files)
$(AM_V_GEN) glib-compile-resources --target=$@ --sourcedir=$(srcdir) --generate-source $<
BUILT_SOURCES = resources.c
EXTRA_DIST = \
gnome-control-center.desktop.in.in \
$(servicefile_in_files) \
$(completion_in_files) \
gnome-control-center.gresource.xml \
help-overlay.ui \
$(resource_files) \
list-panel.sh
CLEANFILES = $(BUILT_SOURCES) $(completion_DATA) $(servicefile_DATA)

View file

@ -248,6 +248,7 @@ cc_application_startup (GApplication *application)
menu = g_menu_new ();
section = g_menu_new ();
g_menu_append (section, _("Keyboard Shortcuts"), "win.show-help-overlay");
g_menu_append (section, _("Help"), "app.help");
g_menu_append (section, _("Quit"), "app.quit");

View file

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<gresources>
<gresource prefix="/org/gnome/ControlCenter/gtk">
<file preprocess="xml-stripblanks">help-overlay.ui</file>
</gresource>
</gresources>

61
shell/help-overlay.ui Normal file
View file

@ -0,0 +1,61 @@
<?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>
<property name="section-name">shortcuts</property>
<property name="max-height">10</property>
<child>
<object class="GtkShortcutsGroup">
<property name="visible">1</property>
<property name="title" translatable="yes">General</property>
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">1</property>
<property name="accelerator">&lt;ctrl&gt;Q</property>
<property name="title" translatable="yes">Quit</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">Search</property>
</object>
</child>
</object>
</child>
<child>
<object class="GtkShortcutsGroup">
<property name="visible">1</property>
<property name="title" translatable="yes">Panels</property>
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">1</property>
<property name="accelerator">&lt;Alt&gt;Left</property>
<property name="title" translatable="yes">Go back to the overview</property>
</object>
</child>
</object>
</child>
<child>
<object class="GtkShortcutsGroup">
<property name="visible">1</property>
<property name="title" translatable="yes">Search</property>
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">1</property>
<property name="accelerator">Escape</property>
<property name="title" translatable="yes">Cancel search</property>
</object>
</child>
</object>
</child>
</object>
</child>
</object>
</interface>