summaryrefslogtreecommitdiff
path: root/bus
diff options
context:
space:
mode:
authorAlberts Muktupāvels <alberts.muktupavels@gmail.com>2015-09-15 19:31:52 +0300
committerMike Gorse <mgorse@suse.com>2016-01-26 08:03:58 -0600
commitd2004dbb0d0903548f734029718ee5bf212d107c (patch)
treed06dfe778e94eec38d22bbbd9775065b0cd58293 /bus
parentf9bd5d01b82497f46bee26845e0f628ad483d6e8 (diff)
downloadat-spi2-core-d2004dbb0d0903548f734029718ee5bf212d107c.tar.gz
at-spi-bus-launcher: register with session manager
This application is started in Initialization phase. In this phase it is required to register with session manager. See: https://wiki.gnome.org/Projects/SessionManagement/NewGnomeSession https://bugzilla.gnome.org/show_bug.cgi?id=753931
Diffstat (limited to 'bus')
-rw-r--r--bus/at-spi-bus-launcher.c73
1 files changed, 72 insertions, 1 deletions
diff --git a/bus/at-spi-bus-launcher.c b/bus/at-spi-bus-launcher.c
index b6bd8e84..6df220ec 100644
--- a/bus/at-spi-bus-launcher.c
+++ b/bus/at-spi-bus-launcher.c
@@ -76,6 +76,76 @@ static const gchar introspection_xml[] =
static GDBusNodeInfo *introspection_data = NULL;
static void
+register_client (A11yBusLauncher *app)
+{
+ GDBusProxyFlags flags;
+ GDBusProxy *sm_proxy;
+ GError *error;
+ const gchar *app_id;
+ const gchar *autostart_id;
+ gchar *client_startup_id;
+ GVariant *parameters;
+ GVariant *variant;
+ gchar *object_path;
+
+ flags = G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES |
+ G_DBUS_PROXY_FLAGS_DO_NOT_CONNECT_SIGNALS;
+
+ error = NULL;
+ sm_proxy = g_dbus_proxy_new_sync (app->session_bus, flags, NULL,
+ "org.gnome.SessionManager",
+ "/org/gnome/SessionManager",
+ "org.gnome.SessionManager",
+ NULL, &error);
+
+ if (error != NULL)
+ {
+ g_warning ("Failed to get session manager proxy: %s", error->message);
+ g_error_free (error);
+
+ return;
+ }
+
+ app_id = "at-spi-bus-launcher";
+ autostart_id = g_getenv ("DESKTOP_AUTOSTART_ID");
+
+ if (autostart_id != NULL)
+ {
+ client_startup_id = g_strdup (autostart_id);
+ g_unsetenv ("DESKTOP_AUTOSTART_ID");
+ }
+ else
+ {
+ client_startup_id = g_strdup ("");
+ }
+
+ parameters = g_variant_new ("(ss)", app_id, client_startup_id);
+ g_free (client_startup_id);
+
+ error = NULL;
+ variant = g_dbus_proxy_call_sync (sm_proxy,
+ "RegisterClient", parameters,
+ G_DBUS_CALL_FLAGS_NONE,
+ -1, NULL, &error);
+
+ g_object_unref (sm_proxy);
+
+ if (error != NULL)
+ {
+ g_warning ("Failed to register client: %s", error->message);
+ g_error_free (error);
+
+ return;
+ }
+
+ g_variant_get (variant, "(o)", &object_path);
+ g_variant_unref (variant);
+
+ g_debug ("Client registered - %s", object_path);
+ g_free (object_path);
+}
+
+static void
setup_bus_child (gpointer data)
{
A11yBusLauncher *app = data;
@@ -454,7 +524,8 @@ on_name_acquired (GDBusConnection *connection,
gpointer user_data)
{
A11yBusLauncher *app = user_data;
- (void) app;
+
+ register_client (app);
}
static int sigterm_pipefd[2];