[gnome-clocks] Add a help overlay
- From: Paolo Borelli <pborelli src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-clocks] Add a help overlay
- Date: Wed, 9 Dec 2015 23:24:20 +0000 (UTC)
commit a5c5247b358e46bff06a4319b266ab7c9f2978cf
Author: Matthias Clasen <mclasen redhat com>
Date: Wed Dec 9 07:37:47 2015 -0500
Add a help overlay
https://bugzilla.gnome.org/show_bug.cgi?id=757837
data/gnome-clocks.gresource.xml | 1 +
data/gtk/help-overlay.ui | 111 +++++++++++++++++++++++++++++++++++++++
data/gtk/menus.ui | 5 ++
src/window.vala | 2 +
4 files changed, 119 insertions(+), 0 deletions(-)
---
diff --git a/data/gnome-clocks.gresource.xml b/data/gnome-clocks.gresource.xml
index 6305a4d..adee346 100644
--- a/data/gnome-clocks.gresource.xml
+++ b/data/gnome-clocks.gresource.xml
@@ -3,6 +3,7 @@
<gresource prefix="/org/gnome/clocks">
<file>css/gnome-clocks.css</file>
<file preprocess="xml-stripblanks">gtk/menus.ui</file>
+ <file preprocess="xml-stripblanks">gtk/help-overlay.ui</file>
<file preprocess="xml-stripblanks">ui/window.ui</file>
<file preprocess="xml-stripblanks">ui/worldlocationdialog.ui</file>
<file preprocess="xml-stripblanks">ui/world.ui</file>
diff --git a/data/gtk/help-overlay.ui b/data/gtk/help-overlay.ui
new file mode 100644
index 0000000..a6c6ec4
--- /dev/null
+++ b/data/gtk/help-overlay.ui
@@ -0,0 +1,111 @@
+<?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"><ctrl><alt>Page_Down</property>
+ <property name="title" translatable="yes">Go to the next section</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkShortcutsShortcut">
+ <property name="visible">1</property>
+ <property name="accelerator"><ctrl><alt>Page_Up</property>
+ <property name="title" translatable="yes">Go to the previous section</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkShortcutsShortcut">
+ <property name="visible">1</property>
+ <property name="accelerator"><alt>Q</property>
+ <property name="title" translatable="yes">Quit</property>
+ </object>
+ </child>
+ </object>
+ </child>
+ <child>
+ <object class="GtkShortcutsGroup">
+ <property name="visible">1</property>
+ <property name="view">ClocksWorldFace</property>
+ <property name="title" translatable="yes">World Clocks</property>
+ <child>
+ <object class="GtkShortcutsShortcut">
+ <property name="visible">1</property>
+ <property name="accelerator"><ctrl>N</property>
+ <property name="title" translatable="yes">Add a world clock</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkShortcutsShortcut">
+ <property name="visible">1</property>
+ <property name="accelerator"><ctrl>A</property>
+ <property name="title" translatable="yes">Select all world clocks</property>
+ </object>
+ </child>
+ </object>
+ </child>
+ <child>
+ <object class="GtkShortcutsGroup">
+ <property name="visible">1</property>
+ <property name="view">ClocksAlarmFace</property>
+ <property name="title" translatable="yes">Alarm</property>
+ <child>
+ <object class="GtkShortcutsShortcut">
+ <property name="visible">1</property>
+ <property name="accelerator"><ctrl>N</property>
+ <property name="title" translatable="yes">Add an alarm</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkShortcutsShortcut">
+ <property name="visible">1</property>
+ <property name="accelerator"><ctrl>A</property>
+ <property name="title" translatable="yes">Select all alarms</property>
+ </object>
+ </child>
+ </object>
+ </child>
+ <child>
+ <object class="GtkShortcutsGroup">
+ <property name="visible">1</property>
+ <property name="view">ClocksStopwatchFace</property>
+ <property name="title" translatable="yes">Stopwatch</property>
+ <child>
+ <object class="GtkShortcutsShortcut">
+ <property name="visible">1</property>
+ <property name="accelerator">Escape</property>
+ <property name="title" translatable="yes">Stop / Reset</property>
+ </object>
+ </child>
+ </object>
+ </child>
+ <child>
+ <object class="GtkShortcutsGroup">
+ <property name="visible">1</property>
+ <property name="view">ClocksTimerFace</property>
+ <property name="title" translatable="yes">Timer</property>
+ <child>
+ <object class="GtkShortcutsShortcut">
+ <property name="visible">1</property>
+ <property name="accelerator">Escape</property>
+ <property name="title" translatable="yes">Reset</property>
+ </object>
+ </child>
+ </object>
+ </child>
+ </object>
+ </child>
+ </object>
+</interface>
diff --git a/data/gtk/menus.ui b/data/gtk/menus.ui
index 10ac040..d143ac4 100644
--- a/data/gtk/menus.ui
+++ b/data/gtk/menus.ui
@@ -4,6 +4,11 @@
<menu id="app-menu">
<section>
<item>
+ <attribute name="label" translatable="yes">_Keyboard Shortcuts</attribute>
+ <attribute name="action">win.show-help-overlay</attribute>
+ <attribute name="accel"><Primary>F1</attribute>
+ </item>
+ <item>
<attribute name="label" translatable="yes">_Help</attribute>
<attribute name="action">win.help</attribute>
<attribute name="accel">F1</attribute>
diff --git a/src/window.vala b/src/window.vala
index a770e35..e7632ab 100644
--- a/src/window.vala
+++ b/src/window.vala
@@ -81,6 +81,8 @@ public class Window : Gtk.ApplicationWindow {
stack_switcher.set_stack (stack);
var stack_id = stack.notify["visible-child"].connect (() => {
+ var help_overlay = get_help_overlay ();
+ help_overlay.view_name = Type.from_instance(stack.visible_child).name();
update_header_bar ();
});
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]