[evince] [shell] Make sure to not open a document on the last page



commit ac8a74db7b864b3d9163e130f269fcb34b059ae7
Author: Carlos Garcia Campos <carlosgc gnome org>
Date:   Mon Aug 24 15:53:12 2009 +0200

    [shell] Make sure to not open a document on the last page
    
    It was actually broken since commit 0e064f5e.

 shell/ev-window.c |   21 +++++++--------------
 1 files changed, 7 insertions(+), 14 deletions(-)
---
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);
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]