From a154e22c19e8c654971c4fc06ddf106c30f47f87 Mon Sep 17 00:00:00 2001 From: "Nickolay V. Shmyrev" Date: Wed, 27 Apr 2005 22:58:24 +0000 Subject: [PATCH] Update current page while scrolling in continuous mode CVSr ---------------------------------------------------------------------- --- ChangeLog | 9 +++++++++ shell/ev-page-action.c | 1 + shell/ev-view.c | 17 +++++++++++++++-- shell/ev-window.c | 7 ++++++- 4 files changed, 31 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index eeec3943..b689d186 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2005-04-28 Nickolay V. Shmyrev + + * shell/ev-page-action.c: (ev_page_action_dispose): + * shell/ev-view.c: (view_update_range_and_current_page): + * shell/ev-window.c: (ev_window_dispose): + + Set page on scroll in continuous mode. Fixes bug 301986. + Also cleanup callbacks on destroy of EvWindow and EvPageAction. + 2005-04-26 Marco Pesenti Gritti * configure.ac: diff --git a/shell/ev-page-action.c b/shell/ev-page-action.c index 18415a36..e378d306 100644 --- a/shell/ev-page-action.c +++ b/shell/ev-page-action.c @@ -415,6 +415,7 @@ ev_page_action_dispose (GObject *object) EvPageAction *page = EV_PAGE_ACTION (object); if (page->priv->page_cache) { + g_signal_handlers_disconnect_matched (page->priv->page_cache, G_SIGNAL_MATCH_FUNC, 0, 0, NULL, page_changed_cb, NULL); g_object_unref (page->priv->page_cache); page->priv->page_cache = NULL; } diff --git a/shell/ev-view.c b/shell/ev-view.c index 98374dbe..cf00d82c 100644 --- a/shell/ev-view.c +++ b/shell/ev-view.c @@ -151,6 +151,10 @@ static void get_bounding_box_size (EvView *view, int *max_height); static void view_update_range_and_current_page (EvView *view); +static void page_changed_cb (EvPageCache *page_cache, + int new_page, + EvView *view); + G_DEFINE_TYPE (EvView, ev_view, GTK_TYPE_WIDGET) @@ -224,13 +228,13 @@ view_set_adjustment_values (EvView *view, static void view_update_range_and_current_page (EvView *view) { - /* Presentation trumps all other modes */ if (view->presentation) { view->start_page = view->current_page; view->end_page = view->current_page; } else if (view->continuous) { GdkRectangle current_area, unused, page_area; + gint current_page; gboolean found = FALSE; int i; @@ -259,6 +263,7 @@ view_update_range_and_current_page (EvView *view) if (! found) { view->start_page = i; found = TRUE; + } view->end_page = i; } else if (found) { @@ -275,6 +280,14 @@ view_update_range_and_current_page (EvView *view) page_area.y += page_area.height + view->spacing; } } + + current_page = ev_page_cache_get_current_page (view->page_cache); + + if (current_page < view->start_page || current_page > view->end_page) { + g_signal_handlers_block_by_func (view->page_cache, page_changed_cb, view); + ev_page_cache_set_current_page (view->page_cache, view->start_page); + g_signal_handlers_unblock_by_func (view->page_cache, page_changed_cb, view); + } } else { if (view->dual_page) { if (view->current_page % 2 == 0) { @@ -294,7 +307,7 @@ view_update_range_and_current_page (EvView *view) ev_pixbuf_cache_set_page_range (view->pixbuf_cache, view->start_page, view->end_page, - view->scale); + view->scale); } /*** Virtual function implementations ***/ diff --git a/shell/ev-window.c b/shell/ev-window.c index 9f18753f..ad2e19a9 100644 --- a/shell/ev-window.c +++ b/shell/ev-window.c @@ -1996,11 +1996,16 @@ ev_window_dispose (GObject *object) priv->action_group = NULL; } + if (priv->page_cache) { + g_signal_handlers_disconnect_by_func (priv->page_cache, page_changed_cb, window); + priv->page_cache = NULL; + } + if (priv->document) { g_object_unref (priv->document); priv->document = NULL; } - + if (priv->view) { g_object_unref (priv->view); priv->view = NULL; -- 2.43.5