Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/shell
diff options
context:
space:
mode:
Diffstat (limited to 'shell')
-rw-r--r--shell/ev-application.c24
-rw-r--r--shell/ev-daemon.c40
2 files changed, 43 insertions, 21 deletions
diff --git a/shell/ev-application.c b/shell/ev-application.c
index 050b396..454a2ee 100644
--- a/shell/ev-application.c
+++ b/shell/ev-application.c
@@ -332,6 +332,22 @@ ev_application_get_empty_window (EvApplication *application,
#ifdef ENABLE_DBUS
+/*
+ * ev_application_register_uri:
+ * @application:
+ * @uri:
+ * @screen:
+ * @dest:
+ * @mode:
+ * @search_string:
+ * @timestamp:
+ *
+ * Registers @uri with evince-daemon.
+ *
+ * Returns: %TRUE to continue by opening @uri in this instance,
+ * or %FALSE if the request was forwarded to an existing evince
+ * instance for @uri
+ */
static gboolean
ev_application_register_uri (EvApplication *application,
const gchar *uri,
@@ -369,7 +385,10 @@ ev_application_register_uri (EvApplication *application,
g_variant_get (value, "(&s)", &owner);
- if (owner[0] != ':') {
+ /* This means that the document wasn't already registered; go
+ * ahead with opening it.
+ */
+ if (owner[0] == '\0') {
g_variant_unref (value);
return TRUE;
}
@@ -416,8 +435,9 @@ ev_application_register_uri (EvApplication *application,
NULL,
&error);
if (value2 == NULL) {
- g_warning ("%s", error->message);
+ g_warning ("Failed to OpenURI: %s", error->message);
g_error_free (error);
+ return FALSE;
}
g_variant_unref (value);
diff --git a/shell/ev-daemon.c b/shell/ev-daemon.c
index b304dfc..b30238a 100644
--- a/shell/ev-daemon.c
+++ b/shell/ev-daemon.c
@@ -254,28 +254,30 @@ method_call_cb (GDBusConnection *connection,
g_variant_get (parameters, "(&s)", &uri);
doc = ev_daemon_find_doc (uri);
- if (doc == NULL) {
- ev_daemon_stop_killtimer ();
-
- doc = g_new (EvDoc, 1);
- doc->dbus_name = g_strdup (sender);
- doc->uri = g_strdup (uri);
-
- doc->watch_id = g_bus_watch_name (G_BUS_TYPE_STARTER,
- sender,
- G_BUS_NAME_WATCHER_FLAGS_NONE,
- name_appeared_cb,
- name_vanished_cb,
- user_data, NULL);
-
- LOG ("RegisterDocument registered owner '%s' for URI '%s'\n", doc->dbus_name, uri);
- ev_daemon_docs = g_list_prepend (ev_daemon_docs, doc);
- } else {
+ if (doc != NULL) {
LOG ("RegisterDocument found owner '%s' for URI '%s'\n", doc->dbus_name, uri);
+ g_dbus_method_invocation_return_value (invocation,
+ g_variant_new ("(s)", doc->dbus_name));
+ return;
}
+
+ ev_daemon_stop_killtimer ();
+
+ doc = g_new (EvDoc, 1);
+ doc->dbus_name = g_strdup (sender);
+ doc->uri = g_strdup (uri);
+
+ doc->watch_id = g_bus_watch_name (G_BUS_TYPE_STARTER,
+ sender,
+ G_BUS_NAME_WATCHER_FLAGS_NONE,
+ name_appeared_cb,
+ name_vanished_cb,
+ user_data, NULL);
+
+ LOG ("RegisterDocument registered owner '%s' for URI '%s'\n", doc->dbus_name, uri);
+ ev_daemon_docs = g_list_prepend (ev_daemon_docs, doc);
- g_dbus_method_invocation_return_value (invocation,
- g_variant_new ("(s)", doc->dbus_name));
+ g_dbus_method_invocation_return_value (invocation, g_variant_new ("(s)", ""));
return;
} else if (g_strcmp0 (method_name, "UnregisterDocument") == 0) {