Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evince/ChangeLog,v
retrieving revision 1.331
diff -u -r1.331 ChangeLog
--- ChangeLog	23 Apr 2005 17:13:39 -0000	1.331
+++ ChangeLog	23 Apr 2005 19:07:22 -0000
@@ -1,3 +1,8 @@
+2005-04-23  James Bowes  <bowes@cs.dal.ca>
+
+	* shell/main.c: (load_files): Add --page command-line option,
+	to open to a specified page number or label. Fixes bug #170458
+
 Sat Apr 23 13:13:04 2005  Jonathan Blandford  <jrb@redhat.com>
 
 	* TODO:
Index: shell/ev-window.c
===================================================================
RCS file: /cvs/gnome/evince/shell/ev-window.c,v
retrieving revision 1.114
diff -u -r1.114 ev-window.c
--- shell/ev-window.c	23 Apr 2005 17:13:40 -0000	1.114
+++ shell/ev-window.c	23 Apr 2005 19:07:22 -0000
@@ -390,11 +390,12 @@
 }
 
 void
-ev_window_open_page (EvWindow *ev_window, int page)
+ev_window_open_page_label (EvWindow   *ev_window, 
+			   const char *label)
 {
 	if (ev_window->priv->page_cache) {
-	    page = CLAMP (page, 0, ev_page_cache_get_n_pages (ev_window->priv->page_cache));
-	    ev_page_cache_set_current_page (ev_window->priv->page_cache, page);
+		ev_page_cache_set_page_label (ev_window->priv->page_cache, 
+					      label);
 	}
 }
 
@@ -1584,7 +1585,11 @@
 	uri = g_strdup (ev_window->priv->uri);
 
 	ev_window_open (ev_window, uri);
-	ev_window_open_page (ev_window, page);
+
+	/* In case the number of pages in the document has changed. */
+	page = CLAMP (page, 0, ev_page_cache_get_n_pages (ev_window->priv->page_cache));
+
+	ev_page_cache_set_current_page (ev_window->priv->page_cache, page);
 
 	g_free (uri);
 }
Index: shell/ev-window.h
===================================================================
RCS file: /cvs/gnome/evince/shell/ev-window.h,v
retrieving revision 1.6
diff -u -r1.6 ev-window.h
--- shell/ev-window.h	16 Apr 2005 22:54:22 -0000	1.6
+++ shell/ev-window.h	23 Apr 2005 19:07:22 -0000
@@ -50,12 +50,12 @@
 	GtkWindowClass		base_class;
 };
 
-GType		ev_window_get_type	(void);
-void		ev_window_open		(EvWindow       *ev_window,
-					 const char     *uri);
-void		ev_window_open_page	(EvWindow       *ev_window,
-					 int             page);
-gboolean	ev_window_is_empty	(const EvWindow *ev_window);
+GType		ev_window_get_type		(void);
+void		ev_window_open			(EvWindow	*ev_window,
+						 const char	*uri);
+void		ev_window_open_page_label	(EvWindow       *ev_window, 
+						 const char     *label);
+gboolean	ev_window_is_empty		(const EvWindow *ev_window);
 
 G_END_DECLS
 
Index: shell/main.c
===================================================================
RCS file: /cvs/gnome/evince/shell/main.c,v
retrieving revision 1.11
diff -u -r1.11 main.c
--- shell/main.c	9 Apr 2005 11:26:38 -0000	1.11
+++ shell/main.c	23 Apr 2005 19:07:22 -0000
@@ -33,8 +33,11 @@
 #include "ev-debug.h"
 #include "ev-job-queue.h"
 
+char *page_label;
+
 static struct poptOption popt_options[] =
 {
+	{ "page-label", 'p', POPT_ARG_STRING, &page_label, 0, N_("The page of the document to display."), N_("PAGE")},
 	{ NULL, 0, 0, NULL, 0, NULL, NULL }
 };
 
@@ -58,9 +61,14 @@
 		window = GTK_WIDGET (ev_application_new_window (EV_APP));
 		gtk_widget_show (window);
 		ev_window_open (EV_WINDOW (window), uri);
+		
+		if (page_label != NULL)
+			ev_window_open_page_label (EV_WINDOW (window), page_label);
 
 		g_free (uri);
         }
+
+	g_free (page_label);
 }
 
 int
