[gdm/wip/xserver-in-session: 37/54] manager: add way for displays to register themselves



commit 1a24885c9f82098846af9941144c07b43f9a1b43
Author: Ray Strode <rstrode redhat com>
Date:   Fri Feb 13 13:41:16 2015 -0500

    manager: add way for displays to register themselves
    
    The plan is to start the X server implicitly as part
    of starting the session. Once we do that, we'll need
    some way to communicate that the X server started
    successfully.
    
    This commit adds a RegisterX11Display method to GdmManager
    to handle that.

 daemon/gdm-manager.c   |   34 ++++++++++++++++++++++++++++++++++
 daemon/gdm-manager.xml |    3 +++
 2 files changed, 37 insertions(+), 0 deletions(-)
---
diff --git a/daemon/gdm-manager.c b/daemon/gdm-manager.c
index 5e4bbf2..2311484 100644
--- a/daemon/gdm-manager.c
+++ b/daemon/gdm-manager.c
@@ -985,6 +985,39 @@ get_seed_session_for_display (GdmDisplay *display)
 }
 
 static gboolean
+gdm_manager_handle_register_x11_display (GdmDBusManager        *manager,
+                                         GDBusMethodInvocation *invocation,
+                                         const char            *display_name)
+{
+        GdmManager       *self = GDM_MANAGER (manager);
+        const char       *sender;
+        GDBusConnection  *connection;
+        GdmDisplay       *display = NULL;
+
+        g_debug ("GdmManager: trying to register new display");
+
+        sender = g_dbus_method_invocation_get_sender (invocation);
+        connection = g_dbus_method_invocation_get_connection (invocation);
+        get_display_and_details_for_bus_sender (self, connection, sender, &display, NULL, NULL, NULL, NULL, 
NULL, NULL);
+
+        if (display == NULL) {
+                g_dbus_method_invocation_return_error_literal (invocation,
+                                                               G_DBUS_ERROR,
+                                                               G_DBUS_ERROR_ACCESS_DENIED,
+                                                               _("No display available"));
+
+                return TRUE;
+        }
+
+        g_object_set (G_OBJECT (display), "status", GDM_DISPLAY_MANAGED, NULL);
+
+        gdm_dbus_manager_complete_register_x11_display (GDM_DBUS_MANAGER (manager),
+                                                        invocation);
+
+        return TRUE;
+}
+
+static gboolean
 gdm_manager_handle_open_session (GdmDBusManager        *manager,
                                  GDBusMethodInvocation *invocation)
 {
@@ -1309,6 +1342,7 @@ gdm_manager_handle_open_reauthentication_channel (GdmDBusManager        *manager
 static void
 manager_interface_init (GdmDBusManagerIface *interface)
 {
+        interface->handle_register_x11_display = gdm_manager_handle_register_x11_display;
         interface->handle_open_session = gdm_manager_handle_open_session;
         interface->handle_open_reauthentication_channel = gdm_manager_handle_open_reauthentication_channel;
 }
diff --git a/daemon/gdm-manager.xml b/daemon/gdm-manager.xml
index d3bb3b2..7d84f44 100644
--- a/daemon/gdm-manager.xml
+++ b/daemon/gdm-manager.xml
@@ -1,6 +1,9 @@
 <!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN" 
"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd";>
 <node name="/org/gnome/DisplayManager/Manager">
   <interface name="org.gnome.DisplayManager.Manager">
+    <method name="RegisterX11Display">
+      <arg name="name" direction="in" type="s"/>
+    </method>
     <method name="OpenSession">
       <arg name="address" direction="out" type="s"/>
     </method>


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