[gnome-maps] Add a help overlay



commit 6c07319d3a31036c79bb98bf216fda0c8c0ce7ae
Author: Jonas Danielsson <jonas threetimestwo org>
Date:   Thu Dec 17 08:02:40 2015 +0100

    Add a help overlay
    
    GNOME has a new Goal: Adding shortcut windows.
    
    GTK+ 3.19.x includes a new widget called GtkShortcutsWindow.
    This is a dialog window that shows an overview of shortcuts
    (keyboard shortcuts and touch gestures) for an application.
    
    To add a help overlay we need to create an UI file in our
    resources at $(gresource prefix)/gtk/.
    
    And the rest should be magical.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=756946

 data/org.gnome.Maps.data.gresource.xml |    3 +
 data/ui/app-menu.ui                    |    5 ++
 data/ui/help-overlay.ui                |   65 ++++++++++++++++++++++++++++++++
 po/POTFILES.in                         |    1 +
 4 files changed, 74 insertions(+), 0 deletions(-)
---
diff --git a/data/org.gnome.Maps.data.gresource.xml b/data/org.gnome.Maps.data.gresource.xml
index 225c61a..3e579f1 100644
--- a/data/org.gnome.Maps.data.gresource.xml
+++ b/data/org.gnome.Maps.data.gresource.xml
@@ -31,4 +31,7 @@
     <file alias="ui/maptype-aerial.png">media/maptype-aerial.png</file>
     <file alias="ui/maptype-street.png">media/maptype-street.png</file>
   </gresource>
+  <gresource prefix="/org/gnome/Maps/gtk">
+    <file alias="help-overlay.ui" preprocess="xml-stripblanks">ui/help-overlay.ui</file>
+  </gresource>
 </gresources>
diff --git a/data/ui/app-menu.ui b/data/ui/app-menu.ui
index 1dd897e..c9860b4 100644
--- a/data/ui/app-menu.ui
+++ b/data/ui/app-menu.ui
@@ -3,6 +3,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">F1</attribute>
+      </item>
+      <item>
         <attribute name="action">app.osm-account-setup</attribute>
         <attribute name="label" translatable="yes">Setup OpenStreetMap Account</attribute>
       </item>
diff --git a/data/ui/help-overlay.ui b/data/ui/help-overlay.ui
new file mode 100644
index 0000000..a95177c
--- /dev/null
+++ b/data/ui/help-overlay.ui
@@ -0,0 +1,65 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+  <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="visible">1</property>
+            <property name="title" translatable="yes">General</property>
+            <child>
+              <object class="GtkShortcutsShortcut">
+                <property name="visible">1</property>
+                <property name="title" translatable="yes">Show help</property>
+                <property name="accelerator">F1</property>
+              </object>
+            </child>
+            <child>
+              <object class="GtkShortcutsShortcut">
+                <property name="visible">1</property>
+                <property name="title" translatable="yes">Search</property>
+                <property name="accelerator">&lt;Primary&gt;F</property>
+              </object>
+            </child>
+           <child>
+              <object class="GtkShortcutsShortcut">
+                <property name="visible">1</property>
+                <property name="title" translatable="yes">Toggle route planner</property>
+                <property name="accelerator">&lt;Primary&gt;D</property>
+              </object>
+            </child>
+            <child>
+              <object class="GtkShortcutsShortcut">
+                <property name="visible">1</property>
+                <property name="title" translatable="yes">Quit</property>
+                <property name="accelerator">&lt;Primary&gt;Q</property>
+              </object>
+            </child>
+          </object>
+        </child>
+        <child>
+          <object class="GtkShortcutsGroup">
+            <property name="visible">1</property>
+            <property name="title" translatable="yes">Map View</property>
+            <child>
+              <object class="GtkShortcutsShortcut">
+                <property name="visible">1</property>
+                <property name="title" translatable="yes">Zoom in</property>
+                <property name="accelerator">plus</property>
+              </object>
+            </child>
+            <child>
+              <object class="GtkShortcutsShortcut">
+                <property name="visible">1</property>
+                <property name="title" translatable="yes">Zoom out</property>
+                <property name="accelerator">minus</property>
+              </object>
+            </child>
+          </object>
+        </child>
+      </object>
+    </child>
+  </object>
+</interface>
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 113324c..6943b30 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -6,6 +6,7 @@ data/org.gnome.Maps.gschema.xml
 [type: gettext/glade]data/ui/check-in-dialog.ui
 [type: gettext/glade]data/ui/context-menu.ui
 [type: gettext/glade]data/ui/export-view-dialog.ui
+[type: gettext/glade]data/ui/help-overlay.ui
 [type: gettext/glade]data/ui/location-service-notification.ui
 [type: gettext/glade]data/ui/main-window.ui
 [type: gettext/glade]data/ui/map-bubble.ui


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