[evince/wip/recent-view: 1/2] recent-view: Integrate recent view in the shell
- From: Germán Poó Caamaño <gpoo src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evince/wip/recent-view: 1/2] recent-view: Integrate recent view in the shell
- Date: Fri, 25 Jul 2014 06:29:43 +0000 (UTC)
commit 0c81628807751c46ea7e02be46862a6be0573a06
Author: Germán Poo-Caamaño <gpoo gnome org>
Date: Tue Jul 1 13:01:16 2014 -0700
recent-view: Integrate recent view in the shell
Given the restrictions of GtkHeaderBar for reparenting, we must
implement multiple modes for the toolbar, which can be customized
for Recent View, Full Screen, and Document (normal).
https://bugzilla.gnome.org/show_bug.cgi?id=633501
shell/ev-application.c | 3 +
shell/ev-toolbar.c | 109 +++++++++++++++++++--
shell/ev-toolbar.h | 19 +++-
shell/ev-window.c | 261 +++++++++++++++++++++++++++++++++++++-----------
shell/ev-window.h | 1 +
5 files changed, 324 insertions(+), 69 deletions(-)
---
diff --git a/shell/ev-application.c b/shell/ev-application.c
index b7fa935..9ba260b 100644
--- a/shell/ev-application.c
+++ b/shell/ev-application.c
@@ -655,6 +655,9 @@ ev_application_open_window (EvApplication *application,
guint32 timestamp)
{
GtkWidget *new_window = ev_window_new ();
+
+ ev_window_open_recent_view (EV_WINDOW (new_window));
+
#ifdef GDK_WINDOWING_X11
GdkWindow *gdk_window;
#endif
diff --git a/shell/ev-toolbar.c b/shell/ev-toolbar.c
index a57bb4c..4740b74 100644
--- a/shell/ev-toolbar.c
+++ b/shell/ev-toolbar.c
@@ -1,7 +1,8 @@
/* ev-toolbar.h
* this file is part of evince, a gnome document viewer
*
- * Copyright (C) 2012 Carlos Garcia Campos <carlosgc gnome org>
+ * Copyright (C) 2012-2014 Carlos Garcia Campos <carlosgc gnome org>
+ * Copyright (C) 2014 Germán Poo-Caamaño <gpoo gnome org>
*
* Evince is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
@@ -48,7 +49,13 @@ struct _EvToolbarPrivate {
GtkWidget *history_action;
GtkWidget *zoom_action;
GtkWidget *page_selector;
+ GtkWidget *navigation_action;
+ GtkWidget *find_button;
+ GtkWidget *recent_view_button;
+ GtkWidget *open_button;
GMenu *bookmarks_section;
+
+ EvToolbarMode toolbar_mode;
};
G_DEFINE_TYPE (EvToolbar, ev_toolbar, GTK_TYPE_HEADER_BAR)
@@ -83,6 +90,24 @@ ev_toolbar_set_button_action (EvToolbar *ev_toolbar,
}
static GtkWidget *
+ev_toolbar_create_button (EvToolbar *ev_toolbar,
+ const gchar *action_name,
+ const gchar *icon_name,
+ const gchar *tooltip)
+{
+ GtkWidget *button = gtk_button_new ();
+ GtkWidget *image;
+
+ image = gtk_image_new_from_icon_name (icon_name, GTK_ICON_SIZE_MENU);
+
+ gtk_widget_set_valign (button, GTK_ALIGN_CENTER);
+ gtk_button_set_image (GTK_BUTTON (button), image);
+ ev_toolbar_set_button_action (ev_toolbar, GTK_BUTTON (button), action_name, tooltip);
+
+ return button;
+}
+
+static GtkWidget *
ev_toolbar_create_toggle_button (EvToolbar *ev_toolbar,
const gchar *action_name,
const gchar *icon_name,
@@ -178,6 +203,27 @@ ev_toolbar_constructed (GObject *object)
builder = gtk_builder_new_from_resource ("/org/gnome/evince/shell/ui/menus.ui");
+ /* View of recent items */
+ button = ev_toolbar_create_toggle_button (ev_toolbar, "win.recent-view",
+ "view-grid-symbolic",
+ _("Toggle between view of recent items and open
document"));
+ ev_toolbar->priv->recent_view_button = button;
+ if (rtl)
+ gtk_widget_set_margin_left (button, 6);
+ else
+ gtk_widget_set_margin_right (button, 6);
+ gtk_container_add (GTK_CONTAINER (ev_toolbar), button);
+
+ button = ev_toolbar_create_button (ev_toolbar, "win.open",
+ "document-open-symbolic",
+ _("Open an existenting document"));
+ ev_toolbar->priv->open_button = button;
+ gtk_container_add (GTK_CONTAINER (ev_toolbar), button);
+ if (rtl)
+ gtk_widget_set_margin_left (button, 6);
+ else
+ gtk_widget_set_margin_right (button, 6);
+
/* Page selector */
/* Use EvPageActionWidget for now, since the page selector action is also used by the previewer */
tool_item = GTK_WIDGET (g_object_new (EV_TYPE_PAGE_ACTION_WIDGET, NULL));
@@ -189,7 +235,6 @@ ev_toolbar_constructed (GObject *object)
else
gtk_widget_set_margin_right (tool_item, 6);
gtk_header_bar_pack_start (GTK_HEADER_BAR (ev_toolbar), tool_item);
- gtk_widget_show (tool_item);
/* History */
hbox = ev_history_action_new (ev_window_get_history (ev_toolbar->priv->window));
@@ -199,17 +244,16 @@ ev_toolbar_constructed (GObject *object)
else
gtk_widget_set_margin_right (hbox, 6);
gtk_header_bar_pack_start (GTK_HEADER_BAR (ev_toolbar), hbox);
- gtk_widget_show (hbox);
/* Find */
button = ev_toolbar_create_toggle_button (ev_toolbar, "win.toggle-find", "edit-find-symbolic",
_("Find a word or phrase in the document"));
+ ev_toolbar->priv->find_button = button;
if (rtl)
gtk_widget_set_margin_left (button, 6);
else
gtk_widget_set_margin_right (button, 6);
gtk_header_bar_pack_start (GTK_HEADER_BAR (ev_toolbar), button);
- gtk_widget_show (button);
/* Action Menu */
menu = G_MENU_MODEL (gtk_builder_get_object (builder, "action-menu"));
@@ -218,7 +262,6 @@ ev_toolbar_constructed (GObject *object)
gtk_widget_set_tooltip_text (button, _("File options"));
ev_toolbar->priv->action_menu_button = button;
gtk_header_bar_pack_end (GTK_HEADER_BAR (ev_toolbar), button);
- gtk_widget_show (button);
/* View Menu */
menu = G_MENU_MODEL (gtk_builder_get_object (builder, "view-menu"));
@@ -227,7 +270,6 @@ ev_toolbar_constructed (GObject *object)
gtk_widget_set_tooltip_text (button, _("View options"));
ev_toolbar->priv->view_menu_button = button;
gtk_header_bar_pack_end (GTK_HEADER_BAR (ev_toolbar), button);
- gtk_widget_show (button);
/* Zoom selector */
vbox = ev_zoom_action_new (ev_window_get_document_model (ev_toolbar->priv->window),
@@ -241,7 +283,6 @@ ev_toolbar_constructed (GObject *object)
else
gtk_widget_set_margin_right (vbox, 6);
gtk_header_bar_pack_end (GTK_HEADER_BAR (ev_toolbar), vbox);
- gtk_widget_show (vbox);
recent_menu_model = ev_recent_menu_model_new (gtk_recent_manager_get_default (),
"win.open-recent",
@@ -286,6 +327,7 @@ static void
ev_toolbar_init (EvToolbar *ev_toolbar)
{
ev_toolbar->priv = G_TYPE_INSTANCE_GET_PRIVATE (ev_toolbar, EV_TYPE_TOOLBAR, EvToolbarPrivate);
+ ev_toolbar->priv->toolbar_mode = EV_TOOLBAR_MODE_NORMAL;
}
GtkWidget *
@@ -341,3 +383,56 @@ ev_toolbar_get_page_selector (EvToolbar *ev_toolbar)
return ev_toolbar->priv->page_selector;
}
+
+void
+ev_toolbar_set_mode (EvToolbar *ev_toolbar,
+ EvToolbarMode mode)
+{
+ EvToolbarPrivate *priv;
+
+ g_return_if_fail (EV_IS_TOOLBAR (ev_toolbar));
+
+ priv = ev_toolbar->priv;
+ priv->toolbar_mode = mode;
+
+ switch (mode) {
+ case EV_TOOLBAR_MODE_NORMAL:
+ gtk_widget_show (priv->view_menu_button);
+ gtk_widget_show (priv->action_menu_button);
+ gtk_widget_show (priv->history_action);
+ gtk_widget_show (priv->zoom_action);
+ gtk_widget_show (priv->page_selector);
+ gtk_widget_show (priv->find_button);
+ gtk_widget_show (priv->recent_view_button);
+ gtk_widget_hide (priv->open_button);
+ break;
+ case EV_TOOLBAR_MODE_FULLSCREEN:
+ gtk_widget_show (priv->view_menu_button);
+ gtk_widget_show (priv->action_menu_button);
+ gtk_widget_show (priv->history_action);
+ gtk_widget_show (priv->zoom_action);
+ gtk_widget_show (priv->page_selector);
+ gtk_widget_show (priv->find_button);
+ gtk_widget_hide (priv->recent_view_button);
+ gtk_widget_hide (priv->open_button);
+ break;
+ case EV_TOOLBAR_MODE_RECENT_VIEW:
+ gtk_widget_hide (priv->view_menu_button);
+ gtk_widget_hide (priv->action_menu_button);
+ gtk_widget_hide (priv->history_action);
+ gtk_widget_hide (priv->zoom_action);
+ gtk_widget_hide (priv->page_selector);
+ gtk_widget_hide (priv->find_button);
+ gtk_widget_show (priv->recent_view_button);
+ gtk_widget_show (priv->open_button);
+ break;
+ }
+}
+
+EvToolbarMode
+ev_toolbar_get_mode (EvToolbar *ev_toolbar)
+{
+ g_return_val_if_fail (EV_IS_TOOLBAR (ev_toolbar), EV_TOOLBAR_MODE_NORMAL);
+
+ return ev_toolbar->priv->toolbar_mode;
+}
diff --git a/shell/ev-toolbar.h b/shell/ev-toolbar.h
index 8eba914..ae5682b 100644
--- a/shell/ev-toolbar.h
+++ b/shell/ev-toolbar.h
@@ -26,6 +26,12 @@
G_BEGIN_DECLS
+typedef enum {
+ EV_TOOLBAR_MODE_NORMAL,
+ EV_TOOLBAR_MODE_FULLSCREEN,
+ EV_TOOLBAR_MODE_RECENT_VIEW,
+} EvToolbarMode;
+
#define EV_TYPE_TOOLBAR (ev_toolbar_get_type())
#define EV_TOOLBAR(object) (G_TYPE_CHECK_INSTANCE_CAST((object), EV_TYPE_TOOLBAR, EvToolbar))
#define EV_IS_TOOLBAR(object) (G_TYPE_CHECK_INSTANCE_TYPE((object), EV_TYPE_TOOLBAR))
@@ -47,11 +53,14 @@ struct _EvToolbarClass {
GtkHeaderBarClass base_class;
};
-GType ev_toolbar_get_type (void);
-GtkWidget *ev_toolbar_new (EvWindow *window);
-gboolean ev_toolbar_has_visible_popups (EvToolbar *ev_toolbar);
-void ev_toolbar_action_menu_popup (EvToolbar *ev_toolbar);
-GtkWidget *ev_toolbar_get_page_selector (EvToolbar *ev_toolbar);
+GType ev_toolbar_get_type (void);
+GtkWidget *ev_toolbar_new (EvWindow *window);
+gboolean ev_toolbar_has_visible_popups (EvToolbar *ev_toolbar);
+void ev_toolbar_action_menu_popup (EvToolbar *ev_toolbar);
+GtkWidget *ev_toolbar_get_page_selector (EvToolbar *ev_toolbar);
+void ev_toolbar_set_mode (EvToolbar *ev_toolbar,
+ EvToolbarMode mode);
+EvToolbarMode ev_toolbar_get_mode (EvToolbar *ev_toolbar);
G_END_DECLS
diff --git a/shell/ev-window.c b/shell/ev-window.c
index 4ae4829..583d221 100644
--- a/shell/ev-window.c
+++ b/shell/ev-window.c
@@ -51,7 +51,6 @@
#include "ev-document-images.h"
#include "ev-document-links.h"
#include "ev-document-annotations.h"
-#include "ev-document-type-builtins.h"
#include "ev-document-misc.h"
#include "ev-file-exporter.h"
#include "ev-file-helpers.h"
@@ -89,6 +88,7 @@
#include "ev-zoom-action.h"
#include "ev-toolbar.h"
#include "ev-bookmarks.h"
+#include "ev-recent-view.h"
#ifdef ENABLE_DBUS
#include "ev-gdbus-generated.h"
@@ -182,6 +182,9 @@ struct _EvWindowPrivate {
GtkWidget *attachment_popup;
GList *attach_list;
+ /* For bookshelf view of recent items*/
+ EvRecentView *recent_view;
+
/* Document */
EvDocumentModel *model;
char *uri;
@@ -368,6 +371,11 @@ static void ev_window_setup_bookmarks (EvWindow *windo
static void ev_window_show_find_bar (EvWindow *ev_window,
gboolean restart);
static void ev_window_close_find_bar (EvWindow *ev_window);
+static void ev_window_show_recent_view (EvWindow *ev_window);
+static void ev_window_hide_recent_view (EvWindow *ev_window);
+static void recent_view_item_activated_cb (EvRecentView *recent_view,
+ const char *uri,
+ EvWindow *ev_window);
static gchar *nautilus_sendto = NULL;
@@ -394,9 +402,11 @@ ev_window_set_action_enabled (EvWindow *ev_window,
}
static void
-ev_window_setup_action_sensitivity (EvWindow *ev_window)
+ev_window_update_actions_sensitivity (EvWindow *ev_window)
{
EvDocument *document = ev_window->priv->document;
+ EvView *view = EV_VIEW (ev_window->priv->view);
+ EvToolbar *toolbar = EV_TOOLBAR (ev_window->priv->toolbar);
const EvDocumentInfo *info = NULL;
gboolean has_document = FALSE;
gboolean ok_to_print = TRUE;
@@ -404,13 +414,22 @@ ev_window_setup_action_sensitivity (EvWindow *ev_window)
gboolean has_properties = TRUE;
gboolean override_restrictions = TRUE;
gboolean can_get_text = FALSE;
- gboolean has_pages = FALSE;
gboolean can_find = FALSE;
+ gboolean can_find_in_page = FALSE;
+ gboolean presentation_mode;
+ gboolean fullscreen_mode;
+ gboolean recent_view_mode;
+ gboolean dual_mode = FALSE;
+ gboolean has_pages = FALSE;
+ int n_pages = 0, page = -1;
if (document) {
has_document = TRUE;
- has_pages = ev_document_get_n_pages (document) > 0;
info = ev_document_get_info (document);
+ 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);
}
if (!info || info->fields_mask == 0) {
@@ -449,76 +468,114 @@ ev_window_setup_action_sensitivity (EvWindow *ev_window)
ok_to_print = FALSE;
}
+ /* Get modes */
+ presentation_mode = EV_WINDOW_IS_PRESENTATION (ev_window);
+ fullscreen_mode = ev_document_model_get_fullscreen (ev_window->priv->model);
+ recent_view_mode = ev_toolbar_get_mode (toolbar) == EV_TOOLBAR_MODE_RECENT_VIEW;
+
/* File menu */
ev_window_set_action_enabled (ev_window, "open-copy", has_document);
- ev_window_set_action_enabled (ev_window, "save-copy", has_document && ok_to_copy);
- ev_window_set_action_enabled (ev_window, "print", has_pages && ok_to_print);
- ev_window_set_action_enabled (ev_window, "show-properties", has_document && has_properties);
- ev_window_set_action_enabled (ev_window, "open-containing-folder", has_document);
- ev_window_set_action_enabled (ev_window, "send-to",
- has_document && ev_window->priv->has_mailto_handler);
- ev_window_set_action_enabled (ev_window, "presentation", has_document);
+ ev_window_set_action_enabled (ev_window, "save-copy", has_document &&
+ ok_to_copy && !recent_view_mode);
+ ev_window_set_action_enabled (ev_window, "print", has_pages &&
+ ok_to_print && !recent_view_mode);
+ ev_window_set_action_enabled (ev_window, "show-properties",
+ has_document && has_properties &&
+ !recent_view_mode);
+ ev_window_set_action_enabled (ev_window, "open-containing-folder",
+ has_document && !recent_view_mode);
+ ev_window_set_action_enabled (ev_window, "send-to", has_document &&
+ ev_window->priv->has_mailto_handler &&
+ !recent_view_mode);
+ ev_window_set_action_enabled (ev_window, "presentation",
+ has_document && !recent_view_mode);
/* Edit menu */
- ev_window_set_action_enabled (ev_window, "select-all", has_pages && can_get_text);
- ev_window_set_action_enabled (ev_window, "find", can_find);
- ev_window_set_action_enabled (ev_window, "rotate-left", has_pages);
- ev_window_set_action_enabled (ev_window, "rotate-right", has_pages);
+ ev_window_set_action_enabled (ev_window, "select-all", has_pages &&
+ can_get_text && !recent_view_mode);
+ ev_window_set_action_enabled (ev_window, "find", can_find &&
+ !recent_view_mode);
+ ev_window_set_action_enabled (ev_window, "rotate-left", has_pages &&
+ !recent_view_mode);
+ ev_window_set_action_enabled (ev_window, "rotate-right", has_pages &&
+ !recent_view_mode);
/* View menu */
- ev_window_set_action_enabled (ev_window, "continuous", has_pages);
- ev_window_set_action_enabled (ev_window, "dual-page", has_pages);
- ev_window_set_action_enabled (ev_window, "dual-odd-left", has_pages);
- ev_window_set_action_enabled (ev_window, "reload", has_pages);
- ev_window_set_action_enabled (ev_window, "auto-scroll", has_pages);
- ev_window_set_action_enabled (ev_window, "inverted-colors", has_pages);
+ ev_window_set_action_enabled (ev_window, "continuous", has_pages &&
+ !recent_view_mode);
+ ev_window_set_action_enabled (ev_window, "dual-page", has_pages &&
+ !recent_view_mode);
+ ev_window_set_action_enabled (ev_window, "dual-odd-left", has_pages &&
+ !recent_view_mode);
+ ev_window_set_action_enabled (ev_window, "reload", has_pages &&
+ !recent_view_mode);
+ ev_window_set_action_enabled (ev_window, "auto-scroll", has_pages &&
+ !recent_view_mode);
+ ev_window_set_action_enabled (ev_window, "inverted-colors",
+ has_pages && !recent_view_mode);
/* Bookmarks menu */
ev_window_set_action_enabled (ev_window, "add-bookmark",
- has_pages && ev_window->priv->bookmarks);
-
- ev_window_update_actions_sensitivity (ev_window);
-}
-
-static void
-ev_window_update_actions_sensitivity (EvWindow *ev_window)
-{
- EvView *view = EV_VIEW (ev_window->priv->view);
- int n_pages = 0, page = -1;
- gboolean has_pages = FALSE;
- gboolean presentation_mode;
- gboolean can_find_in_page = FALSE;
- gboolean dual_mode = FALSE;
-
- if (ev_window->priv->document) {
- 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);
- }
+ has_pages && ev_window->priv->bookmarks &&
+ !recent_view_mode);
+
+ /* Recent View */
+ ev_window_set_action_enabled (ev_window, "recent-view", has_document &&
+ !fullscreen_mode);
+
+ /* Other actions that must be disabled in recent view, in
+ case they have a shortcup or gesture associated */
+ ev_window_set_action_enabled (ev_window, "save-settings", !recent_view_mode);
+ ev_window_set_action_enabled (ev_window, "show-side-pane", !recent_view_mode);
+ ev_window_set_action_enabled (ev_window, "fullscreen", !recent_view_mode);
+ ev_window_set_action_enabled (ev_window, "presentation", !recent_view_mode);
+ ev_window_set_action_enabled (ev_window, "rotate-left", !recent_view_mode);
+ ev_window_set_action_enabled (ev_window, "rotate-right", !recent_view_mode);
+ ev_window_set_action_enabled (ev_window, "goto-bookmark", !recent_view_mode);
+ ev_window_set_action_enabled (ev_window, "scroll-forward", !recent_view_mode);
+ ev_window_set_action_enabled (ev_window, "scroll-backwards", !recent_view_mode);
+ ev_window_set_action_enabled (ev_window, "sizing-mode", !recent_view_mode);
+ ev_window_set_action_enabled (ev_window, "zoom", !recent_view_mode);
+ ev_window_set_action_enabled (ev_window, "escape", !recent_view_mode);
+ ev_window_set_action_enabled (ev_window, "open-menu", !recent_view_mode);
+
+ /* Same for popups specific actions */
+ ev_window_set_action_enabled (ev_window, "open-link", !recent_view_mode);
+ ev_window_set_action_enabled (ev_window, "open-link-new-window", !recent_view_mode);
+ ev_window_set_action_enabled (ev_window, "go-to-link", !recent_view_mode);
+ ev_window_set_action_enabled (ev_window, "copy-link-address", !recent_view_mode);
+ ev_window_set_action_enabled (ev_window, "save-image", !recent_view_mode);
+ ev_window_set_action_enabled (ev_window, "copy-image", !recent_view_mode);
+ ev_window_set_action_enabled (ev_window, "open-attachment", !recent_view_mode);
+ ev_window_set_action_enabled (ev_window, "save-attachment", !recent_view_mode);
+ ev_window_set_action_enabled (ev_window, "annot-properties", !recent_view_mode);
can_find_in_page = (ev_window->priv->find_job &&
ev_job_find_has_results (EV_JOB_FIND (ev_window->priv->find_job)));
ev_window_set_action_enabled (ev_window, "copy",
has_pages &&
- ev_view_get_has_selection (view));
+ ev_view_get_has_selection (view) &&
+ !recent_view_mode);
ev_window_set_action_enabled (ev_window, "find-next",
- has_pages && can_find_in_page);
+ has_pages && can_find_in_page &&
+ !recent_view_mode);
ev_window_set_action_enabled (ev_window, "find-previous",
- has_pages && can_find_in_page);
- ev_window_set_action_enabled (ev_window, "dual-odd-left", dual_mode);
-
- presentation_mode = EV_WINDOW_IS_PRESENTATION (ev_window);
+ has_pages && can_find_in_page &&
+ !recent_view_mode);
+ ev_window_set_action_enabled (ev_window, "dual-odd-left", dual_mode &&
+ !recent_view_mode);
ev_window_set_action_enabled (ev_window, "zoom-in",
has_pages &&
ev_view_can_zoom_in (view) &&
- !presentation_mode);
+ !presentation_mode &&
+ !recent_view_mode);
ev_window_set_action_enabled (ev_window, "zoom-out",
has_pages &&
ev_view_can_zoom_out (view) &&
- !presentation_mode);
+ !presentation_mode &&
+ !recent_view_mode);
/* Go menu */
if (has_pages) {
@@ -537,15 +594,18 @@ ev_window_update_actions_sensitivity (EvWindow *ev_window)
ev_window_set_action_enabled (ev_window, "go-back-history",
!ev_history_is_frozen (ev_window->priv->history) &&
- ev_history_can_go_back (ev_window->priv->history));
+ ev_history_can_go_back (ev_window->priv->history) &&
+ !recent_view_mode);
ev_window_set_action_enabled (ev_window, "go-forward-history",
!ev_history_is_frozen (ev_window->priv->history) &&
- ev_history_can_go_forward (ev_window->priv->history));
+ ev_history_can_go_forward (ev_window->priv->history) &&
+ !recent_view_mode);
ev_window_set_action_enabled (ev_window, "caret-navigation",
has_pages &&
ev_view_supports_caret_navigation (view) &&
- !presentation_mode);
+ !presentation_mode &&
+ !recent_view_mode);
}
static void
@@ -1395,7 +1455,7 @@ override_restrictions_changed (GSettings *settings,
gchar *key,
EvWindow *ev_window)
{
- ev_window_setup_action_sensitivity (ev_window);
+ ev_window_update_actions_sensitivity (ev_window);
}
#ifdef HAVE_DESKTOP_SCHEMAS
@@ -1404,7 +1464,7 @@ lockdown_changed (GSettings *lockdown,
const gchar *key,
EvWindow *ev_window)
{
- ev_window_setup_action_sensitivity (ev_window);
+ ev_window_update_actions_sensitivity (ev_window);
}
#endif
@@ -1455,7 +1515,7 @@ ev_window_setup_document (EvWindow *ev_window)
}
#endif
- ev_window_setup_action_sensitivity (ev_window);
+ ev_window_update_actions_sensitivity (ev_window);
if (ev_window->priv->properties) {
ev_properties_dialog_set_document (EV_PROPERTIES_DIALOG (ev_window->priv->properties),
@@ -1534,6 +1594,8 @@ ev_window_set_document (EvWindow *ev_window, EvDocument *document)
_("The document contains only empty pages"));
}
+ ev_window_hide_recent_view (ev_window);
+
if (EV_WINDOW_IS_PRESENTATION (ev_window)) {
gint current_page;
@@ -2232,6 +2294,12 @@ ev_window_open_document (EvWindow *ev_window,
ev_window);
}
+void
+ev_window_open_recent_view (EvWindow *ev_window)
+{
+ ev_window_show_recent_view (EV_WINDOW (ev_window));
+}
+
static void
ev_window_reload_local (EvWindow *ev_window)
{
@@ -4040,6 +4108,9 @@ ev_window_run_fullscreen (EvWindow *window)
g_object_unref (window->priv->main_box);
window->priv->fs_toolbar = ev_toolbar_new (window);
+ ev_toolbar_set_mode (EV_TOOLBAR (window->priv->fs_toolbar),
+ EV_TOOLBAR_MODE_FULLSCREEN);
+
ev_window_update_links_model (window);
g_signal_connect (ev_toolbar_get_page_selector (EV_TOOLBAR (window->priv->fs_toolbar)),
"activate-link",
@@ -4552,6 +4623,21 @@ ev_window_cmd_go_backwards (GSimpleAction *action,
}
}
+static void
+ev_window_cmd_toggle_recent_view (GSimpleAction *action,
+ GVariant *state,
+ gpointer user_data)
+{
+ EvWindow *ev_window = user_data;
+
+ if (g_variant_get_boolean (state))
+ ev_window_show_recent_view (ev_window);
+ else
+ ev_window_hide_recent_view (ev_window);
+
+ g_simple_action_set_state (action, state);
+}
+
static gint
compare_bookmarks (EvBookmark *a,
EvBookmark *b)
@@ -5033,6 +5119,27 @@ find_sidebar_result_activated_cb (EvFindSidebar *find_sidebar,
}
static void
+recent_view_item_activated_cb (EvRecentView *recent_view,
+ const char *uri,
+ EvWindow *ev_window)
+{
+ GAction *action;
+
+ if (g_strcmp0 (ev_window->priv->uri, uri) == 0) {
+ ev_window_hide_recent_view (ev_window);
+ action = g_action_map_lookup_action (G_ACTION_MAP (ev_window),
+ "recent-view");
+ g_simple_action_set_state (G_SIMPLE_ACTION (action),
+ g_variant_new_boolean (FALSE));
+ return;
+ }
+
+ ev_application_open_uri_at_dest (EV_APP, uri,
+ gtk_window_get_screen (GTK_WINDOW (ev_window)),
+ NULL, 0, NULL, gtk_get_current_event_time ());
+}
+
+static void
ev_window_update_find_status_message (EvWindow *ev_window)
{
gchar *message;
@@ -5708,6 +5815,7 @@ static const GActionEntry actions[] = {
{ "escape", ev_window_cmd_escape },
{ "open-menu", ev_window_cmd_action_menu },
{ "caret-navigation", NULL, NULL, "false", ev_window_cmd_view_toggle_caret_navigation },
+ { "recent-view", NULL, NULL, "false", ev_window_cmd_toggle_recent_view },
/* Popups specific items */
{ "open-link", ev_window_popup_cmd_open_link },
@@ -7054,7 +7162,7 @@ ev_window_init (EvWindow *ev_window)
gtk_window_set_hide_titlebar_when_maximized (GTK_WINDOW (ev_window), TRUE);
ev_window_sizing_mode_changed_cb (ev_window->priv->model, NULL, ev_window);
- ev_window_setup_action_sensitivity (ev_window);
+ ev_window_update_actions_sensitivity (ev_window);
/* Drag and Drop */
gtk_drag_dest_set (GTK_WIDGET (ev_window),
@@ -7085,6 +7193,45 @@ ev_window_new (void)
return ev_window;
}
+static void
+ev_window_show_recent_view (EvWindow *ev_window)
+{
+ EvToolbar *toolbar = EV_TOOLBAR (ev_window->priv->toolbar);
+
+ gtk_widget_hide (ev_window->priv->hpaned);
+ gtk_widget_hide (ev_window->priv->find_bar);
+
+ if (!ev_window->priv->recent_view) {
+ ev_window->priv->recent_view = EV_RECENT_VIEW (ev_recent_view_new ());
+ g_signal_connect_object (ev_window->priv->recent_view,
+ "item-activated",
+ G_CALLBACK (recent_view_item_activated_cb),
+ ev_window, 0);
+ gtk_box_pack_start (GTK_BOX (ev_window->priv->main_box),
+ GTK_WIDGET (ev_window->priv->recent_view),
+ TRUE, TRUE, 0);
+ }
+
+ gtk_widget_show (GTK_WIDGET (ev_window->priv->recent_view));
+ ev_toolbar_set_mode (toolbar, EV_TOOLBAR_MODE_RECENT_VIEW);
+
+ ev_window_update_actions_sensitivity (ev_window);
+}
+
+static void
+ev_window_hide_recent_view (EvWindow *ev_window)
+{
+ EvToolbar *toolbar = EV_TOOLBAR (ev_window->priv->toolbar);
+
+ if (ev_window->priv->recent_view)
+ gtk_widget_hide (GTK_WIDGET (ev_window->priv->recent_view));
+
+ gtk_widget_show (ev_window->priv->hpaned);
+ ev_toolbar_set_mode (toolbar, EV_TOOLBAR_MODE_NORMAL);
+
+ ev_window_update_actions_sensitivity (ev_window);
+}
+
const gchar *
ev_window_get_dbus_object_path (EvWindow *ev_window)
{
diff --git a/shell/ev-window.h b/shell/ev-window.h
index f420e97..a3795cf 100644
--- a/shell/ev-window.h
+++ b/shell/ev-window.h
@@ -83,6 +83,7 @@ void ev_window_open_document (EvWindow *ev_window,
EvLinkDest *dest,
EvWindowRunMode mode,
const gchar *search_string);
+void ev_window_open_recent_view (EvWindow *ev_window);
gboolean ev_window_is_empty (const EvWindow *ev_window);
void ev_window_print_range (EvWindow *ev_window,
int first_page,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]