[evince] shell: Add shortcuts help window



commit 6e454ee8f362fcce647ec875406451b4f5cd394f
Author: Felipe Borges <felipeborges gnome org>
Date:   Wed Nov 11 11:00:51 2015 +0100

    shell: Add shortcuts help window
    
    Use GTK+'s new shortcut window to document our shortcuts.
    See: https://wiki.gnome.org/Initiatives/GnomeGoals/ShortcutWindows
    
    https://bugzilla.gnome.org/show_bug.cgi?id=757828

 shell/Makefile.am          |    1 +
 shell/ev-application.c     |    4 +-
 shell/ev-toolbar.c         |    2 +-
 shell/ev-window.c          |    4 +-
 shell/evince.css           |    2 +-
 shell/evince.gresource.xml |    3 +-
 shell/help-overlay.ui      |  225 ++++++++++++++++++++++++++++++++++++++++++++
 7 files changed, 235 insertions(+), 6 deletions(-)
---
diff --git a/shell/Makefile.am b/shell/Makefile.am
index 96075c3..9719fa1 100644
--- a/shell/Makefile.am
+++ b/shell/Makefile.am
@@ -169,6 +169,7 @@ endif
 EXTRA_DIST = \
        evince.css \
        evince-menus.ui \
+        help-overlay.ui \
        evince-icon.rc \
        evince.gresource.xml \
        ev-gdbus.xml \
diff --git a/shell/ev-application.c b/shell/ev-application.c
index 2a2830b..1466b4f 100644
--- a/shell/ev-application.c
+++ b/shell/ev-application.c
@@ -1091,6 +1091,8 @@ ev_application_startup (GApplication *gapplication)
         GError *error = NULL;
         const gchar **it;
 
+       g_application_set_resource_base_path (gapplication, "/org/gnome/evince");
+
         G_APPLICATION_CLASS (ev_application_parent_class)->startup (gapplication);
 
         g_action_map_add_action_entries (G_ACTION_MAP (application),
@@ -1098,7 +1100,7 @@ ev_application_startup (GApplication *gapplication)
                                          application);
 
         builder = gtk_builder_new ();
-        gtk_builder_add_from_resource (builder, "/org/gnome/evince/shell/ui/menus.ui", &error);
+        gtk_builder_add_from_resource (builder, "/org/gnome/evince/ui/menus.ui", &error);
         g_assert_no_error (error);
 
         gtk_application_set_app_menu (GTK_APPLICATION (application),
diff --git a/shell/ev-toolbar.c b/shell/ev-toolbar.c
index b25b04a..64aed8e 100644
--- a/shell/ev-toolbar.c
+++ b/shell/ev-toolbar.c
@@ -195,7 +195,7 @@ ev_toolbar_constructed (GObject *object)
 
         G_OBJECT_CLASS (ev_toolbar_parent_class)->constructed (object);
 
-        builder = gtk_builder_new_from_resource ("/org/gnome/evince/shell/ui/menus.ui");
+        builder = gtk_builder_new_from_resource ("/org/gnome/evince/ui/menus.ui");
 
         button = ev_toolbar_create_button (ev_toolbar, "win.open",
                                            "document-open-symbolic",
diff --git a/shell/ev-window.c b/shell/ev-window.c
index 462f78c..601bb1b 100644
--- a/shell/ev-window.c
+++ b/shell/ev-window.c
@@ -6782,7 +6782,7 @@ ev_window_init (EvWindow *ev_window)
 
        css_provider = gtk_css_provider_new ();
        _gtk_css_provider_load_from_resource (css_provider,
-                                             "/org/gnome/evince/shell/ui/evince.css",
+                                             "/org/gnome/evince/ui/evince.css",
                                              &error);
        g_assert_no_error (error);
        gtk_style_context_add_provider_for_screen (gtk_widget_get_screen (GTK_WIDGET (ev_window)),
@@ -7091,7 +7091,7 @@ ev_window_init (EvWindow *ev_window)
                          ev_window);
 
        /* Popups */
-       builder = gtk_builder_new_from_resource ("/org/gnome/evince/shell/ui/menus.ui");
+       builder = gtk_builder_new_from_resource ("/org/gnome/evince/ui/menus.ui");
        ev_window->priv->view_popup_menu = g_object_ref (G_MENU_MODEL (gtk_builder_get_object (builder, 
"view-popup-menu")));
        ev_window->priv->attachment_popup_menu = g_object_ref (G_MENU_MODEL (gtk_builder_get_object (builder, 
"attachments-popup")));
        g_object_unref (builder);
diff --git a/shell/evince.css b/shell/evince.css
index 63afebf..d8c4613 100644
--- a/shell/evince.css
+++ b/shell/evince.css
@@ -12,7 +12,7 @@
 .content-view.document-page {
     border-style: solid;
     border-width: 3px 3px 6px 4px;
-    border-image: url("resource:///org/gnome/evince/shell/ui/thumbnail-frame.png") 3 3 6 4;
+    border-image: url("resource:///org/gnome/evince/ui/thumbnail-frame.png") 3 3 6 4;
     background-color: @theme_bg_color;
 }
 
diff --git a/shell/evince.gresource.xml b/shell/evince.gresource.xml
index 75bbdec..bbacb1c 100644
--- a/shell/evince.gresource.xml
+++ b/shell/evince.gresource.xml
@@ -16,7 +16,8 @@
   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 -->
 <gresources>
-  <gresource prefix="/org/gnome/evince/shell">
+  <gresource prefix="/org/gnome/evince">
+    <file alias="gtk/help-overlay.ui" preprocess="xml-stripblanks">help-overlay.ui</file>
     <file alias="ui/evince.css" compressed="true">evince.css</file>
     <file alias="ui/thumbnail-frame.png" compressed="true">thumbnail-frame.png</file>
     <file alias="ui/menus.ui" compressed="true" preprocess="xml-stripblanks">evince-menus.ui</file>
diff --git a/shell/help-overlay.ui b/shell/help-overlay.ui
new file mode 100644
index 0000000..b8f3088
--- /dev/null
+++ b/shell/help-overlay.ui
@@ -0,0 +1,225 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+  <object class="GtkShortcutsWindow" id="help_overlay">
+    <property name="modal">True</property>
+    <child>
+      <object class="GtkShortcutsSection">
+        <property name="visible">True</property>
+        <property name="section-name">shortcuts</property>
+        <property name="max-height">12</property>
+        <child>
+          <object class="GtkShortcutsGroup">
+            <property name="visible">True</property>
+            <property name="title" translatable="yes">Opening, closing, saving and printing</property>
+            <child>
+              <object class="GtkShortcutsShortcut">
+                <property name="visible">True</property>
+                <property name="title" translatable="yes">Open a document</property>
+                <property name="accelerator">&lt;Primary&gt;O</property>
+              </object>
+            </child>
+            <child>
+              <object class="GtkShortcutsShortcut">
+                <property name="visible">True</property>
+                <property name="title" translatable="yes">Open a copy of the current document</property>
+                <property name="accelerator">&lt;Primary&gt;N</property>
+              </object>
+            </child>
+            <child>
+              <object class="GtkShortcutsShortcut">
+                <property name="visible">True</property>
+                <property name="title" translatable="yes">Save a copy of the current document</property>
+                <property name="accelerator">&lt;Primary&gt;S</property>
+              </object>
+            </child>
+            <child>
+              <object class="GtkShortcutsShortcut">
+                <property name="visible">True</property>
+                <property name="title" translatable="yes">Print the current document</property>
+                <property name="accelerator">&lt;Primary&gt;P</property>
+              </object>
+            </child>
+            <child>
+              <object class="GtkShortcutsShortcut">
+                <property name="visible">True</property>
+                <property name="title" translatable="yes">Close the current document window</property>
+                <property name="accelerator">&lt;Primary&gt;W</property>
+              </object>
+            </child>
+            <child>
+              <object class="GtkShortcutsShortcut">
+                <property name="visible">True</property>
+                <property name="title" translatable="yes">Reload the document</property>
+                <property name="accelerator">&lt;Primary&gt;R</property>
+              </object>
+            </child>
+          </object>
+        </child>
+        <child>
+          <object class="GtkShortcutsGroup">
+            <property name="visible">True</property>
+            <property name="title" translatable="yes">Selecting and copying text</property>
+            <child>
+              <object class="GtkShortcutsShortcut">
+                <property name="visible">True</property>
+                <property name="title" translatable="yes">Copy highlighted text</property>
+                <property name="accelerator">&lt;Primary&gt;C</property>
+              </object>
+            </child>
+            <child>
+              <object class="GtkShortcutsShortcut">
+                <property name="visible">True</property>
+                <property name="title" translatable="yes">Select all the text in a document</property>
+                <property name="accelerator">&lt;Primary&gt;A</property>
+              </object>
+            </child>
+          </object>
+        </child>
+        <child>
+          <object class="GtkShortcutsGroup">
+            <property name="visible">True</property>
+            <property name="title" translatable="yes">Moving around the document</property>
+            <child>
+              <object class="GtkShortcutsShortcut">
+                <property name="visible">True</property>
+                <property name="title" translatable="yes">Move up/down a page</property>
+                <property name="accelerator">Left Up Down Right</property>
+              </object>
+            </child>
+            <child>
+              <object class="GtkShortcutsShortcut">
+                <property name="visible">True</property>
+                <property name="title" translatable="yes">Move up/down a page several lines at a 
time</property>
+                <property name="accelerator">Page_Up Page_Down</property>
+              </object>
+            </child>
+            <child>
+              <object class="GtkShortcutsShortcut">
+                <property name="visible">True</property>
+                <property name="title" translatable="yes">Go to page number</property>
+                <property name="accelerator">&lt;Primary&gt;L</property>
+              </object>
+            </child>
+            <child>
+              <object class="GtkShortcutsShortcut">
+                <property name="visible">True</property>
+                <property name="title" translatable="yes">Go to the beginning/end of a page</property>
+                <property name="accelerator">Home End</property>
+              </object>
+            </child>
+            <child>
+              <object class="GtkShortcutsShortcut">
+                <property name="visible">True</property>
+                <property name="title" translatable="yes">Go to the beginning of the document</property>
+                <property name="accelerator">&lt;Primary&gt;Home</property>
+              </object>
+            </child>
+            <child>
+              <object class="GtkShortcutsShortcut">
+                <property name="visible">True</property>
+                <property name="title" translatable="yes">Go to the end of the document</property>
+                <property name="accelerator">&lt;Primary&gt;End</property>
+              </object>
+            </child>
+          </object>
+        </child>
+        <child>
+          <object class="GtkShortcutsGroup">
+            <property name="visible">True</property>
+            <property name="title" translatable="yes">Finding text</property>
+            <child>
+              <object class="GtkShortcutsShortcut">
+                <property name="visible">True</property>
+                <property name="title" translatable="yes">Show the search bar</property>
+                <property name="accelerator">&lt;Primary&gt;F</property>
+              </object>
+            </child>
+            <child>
+              <object class="GtkShortcutsShortcut">
+                <property name="visible">True</property>
+                <property name="title" translatable="yes">Go to the next search result</property>
+                <property name="accelerator">&lt;Primary&gt;G</property>
+              </object>
+            </child>
+            <child>
+              <object class="GtkShortcutsShortcut">
+                <property name="visible">True</property>
+                <property name="title" translatable="yes">Go to the previous search result</property>
+                <property name="accelerator">&lt;Primary&gt;&lt;shift&gt;G</property>
+              </object>
+            </child>
+          </object>
+        </child>
+        <child>
+          <object class="GtkShortcutsGroup">
+            <property name="visible">True</property>
+            <property name="title" translatable="yes">Rotating and zooming</property>
+            <child>
+              <object class="GtkShortcutsShortcut">
+                <property name="visible">True</property>
+                <property name="title" translatable="yes">Rotate the page 90 degrees 
counter-clockwise</property>
+                <property name="accelerator">&lt;Primary&gt;Left</property>
+              </object>
+            </child>
+            <child>
+              <object class="GtkShortcutsShortcut">
+                <property name="visible">True</property>
+                <property name="title" translatable="yes">Rotate the page 90 degrees clockwise</property>
+                <property name="accelerator">&lt;Primary&gt;Right</property>
+              </object>
+            </child>
+            <child>
+              <object class="GtkShortcutsShortcut">
+                <property name="visible">True</property>
+                <property name="title" translatable="yes">Zoom in</property>
+                <property name="accelerator">&lt;Primary&gt;plus</property>
+              </object>
+            </child>
+            <child>
+              <object class="GtkShortcutsShortcut">
+                <property name="visible">True</property>
+                <property name="title" translatable="yes">Zoom out</property>
+                <property name="accelerator">&lt;Primary&gt;minus</property>
+              </object>
+            </child>
+          </object>
+        </child>
+        <child>
+          <object class="GtkShortcutsGroup">
+            <property name="visible">True</property>
+            <property name="title" translatable="yes">Touchpad gestures</property>
+            <child>
+              <object class="GtkShortcutsShortcut">
+                <property name="visible">True</property>
+                <property name="title" translatable="yes">Zoom in</property>
+                <property name="shortcut-type">gesture-pinch</property>
+              </object>
+            </child>
+            <child>
+              <object class="GtkShortcutsShortcut">
+                <property name="visible">True</property>
+                <property name="title" translatable="yes">Zoom in</property>
+                <property name="shortcut-type">gesture-stretch</property>
+              </object>
+            </child>
+            <child>
+              <object class="GtkShortcutsShortcut">
+                <property name="visible">True</property>
+                <property name="title" translatable="yes">Go to next page</property>
+                <property name="shortcut-type">gesture-two-finger-swipe-right</property>
+              </object>
+            </child>
+            <child>
+              <object class="GtkShortcutsShortcut">
+                <property name="visible">True</property>
+                <property name="title" translatable="yes">Go to previous page</property>
+                <property name="shortcut-type">gesture-two-finger-swipe-left</property>
+              </object>
+            </child>
+
+          </object>
+        </child>
+      </object>
+    </child>
+  </object>
+</interface>


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