Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/shell
diff options
context:
space:
mode:
authorWouter Bolsterlee <wbolster@cvs.gnome.org>2006-12-20 14:03:21 (GMT)
committer Wouter Bolsterlee <wbolster@src.gnome.org>2006-12-20 14:03:21 (GMT)
commit6cc40fe44384df3cb2a6c43b8823d0d940254039 (patch)
treed50000f2530606b940579f2d3a3a51962a937abc /shell
parent9506bc73a25814c59d5206e36ea4330a633f68dc (diff)
Make sure Evince doesn't restore the view on the last page when a document
2006-12-20 Wouter Bolsterlee <wbolster@cvs.gnome.org> * shell/ev-window.c: (setup_document_from_metadata): Make sure Evince doesn't restore the view on the last page when a document is reopened. Fixes bug #383381.
Diffstat (limited to 'shell')
-rw-r--r--shell/ev-window.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/shell/ev-window.c b/shell/ev-window.c
index 2aaff16..9eac43f 100644
--- a/shell/ev-window.c
+++ b/shell/ev-window.c
@@ -664,10 +664,18 @@ setup_document_from_metadata (EvWindow *window)
{
char *uri = window->priv->uri;
GValue page = { 0, };
+ gint n_pages;
gint new_page;
+ /* View the previously shown page, but make sure to not open a document on
+ * the last page, since closing it on the last page most likely means the
+ * user was finished reading the document. In that case, reopening should
+ * show the first page. */
if (uri && ev_metadata_manager_get (uri, "page", &page, TRUE)) {
- new_page = CLAMP (g_value_get_int (&page), 0, ev_page_cache_get_n_pages (window->priv->page_cache) - 1);
+ n_pages = ev_page_cache_get_n_pages (window->priv->page_cache);
+ new_page = CLAMP (g_value_get_int (&page), 0, n_pages - 1);
+ if (new_page == n_pages - 1)
+ new_page = 0;
ev_page_cache_set_current_page (window->priv->page_cache,
new_page);
g_value_unset (&page);