From: Carlos Garcia Campos Date: Sun, 1 Mar 2009 16:28:06 +0000 (+0000) Subject: Do not lose page position when reloading. Fixes bug #573091. X-Git-Tag: EVINCE_2_25_92~9 X-Git-Url: https://www.fi.muni.cz/~kas/git//home/kas/public_html/git/?a=commitdiff_plain;h=0d3ecd2dee49b48a8c2ccf7b59de516987fb3d7f;p=evince.git Do not lose page position when reloading. Fixes bug #573091. 2009-03-01 Carlos Garcia Campos * shell/ev-window.c: (ev_window_set_document), (ev_window_reload_job_cb): Do not lose page position when reloading. Fixes bug #573091. svn path=/trunk/; revision=3503 --- diff --git a/ChangeLog b/ChangeLog index 18be5f66..9a93f802 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2009-03-01 Carlos Garcia Campos + + * shell/ev-window.c: (ev_window_set_document), + (ev_window_reload_job_cb): + + Do not lose page position when reloading. Fixes bug #573091. + 2009-03-01 Carlos Garcia Campos * backend/pdf/ev-poppler.cc: (make_thumbnail_for_page), diff --git a/shell/ev-window.c b/shell/ev-window.c index f950c9b6..455c6a59 100644 --- a/shell/ev-window.c +++ b/shell/ev-window.c @@ -1248,6 +1248,18 @@ ev_window_set_document (EvWindow *ev_window, EvDocument *document) g_signal_connect (ev_window->priv->page_cache, "history-changed", G_CALLBACK (history_changed_cb), ev_window); + if (ev_window->priv->in_reload && ev_window->priv->dest) { + gint page; + + /* Restart the current page */ + page = CLAMP (ev_link_dest_get_page (ev_window->priv->dest), + 0, + ev_page_cache_get_n_pages (ev_window->priv->page_cache) - 1); + ev_page_cache_set_current_page (ev_window->priv->page_cache, page); + g_object_unref (ev_window->priv->dest); + ev_window->priv->dest = NULL; + } + if (ev_page_cache_get_n_pages (ev_window->priv->page_cache) > 0) { ev_view_set_document (view, document); } else { @@ -1486,7 +1498,6 @@ ev_window_reload_job_cb (EvJob *job, EvWindow *ev_window) { GtkWidget *widget; - gint page; if (ev_job_is_failed (job)) { ev_window_clear_reload_job (ev_window); @@ -1498,14 +1509,6 @@ ev_window_reload_job_cb (EvJob *job, } ev_window_set_document (ev_window, job->document); - - /* Restart the current page */ - page = CLAMP (ev_link_dest_get_page (ev_window->priv->dest), - 0, - ev_page_cache_get_n_pages (ev_window->priv->page_cache) - 1); - ev_page_cache_set_current_page (ev_window->priv->page_cache, page); - g_object_unref (ev_window->priv->dest); - ev_window->priv->dest = NULL; /* Restart the search after reloading */ widget = gtk_window_get_focus (GTK_WINDOW (ev_window));