summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--data/Makefile.am2
-rw-r--r--shell/Makefile.am12
-rw-r--r--shell/atril-toolbar.xml41
-rw-r--r--shell/atril-ui.xml149
-rw-r--r--shell/atril.gresource.xml24
-rw-r--r--shell/ev-application.c9
-rw-r--r--shell/ev-application.h1
-rw-r--r--shell/ev-window.c24
8 files changed, 233 insertions, 29 deletions
diff --git a/data/Makefile.am b/data/Makefile.am
index c442a575..a230ccbb 100644
--- a/data/Makefile.am
+++ b/data/Makefile.am
@@ -15,8 +15,6 @@ man_MANS=atril.1
uidir = $(pkgdatadir)
ui_DATA = \
- atril-ui.xml \
- atril-toolbar.xml \
hand-open.png
#
diff --git a/shell/Makefile.am b/shell/Makefile.am
index 1bf3cba4..ea8d91d8 100644
--- a/shell/Makefile.am
+++ b/shell/Makefile.am
@@ -65,6 +65,8 @@ atril_SOURCES= \
ev-properties-license.h \
ev-open-recent-action.c \
ev-open-recent-action.h \
+ ev-resources.c \
+ ev-resources.h \
ev-utils.c \
ev-utils.h \
ev-window.c \
@@ -115,7 +117,8 @@ atril_LDADD= \
$(top_builddir)/libmisc/libevmisc.la \
$(SHELL_LIBS)
-BUILT_SOURCES =
+BUILT_SOURCES = \
+ ev-resources.c
if ENABLE_DBUS
BUILT_SOURCES += \
@@ -150,9 +153,13 @@ atrild_LDADD= \
endif
EXTRA_DIST = \
+ atril-ui.xml \
+ atril-toolbar.xml \
+ atril.gresource.xml \
ev-gdbus.xml \
ev-daemon-gdbus.xml
+
ev-gdbus-generated.c ev-gdbus-generated.h: ev-gdbus.xml Makefile
$(AM_V_GEN) $(GDBUS_CODEGEN) \
--interface-prefix=org.mate.atril \
@@ -169,6 +176,9 @@ ev-daemon-gdbus-generated.c ev-daemon-gdbus-generated.h: ev-daemon-gdbus.xml Mak
--generate-c-code ev-daemon-gdbus-generated \
$<
+ev-resources.c: atril.gresource.xml Makefile $(shell $(GLIB_COMPILE_RESOURCES) --generate-dependencies --sourcedir $(srcdir) $(srcdir)/atril.gresource.xml)
+ $(AM_V_GEN) XMLLINT=$(XMLLINT) $(GLIB_COMPILE_RESOURCES) --target $@ --sourcedir $(srcdir) --generate-source --c-name ev $<
+
DISTCLEANFILES = $(BUILT_SOURCES)
-include $(top_srcdir)/git.mk
diff --git a/shell/atril-toolbar.xml b/shell/atril-toolbar.xml
new file mode 100644
index 00000000..eb641581
--- /dev/null
+++ b/shell/atril-toolbar.xml
@@ -0,0 +1,41 @@
+<?xml version="1.0"?>
+<toolbars version="1.0">
+<available>
+ <toolitem name="FileOpenRecent"/>
+ <toolitem name="FilePrint"/>
+ <toolitem name="FileSaveAs"/>
+ <toolitem name="FileSendTo"/>
+ <toolitem name="ViewContinuous"/>
+ <toolitem name="ViewDual"/>
+ <toolitem name="ViewInvertedColors"/>
+ <toolitem name="ViewReload"/>
+ <toolitem name="ViewAutoscroll"/>
+ <toolitem name="ViewSidebar"/>
+ <toolitem name="ViewZoom"/>
+ <toolitem name="ViewZoomIn"/>
+ <toolitem name="ViewZoomOut"/>
+ <toolitem name="ViewZoomReset"/>
+ <toolitem name="ViewFitPage"/>
+ <toolitem name="ViewFitWidth"/>
+ <toolitem name="ViewFullscreen"/>
+ <toolitem name="ViewPresentation"/>
+ <toolitem name="GoPreviousPage"/>
+ <toolitem name="GoNextPage"/>
+ <toolitem name="GoFirstPage"/>
+ <toolitem name="GoLastPage"/>
+ <toolitem name="EditRotateLeft"/>
+ <toolitem name="EditRotateRight"/>
+ <toolitem name="EditSelectAll"/>
+ <toolitem name="EditFind"/>
+ <toolitem name="PageSelector"/>
+ <toolitem name="Navigation"/>
+</available>
+ <toolbar name="DefaultToolBar">
+ <toolitem name="GoPreviousPage"/>
+ <toolitem name="GoNextPage"/>
+ <separator/>
+ <toolitem name="PageSelector"/>
+ <separator/>
+ <toolitem name="ViewZoom"/>
+ </toolbar>
+</toolbars>
diff --git a/shell/atril-ui.xml b/shell/atril-ui.xml
new file mode 100644
index 00000000..851a014c
--- /dev/null
+++ b/shell/atril-ui.xml
@@ -0,0 +1,149 @@
+<ui>
+ <menubar name="MainMenu">
+ <menu name="FileMenu" action="File">
+ <menuitem name="FileOpenMenu" action="FileOpen"/>
+ <menuitem name="FileOpenCopyMenu" action="FileOpenCopy"/>
+ <menuitem name="FileSaveAsMenu" action="FileSaveAs"/>
+ <menuitem name="FileSendToMenu" action="FileSendTo"/>
+ <separator/>
+ <menuitem name="FilePrintMenu" action="FilePrint"/>
+ <separator/>
+ <menuitem name="FilePropertiesMenu" action="FileProperties"/>
+ <separator/>
+ <placeholder name="RecentFilesMenu"/>
+ <separator/>
+ <menuitem name="FileCloseWindowMenu" action="FileCloseWindow"/>
+ </menu>
+
+ <menu name="EditMenu" action="Edit">
+ <menuitem name="EditCopyMenu" action="EditCopy"/>
+ <separator/>
+ <menuitem name="EditSelectAllMenu" action="EditSelectAll"/>
+ <separator/>
+ <menuitem name="EditFindMenu" action="EditFind"/>
+ <menuitem name="EditFindNextMenu" action="EditFindNext"/>
+ <menuitem name="EditFindPreviousMenu" action="EditFindPrevious"/>
+ <separator/>
+ <menuitem name="EditRotateLeftMenu" action="EditRotateLeft"/>
+ <menuitem name="EditRotateRightMenu" action="EditRotateRight"/>
+ <separator/>
+ <menuitem name="EditToolbarMenu" action="EditToolbar"/>
+ <separator/>
+ <menuitem name="EditSaveSettingsMenu" action="EditSaveSettings"/>
+ </menu>
+
+ <menu name="ViewMenu" action="View">
+ <menuitem name="ViewToolbarMenu" action="ViewToolbar"/>
+ <menuitem name="ViewSidebarMenu" action="ViewSidebar"/>
+ <separator/>
+ <menuitem name="ViewFullscreenMenu" action="ViewFullscreen"/>
+ <menuitem name="ViewPresentationMenu" action="ViewPresentation"/>
+ <separator/>
+ <menuitem name="ViewContinuousMenu" action="ViewContinuous"/>
+ <menuitem name="ViewDualMenu" action="ViewDual"/>
+ <menuitem name="ViewDualOddLeftMenu" action="ViewDualOddLeft"/>
+ <separator/>
+ <menuitem name="ViewInvertedColors" action="ViewInvertedColors"/>
+ <separator/>
+ <menuitem name="ViewCaretNavigationMenu" action="ViewCaretNavigation"/>
+ <separator/>
+ <menuitem name="ViewZoomInMenu" action="ViewZoomIn"/>
+ <menuitem name="ViewZoomOutMenu" action="ViewZoomOut"/>
+ <menuitem name="ViewZoomResetMenu" action="ViewZoomReset"/>
+ <menuitem name="ViewFitPageMenu" action="ViewFitPage"/>
+ <menuitem name="ViewFitWidthMenu" action="ViewFitWidth"/>
+ <menuitem name="ViewExpandWindowMenu" action="ViewExpandWindow"/>
+ <separator/>
+ <menuitem name="ViewReload" action="ViewReload"/>
+ </menu>
+
+ <menu name="GoMenu" action="Go">
+ <menuitem name="GoPreviousPageMenu" action="GoPreviousPage"/>
+ <menuitem name="GoNextPageMenu" action="GoNextPage"/>
+ <separator/>
+ <menuitem name="GoFirstPageMenu" action="GoFirstPage"/>
+ <menuitem name="GoLastPageMenu" action="GoLastPage"/>
+ </menu>
+
+ <menu name="BookmarksMenu" action="Bookmarks">
+ <menuitem name="BookmarksAddMenu" action="BookmarksAdd"/>
+ <separator/>
+ <placeholder name="BookmarksItems"/>
+ </menu>
+
+ <menu name="HelpMenu" action="Help">
+ <menuitem name="HelpContentsMenu" action="HelpContents"/>
+ <menuitem name="HelpAboutMenu" action="HelpAbout"/>
+ </menu>
+ </menubar>
+
+ <popup name="DocumentPopup" action="DocumentPopupAction">
+ <menuitem name="OpenLink" action="OpenLink"/>
+ <menuitem name="CopyLinkAddress" action="CopyLinkAddress"/>
+ <menuitem name="GoLink" action="GoLink"/>
+ <menuitem name="OpenLinkNewWindow" action="OpenLinkNewWindow"/>
+ <separator/>
+ <menuitem name="GoPreviousPage" action="GoPreviousPage"/>
+ <menuitem name="GoNextPage" action="GoNextPage"/>
+ <menuitem name="ViewReload" action="ViewReload"/>
+ <menuitem name="ViewAutoscroll" action="ViewAutoscroll"/>
+ <separator/>
+ <menuitem name="EditCopy" action="EditCopy"/>
+ <menuitem name="EditSelectAllPopup" action="EditSelectAll"/>
+ <separator/>
+ <menuitem name="SaveImageAs" action="SaveImageAs"/>
+ <menuitem name="CopyImage" action="CopyImage"/>
+ <separator/>
+ <menuitem name="OpenAttachment" action="OpenAttachment"/>
+ <menuitem name="SaveAttachmentAs" action="SaveAttachmentAs"/>
+ <separator/>
+ <menuitem name="AnnotProperties" action="AnnotProperties"/>
+ <menuitem name="RemoveAnnot" action="RemoveAnnot"/>
+ </popup>
+
+ <popup name="AttachmentPopup" action="AttachmentPopupAction">
+ <menuitem name="OpenAttachment" action="OpenAttachment"/>
+ <separator/>
+ <menuitem name="SaveAttachmentAs" action="SaveAttachmentAs"/>
+ </popup>
+
+ <popup name="ToolbarPopup" action="ToolbarPopupAction">
+ <menuitem name="EditToolbarMenu" action="EditToolbar"/>
+ </popup>
+
+ <accelerator name="PageDownAccel" action="PageDown"/>
+ <accelerator name="PageUpAccel" action="PageUp"/>
+ <accelerator name="GoBackwardFastAccel" action="GoBackwardFast"/>
+ <accelerator name="GoForwardFastAccel" action="GoForwardFast"/>
+ <accelerator name="EscapeAccel" action="Escape"/>
+ <accelerator name="SlashAccel" action="Slash"/>
+ <accelerator name="F3Accel" action="F3"/>
+ <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"/>
+ <accelerator name="CtrlInsertAccel" action="CtrlInsert" />
+ <accelerator name="FitPageAccel" action ="FitPage" />
+ <accelerator name="FitWidthAccel" action ="FitWidth" />
+ <accelerator name="F7Accel" action="F7" />
+
+ <toolbar name="FullscreenToolbar">
+ <toolitem name="GoPreviousPage" action="GoPreviousPage"/>
+ <toolitem name="GoNextPage" action="GoNextPage"/>
+ <separator/>
+ <toolitem name="PageSelector" action="PageSelector"/>
+ <separator/>
+ <toolitem name="ViewZoom" action="ViewZoom"/>
+ <separator expand="true"/>
+ <toolitem name="StartPresentation" action="StartPresentation"/>
+ <toolitem name="LeaveFullscreen" action="LeaveFullscreen"/>
+ </toolbar>
+</ui>
diff --git a/shell/atril.gresource.xml b/shell/atril.gresource.xml
new file mode 100644
index 00000000..f66c2a10
--- /dev/null
+++ b/shell/atril.gresource.xml
@@ -0,0 +1,24 @@
+<?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/shell">
+ <file alias="ui/atril.xml" compressed="true" preprocess="xml-stripblanks">atril-ui.xml</file>
+ <file alias="ui/toolbar.xml" compressed="true" preprocess="xml-stripblanks">atril-toolbar.xml</file>
+ </gresource>
+</gresources>
+
diff --git a/shell/ev-application.c b/shell/ev-application.c
index 601a09a6..6307c7fe 100644
--- a/shell/ev-application.c
+++ b/shell/ev-application.c
@@ -49,7 +49,6 @@ struct _EvApplication {
gchar *uri;
gchar *dot_dir;
- gchar *data_dir;
#ifdef ENABLE_DBUS
EvAtrilApplication *skeleton;
@@ -990,8 +989,6 @@ static void ev_application_init(EvApplication* ev_application)
ev_application->dot_dir = g_build_filename(g_get_user_config_dir(), "atril", NULL);
}
- ev_application->data_dir = g_strdup (ATRILDATADIR);
-
ev_application_init_session (ev_application);
ev_application_accel_map_load (ev_application);
@@ -1063,9 +1060,3 @@ ev_application_get_dot_dir (EvApplication *application,
return application->dot_dir;
}
-
-const gchar *
-ev_application_get_data_dir (EvApplication *application)
-{
- return application->data_dir;
-}
diff --git a/shell/ev-application.h b/shell/ev-application.h
index d8d9cff1..b5187509 100644
--- a/shell/ev-application.h
+++ b/shell/ev-application.h
@@ -70,7 +70,6 @@ const gchar * ev_application_get_uri (EvApplication *applicati
GObject *ev_application_get_media_keys (EvApplication *application);
const gchar *ev_application_get_dot_dir (EvApplication *application,
gboolean create);
-const gchar *ev_application_get_data_dir (EvApplication *application);
G_END_DECLS
diff --git a/shell/ev-window.c b/shell/ev-window.c
index f323a4f9..065ada89 100644
--- a/shell/ev-window.c
+++ b/shell/ev-window.c
@@ -288,6 +288,8 @@ struct _EvWindowPrivate {
#define MAX_RECENT_ITEM_LEN (40)
+#define TOOLBAR_RESOURCE_PATH "/org/mate/atril/shell/ui/toolbar.xml"
+
static const gchar *document_print_settings[] = {
GTK_PRINT_SETTINGS_N_COPIES,
GTK_PRINT_SETTINGS_COLLATE,
@@ -7520,19 +7522,16 @@ get_toolbars_model (void)
{
EggToolbarsModel *toolbars_model;
gchar *toolbars_file;
- gchar *toolbars_path;
gint i;
toolbars_model = egg_toolbars_model_new ();
toolbars_file = g_build_filename (ev_application_get_dot_dir (EV_APP, FALSE),
"atril_toolbar.xml", NULL);
- toolbars_path = g_build_filename (ev_application_get_data_dir (EV_APP),
- "atril-toolbar.xml", NULL);
- egg_toolbars_model_load_names (toolbars_model, toolbars_path);
+ egg_toolbars_model_load_names_from_resource (toolbars_model, TOOLBAR_RESOURCE_PATH);
if (!egg_toolbars_model_load_toolbars (toolbars_model, toolbars_file)) {
- egg_toolbars_model_load_toolbars (toolbars_model, toolbars_path);
+ egg_toolbars_model_load_toolbars_from_resource (toolbars_model, TOOLBAR_RESOURCE_PATH);
goto skip_conversion;
}
@@ -7554,7 +7553,6 @@ get_toolbars_model (void)
skip_conversion:
g_free (toolbars_file);
- g_free (toolbars_path);
egg_toolbars_model_set_flags (toolbars_model, 0, EGG_TB_MODEL_NOT_REMOVABLE);
@@ -7660,7 +7658,6 @@ ev_window_init (EvWindow *ev_window)
GtkWidget *overlay;
GObject *mpkeys;
guint page_cache_mb;
- gchar *ui_path;
#ifdef ENABLE_DBUS
GDBusConnection *connection;
static gint window_id = 0;
@@ -7756,15 +7753,10 @@ ev_window_init (EvWindow *ev_window)
gtk_ui_manager_insert_action_group (ev_window->priv->ui_manager,
action_group, 0);
- ui_path = g_build_filename (ev_application_get_data_dir (EV_APP),
- "atril-ui.xml", NULL);
- if (!gtk_ui_manager_add_ui_from_file (
- ev_window->priv->ui_manager, ui_path, &error))
- {
- g_warning ("building menus failed: %s", error->message);
- g_error_free (error);
- }
- g_free (ui_path);
+ gtk_ui_manager_add_ui_from_resource (ev_window->priv->ui_manager,
+ "/org/mate/atril/shell/ui/atril.xml",
+ &error);
+ g_assert_no_error (error);
ev_window->priv->recent_manager = gtk_recent_manager_get_default ();
ev_window->priv->recent_action_group = NULL;