summaryrefslogtreecommitdiff
path: root/daemon/gdm-x-session.c
diff options
context:
space:
mode:
Diffstat (limited to 'daemon/gdm-x-session.c')
-rw-r--r--daemon/gdm-x-session.c42
1 files changed, 39 insertions, 3 deletions
diff --git a/daemon/gdm-x-session.c b/daemon/gdm-x-session.c
index 624f67ca..c01cc5ee 100644
--- a/daemon/gdm-x-session.c
+++ b/daemon/gdm-x-session.c
@@ -378,6 +378,9 @@ spawn_bus (State *state,
GSubprocess *subprocess = NULL;
GInputStream *input_stream = NULL;
GDataInputStream *data_stream = NULL;
+ GDBusConnection *connection = NULL;
+ GVariantBuilder *builder = NULL;
+ GVariant *reply = NULL;
GError *error = NULL;
const char *bus_env = NULL;
char *bus_address_fd_string;
@@ -407,9 +410,6 @@ spawn_bus (State *state,
arguments = g_ptr_array_new ();
launcher = g_subprocess_launcher_new (G_SUBPROCESS_FLAGS_NONE);
- g_subprocess_launcher_setenv (launcher, "DISPLAY", state->display_name, TRUE);
- g_subprocess_launcher_setenv (launcher, "XAUTHORITY", state->auth_file, TRUE);
-
g_subprocess_launcher_take_fd (launcher, pipe_fds[1], BUS_ADDRESS_FILENO);
bus_address_fd_string = g_strdup_printf ("%d", BUS_ADDRESS_FILENO);
@@ -462,6 +462,42 @@ spawn_bus (State *state,
on_bus_finished,
state);
+ connection = g_dbus_connection_new_for_address_sync (state->bus_address,
+ G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_CLIENT |
+ G_DBUS_CONNECTION_FLAGS_MESSAGE_BUS_CONNECTION,
+ NULL,
+ cancellable,
+ &error);
+
+ if (connection == NULL) {
+ g_debug ("could not open connection to session bus: %s",
+ error->message);
+ goto out;
+ }
+
+ g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{ss}"));
+ g_variant_builder_add (&builder, "{ss}", "DISPLAY", state->display_name);
+ g_variant_builder_add (&builder, "{ss}", "XAUTHORITY", state->auth_file);
+
+ reply = g_dbus_connection_call_sync (connection,
+ "org.freedesktop.DBus",
+ "/org/freedesktop/DBus",
+ "org.freedesktop.DBus",
+ "UpdateActivationEnvironment",
+ g_variant_new ("(@a{ss})",
+ g_variant_builder_end (&builder)),
+ NULL,
+ G_DBUS_CALL_FLAGS_NONE,
+ -1, NULL, &error);
+
+ if (reply == NULL) {
+ g_debug ("could not update activation environment: %s", error->message);
+ goto out;
+ }
+
+ g_variant_unref (reply);
+ g_clear_object (&connection);
+
is_running = TRUE;
out:
g_clear_object (&data_stream);