From a601c252dae06def4379c838ed176955903b34c9 Mon Sep 17 00:00:00 2001 From: Marco Pesenti Gritti Date: Thu, 20 Jan 2005 11:35:19 +0000 Subject: Ensure thumbnails selection, toolbar page control and current page are in 2005-01-20 Marco Pesenti Gritti * shell/ev-sidebar-thumbnails.c: (ev_sidebar_tree_selection_changed), (ev_sidebar_thumbnails_select_page): * shell/ev-sidebar-thumbnails.h: * shell/ev-view.c: (ev_view_set_document), (ev_view_can_go_back), (ev_view_can_go_forward): * shell/ev-window.c: (ev_window_open_page), (ev_window_setup_document), (update_current_page), (view_page_changed_cb), (ev_window_init): * shell/ev-window.h: Ensure thumbnails selection, toolbar page control and current page are in sync. --- (limited to 'shell/ev-sidebar-thumbnails.c') diff --git a/shell/ev-sidebar-thumbnails.c b/shell/ev-sidebar-thumbnails.c index 88d7003..217c862 100644 --- a/shell/ev-sidebar-thumbnails.c +++ b/shell/ev-sidebar-thumbnails.c @@ -32,6 +32,7 @@ #include "ev-sidebar-thumbnails.h" #include "ev-document-thumbnails.h" #include "ev-document-misc.h" +#include "ev-window.h" #include "ev-utils.h" #define THUMBNAIL_WIDTH 75 @@ -133,6 +134,7 @@ ev_sidebar_tree_selection_changed (GtkTreeSelection *selection, EvSidebarThumbnails *ev_sidebar_thumbnails) { EvSidebarThumbnailsPrivate *priv; + GtkWidget *window; GtkTreePath *path; GtkTreeIter iter; int page; @@ -149,7 +151,11 @@ ev_sidebar_tree_selection_changed (GtkTreeSelection *selection, gtk_tree_path_free (path); - ev_document_set_page (priv->document, page); + window = gtk_widget_get_ancestor (GTK_WIDGET (ev_sidebar_thumbnails), + EV_TYPE_WINDOW); + if (window && ev_document_get_page (priv->document) != page) { + ev_window_open_page (EV_WINDOW (window), page); + } } static void @@ -304,6 +310,24 @@ populate_thumbnails_idle (gpointer data) } void +ev_sidebar_thumbnails_select_page (EvSidebarThumbnails *sidebar, + int page) +{ + GtkTreePath *path; + GtkTreeSelection *selection; + + path = gtk_tree_path_new_from_indices (page - 1, -1); + selection = gtk_tree_view_get_selection + (GTK_TREE_VIEW (sidebar->priv->tree_view)); + + if (path) { + gtk_tree_selection_select_path (selection, path); + gtk_tree_path_free (path); + } +} + + +void ev_sidebar_thumbnails_set_document (EvSidebarThumbnails *sidebar_thumbnails, EvDocument *document) { -- cgit v0.9.1