summaryrefslogtreecommitdiff
path: root/shell
diff options
context:
space:
mode:
Diffstat (limited to 'shell')
-rw-r--r--shell/atril-ui.xml4
-rw-r--r--shell/eggfindbar.c3
-rw-r--r--shell/eggfindbar.h1
-rw-r--r--shell/ev-application.c16
-rw-r--r--shell/ev-bookmarks.h2
-rw-r--r--shell/ev-daemon.c1
-rw-r--r--shell/ev-history.c1
-rw-r--r--shell/ev-loading-message.c1
-rw-r--r--shell/ev-media-player-keys.h1
-rw-r--r--shell/ev-navigation-action.c3
-rw-r--r--shell/ev-open-recent-action.c5
-rw-r--r--shell/ev-password-view.c2
-rw-r--r--shell/ev-sidebar-annotations.c2
-rw-r--r--shell/ev-sidebar-attachments.c1
-rw-r--r--shell/ev-sidebar-bookmarks.c1
-rw-r--r--shell/ev-sidebar-layers.c1
-rw-r--r--shell/ev-sidebar-links.c158
-rw-r--r--shell/ev-sidebar-links.h1
-rw-r--r--shell/ev-sidebar-page.c1
-rw-r--r--shell/ev-sidebar-page.h1
-rw-r--r--shell/ev-sidebar-thumbnails.c7
-rw-r--r--shell/ev-sidebar-thumbnails.h1
-rw-r--r--shell/ev-sidebar.c8
-rw-r--r--shell/ev-sidebar.h1
-rw-r--r--shell/ev-window.c98
-rw-r--r--shell/ev-window.h2
-rw-r--r--shell/main.c9
-rw-r--r--shell/meson.build168
28 files changed, 346 insertions, 154 deletions
diff --git a/shell/atril-ui.xml b/shell/atril-ui.xml
index 851a014c..3ba59ee7 100644
--- a/shell/atril-ui.xml
+++ b/shell/atril-ui.xml
@@ -24,8 +24,8 @@
<menuitem name="EditFindNextMenu" action="EditFindNext"/>
<menuitem name="EditFindPreviousMenu" action="EditFindPrevious"/>
<separator/>
- <menuitem name="EditRotateLeftMenu" action="EditRotateLeft"/>
- <menuitem name="EditRotateRightMenu" action="EditRotateRight"/>
+ <menuitem name="EditRotateLeftMenu" action="EditRotateLeft" always-show-image="true"/>
+ <menuitem name="EditRotateRightMenu" action="EditRotateRight" always-show-image="true"/>
<separator/>
<menuitem name="EditToolbarMenu" action="EditToolbar"/>
<separator/>
diff --git a/shell/eggfindbar.c b/shell/eggfindbar.c
index 438c5dc7..99e83921 100644
--- a/shell/eggfindbar.c
+++ b/shell/eggfindbar.c
@@ -573,7 +573,6 @@ egg_find_bar_set_search_string (EggFindBar *find_bar,
g_object_thaw_notify (G_OBJECT (find_bar));
}
-
/**
* egg_find_bar_get_search_string:
*
@@ -618,7 +617,7 @@ egg_find_bar_set_case_sensitive (EggFindBar *find_bar,
if (priv->case_sensitive != case_sensitive)
{
- priv->case_sensitive = case_sensitive;
+ priv->case_sensitive = (case_sensitive != FALSE);
gtk_toggle_tool_button_set_active (GTK_TOGGLE_TOOL_BUTTON (priv->case_button),
priv->case_sensitive);
diff --git a/shell/eggfindbar.h b/shell/eggfindbar.h
index df7157e1..5f41cc17 100644
--- a/shell/eggfindbar.h
+++ b/shell/eggfindbar.h
@@ -77,4 +77,3 @@ G_END_DECLS
#endif /* __EGG_FIND_BAR_H__ */
-
diff --git a/shell/ev-application.c b/shell/ev-application.c
index 8cff194f..57f1b922 100644
--- a/shell/ev-application.c
+++ b/shell/ev-application.c
@@ -21,7 +21,6 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-
#include <config.h>
#include <stdlib.h>
#include <string.h>
@@ -311,7 +310,6 @@ ev_application_get_empty_window (EvApplication *application,
return empty_window;
}
-
#ifdef ENABLE_DBUS
typedef struct {
gchar *uri;
@@ -421,9 +419,17 @@ on_register_uri_cb (GObject *source_object,
g_variant_builder_add (&builder, "{sv}",
"display",
g_variant_new_string (gdk_display_get_name (gdk_screen_get_display (data->screen))));
- g_variant_builder_add (&builder, "{sv}",
- "screen",
- g_variant_new_int32 (gdk_x11_screen_get_screen_number (data->screen)));
+
+ if (GDK_IS_X11_SCREEN (data->screen)) {
+ g_variant_builder_add (&builder, "{sv}",
+ "screen",
+ g_variant_new_int32 (gdk_x11_screen_get_screen_number (data->screen)));
+ } else {
+ /*Do not crash on wayland, use the first monitor for now*/
+ g_variant_builder_add (&builder, "{sv}",
+ "screen",
+ g_variant_new_int32 (0));
+ }
if (data->dest) {
switch (ev_link_dest_get_dest_type (data->dest)) {
case EV_LINK_DEST_TYPE_PAGE_LABEL:
diff --git a/shell/ev-bookmarks.h b/shell/ev-bookmarks.h
index d15ebad9..ac6ef524 100644
--- a/shell/ev-bookmarks.h
+++ b/shell/ev-bookmarks.h
@@ -50,8 +50,6 @@ void ev_bookmarks_delete (EvBookmarks *bookmarks,
void ev_bookmarks_update (EvBookmarks *bookmarks,
EvBookmark *bookmark);
-
-
G_END_DECLS
#endif /* EV_BOOKMARKS_H */
diff --git a/shell/ev-daemon.c b/shell/ev-daemon.c
index a45adefb..bf552f5d 100644
--- a/shell/ev-daemon.c
+++ b/shell/ev-daemon.c
@@ -43,7 +43,6 @@
#define LOG g_debug
-
#define EV_TYPE_DAEMON_APPLICATION (ev_daemon_application_get_type ())
#define EV_DAEMON_APPLICATION(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), EV_TYPE_DAEMON_APPLICATION, EvDaemonApplication))
diff --git a/shell/ev-history.c b/shell/ev-history.c
index 940c66f9..7fc3c824 100644
--- a/shell/ev-history.c
+++ b/shell/ev-history.c
@@ -24,7 +24,6 @@
#include "ev-history.h"
-
enum
{
HISTORY_CHANGED,
diff --git a/shell/ev-loading-message.c b/shell/ev-loading-message.c
index aa7014e5..530f4e73 100644
--- a/shell/ev-loading-message.c
+++ b/shell/ev-loading-message.c
@@ -174,4 +174,3 @@ ev_loading_message_new (void)
return message;
}
-
diff --git a/shell/ev-media-player-keys.h b/shell/ev-media-player-keys.h
index f18f192a..fb69aa47 100644
--- a/shell/ev-media-player-keys.h
+++ b/shell/ev-media-player-keys.h
@@ -37,7 +37,6 @@ G_BEGIN_DECLS
typedef struct _EvMediaPlayerKeys EvMediaPlayerKeys;
typedef struct _EvMediaPlayerKeysClass EvMediaPlayerKeysClass;
-
GType ev_media_player_keys_get_type (void) G_GNUC_CONST;
EvMediaPlayerKeys *ev_media_player_keys_new (void);
diff --git a/shell/ev-navigation-action.c b/shell/ev-navigation-action.c
index 57b4c463..181b0a51 100644
--- a/shell/ev-navigation-action.c
+++ b/shell/ev-navigation-action.c
@@ -26,6 +26,7 @@
#include "ev-navigation-action.h"
#include "ev-navigation-action-widget.h"
+#include <libmate-desktop/mate-image-menu-item.h>
enum
{
@@ -100,7 +101,7 @@ new_history_menu_item (EvNavigationAction *action,
const char *title;
title = ev_link_get_title (link);
- item = gtk_image_menu_item_new_with_label (title);
+ item = mate_image_menu_item_new_with_label (title);
label = GTK_LABEL (gtk_bin_get_child (GTK_BIN (item)));
gtk_label_set_use_markup (label, TRUE);
g_object_set_data (G_OBJECT (item), "index",
diff --git a/shell/ev-open-recent-action.c b/shell/ev-open-recent-action.c
index 0c1a21dc..46d5eda8 100644
--- a/shell/ev-open-recent-action.c
+++ b/shell/ev-open-recent-action.c
@@ -24,7 +24,6 @@
#include "ev-open-recent-action.h"
-
enum {
ITEM_ACTIVATED,
N_SIGNALS
@@ -66,7 +65,9 @@ ev_open_recent_action_create_tool_item (GtkAction *action)
gtk_recent_filter_add_application (filter, g_get_application_name ());
gtk_recent_chooser_set_filter (GTK_RECENT_CHOOSER (toolbar_recent_menu), filter);
- tool_item = GTK_WIDGET (gtk_menu_tool_button_new_from_stock ("gtk-open"));
+ GtkWidget *icon = gtk_image_new_from_icon_name ("document-open", GTK_ICON_SIZE_SMALL_TOOLBAR);
+ tool_item = GTK_WIDGET (gtk_menu_tool_button_new (icon, NULL));
+
gtk_menu_tool_button_set_arrow_tooltip_text (GTK_MENU_TOOL_BUTTON (tool_item),
_("Open a recently used document"));
gtk_menu_tool_button_set_menu (GTK_MENU_TOOL_BUTTON (tool_item),
diff --git a/shell/ev-password-view.c b/shell/ev-password-view.c
index e720a7f5..601a5e5e 100644
--- a/shell/ev-password-view.c
+++ b/shell/ev-password-view.c
@@ -18,7 +18,6 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
@@ -47,7 +46,6 @@ struct _EvPasswordViewPrivate {
static guint password_view_signals [LAST_SIGNAL] = { 0 };
-
G_DEFINE_TYPE_WITH_PRIVATE (EvPasswordView, ev_password_view, GTK_TYPE_VIEWPORT)
static void
diff --git a/shell/ev-sidebar-annotations.c b/shell/ev-sidebar-annotations.c
index f445cd35..cc39617f 100644
--- a/shell/ev-sidebar-annotations.c
+++ b/shell/ev-sidebar-annotations.c
@@ -56,7 +56,7 @@ struct _EvSidebarAnnotationsPrivate {
GtkWidget *annot_text_item;
EvJob *job;
- guint selection_changed_id;
+ gulong selection_changed_id;
};
static void ev_sidebar_annotations_page_iface_init (EvSidebarPageInterface *iface);
diff --git a/shell/ev-sidebar-attachments.c b/shell/ev-sidebar-attachments.c
index 81aee149..007322f4 100644
--- a/shell/ev-sidebar-attachments.c
+++ b/shell/ev-sidebar-attachments.c
@@ -631,7 +631,6 @@ job_finished_callback (EvJobAttachments *job,
g_object_unref (job);
}
-
static void
ev_sidebar_attachments_document_changed_cb (EvDocumentModel *model,
GParamSpec *pspec,
diff --git a/shell/ev-sidebar-bookmarks.c b/shell/ev-sidebar-bookmarks.c
index 2abdd695..214ca61a 100644
--- a/shell/ev-sidebar-bookmarks.c
+++ b/shell/ev-sidebar-bookmarks.c
@@ -122,7 +122,6 @@ ev_bookmarks_popup_cmd_rename_bookmark (GtkAction *action,
GtkTreeModel *model;
GtkTreeIter iter;
-
selection = gtk_tree_view_get_selection (tree_view);
if (gtk_tree_selection_get_selected (selection, &model, &iter)) {
GtkTreePath *path;
diff --git a/shell/ev-sidebar-layers.c b/shell/ev-sidebar-layers.c
index 1326e381..5518f4a9 100644
--- a/shell/ev-sidebar-layers.c
+++ b/shell/ev-sidebar-layers.c
@@ -239,7 +239,6 @@ ev_sidebar_layers_create_tree_view (EvSidebarLayers *ev_layers)
gtk_tree_selection_set_mode (gtk_tree_view_get_selection (tree_view),
GTK_SELECTION_NONE);
-
column = gtk_tree_view_column_new ();
renderer = gtk_cell_renderer_toggle_new ();
diff --git a/shell/ev-sidebar-links.c b/shell/ev-sidebar-links.c
index 92caa959..e6531cae 100644
--- a/shell/ev-sidebar-links.c
+++ b/shell/ev-sidebar-links.c
@@ -29,6 +29,8 @@
#include <glib/gi18n.h>
#include <gtk/gtk.h>
+#include <libmate-desktop/mate-image-menu-item.h>
+
#include "ev-document-links.h"
#include "ev-job-scheduler.h"
#include "ev-sidebar-links.h"
@@ -39,14 +41,16 @@ struct _EvSidebarLinksPrivate {
GtkWidget *tree_view;
/* Keep these ids around for blocking */
- guint selection_id;
- guint page_changed_id;
- guint row_activated_id;
+ gulong selection_id;
+ gulong page_changed_id;
+ gulong row_activated_id;
EvJob *job;
GtkTreeModel *model;
EvDocument *document;
EvDocumentModel *doc_model;
+
+ GTree *page_link_tree;
};
enum {
@@ -149,6 +153,11 @@ ev_sidebar_links_dispose (GObject *object)
sidebar->priv->model = NULL;
}
+ if (sidebar->priv->page_link_tree) {
+ g_tree_unref (sidebar->priv->page_link_tree);
+ sidebar->priv->page_link_tree = NULL;
+ }
+
if (sidebar->priv->document) {
g_object_unref (sidebar->priv->document);
sidebar->priv->document = NULL;
@@ -324,11 +333,13 @@ static GtkMenu *
build_popup_menu (EvSidebarLinks *sidebar)
{
GtkWidget *menu;
+ GtkWidget *image;
GtkWidget *item;
menu = gtk_menu_new ();
- item = gtk_image_menu_item_new_from_stock ("gtk-print", NULL);
- gtk_label_set_label (GTK_LABEL (gtk_bin_get_child (GTK_BIN (item))), _("Print…"));
+ item = mate_image_menu_item_new_with_label ("Print…");
+ image = gtk_image_new_from_icon_name ("gtk-print", GTK_ICON_SIZE_MENU);
+ mate_image_menu_item_set_image (MATE_IMAGE_MENU_ITEM (item), image);
gtk_widget_show (item);
gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
g_signal_connect (item, "activate",
@@ -372,7 +383,6 @@ button_press_cb (GtkWidget *treeview,
return FALSE;
}
-
static void
ev_sidebar_links_construct (EvSidebarLinks *ev_sidebar_links)
{
@@ -418,7 +428,6 @@ ev_sidebar_links_construct (EvSidebarLinks *ev_sidebar_links)
"markup", EV_DOCUMENT_LINKS_COLUMN_MARKUP,
NULL);
-
renderer = gtk_cell_renderer_text_new ();
gtk_tree_view_column_pack_end (GTK_TREE_VIEW_COLUMN (column), renderer, FALSE);
gtk_tree_view_column_set_attributes (GTK_TREE_VIEW_COLUMN (column), renderer,
@@ -461,40 +470,19 @@ ev_sidebar_links_new (void)
return ev_sidebar_links;
}
-static gboolean
-update_page_callback_foreach (GtkTreeModel *model,
- GtkTreePath *path,
- GtkTreeIter *iter,
- gpointer data)
-{
- EvSidebarLinks *sidebar_links = (data);
- EvLink *link;
-
- gtk_tree_model_get (model, iter,
- EV_DOCUMENT_LINKS_COLUMN_LINK, &link,
- -1);
-
- if (link) {
- int current_page;
- int dest_page;
- EvDocumentLinks *document_links = EV_DOCUMENT_LINKS (sidebar_links->priv->document);
-
- dest_page = ev_document_links_get_link_page (document_links, link);
- g_object_unref (link);
+typedef struct EvSidebarLinkPageSearch {
+ gint page;
+ gint best_existing;
+} EvSidebarLinkPageSearch;
- current_page = ev_document_model_get_page (sidebar_links->priv->doc_model);
-
- if (dest_page == current_page) {
- gtk_tree_view_expand_to_path (GTK_TREE_VIEW (sidebar_links->priv->tree_view),
- path);
- gtk_tree_view_set_cursor (GTK_TREE_VIEW (sidebar_links->priv->tree_view),
- path, NULL, FALSE);
-
- return TRUE;
- }
- }
+static gint
+page_link_tree_search_best_page (gpointer page_ptr, EvSidebarLinkPageSearch* data)
+{
+ gint page = GPOINTER_TO_INT (page_ptr);
+ if (page <= data->page && page > data->best_existing)
+ data->best_existing = page;
- return FALSE;
+ return data->page - page;
}
static void
@@ -502,44 +490,34 @@ ev_sidebar_links_set_current_page (EvSidebarLinks *sidebar_links,
gint current_page)
{
GtkTreeSelection *selection;
- GtkTreeModel *model;
- GtkTreeIter iter;
+ GtkTreePath *path;
+ EvSidebarLinkPageSearch search_data;
/* Widget is not currently visible */
- if (!gtk_widget_get_mapped (GTK_WIDGET (sidebar_links)))
+ if (!gtk_widget_is_visible (GTK_WIDGET (sidebar_links)))
return;
- selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (sidebar_links->priv->tree_view));
+ search_data.page = current_page;
+ search_data.best_existing = G_MININT;
- if (gtk_tree_selection_get_selected (selection, &model, &iter)) {
- EvLink *link;
-
- gtk_tree_model_get (model, &iter,
- EV_DOCUMENT_LINKS_COLUMN_LINK, &link,
- -1);
- if (link) {
- gint dest_page;
- EvDocumentLinks *document_links = EV_DOCUMENT_LINKS (sidebar_links->priv->document);
+ path = g_tree_search (sidebar_links->priv->page_link_tree, (GCompareFunc) page_link_tree_search_best_page, &search_data);
+ /* No direct hit, try a lookup on the best match. */
+ if (!path)
+ path = g_tree_lookup (sidebar_links->priv->page_link_tree, GINT_TO_POINTER (search_data.best_existing));
- dest_page = ev_document_links_get_link_page (document_links, link);
- g_object_unref (link);
+ /* Still no hit, give up. */
+ if (!path)
+ return;
- if (dest_page == current_page)
- return;
- }
- }
+ selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (sidebar_links->priv->tree_view));
- /* We go through the tree linearly looking for the first page that
- * matches. This is pretty inefficient. We can do something neat with
- * a GtkTreeModelSort here to make it faster, if it turns out to be
- * slow.
- */
g_signal_handler_block (selection, sidebar_links->priv->selection_id);
g_signal_handler_block (sidebar_links->priv->tree_view, sidebar_links->priv->row_activated_id);
- gtk_tree_model_foreach (model,
- update_page_callback_foreach,
- sidebar_links);
+ gtk_tree_view_expand_to_path (GTK_TREE_VIEW (sidebar_links->priv->tree_view),
+ path);
+ gtk_tree_view_set_cursor (GTK_TREE_VIEW (sidebar_links->priv->tree_view),
+ path, NULL, FALSE);
g_signal_handler_unblock (selection, sidebar_links->priv->selection_id);
g_signal_handler_unblock (sidebar_links->priv->tree_view, sidebar_links->priv->row_activated_id);
@@ -590,6 +568,41 @@ expand_open_links (GtkTreeView *tree_view, GtkTreeModel *model, GtkTreeIter *par
}
}
+static gint
+page_link_tree_sort (gconstpointer a, gconstpointer b, void *data)
+{
+ return GPOINTER_TO_INT (a) - GPOINTER_TO_INT (b);
+}
+
+static gboolean
+update_page_link_tree_foreach (GtkTreeModel *model,
+ GtkTreePath *path,
+ GtkTreeIter *iter,
+ gpointer data)
+{
+ EvSidebarLinks *sidebar_links = data;
+ EvSidebarLinksPrivate *priv = sidebar_links->priv;
+ EvDocumentLinks *document_links = EV_DOCUMENT_LINKS (priv->document);
+ EvLink *link;
+ int page;
+
+ gtk_tree_model_get (model, iter,
+ EV_DOCUMENT_LINKS_COLUMN_LINK, &link,
+ -1);
+
+ if (!link)
+ return FALSE;
+
+ page = ev_document_links_get_link_page (document_links, link);
+ g_object_unref (link);
+
+ /* Only save the first link we find per page. */
+ if (!g_tree_lookup (priv->page_link_tree, GINT_TO_POINTER (page)))
+ g_tree_insert (priv->page_link_tree, GINT_TO_POINTER (page), gtk_tree_path_copy (path));
+
+ return FALSE;
+}
+
static void
ev_sidebar_links_set_links_model (EvSidebarLinks *sidebar_links,
GtkTreeModel *model)
@@ -603,6 +616,15 @@ ev_sidebar_links_set_links_model (EvSidebarLinks *sidebar_links,
g_object_unref (priv->model);
priv->model = g_object_ref (model);
+ /* Rebuild the binary search tree for finding links on pages. */
+ if (priv->page_link_tree)
+ g_tree_unref (priv->page_link_tree);
+ priv->page_link_tree = g_tree_new_full (page_link_tree_sort, NULL, NULL, (GDestroyNotify) gtk_tree_path_free);
+
+ gtk_tree_model_foreach (model,
+ update_page_link_tree_foreach,
+ sidebar_links);
+
g_object_notify (G_OBJECT (sidebar_links), "model");
}
@@ -625,7 +647,7 @@ job_finished_callback (EvJobLinks *job,
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (priv->tree_view));
gtk_tree_selection_set_mode (selection, GTK_SELECTION_SINGLE);
- if (priv->selection_id <= 0) {
+ if (priv->selection_id == 0) {
priv->selection_id =
g_signal_connect (selection, "changed",
G_CALLBACK (selection_changed_callback),
@@ -635,7 +657,7 @@ job_finished_callback (EvJobLinks *job,
g_signal_connect_swapped (priv->doc_model, "page-changed",
G_CALLBACK (update_page_callback),
sidebar_links);
- if (priv->row_activated_id <= 0) {
+ if (priv->row_activated_id == 0) {
priv->row_activated_id =
g_signal_connect (priv->tree_view, "row-activated",
G_CALLBACK (row_activated_callback),
diff --git a/shell/ev-sidebar-links.h b/shell/ev-sidebar-links.h
index eb4ae8ff..d0475dc5 100644
--- a/shell/ev-sidebar-links.h
+++ b/shell/ev-sidebar-links.h
@@ -63,4 +63,3 @@ G_END_DECLS
#endif /* __EV_SIDEBAR_LINKS_H__ */
-
diff --git a/shell/ev-sidebar-page.c b/shell/ev-sidebar-page.c
index 0b216bd8..bd5b85c2 100644
--- a/shell/ev-sidebar-page.c
+++ b/shell/ev-sidebar-page.c
@@ -74,7 +74,6 @@ ev_sidebar_page_get_label (EvSidebarPage *sidebar_page)
return iface->get_label (sidebar_page);
}
-
static void
ev_sidebar_page_default_init (EvSidebarPageInterface *iface)
{
diff --git a/shell/ev-sidebar-page.h b/shell/ev-sidebar-page.h
index 21ef92cf..21791aaa 100644
--- a/shell/ev-sidebar-page.h
+++ b/shell/ev-sidebar-page.h
@@ -58,7 +58,6 @@ void ev_sidebar_page_set_model (EvSidebarPage *sidebar_page,
EvDocumentModel *model);
const gchar* ev_sidebar_page_get_label (EvSidebarPage *page);
-
G_END_DECLS
#endif /* EV_SIDEBAR_PAGE */
diff --git a/shell/ev-sidebar-thumbnails.c b/shell/ev-sidebar-thumbnails.c
index 05a9049f..c12a7a10 100644
--- a/shell/ev-sidebar-thumbnails.c
+++ b/shell/ev-sidebar-thumbnails.c
@@ -245,7 +245,6 @@ ev_thumbnails_size_cache_get (EvDocument *document)
return cache;
}
-
static void
ev_sidebar_thumbnails_dispose (GObject *object)
{
@@ -582,6 +581,10 @@ ev_sidebar_thumbnails_fill_model (EvSidebarThumbnails *sidebar_thumbnails)
GtkTreeIter iter;
int i;
+ if (priv->document->iswebdocument) {
+ return;
+ }
+
for (i = 0; i < sidebar_thumbnails->priv->n_pages; i++) {
gchar *page_label;
gchar *page_string;
@@ -1019,7 +1022,7 @@ static gboolean
ev_sidebar_thumbnails_support_document (EvSidebarPage *sidebar_page,
EvDocument *document)
{
- return (EV_IS_DOCUMENT_THUMBNAILS (document));
+ return (EV_IS_DOCUMENT_THUMBNAILS (document) && !document->iswebdocument);
}
static const gchar*
diff --git a/shell/ev-sidebar-thumbnails.h b/shell/ev-sidebar-thumbnails.h
index ed10ac39..3a0186cd 100644
--- a/shell/ev-sidebar-thumbnails.h
+++ b/shell/ev-sidebar-thumbnails.h
@@ -56,4 +56,3 @@ G_END_DECLS
#endif /* __EV_SIDEBAR_THUMBNAILS_H__ */
-
diff --git a/shell/ev-sidebar.c b/shell/ev-sidebar.c
index b9173cdd..f05721de 100644
--- a/shell/ev-sidebar.c
+++ b/shell/ev-sidebar.c
@@ -26,9 +26,13 @@
#include <string.h>
+#include <glib.h>
+#include <glib/gi18n.h>
#include <gtk/gtk.h>
#include <gdk/gdkkeysyms.h>
+#include <libmate-desktop/mate-image-menu-item.h>
+
#include "ev-sidebar.h"
#include "ev-sidebar-page.h"
@@ -362,6 +366,7 @@ ev_sidebar_init (EvSidebar *ev_sidebar)
g_signal_connect (close_button, "clicked",
G_CALLBACK (ev_sidebar_close_clicked_cb),
ev_sidebar);
+ gtk_widget_set_tooltip_text (close_button, _("Hide sidebar"));
image = gtk_image_new_from_icon_name ("window-close",
GTK_ICON_SIZE_MENU);
@@ -424,7 +429,7 @@ ev_sidebar_add_page (EvSidebar *ev_sidebar,
index = gtk_notebook_append_page (GTK_NOTEBOOK (ev_sidebar->priv->notebook),
main_widget, NULL);
- menu_item = gtk_image_menu_item_new_with_label (title);
+ menu_item = mate_image_menu_item_new_with_label (title);
g_signal_connect (menu_item, "activate",
G_CALLBACK (ev_sidebar_menu_item_activate_cb),
ev_sidebar);
@@ -443,7 +448,6 @@ ev_sidebar_add_page (EvSidebar *ev_sidebar,
gtk_list_store_move_before(GTK_LIST_STORE(ev_sidebar->priv->page_model),
&iter, NULL);
-
/* Set the first item added as active */
gtk_tree_model_get_iter_first (ev_sidebar->priv->page_model, &iter);
gtk_tree_model_get (ev_sidebar->priv->page_model,
diff --git a/shell/ev-sidebar.h b/shell/ev-sidebar.h
index 11d16632..20a73e3a 100644
--- a/shell/ev-sidebar.h
+++ b/shell/ev-sidebar.h
@@ -64,4 +64,3 @@ G_END_DECLS
#endif /* __EV_SIDEBAR_H__ */
-
diff --git a/shell/ev-window.c b/shell/ev-window.c
index b26795e1..5281acda 100644
--- a/shell/ev-window.c
+++ b/shell/ev-window.c
@@ -418,7 +418,6 @@ ev_window_set_action_sensitive (EvWindow *ev_window,
G_GNUC_END_IGNORE_DEPRECATIONS;
}
-
static void
ev_window_setup_action_sensitivity (EvWindow *ev_window)
{
@@ -538,7 +537,7 @@ ev_window_update_actions (EvWindow *ev_window)
page = ev_document_model_get_page (ev_window->priv->model);
n_pages = ev_document_get_n_pages (ev_window->priv->document);
has_pages = n_pages > 0;
- dual_mode = ev_document_model_get_dual_page (ev_window->priv->model);
+ dual_mode = ev_document_model_get_page_layout (ev_window->priv->model);
}
#if ENABLE_EPUB
if (ev_window->priv->document && ev_window->priv->document->iswebdocument == TRUE ) {
@@ -1555,7 +1554,6 @@ ev_window_setup_default (EvWindow *ev_window)
ev_document_model_set_scale (model, g_settings_get_double (settings, "zoom"));
}
-
static void
ev_window_clear_thumbnail_job (EvWindow *ev_window)
{
@@ -1594,7 +1592,8 @@ ev_window_refresh_window_thumbnail (EvWindow *ev_window)
EvDocument *document = ev_window->priv->document;
if (!document || ev_document_get_n_pages (document) <= 0 ||
- !ev_document_check_dimensions (document)) {
+ !ev_document_check_dimensions (document) ||
+ document->iswebdocument) {
return;
}
@@ -1787,6 +1786,14 @@ ev_window_set_document (EvWindow *ev_window, EvDocument *document)
ev_view_disconnect_handlers(EV_VIEW(ev_window->priv->view));
g_object_unref(ev_window->priv->view);
ev_window->priv->view = NULL;
+
+ if (ev_window->priv->webview == NULL)
+ {
+ ev_window->priv->webview = ev_web_view_new();
+ ev_web_view_set_model(EV_WEB_VIEW(ev_window->priv->webview),ev_window->priv->model);
+ ev_web_view_reload(EV_WEB_VIEW(ev_window->priv->webview));
+ }
+
gtk_container_add (GTK_CONTAINER (ev_window->priv->scrolled_window),
ev_window->priv->webview);
gtk_widget_show(ev_window->priv->webview);
@@ -2166,6 +2173,19 @@ show_loading_progress (EvWindow *ev_window)
return FALSE;
}
+#if !GLIB_CHECK_VERSION(2, 62, 0)
+/* Non-year-2038-proof compatibility with GLib < 2.62 */
+static GDateTime *
+_g_file_info_get_modification_date_time (GFileInfo *info)
+{
+ GTimeVal mtime;
+
+ g_file_info_get_modification_time (info, &mtime);
+ return g_date_time_new_from_timeval_utc (&mtime);
+}
+#define g_file_info_get_modification_date_time _g_file_info_get_modification_date_time
+#endif
+
static void
ev_window_load_remote_failed (EvWindow *ev_window,
GError *error)
@@ -3580,9 +3600,12 @@ ev_window_print_update_pending_jobs_message (EvWindow *ev_window,
}
if (n_jobs > 1) {
- text = g_strdup_printf (ngettext ("%d pending job in queue",
- "%d pending jobs in queue",
- n_jobs - 1), n_jobs - 1);
+ gulong n = (gulong) (n_jobs - 1);
+ text = g_strdup_printf (g_dngettext (GETTEXT_PACKAGE,
+ "%lu pending job in queue",
+ "%lu pending jobs in queue",
+ n),
+ n);
}
ev_message_area_set_secondary_text (EV_MESSAGE_AREA (ev_window->priv->message_area),
@@ -3625,7 +3648,6 @@ ev_window_print_operation_done (EvPrintOperation *op,
GtkWidget *dialog;
GError *error = NULL;
-
ev_print_operation_get_error (op, &error);
/* The message area is already used by
@@ -3880,7 +3902,6 @@ ev_window_check_document_modified (EvWindow *ev_window)
return FALSE;
}
-
text = g_markup_printf_escaped (_("Save a copy of document “%s” before closing?"),
gtk_window_get_title (GTK_WINDOW (ev_window)));
@@ -3979,12 +4000,13 @@ ev_window_check_print_queue (EvWindow *ev_window)
/* TRANS: the singular form is not really used as n_print_jobs > 1
but some languages distinguish between different plurals forms,
so the ngettext is needed. */
- text = g_strdup_printf (ngettext("There is %d print job active. "
- "Wait until print finishes before closing?",
- "There are %d print jobs active. "
- "Wait until print finishes before closing?",
- n_print_jobs),
- n_print_jobs);
+ text = g_strdup_printf (g_dngettext (GETTEXT_PACKAGE,
+ "There is %d print job active. "
+ "Wait until print finishes before closing?",
+ "There are %d print jobs active. "
+ "Wait until print finishes before closing?",
+ (gulong) n_print_jobs),
+ n_print_jobs);
}
markup = g_strdup_printf ("<b>%s</b>", text);
@@ -4402,7 +4424,6 @@ ev_window_inhibit_screensaver (EvWindow *window)
_("Running in presentation mode"));
}
-
static void
ev_window_uninhibit_screensaver (EvWindow *window)
{
@@ -4715,7 +4736,6 @@ ev_window_set_page_mode (EvWindow *window,
ev_window_update_actions (window);
}
-
static void
ev_window_cmd_edit_rotate_left (GtkAction *action, EvWindow *ev_window)
{
@@ -4824,7 +4844,7 @@ ev_window_cmd_edit_save_settings (GtkAction *action, EvWindow *ev_window)
g_settings_set_boolean (settings, "continuous",
ev_document_model_get_continuous (model));
g_settings_set_boolean (settings, "dual-page",
- ev_document_model_get_dual_page (model));
+ ev_document_model_get_page_layout (model));
g_settings_set_boolean (settings, "dual-page-odd-left",
ev_document_model_get_dual_page_odd_pages_left (model));
g_settings_set_boolean (settings, "fullscreen",
@@ -5313,7 +5333,7 @@ ev_window_update_dual_page_action (EvWindow *window)
g_signal_handlers_block_by_func
(action, G_CALLBACK (ev_window_cmd_dual), window);
gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action),
- ev_document_model_get_dual_page (window->priv->model));
+ ev_document_model_get_page_layout (window->priv->model));
G_GNUC_END_IGNORE_DEPRECATIONS;
g_signal_handlers_unblock_by_func
(action, G_CALLBACK (ev_window_cmd_dual), window);
@@ -5328,7 +5348,7 @@ ev_window_dual_mode_changed_cb (EvDocumentModel *model,
if (ev_window->priv->metadata && !ev_window_is_empty (ev_window))
ev_metadata_set_boolean (ev_window->priv->metadata, "dual-page",
- ev_document_model_get_dual_page (model));
+ ev_document_model_get_page_layout (model));
}
static void
@@ -5446,7 +5466,7 @@ ev_window_cmd_help_about (GtkAction *action, EvWindow *ev_window)
"copyright", _("Copyright \xc2\xa9 1996–2009 The Evince authors\n"
"Copyright \xc2\xa9 2012–2021 The MATE developers"),
"license", license_trans,
- "website", "https://mate-desktop.org/",
+ "website", PACKAGE_URL,
"comments", comments,
"authors", authors,
"documenters", documenters,
@@ -5744,10 +5764,11 @@ ev_window_update_find_status_message (EvWindow *ev_window)
/* TRANS: Sometimes this could be better translated as
"%d hit(s) on this page". Therefore this string
contains plural cases. */
- message = g_strdup_printf (ngettext ("%d found on this page",
- "%d found on this page",
- n_results),
- n_results);
+ message = g_strdup_printf (g_dngettext (GETTEXT_PACKAGE,
+ "%d found on this page",
+ "%d found on this page",
+ (gulong) n_results),
+ n_results);
} else {
message = g_strdup (_("Not found"));
}
@@ -5964,7 +5985,6 @@ zoom_control_changed_cb (EphyZoomAction *action,
* the new expanded window size.
*/
-
if (ev_window->priv->chrome & EV_CHROME_SIDEBAR)
{
GtkAllocation alloc;
@@ -6429,12 +6449,12 @@ ev_window_class_init (EvWindowClass *ev_window_class)
/* Normal items */
static const GtkActionEntry entries[] = {
- { "File", NULL, N_("_File") },
- { "Edit", NULL, N_("_Edit") },
- { "View", NULL, N_("_View") },
- { "Go", NULL, N_("_Go") },
- { "Bookmarks", NULL, N_("_Bookmarks") },
- { "Help", NULL, N_("_Help") },
+ { "File", NULL, N_("_File"), NULL, NULL, NULL },
+ { "Edit", NULL, N_("_Edit"), NULL, NULL, NULL },
+ { "View", NULL, N_("_View"), NULL, NULL, NULL },
+ { "Go", NULL, N_("_Go"), NULL, NULL, NULL },
+ { "Bookmarks", NULL, N_("_Bookmarks"), NULL, NULL, NULL },
+ { "Help", NULL, N_("_Help"), NULL, NULL, NULL },
/* File menu */
{ "FileOpen", "document-open", N_("_Open…"), "<control>O",
@@ -6478,7 +6498,6 @@ static const GtkActionEntry entries[] = {
{ "EditSaveSettings", NULL, N_("Save Current Settings as _Default"), "<control>T", NULL,
G_CALLBACK (ev_window_cmd_edit_save_settings) },
-
/* View menu */
{ "ViewZoomIn", "zoom-in", N_("Zoom _In"), "<control>plus",
N_("Enlarge the document"),
@@ -7733,7 +7752,6 @@ ev_window_emit_doc_loaded (EvWindow *window)
ev_atril_window_emit_document_loaded (window->priv->skeleton, window->priv->uri);
}
-
#ifdef ENABLE_SYNCTEX
static gboolean
handle_sync_view_cb (EvAtrilWindow *object,
@@ -7787,7 +7805,6 @@ ev_window_init (EvWindow *ev_window)
GtkCssProvider *css_provider;
GError *error = NULL;
GtkWidget *sidebar_widget;
- GtkWidget *menuitem;
GtkWidget *overlay;
GObject *mpkeys;
guint page_cache_mb;
@@ -7923,12 +7940,6 @@ ev_window_init (EvWindow *ev_window)
gtk_box_pack_start (GTK_BOX (ev_window->priv->main_box),
ev_window->priv->menubar,
FALSE, FALSE, 0);
- menuitem = gtk_ui_manager_get_widget (ev_window->priv->ui_manager,
- "/MainMenu/EditMenu/EditRotateLeftMenu");
- gtk_image_menu_item_set_always_show_image (GTK_IMAGE_MENU_ITEM (menuitem), TRUE);
- menuitem = gtk_ui_manager_get_widget (ev_window->priv->ui_manager,
- "/MainMenu/EditMenu/EditRotateRightMenu");
- gtk_image_menu_item_set_always_show_image (GTK_IMAGE_MENU_ITEM (menuitem), TRUE);
ev_window->priv->toolbars_model = get_toolbars_model ();
ev_window->priv->toolbar = GTK_WIDGET
@@ -8084,9 +8095,8 @@ ev_window_init (EvWindow *ev_window)
ev_window->priv->view = ev_view_new ();
-#if ENABLE_EPUB /*The webview, we won't add it now but it will replace the atril-view if a web(epub) document is encountered.*/
- ev_window->priv->webview = ev_web_view_new();
- ev_web_view_set_model(EV_WEB_VIEW(ev_window->priv->webview),ev_window->priv->model);
+#if ENABLE_EPUB /* The webview is created in ev_window_set_document only if the document is a webdocument. */
+ ev_window->priv->webview = NULL;
#endif
page_cache_mb = g_settings_get_uint (ev_window_ensure_settings (ev_window),
GS_PAGE_CACHE_SIZE);
diff --git a/shell/ev-window.h b/shell/ev-window.h
index 32d303aa..8e4dd9cf 100644
--- a/shell/ev-window.h
+++ b/shell/ev-window.h
@@ -58,7 +58,6 @@ typedef struct _EvWindowPrivate EvWindowPrivate;
#define EV_IS_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), EV_TYPE_WINDOW))
#define EV_WINDOW_GET_CLASS(object) (G_TYPE_INSTANCE_GET_CLASS((object), EV_TYPE_WINDOW, EvWindowClass))
-
struct _EvWindow {
GtkApplicationWindow base_instance;
EvWindowPrivate *priv;
@@ -87,7 +86,6 @@ void ev_window_print_range (EvWindow *ev_window,
int last_page);
const gchar * ev_window_get_dbus_object_path (EvWindow *ev_window);
-
G_END_DECLS
#endif /* !EV_WINDOW_H */
diff --git a/shell/main.c b/shell/main.c
index 7a4658be..321bdaa5 100644
--- a/shell/main.c
+++ b/shell/main.c
@@ -36,7 +36,6 @@
#include "eggsmclient.h"
#include "eggdesktopfile.h"
-
static gchar *ev_page_label;
static gchar *ev_find_string;
static gint ev_page_index = 0;
@@ -48,7 +47,6 @@ static gboolean unlink_temp_file = FALSE;
static gchar *print_settings;
static const char **file_arguments = NULL;
-
static gboolean
option_version_cb (const gchar *option_name,
const gchar *value,
@@ -206,8 +204,6 @@ load_files (const char **files)
continue;
}
-
-
ev_application_open_uri_at_dest (EV_APP, uri, screen, dest,
mode, ev_find_string,
GDK_CURRENT_TIME);
@@ -231,10 +227,12 @@ main (int argc, char *argv[])
bindtextdomain (GETTEXT_PACKAGE, ev_get_locale_dir());
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
textdomain (GETTEXT_PACKAGE);
-#endif
+#endif /* ENABLE_NLS */
context = g_option_context_new (N_("MATE Document Viewer"));
+#ifdef ENABLE_NLS
g_option_context_set_translation_domain(context, GETTEXT_PACKAGE);
+#endif /* ENABLE_NLS */
g_option_context_add_main_entries (context, goption_options, GETTEXT_PACKAGE);
g_option_context_add_group (context, egg_sm_client_get_option_group ());
g_option_context_add_group (context, gtk_get_option_group (TRUE));
@@ -283,7 +281,6 @@ main (int argc, char *argv[])
done:
ev_shutdown ();
- ev_stock_icons_shutdown ();
g_object_unref (application);
return status;
diff --git a/shell/meson.build b/shell/meson.build
new file mode 100644
index 00000000..268416ef
--- /dev/null
+++ b/shell/meson.build
@@ -0,0 +1,168 @@
+# Define include directories
+include_dirs = include_directories(
+ '.', # Current directory
+ '..', # Parent directory
+ '../cut-n-paste/zoom-control',
+ '../cut-n-paste/toolbar-editor',
+ '../libdocument',
+ '../libview',
+ '../libmisc',
+ '../properties'
+)
+
+# Define preprocessor definitions
+c_args = [
+ '-DATRILDATADIR="' + join_paths(get_option('prefix'), get_option('datadir'), 'atril') + '"',
+ '-DMATEDATADIR="' + get_option('datadir') + '"',
+ '-DLIBEXECDIR="' + get_option('libexecdir') + '"',
+ '-DATRIL_COMPILATION'
+]
+
+shell_sources = [
+ 'eggfindbar.c',
+ 'eggfindbar.h',
+ 'ev-annotation-properties-dialog.h',
+ 'ev-annotation-properties-dialog.c',
+ 'ev-bookmarks.h',
+ 'ev-bookmarks.c',
+ 'ev-bookmark-action.h',
+ 'ev-bookmark-action.c',
+ 'ev-application.c',
+ 'ev-application.h',
+ 'ev-file-monitor.h',
+ 'ev-file-monitor.c',
+ 'ev-history.c',
+ 'ev-history.h',
+ 'ev-loading-message.h',
+ 'ev-loading-message.c',
+ 'ev-keyring.h',
+ 'ev-keyring.c',
+ 'ev-message-area.c',
+ 'ev-message-area.h',
+ 'ev-media-player-keys.h',
+ 'ev-media-player-keys.c',
+ 'ev-metadata.c',
+ 'ev-metadata.h',
+ 'ev-navigation-action.h',
+ 'ev-navigation-action.c',
+ 'ev-navigation-action-widget.h',
+ 'ev-navigation-action-widget.c',
+ 'ev-password-view.h',
+ 'ev-password-view.c',
+ 'ev-progress-message-area.h',
+ 'ev-progress-message-area.c',
+ 'ev-properties-dialog.c',
+ 'ev-properties-dialog.h',
+ 'ev-properties-fonts.c',
+ 'ev-properties-fonts.h',
+ 'ev-properties-license.c',
+ 'ev-properties-license.h',
+ 'ev-open-recent-action.c',
+ 'ev-open-recent-action.h',
+ 'ev-utils.c',
+ 'ev-utils.h',
+ 'ev-window.c',
+ 'ev-window.h',
+ 'ev-window-title.c',
+ 'ev-window-title.h',
+ 'ev-sidebar.c',
+ 'ev-sidebar.h',
+ 'ev-sidebar-annotations.c',
+ 'ev-sidebar-annotations.h',
+ 'ev-sidebar-attachments.c',
+ 'ev-sidebar-attachments.h',
+ 'ev-sidebar-bookmarks.h',
+ 'ev-sidebar-bookmarks.c',
+ 'ev-sidebar-layers.c',
+ 'ev-sidebar-layers.h',
+ 'ev-sidebar-links.c',
+ 'ev-sidebar-links.h',
+ 'ev-sidebar-page.c',
+ 'ev-sidebar-page.h',
+ 'ev-sidebar-thumbnails.c',
+ 'ev-sidebar-thumbnails.h',
+]
+
+ev_resources = gnome.compile_resources(
+ 'atril-resources',
+ 'atril.gresource.xml',
+ source_dir: '../data',
+ c_name: 'ev',
+)
+
+shell_sources += ev_resources
+
+atril_deps = [
+ libdocument_dep,
+ config_h,
+ gio,
+ glib,
+ gtk,
+ libsecret,
+ math,
+ mate_desktop,
+ mate_submodules_dep,
+ libtoolbareditor_dep,
+ libevproperties_dep
+]
+
+if get_option('enable_dbus')
+ dbus_generated = gnome.gdbus_codegen(
+ 'ev-gdbus-generated',
+ 'ev-gdbus.xml',
+ interface_prefix: 'org.mate.atril',
+ namespace: 'Ev',
+ object_manager: true,
+ )
+
+ shell_sources += dbus_generated
+
+ # Generate the daemon D-Bus code
+ dbus_daemon_generated = gnome.gdbus_codegen(
+ 'ev-daemon-gdbus-generated',
+ 'ev-daemon-gdbus.xml',
+ interface_prefix: 'org.mate.atril',
+ namespace: 'Ev',
+ object_manager: true,
+ )
+
+ executable(
+ 'atrild',
+ sources: ['ev-daemon.c', ] + dbus_daemon_generated,
+ include_directories: include_dirs,
+ dependencies: atril_deps,
+ c_args: c_args,
+ install: true,
+ install_dir: libexecdir,
+ )
+endif
+
+libshell_deps = [
+ atril_deps,
+ libview_dep,
+ libmisc_dep,
+ mate_submodules_dep,
+ libephyzoom_dep,
+]
+
+libshell = static_library(
+ 'shell',
+ shell_sources,
+ dependencies: libshell_deps,
+ include_directories: include_dirs,
+)
+
+libshell_dep = declare_dependency(
+ link_whole: libshell, # Need the whole lib for gresource lookup
+ dependencies: libshell_deps,
+ include_directories: include_dirs,
+)
+
+atril = executable(
+ 'atril',
+ 'main.c',
+ dependencies: [libshell_dep] + atril_deps,
+ include_directories: include_dirs,
+ c_args: c_args,
+ install: true,
+)