summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorraveit65 <[email protected]>2016-07-14 09:36:07 +0200
committerraveit65 <[email protected]>2016-07-22 15:23:49 +0200
commitb0ec3f2702050fdbbb33e07f64dd518828d05883 (patch)
tree6c9e569f21be5e4a04308a45294fb49a528e77db
parentb63e414f8650d7c02db65c825dddd638e2fbb247 (diff)
downloadatril-b0ec3f2702050fdbbb33e07f64dd518828d05883.tar.bz2
atril-b0ec3f2702050fdbbb33e07f64dd518828d05883.tar.xz
Add --named-dest command line argument
and add spawn and dbus support for named destinations taken from: https://git.gnome.org/browse/evince/commit/?id=a90e764 https://git.gnome.org/browse/evince/commit/?id=26c0109
-rw-r--r--shell/ev-application.c10
-rw-r--r--shell/main.c4
2 files changed, 14 insertions, 0 deletions
diff --git a/shell/ev-application.c b/shell/ev-application.c
index c008f57c..c1bf42f5 100644
--- a/shell/ev-application.c
+++ b/shell/ev-application.c
@@ -236,6 +236,10 @@ ev_spawn (const char *uri,
g_string_append_printf (cmd, " --page-index=%d",
ev_link_dest_get_page (dest) + 1);
break;
+ case EV_LINK_DEST_TYPE_NAMED:
+ g_string_append_printf (cmd, " --named-dest=%s",
+ ev_link_dest_get_named_dest (dest));
+ break;
default:
break;
}
@@ -454,6 +458,10 @@ on_register_uri_cb (GObject *source_object,
g_variant_builder_add (&builder, "{sv}", "page-index",
g_variant_new_uint32 (ev_link_dest_get_page (data->dest)));
break;
+ case EV_LINK_DEST_TYPE_NAMED:
+ g_variant_builder_add (&builder, "{sv}", "named-dest",
+ g_variant_new_string (ev_link_dest_get_named_dest (data->dest)));
+ break;
default:
break;
}
@@ -749,6 +757,8 @@ method_call_cb (GDBusConnection *connection,
mode = g_variant_get_uint32 (value);
} else if (strcmp (key, "page-label") == 0 && g_variant_classify (value) == G_VARIANT_CLASS_STRING) {
dest = ev_link_dest_new_page_label (g_variant_get_string (value, NULL));
+ } else if (strcmp (key, "named-dest") == 0 && g_variant_classify (value) == G_VARIANT_CLASS_STRING) {
+ dest = ev_link_dest_new_named (g_variant_get_string (value, NULL));
} else if (strcmp (key, "page-index") == 0 && g_variant_classify (value) == G_VARIANT_CLASS_UINT32) {
dest = ev_link_dest_new_page (g_variant_get_uint32 (value));
} else if (strcmp (key, "find-string") == 0 && g_variant_classify (value) == G_VARIANT_CLASS_STRING) {
diff --git a/shell/main.c b/shell/main.c
index 3d0def7d..eb2df017 100644
--- a/shell/main.c
+++ b/shell/main.c
@@ -40,6 +40,7 @@
static gchar *ev_page_label;
static gchar *ev_find_string;
static gint ev_page_index = 0;
+static gchar *ev_named_dest;
static gboolean preview_mode = FALSE;
static gboolean fullscreen_mode = FALSE;
static gboolean presentation_mode = FALSE;
@@ -65,6 +66,7 @@ static const GOptionEntry goption_options[] =
{ "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 atril in fullscreen mode"), NULL },
+ { "named-dest", 'n', 0, G_OPTION_ARG_STRING, &ev_named_dest, N_("Named destination to display."), N_("DEST")},
{ "presentation", 's', 0, G_OPTION_ARG_NONE, &presentation_mode, N_("Run atril in presentation mode"), NULL },
{ "preview", 'w', 0, G_OPTION_ARG_NONE, &preview_mode, N_("Run atril as a previewer"), NULL },
{ "find", 'l', 0, G_OPTION_ARG_STRING, &ev_find_string, N_("The word or phrase to find in the document"), N_("STRING")},
@@ -171,6 +173,8 @@ load_files (const char **files)
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));
+ else if (ev_named_dest)
+ global_dest = ev_link_dest_new_named (ev_named_dest);
if (fullscreen_mode)
mode = EV_WINDOW_MODE_FULLSCREEN;