diff options
author | David Liang <liangchanye@gmail.com> | 2014-06-07 13:58:28 -0500 |
---|---|---|
committer | Mike Gorse <mgorse@suse.com> | 2014-06-07 13:58:28 -0500 |
commit | 09854f7a6d7f7b89f415e5f6ffb8beeb70ce1af4 (patch) | |
tree | 2f022cfd2a10b34868f1a75ada5988fae193c2ce | |
parent | 6e96231f7e9f60d1b4d241c3ee670248e834ad69 (diff) | |
download | at-spi2-core-09854f7a6d7f7b89f415e5f6ffb8beeb70ce1af4.tar.gz |
Ensure that we register with the session manager only once
https://bugzilla.gnome.org/show_bug.cgi?id=728934
-rw-r--r-- | registryd/registry-main.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/registryd/registry-main.c b/registryd/registry-main.c index d7556c8a..d8b5dc58 100644 --- a/registryd/registry-main.c +++ b/registryd/registry-main.c @@ -77,12 +77,27 @@ on_session_signal (GDBusProxy *proxy, static gboolean session_manager_connect (void) { + GVariant *res; + gboolean is_running; sm_proxy = g_dbus_proxy_new_for_bus_sync (G_BUS_TYPE_SESSION, 0, NULL, SM_DBUS_NAME, SM_DBUS_PATH, SM_DBUS_INTERFACE, NULL, NULL); + res = g_dbus_proxy_call_sync (sm_proxy, + "IsSessionRunning", NULL, + 0, 1000, NULL, NULL); + + if (res) { + g_variant_get (res, "(b)", &is_running); + g_variant_unref (res); + if (is_running) { + if (!register_client ()) + g_warning ("Unable to register client with session manager"); + } + } + g_signal_connect (G_OBJECT (sm_proxy), "g-signal", G_CALLBACK (on_session_signal), NULL); @@ -141,6 +156,9 @@ register_client (void) const char *startup_id; const char *app_id; + if (client_proxy) + return TRUE; + startup_id = g_getenv ("DESKTOP_AUTOSTART_ID"); if (!startup_id) startup_id = ""; |