]> www.fi.muni.cz Git - evince.git/commitdiff
Fix crash on exit and scrolling to page
authorNickolay V. Shmyrev <nshmyrev@src.gnome.org>
Sat, 23 Apr 2005 21:49:12 +0000 (21:49 +0000)
committerNickolay V. Shmyrev <nshmyrev@src.gnome.org>
Sat, 23 Apr 2005 21:49:12 +0000 (21:49 +0000)
ChangeLog
shell/ev-view.c

index a0596cd03483ee0b856d88a8d99db008c177b6c0..e6924ddd2445eafb773fc5924f064a23b20ddc77 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2005-04-24  Nickolay V. Shmyrev  <nshmyrev@yandex.ru>
+
+       * shell/ev-view.c: (view_update_range_and_current_page),
+       (page_changed_cb):
+       
+       Fix crash on exit and scrolling to page in continuous view.
+
 Sat Apr 23 13:13:04 2005  Jonathan Blandford  <jrb@redhat.com>
 
        * TODO:
index 663c3bfca42b78c75c7d9c1e2c433151335dd0b1..07a71ead20aca43ec66f1d267df493ab3d398b30 100644 (file)
@@ -233,16 +233,27 @@ view_update_range_and_current_page (EvView *view)
                GdkRectangle current_area, unused, page_area;
                gboolean found = FALSE;
                int i;
-
-               current_area.x = view->hadjustment->value;
-               current_area.width = view->hadjustment->page_size;
-               current_area.y = view->vadjustment->value;
-               current_area.height = view->vadjustment->page_size;
-
+               
                get_bounding_box_size (view, &(page_area.width), &(page_area.height));
                page_area.x = view->spacing;
                page_area.y = view->spacing;
 
+               if (view->hadjustment) {
+                       current_area.x = view->hadjustment->value;
+                       current_area.width = view->hadjustment->page_size;
+               } else {
+                       current_area.x = page_area.x;
+                       current_area.width = page_area.width;
+               }
+
+               if (view->vadjustment) {
+                       current_area.y = view->vadjustment->value;
+                       current_area.height = view->vadjustment->page_size;
+               } else {
+                       current_area.y = page_area.y;
+                       current_area.height = page_area.height;
+               }
+
                for (i = 0; i < ev_page_cache_get_n_pages (view->page_cache); i++) {
                        if (gdk_rectangle_intersect (&current_area, &page_area, &unused)) {
                                if (! found) {
@@ -1872,6 +1883,7 @@ page_changed_cb (EvPageCache *page_cache,
        int old_page = view->current_page;
        int old_width, old_height;
        int new_width, new_height;
+       int max_height, n_rows;
 
        if (old_page == new_page)
                return;
@@ -1895,9 +1907,21 @@ page_changed_cb (EvPageCache *page_cache,
                gtk_widget_queue_resize (GTK_WIDGET (view));
        else
                gtk_widget_queue_draw (GTK_WIDGET (view));
-
-       gtk_adjustment_set_value (view->vadjustment,
-                                 view->vadjustment->lower);
+       
+       if (view->continuous) {
+               
+               n_rows = view->dual_page ? new_page / 2 : new_page;
+               
+               get_bounding_box_size (view, NULL, &max_height);
+
+               gtk_adjustment_clamp_page(view->vadjustment,
+                                         (max_height + view->spacing) * n_rows, 
+                                         (max_height + view->spacing) * n_rows +
+                                          view->vadjustment->page_size);
+       } else {
+               gtk_adjustment_set_value (view->vadjustment,
+                                         view->vadjustment->lower);
+       }
 
        if (EV_IS_DOCUMENT_FIND (view->document)) {
                view->find_page = new_page;