]> www.fi.muni.cz Git - evince.git/commitdiff
[libview] Keep scroll position when reloading
authorCarlos Garcia Campos <carlosgc@gnome.org>
Mon, 23 Nov 2009 13:22:37 +0000 (14:22 +0100)
committerCarlos Garcia Campos <carlosgc@gnome.org>
Mon, 23 Nov 2009 13:22:37 +0000 (14:22 +0100)
Fixes bgo#602445.

libview/ev-view.c

index 8c59ec8157a7e41ae7b98634babf70960fc2fad0..36b459ce1916ebed814776a8364679746edab1fd 100644 (file)
@@ -5164,6 +5164,8 @@ ev_view_document_changed_cb (EvDocumentModel *model,
        view->loading = FALSE;
 
        if (document != view->document) {
+               gint current_page;
+
                clear_caches (view);
 
                if (view->document) {
@@ -5178,9 +5180,13 @@ ev_view_document_changed_cb (EvDocumentModel *model,
                        setup_caches (view);
                 }
 
-               ev_view_change_page (view,
-                                    ev_document_model_get_page (model),
-                                    TRUE);
+               current_page = ev_document_model_get_page (model);
+               if (view->current_page != current_page) {
+                       ev_view_change_page (view, current_page, TRUE);
+               } else {
+                       view->pending_scroll = SCROLL_TO_KEEP_POSITION;
+                       gtk_widget_queue_resize (GTK_WIDGET (view));
+               }
        }
 }