aboutsummaryrefslogtreecommitdiff
path: root/libindicator
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2011-07-12 10:43:45 -0500
committerTed Gould <ted@gould.cx>2011-07-12 10:43:45 -0500
commit5de36e3edb6286f9768ac6aa3c96616b6522efe3 (patch)
tree917229eb308f3521880b9ca4ca788ac593116fe3 /libindicator
parentb412bfe918592d1986743e52d967205395788da3 (diff)
downloadlibayatana-indicator-5de36e3edb6286f9768ac6aa3c96616b6522efe3.tar.gz
libayatana-indicator-5de36e3edb6286f9768ac6aa3c96616b6522efe3.tar.bz2
libayatana-indicator-5de36e3edb6286f9768ac6aa3c96616b6522efe3.zip
In replace mode we need to ask the other guy to shutdown and still wait for the name a bit.
Diffstat (limited to 'libindicator')
-rw-r--r--libindicator/indicator-service.c29
1 files changed, 27 insertions, 2 deletions
diff --git a/libindicator/indicator-service.c b/libindicator/indicator-service.c
index 0e87332..5a15d5e 100644
--- a/libindicator/indicator-service.c
+++ b/libindicator/indicator-service.c
@@ -470,8 +470,33 @@ try_and_get_name_lost_cb (GDBusConnection * connection, const gchar * name, gpoi
g_return_if_fail(connection != NULL);
g_return_if_fail(INDICATOR_IS_SERVICE(user_data));
- g_warning("Name request failed.");
- g_signal_emit(G_OBJECT(user_data), signals[SHUTDOWN], 0, TRUE);
+ IndicatorServicePrivate * priv = INDICATOR_SERVICE_GET_PRIVATE(user_data);
+
+ if (!priv->replace_mode) {
+ g_warning("Name request failed.");
+ g_signal_emit(G_OBJECT(user_data), signals[SHUTDOWN], 0, TRUE);
+ } else {
+ /* If we're in replace mode we can be a little more trickey
+ here. We're going to tell the other guy to shutdown and hope
+ that we get the name. */
+ GDBusMessage * message = NULL;
+ message = g_dbus_message_new_method_call(name,
+ INDICATOR_SERVICE_OBJECT,
+ INDICATOR_SERVICE_INTERFACE,
+ "Shutdown");
+
+ g_dbus_connection_send_message(connection, message, G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
+ g_object_unref(message);
+
+ /* Check to see if we need to clean up a timeout */
+ if (priv->timeout != 0) {
+ g_source_remove(priv->timeout);
+ priv->timeout = 0;
+ }
+
+ /* Set a timeout for no watchers if we can't get the name */
+ priv->timeout = g_timeout_add(priv->timeout_length * 4, timeout_no_watchers, user_data);
+ }
return;
}