[gdm] gdm-wayland-session: keep connection to session bus alive



commit 15c84a4f7d966d3062e33326f1433280941145d0
Author: Ray Strode <rstrode redhat com>
Date:   Thu Aug 25 14:04:02 2016 -0400

    gdm-wayland-session: keep connection to session bus alive
    
    This makes it behave more like gdm-x-session. Also, we're
    going to need the connection in a minute.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=736660

 daemon/gdm-wayland-session.c |   23 ++++++++++++++++++++---
 1 files changed, 20 insertions(+), 3 deletions(-)
---
diff --git a/daemon/gdm-wayland-session.c b/daemon/gdm-wayland-session.c
index 6f77741..149eb8a 100644
--- a/daemon/gdm-wayland-session.c
+++ b/daemon/gdm-wayland-session.c
@@ -42,8 +42,10 @@ typedef struct
 {
         GdmSettings  *settings;
         GCancellable *cancellable;
-        GSubprocess  *bus_subprocess;
-        char         *bus_address;
+
+        GSubprocess     *bus_subprocess;
+        GDBusConnection *bus_connection;
+        char            *bus_address;
 
         GSubprocess  *session_subprocess;
         char         *session_command;
@@ -112,7 +114,7 @@ spawn_bus (State        *state,
 
         if (bus_connection != NULL) {
                 g_debug ("session message bus already running, not starting another one");
-                g_clear_object (&bus_connection);
+                state->bus_connection = bus_connection;
                 return TRUE;
         }
 
@@ -177,6 +179,20 @@ spawn_bus (State        *state,
                                  on_bus_finished,
                                  state);
 
+        bus_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 (bus_connection == NULL) {
+                g_debug ("could not open connection to session bus: %s",
+                         error->message);
+                goto out;
+        }
+
+        state->bus_connection = bus_connection;
         is_running = TRUE;
 out:
         g_clear_object (&data_stream);
@@ -349,6 +365,7 @@ clear_state (State **out_state)
         State *state = *out_state;
 
         g_clear_object (&state->cancellable);
+        g_clear_object (&state->bus_connection);
         g_clear_object (&state->session_subprocess);
         g_clear_pointer (&state->main_loop, g_main_loop_unref);
         *out_state = NULL;


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