[gdm/wip/xserver-in-session: 9/9] gdm-x-session: register display if successfully started



commit d5346dfccaf9f0eed69e8e120b8f2ffc83bdcc19
Author: Ray Strode <rstrode redhat com>
Date:   Fri Feb 13 16:46:39 2015 -0500

    gdm-x-session: register display if successfully started
    
    Now that GDM has a way of notifying display success,
    use it in the wrapper.

 utils/gdm-x-session.c |   52 +++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 52 insertions(+), 0 deletions(-)
---
diff --git a/utils/gdm-x-session.c b/utils/gdm-x-session.c
index 3e8a24f..0c807d2 100644
--- a/utils/gdm-x-session.c
+++ b/utils/gdm-x-session.c
@@ -440,6 +440,50 @@ wait_on_subprocesses (State *state)
         }
 }
 
+static gboolean
+register_display (State        *state,
+                  GCancellable *cancellable)
+{
+        GDBusConnection *bus_connection;
+        GVariant        *reply;
+        GError          *error = NULL;
+        gboolean         registered = FALSE;
+
+        bus_connection = g_bus_get_sync (G_BUS_TYPE_SYSTEM,
+                                         cancellable,
+                                         &error);
+
+        if (!bus_connection) {
+                g_debug ("could not get system bus connection: %s", error->message);
+                g_error_free (error);
+                goto out;
+        }
+
+        reply = g_dbus_connection_call_sync (bus_connection,
+                                             "org.gnome.DisplayManager",
+                                             "/org/gnome/DisplayManager/Manager",
+                                             "org.gnome.DisplayManager.Manager",
+                                             "RegisterX11Display",
+                                             g_variant_new ("(s)", state->display_name),
+                                             NULL,
+                                             G_DBUS_CALL_FLAGS_NONE,
+                                             -1,
+                                             cancellable,
+                                             &error);
+
+        if (reply == NULL) {
+                g_debug ("Could not register display: %s", error->message);
+                g_error_free (error);
+                goto out;
+        }
+
+        registered = TRUE;
+
+out:
+        g_clear_object (&bus_connection);
+        return registered;
+}
+
 static void
 init_state (State **state)
 {
@@ -541,6 +585,14 @@ main (int    argc,
                 goto out;
         }
 
+        ret = register_display (state, state->cancellable);
+
+        if (!ret) {
+                g_printerr ("Unable to register display with display manager");
+                exit_status = EX_SOFTWARE;
+                goto out;
+        }
+
         ret = spawn_session (state, run_script, state->cancellable);
 
         if (!ret) {


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