[evince] Send page dest as int to other evince instances when -i switch is used



commit 2faf7d9668abe843e8688fa928a4d52d7df92879
Author: Carlos Garcia Campos <carlosgc gnome org>
Date:   Sat Apr 30 13:40:02 2011 +0200

    Send page dest as int to other evince instances when -i switch is used
    
    Fixes bug #647138.

 shell/ev-application.c |   16 +++++++++++++---
 1 files changed, 13 insertions(+), 3 deletions(-)
---
diff --git a/shell/ev-application.c b/shell/ev-application.c
index 2fc9030..bf828a6 100644
--- a/shell/ev-application.c
+++ b/shell/ev-application.c
@@ -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);
 			}



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]