diff options
author | Christian Persch <chpe@gnome.org> | 2010-05-10 12:52:46 (GMT) |
---|---|---|
committer | Carlos Garcia Campos <carlosgc@gnome.org> | 2010-05-25 07:38:30 (GMT) |
commit | 5bd752a3831fbb99cdcef0055707bd624fb9e30c (patch) | |
tree | cbddaed4b3b296b397e62ec4851868af751c8fde /shell/ev-daemon.c | |
parent | c4589297f7b7f7813c9b3e62ef678dfa5a5f5190 (diff) |
[daemon] Return "" from RegisterDocument on new documents
So we can distinguish this case in ev_application_register_uri().
Diffstat (limited to 'shell/ev-daemon.c')
-rw-r--r-- | shell/ev-daemon.c | 40 |
1 files changed, 21 insertions, 19 deletions
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) { |