diff options
author | Marco Pesenti Gritti <marco@gnome.org> | 2005-01-20 11:35:19 (GMT) |
---|---|---|
committer | Marco Pesenti Gritti <marco@src.gnome.org> | 2005-01-20 11:35:19 (GMT) |
commit | a601c252dae06def4379c838ed176955903b34c9 (patch) | |
tree | 73ebfd2e9265c0df9a963c04a19517ea33fcd200 /shell/ev-sidebar-thumbnails.c | |
parent | dd089d0260316824ae2ad76160cf7b37499a854d (diff) |
Ensure thumbnails selection, toolbar page control and current page are in
2005-01-20 Marco Pesenti Gritti <marco@gnome.org>
* 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.
Diffstat (limited to 'shell/ev-sidebar-thumbnails.c')
-rw-r--r-- | shell/ev-sidebar-thumbnails.c | 26 |
1 files changed, 25 insertions, 1 deletions
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) { |