+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.
+
2006-12-18 Jens Granseuer <jensgr@gmx.net>
* shell/ev-view.c: (draw_loading_text):
{
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);