]> www.fi.muni.cz Git - evince.git/commitdiff
Send page dest as int to other evince instances when -i switch is used
authorCarlos Garcia Campos <carlosgc@gnome.org>
Sat, 30 Apr 2011 11:40:02 +0000 (13:40 +0200)
committerCarlos Garcia Campos <carlosgc@gnome.org>
Sat, 30 Apr 2011 11:40:02 +0000 (13:40 +0200)
Fixes bug #647138.

shell/ev-application.c

index 2fc9030e7832abc309ebd2c6c0e1dd0d347b520e..bf828a61d51887df2ffcc5c389b213ac658504a3 100644 (file)
@@ -469,9 +469,17 @@ on_register_uri_cb (GObject      *source_object,
                                "screen",
                                g_variant_new_int32 (gdk_screen_get_number (data->screen)));
        if (data->dest) {
-                g_variant_builder_add (&builder, "{sv}",
-                                       "page-label",
-                                       g_variant_new_string (ev_link_dest_get_page_label (data->dest)));
+                const gchar *page_label = ev_link_dest_get_page_label (data->dest);
+
+                if (page_label) {
+                        g_variant_builder_add (&builder, "{sv}",
+                                               "page-label",
+                                               g_variant_new_string (page_label));
+                } else {
+                        g_variant_builder_add (&builder, "{sv}",
+                                               "page-index",
+                                               g_variant_new_uint32 (ev_link_dest_get_page (data->dest)));
+                }
        }
        if (data->search_string) {
                 g_variant_builder_add (&builder, "{sv}",
@@ -776,6 +784,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, "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) {
                                search_string = g_variant_get_string (value, NULL);
                        }