Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/shell/main.c
diff options
context:
space:
mode:
authorCarlos Garcia Campos <carlosgc@gnome.org>2010-04-01 11:02:18 (GMT)
committer Carlos Garcia Campos <carlosgc@gnome.org>2010-04-01 11:02:18 (GMT)
commit0dc06cb6a9a123ab2e15cff3dfbabb5e033dd26f (patch)
treee0a17290322336aacfc160c1b6e1b25e4b956297 /shell/main.c
parent80aa207c49dda77a013f0df2a2e2a393062a96b6 (diff)
[shell] Add command line option to open document at a given page index
Based on patch by Daniel M. German. Fixes bug #613449.
Diffstat (limited to 'shell/main.c')
-rw-r--r--shell/main.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/shell/main.c b/shell/main.c
index 2b926c9..078b421 100644
--- a/shell/main.c
+++ b/shell/main.c
@@ -54,6 +54,7 @@
static gchar *ev_page_label;
static gchar *ev_find_string;
+static gint ev_page_index = 0;
static gboolean preview_mode = FALSE;
static gboolean fullscreen_mode = FALSE;
static gboolean presentation_mode = FALSE;
@@ -61,6 +62,7 @@ static gboolean unlink_temp_file = FALSE;
static gchar *print_settings;
static const char **file_arguments = NULL;
+
static gboolean
option_version_cb (const gchar *option_name,
const gchar *value,
@@ -75,7 +77,8 @@ option_version_cb (const gchar *option_name,
static const GOptionEntry goption_options[] =
{
- { "page-label", 'p', 0, G_OPTION_ARG_STRING, &ev_page_label, N_("The page of the document to display."), N_("PAGE")},
+ { "page-label", 'p', 0, G_OPTION_ARG_STRING, &ev_page_label, N_("The page label of the document to display."), N_("PAGE")},
+ { "page-index", 'i', 0, G_OPTION_ARG_INT, &ev_page_index, N_("The page number of the document to display."), N_("NUMBER")},
{ "fullscreen", 'f', 0, G_OPTION_ARG_NONE, &fullscreen_mode, N_("Run evince in fullscreen mode"), NULL },
{ "presentation", 's', 0, G_OPTION_ARG_NONE, &presentation_mode, N_("Run evince in presentation mode"), NULL },
{ "preview", 'w', 0, G_OPTION_ARG_NONE, &preview_mode, N_("Run evince as a previewer"), NULL },
@@ -159,6 +162,8 @@ load_files (const char **files)
if (ev_page_label)
global_dest = ev_link_dest_new_page_label (ev_page_label);
+ else if (ev_page_index)
+ global_dest = ev_link_dest_new_page (MAX (0, ev_page_index - 1));
if (fullscreen_mode)
mode = EV_WINDOW_MODE_FULLSCREEN;