From ac8a74db7b864b3d9163e130f269fcb34b059ae7 Mon Sep 17 00:00:00 2001 From: Carlos Garcia Campos Date: Mon, 24 Aug 2009 13:53:12 +0000 Subject: [shell] Make sure to not open a document on the last page It was actually broken since commit 0e064f5e. --- diff --git a/shell/ev-window.c b/shell/ev-window.c index b640449..9bd7860 100644 --- a/shell/ev-window.c +++ b/shell/ev-window.c @@ -996,27 +996,20 @@ static void setup_document_from_metadata (EvWindow *window) { gchar *uri = window->priv->uri; - GValue page = { 0, }; + gint page, n_pages; GValue width = { 0, }; GValue height = { 0, }; GValue width_ratio = { 0, }; GValue height_ratio = { 0, }; -#if 0 /* FIXME */ - /* 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 + /* 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 (ev_metadata_manager_get (uri, "page", &page, TRUE)) { - gint n_pages; - gint new_page; - - n_pages = ev_document_get_n_pages (window->priv->document); - new_page = CLAMP (g_value_get_int (&page), 0, n_pages - 1); - ev_document_model_set_page (window->priv->model, new_page); - g_value_unset (&page); - } -#endif + page = ev_document_model_get_page (window->priv->model); + n_pages = ev_document_get_n_pages (window->priv->document); + if (page == n_pages - 1) + ev_document_model_set_page (window->priv->model, 0); setup_sidebar_from_metadata (window); -- cgit v0.9.1