Skip to content

Commit

Permalink
shell: Add shortcuts help window
Browse files Browse the repository at this point in the history
  • Loading branch information
Felipe Borges committed Dec 2, 2015
1 parent 91ac78b commit 6e454ee
Show file tree
Hide file tree
Showing 7 changed files with 235 additions and 6 deletions.
1 change: 1 addition & 0 deletions shell/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ endif
EXTRA_DIST = \
evince.css \
evince-menus.ui \
help-overlay.ui \
evince-icon.rc \
evince.gresource.xml \
ev-gdbus.xml \
Expand Down
4 changes: 3 additions & 1 deletion shell/ev-application.c
Original file line number Diff line number Diff line change
Expand Up @@ -1091,14 +1091,16 @@ 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),
app_menu_actions, G_N_ELEMENTS (app_menu_actions),
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),
Expand Down
2 changes: 1 addition & 1 deletion shell/ev-toolbar.c
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
4 changes: 2 additions & 2 deletions shell/ev-window.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)),
Expand Down Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion shell/evince.css
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
3 changes: 2 additions & 1 deletion shell/evince.gresource.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
225 changes: 225 additions & 0 deletions shell/help-overlay.ui
Original file line number Diff line number Diff line change
@@ -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>

0 comments on commit 6e454ee

Please sign in to comment.