diff options
author | infirit <[email protected]> | 2014-12-09 22:56:49 +0100 |
---|---|---|
committer | infirit <[email protected]> | 2014-12-09 23:02:29 +0100 |
commit | 8f70652c07743394f591d0340f468cd1d46785f6 (patch) | |
tree | d52666a5ea81199c35b36664303ab95193862363 /shell/ev-window.c | |
parent | b48d2fec7ea33c23363eec02dfd350c4f5602982 (diff) | |
download | atril-8f70652c07743394f591d0340f468cd1d46785f6.tar.bz2 atril-8f70652c07743394f591d0340f468cd1d46785f6.tar.xz |
shell: Add a new sidebar page for bookmarks
It allows to add, remove and rename internal bookmarks
Taken from evince commit: 180cf6fef2318791abb3583f4c3f3bc176a204d8
From: Carlos Garcia Campos <[email protected]>
Diffstat (limited to 'shell/ev-window.c')
-rw-r--r-- | shell/ev-window.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/shell/ev-window.c b/shell/ev-window.c index 662a9a38..c1933c2c 100644 --- a/shell/ev-window.c +++ b/shell/ev-window.c @@ -79,6 +79,7 @@ #include "ev-properties-dialog.h" #include "ev-sidebar-annotations.h" #include "ev-sidebar-attachments.h" +#include "ev-sidebar-bookmarks.h" #include "ev-sidebar.h" #include "ev-sidebar-links.h" #include "ev-sidebar-page.h" @@ -145,6 +146,7 @@ struct _EvWindowPrivate { GtkWidget *sidebar_attachments; GtkWidget *sidebar_layers; GtkWidget *sidebar_annots; + GtkWidget *sidebar_bookmarks; #if ENABLE_EPUB GtkWidget *webview; #endif @@ -257,6 +259,7 @@ struct _EvWindowPrivate { #define ATTACHMENTS_SIDEBAR_ID "attachments" #define LAYERS_SIDEBAR_ID "layers" #define ANNOTS_SIDEBAR_ID "annotations" +#define BOOKMARKS_SIDEBAR_ID "bookmarks" #define EV_PRINT_SETTINGS_FILE "print-settings" #define EV_PRINT_SETTINGS_GROUP "Print Settings" @@ -1031,6 +1034,8 @@ ev_window_sidebar_get_current_page_id (EvWindow *ev_window) id = LAYERS_SIDEBAR_ID; } else if (current_page == ev_window->priv->sidebar_annots) { id = ANNOTS_SIDEBAR_ID; + } else if (current_page == ev_window->priv->sidebar_bookmarks) { + id = BOOKMARKS_SIDEBAR_ID; } else { g_assert_not_reached(); } @@ -1051,6 +1056,7 @@ ev_window_sidebar_set_current_page (EvWindow *window, GtkWidget *attachments = window->priv->sidebar_attachments; GtkWidget *annots = window->priv->sidebar_annots; GtkWidget *layers = window->priv->sidebar_layers; + GtkWidget *bookmarks = window->priv->sidebar_bookmarks; if (strcmp (page_id, LINKS_SIDEBAR_ID) == 0 && ev_sidebar_page_support_document (EV_SIDEBAR_PAGE (links), document)) { @@ -1067,6 +1073,9 @@ ev_window_sidebar_set_current_page (EvWindow *window, } else if (strcmp (page_id, ANNOTS_SIDEBAR_ID) == 0 && ev_sidebar_page_support_document (EV_SIDEBAR_PAGE (annots), document)) { ev_sidebar_set_page (sidebar, annots); + } else if (strcmp (page_id, BOOKMARKS_SIDEBAR_ID) == 0 && + ev_sidebar_page_support_document (EV_SIDEBAR_PAGE (bookmarks), document)) { + ev_sidebar_set_page (sidebar, bookmarks); } } @@ -2173,6 +2182,8 @@ ev_window_open_uri (EvWindow *ev_window, if (ev_window->priv->metadata) { ev_window->priv->bookmarks = ev_bookmarks_new (ev_window->priv->metadata); + ev_sidebar_bookmarks_set_bookmarks (EV_SIDEBAR_BOOKMARKS (ev_window->priv->sidebar_bookmarks), + ev_window->priv->bookmarks); g_signal_connect_swapped (ev_window->priv->bookmarks, "changed", G_CALLBACK (ev_window_setup_bookmarks), ev_window); @@ -6198,6 +6209,13 @@ sidebar_annots_annot_add_cancelled (EvSidebarAnnotations *sidebar_annots, } static void +sidebar_bookmarks_add_bookmark (EvSidebarBookmarks *sidebar_bookmarks, + EvWindow *window) +{ + ev_window_cmd_bookmarks_add (NULL, window); +} + +static void register_custom_actions (EvWindow *window, GtkActionGroup *group) { GtkAction *action; @@ -7500,6 +7518,16 @@ ev_window_init (EvWindow *ev_window) ev_sidebar_add_page (EV_SIDEBAR (ev_window->priv->sidebar), sidebar_widget); + sidebar_widget = ev_sidebar_bookmarks_new (); + ev_window->priv->sidebar_bookmarks = sidebar_widget; + g_signal_connect (sidebar_widget, + "add-bookmark", + G_CALLBACK (sidebar_bookmarks_add_bookmark), + ev_window); + gtk_widget_show (sidebar_widget); + ev_sidebar_add_page (EV_SIDEBAR (ev_window->priv->sidebar), + sidebar_widget); + ev_window->priv->view_box = gtk_vbox_new (FALSE, 0); ev_window->priv->scrolled_window = GTK_WIDGET (g_object_new (GTK_TYPE_SCROLLED_WINDOW, |