]> www.fi.muni.cz Git - evince.git/commitdiff
Update current page while scrolling in continuous mode
authorNickolay V. Shmyrev <nshmyrev@src.gnome.org>
Wed, 27 Apr 2005 22:58:24 +0000 (22:58 +0000)
committerNickolay V. Shmyrev <nshmyrev@src.gnome.org>
Wed, 27 Apr 2005 22:58:24 +0000 (22:58 +0000)
CVSr ----------------------------------------------------------------------

ChangeLog
shell/ev-page-action.c
shell/ev-view.c
shell/ev-window.c

index eeec3943a1fecd1c7eefca455a7ea7521e5c5a76..b689d1864afc7b93ade5e4a64271c19de1aa02ab 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2005-04-28  Nickolay V. Shmyrev  <nshmyrev@yandex.ru>
+
+       * 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 <mpg@redhat.com>
 
        * configure.ac:
index 18415a3675be8c381b1caab35ccf4d4ef2b2f9fb..e378d306003f8d0deb26f01b024b48f5c7b7d2c2 100644 (file)
@@ -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;
        }
index 98374dbe294509004e148722ff93b703d840f48e..cf00d82ce198bc9689475cd0e579045cd9f847e5 100644 (file)
@@ -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 ***/
index 9f18753f38e26d651e66c8a06106b8b2b7d795fb..ad2e19a9f9dde0148c8d9f63e76ef211c7b298b1 100644 (file)
@@ -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;