[at-spi2-core] Ensure that we register with the session manager only once



commit 09854f7a6d7f7b89f415e5f6ffb8beeb70ce1af4
Author: David Liang <liangchanye gmail com>
Date:   Sat Jun 7 13:58:28 2014 -0500

    Ensure that we register with the session manager only once
    
    https://bugzilla.gnome.org/show_bug.cgi?id=728934

 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 d7556c8..d8b5dc5 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 = "";


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