X-Git-Url: https://www.fi.muni.cz/~kas/git//home/kas/public_html/git/?a=blobdiff_plain;f=shell%2Fev-window.c;h=af8a83f364a151a68652b221a8b2ab3d84b244fa;hb=4f8bc8db98020835d2c4d39c902a296b784cf030;hp=4fe718333f0890a131cef978b55c8269f922865b;hpb=f7eb83a4ad43b1b30af202eb8f33f3057c2a51c5;p=evince.git diff --git a/shell/ev-window.c b/shell/ev-window.c index 4fe71833..af8a83f3 100644 --- a/shell/ev-window.c +++ b/shell/ev-window.c @@ -75,6 +75,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" @@ -140,6 +141,7 @@ struct _EvWindowPrivate { GtkWidget *sidebar_attachments; GtkWidget *sidebar_layers; GtkWidget *sidebar_annots; + GtkWidget *sidebar_bookmarks; /* Settings */ GSettings *settings; @@ -251,6 +253,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" @@ -340,6 +343,8 @@ static void ev_window_cmd_edit_find (GtkAction *actio static void find_bar_search_changed_cb (EggFindBar *find_bar, GParamSpec *param, EvWindow *ev_window); +static void view_external_link_cb (EvWindow *window, + EvLinkAction *action); static void ev_window_load_file_remote (EvWindow *ev_window, GFile *source_file); static void ev_window_media_player_key_pressed (EvWindow *window, @@ -964,6 +969,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(); } @@ -984,6 +991,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)) { @@ -1000,6 +1008,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); } } @@ -2044,6 +2055,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); @@ -3833,22 +3846,19 @@ fullscreen_toolbar_setup_item_properties (GtkUIManager *ui_manager) static void fullscreen_toolbar_remove_shadow (GtkWidget *toolbar) { - static gboolean done = FALSE; + GtkCssProvider *provider; - if (!done) { - gtk_rc_parse_string ( - "\n" - " style \"fullscreen-toolbar-style\"\n" - " {\n" - " GtkToolbar::shadow-type=GTK_SHADOW_NONE\n" - " }\n" - "\n" - " widget \"*.fullscreen-toolbar\" style \"fullscreen-toolbar-style\"\n" - "\n"); - done = TRUE; - } - - gtk_widget_set_name (toolbar, "fullscreen-toolbar"); + gtk_widget_set_name (toolbar, "ev-fullscreen-toolbar"); + + provider = gtk_css_provider_new (); + gtk_css_provider_load_from_data (provider, + "#ev-fullscreen-toolbar {\n" + " -GtkToolbar-shadow-type: none; }", + -1, NULL); + gtk_style_context_add_provider (gtk_widget_get_style_context (toolbar), + GTK_STYLE_PROVIDER (provider), + GTK_STYLE_PROVIDER_PRIORITY_APPLICATION); + g_object_unref (provider); } static void @@ -3984,6 +3994,9 @@ ev_window_run_presentation (EvWindow *window) g_signal_connect_swapped (window->priv->presentation_view, "finished", G_CALLBACK (ev_window_view_presentation_finished), window); + g_signal_connect_swapped (window->priv->presentation_view, "external-link", + G_CALLBACK (view_external_link_cb), + window); gtk_box_pack_start (GTK_BOX (window->priv->main_box), window->priv->presentation_view, @@ -5843,6 +5856,13 @@ sidebar_annots_annot_add_cancelled (EvSidebarAnnotations *sidebar_annots, ev_view_cancel_add_annotation (EV_VIEW (window->priv->view)); } +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) { @@ -6214,7 +6234,7 @@ do_action_named (EvWindow *window, EvLinkAction *action) } static void -view_external_link_cb (EvView *view, EvLinkAction *action, EvWindow *window) +view_external_link_cb (EvWindow *window, EvLinkAction *action) { switch (ev_link_action_get_action_type (action)) { case EV_LINK_ACTION_TYPE_GOTO_DEST: { @@ -7137,6 +7157,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, @@ -7166,9 +7196,9 @@ ev_window_init (EvWindow *ev_window) g_signal_connect_object (ev_window->priv->view, "focus_out_event", G_CALLBACK (view_actions_focus_out_cb), ev_window, 0); - g_signal_connect_object (ev_window->priv->view, "external-link", - G_CALLBACK (view_external_link_cb), - ev_window, 0); + g_signal_connect_swapped (ev_window->priv->view, "external-link", + G_CALLBACK (view_external_link_cb), + ev_window); g_signal_connect_object (ev_window->priv->view, "handle-link", G_CALLBACK (view_handle_link_cb), ev_window, 0);