summaryrefslogtreecommitdiff
path: root/previewer
diff options
context:
space:
mode:
Diffstat (limited to 'previewer')
-rw-r--r--previewer/Makefile.am18
-rw-r--r--previewer/ev-previewer-window.c18
-rw-r--r--previewer/previewer-ui.xml30
-rw-r--r--previewer/previewer.gresource.xml23
4 files changed, 71 insertions, 18 deletions
diff --git a/previewer/Makefile.am b/previewer/Makefile.am
index 462665ac..91241f30 100644
--- a/previewer/Makefile.am
+++ b/previewer/Makefile.am
@@ -5,11 +5,12 @@ man_MANS = atril-previewer.1
atril_previewer_SOURCES = \
ev-previewer.c \
+ ev-previewer-resources.c \
ev-previewer-window.h \
- ev-previewer-window.c
+ ev-previewer-window.c \
+ $(NULL)
atril_previewer_CPPFLAGS = \
- -DATRILDATADIR=\"$(pkgdatadir)\" \
-I$(top_srcdir) \
-I$(top_builddir) \
-I$(top_srcdir)/libdocument \
@@ -33,6 +34,17 @@ atril_previewer_LDADD = \
$(PREVIEWER_LIBS) \
$(WEBKIT_LIBS)
-EXTRA_DIST = $(man_MANS)
+ev-previewer-resources.c: previewer.gresource.xml Makefile $(shell $(GLIB_COMPILE_RESOURCES) --generate-dependencies --sourcedir $(srcdir) $(srcdir)/previewer.gresource.xml)
+ $(AM_V_GEN) XMLLINT=$(XMLLINT) $(GLIB_COMPILE_RESOURCES) --target $@ --sourcedir $(srcdir) --generate-source --c-name ev_previewer $<
+
+EXTRA_DIST = \
+ previewer.gresource.xml \
+ previewer-ui.xml \
+ $(man_MANS) \
+ $(NULL)
+
+CLEANFILES = \
+ ev-previewer-resources.c \
+ $(NULL)
-include $(top_srcdir)/git.mk
diff --git a/previewer/ev-previewer-window.c b/previewer/ev-previewer-window.c
index df1cb7a1..a33929a3 100644
--- a/previewer/ev-previewer-window.c
+++ b/previewer/ev-previewer-window.c
@@ -468,12 +468,6 @@ ev_previewer_window_dispose (GObject *object)
G_OBJECT_CLASS (ev_previewer_window_parent_class)->dispose (object);
}
-static gchar*
-data_dir (void)
-{
- return g_strdup (ATRILDATADIR);
-}
-
static void
ev_previewer_window_init (EvPreviewerWindow *window)
{
@@ -513,7 +507,6 @@ ev_previewer_window_constructor (GType type,
GtkWidget *toolbar;
GtkAction *action;
GError *error = NULL;
- gchar *datadir, *ui_path;
gdouble dpi;
object = G_OBJECT_CLASS (ev_previewer_window_parent_class)->constructor (type,
@@ -566,14 +559,9 @@ ev_previewer_window_constructor (GType type,
window->accels_group, 1);
gtk_window_add_accel_group (GTK_WINDOW (window),
gtk_ui_manager_get_accel_group (window->ui_manager));
- datadir = data_dir ();
- ui_path = g_build_filename (datadir, "atril-previewer-ui.xml", NULL);
- if (!gtk_ui_manager_add_ui_from_file (window->ui_manager, ui_path, &error)) {
- g_warning ("Failed to load ui from atril-previewer-ui.xml: %s", error->message);
- g_error_free (error);
- }
- g_free (ui_path);
- g_free (datadir);
+
+ gtk_ui_manager_add_ui_from_resource (window->ui_manager, "/org/mate/atril/previewer/ui/previewer.xml", &error);
+ g_assert_no_error (error);
/* GTKUIManager connects actions accels only for menu items,
* but not for tool items. See bug #612972.
diff --git a/previewer/previewer-ui.xml b/previewer/previewer-ui.xml
new file mode 100644
index 00000000..8c6e95f6
--- /dev/null
+++ b/previewer/previewer-ui.xml
@@ -0,0 +1,30 @@
+<ui>
+ <toolbar name="PreviewToolbar">
+ <toolitem name="GoPreviousPage" action="GoPreviousPage"/>
+ <toolitem name="GoNextPage" action="GoNextPage"/>
+ <separator/>
+ <toolitem name="PageSelector" action="PageSelector"/>
+ <separator/>
+ <toolitem name="ViewFitWidth" action="ViewFitWidth"/>
+ <toolitem name="ViewFitPage" action="ViewFitPage"/>
+ <toolitem name="ViewZoomIn" action="ViewZoomIn"/>
+ <toolitem name="ViewZoomOut" action="ViewZoomOut"/>
+ <toolitem name="ViewZoomReset" action="ViewZoomReset"/>
+ <separator/>
+ <toolitem name="PreviewPrint" action="PreviewPrint"/>
+ </toolbar>
+
+ <accelerator name="FileCloseWindowAccel" action="FileCloseWindow"/>
+ <accelerator name="pAccel" action="p"/>
+ <accelerator name="nAccel" action="n"/>
+ <accelerator name="FocusPageSelectorAccel" action="FocusPageSelector"/>
+ <accelerator name="PlusAccel" action="Plus"/>
+ <accelerator name="MinusAccel" action="Minus"/>
+ <accelerator name="Equal" action="Equal"/>
+ <accelerator name="CtrlEqualAccel" action="CtrlEqual"/>
+ <accelerator name="KpPlusAccel" action="KpPlus"/>
+ <accelerator name="KpMinusAccel" action="KpMinus"/>
+ <accelerator name="CtrlKpPlusAccel" action="CtrlKpPlus"/>
+ <accelerator name="CtrlKpMinusAccel" action="CtrlKpMinus"/>
+ <accelerator name="CtrlKpZeroAccel" action="CtrlKpZero"/>
+</ui>
diff --git a/previewer/previewer.gresource.xml b/previewer/previewer.gresource.xml
new file mode 100644
index 00000000..31e57f53
--- /dev/null
+++ b/previewer/previewer.gresource.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright © 2012 Christian Persch
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3, or (at your option)
+ any later version.
+
+ This program is distributed in the hope conf it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+-->
+<gresources>
+ <gresource prefix="/org/mate/atril/previewer">
+ <file alias="ui/previewer.xml" compressed="true" preprocess="xml-stripblanks">previewer-ui.xml</file>
+ </gresource>
+</gresources>
+