[gdm/x-gdm-sessionregisters: 2/4] GdmManager, GdmDisplay: Add RegisterSession method
- From: Iain Lane <iainl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gdm/x-gdm-sessionregisters: 2/4] GdmManager, GdmDisplay: Add RegisterSession method
- Date: Wed, 8 May 2019 16:13:55 +0000 (UTC)
commit f1a759d629c89053f89886e217d8191fb3df79e3
Author: Iain Lane <iainl gnome org>
Date: Tue May 7 15:57:43 2019 +0100
GdmManager, GdmDisplay: Add RegisterSession method
Window managers can use this to register with GDM when they've finished
starting up and started displaying.
daemon/gdm-display.c | 27 +++++++++++++++++++++++++++
daemon/gdm-manager.c | 30 ++++++++++++++++++++++++++++++
daemon/gdm-manager.xml | 3 +++
3 files changed, 60 insertions(+)
---
diff --git a/daemon/gdm-display.c b/daemon/gdm-display.c
index a8747785..fb76fd16 100644
--- a/daemon/gdm-display.c
+++ b/daemon/gdm-display.c
@@ -93,6 +93,7 @@ typedef struct _GdmDisplayPrivate
guint allow_timed_login : 1;
guint have_existing_user_accounts : 1;
guint doing_initial_setup : 1;
+ guint registered : 1;
} GdmDisplayPrivate;
enum {
@@ -115,6 +116,7 @@ enum {
PROP_ALLOW_TIMED_LOGIN,
PROP_HAVE_EXISTING_USER_ACCOUNTS,
PROP_DOING_INITIAL_SETUP,
+ PROP_SESSION_REGISTERED,
};
static void gdm_display_class_init (GdmDisplayClass *klass);
@@ -871,6 +873,17 @@ _gdm_display_set_is_local (GdmDisplay *self,
priv->is_local = is_local;
}
+static void
+_gdm_display_set_session_registered (GdmDisplay *self,
+ gboolean registered)
+{
+ GdmDisplayPrivate *priv;
+
+ priv = gdm_display_get_instance_private (self);
+ g_debug ("GdmDisplay: session registered: %s", registered? "yes" : "no");
+ priv->session_registered = registered;
+}
+
static void
_gdm_display_set_launch_environment (GdmDisplay *self,
GdmLaunchEnvironment *launch_environment)
@@ -959,6 +972,9 @@ gdm_display_set_property (GObject *object,
case PROP_IS_INITIAL:
_gdm_display_set_is_initial (self, g_value_get_boolean (value));
break;
+ case PROP_SESSION_REGISTERED:
+ _gdm_display_set_session_registered (self, g_value_get_boolean (value));
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@@ -1031,6 +1047,9 @@ gdm_display_get_property (GObject *object,
case PROP_DOING_INITIAL_SETUP:
g_value_set_boolean (value, priv->doing_initial_setup);
break;
+ case PROP_SESSION_REGISTERED:
+ g_value_set_boolean (value, priv->session_registered);
+ break;
case PROP_ALLOW_TIMED_LOGIN:
g_value_set_boolean (value, priv->allow_timed_login);
break;
@@ -1355,6 +1374,14 @@ gdm_display_class_init (GdmDisplayClass *klass)
NULL,
FALSE,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
+ g_object_class_install_property (object_class,
+ PROP_SESSION_REGISTERED,
+ g_param_spec_boolean ("session-registered",
+ NULL,
+ NULL,
+ FALSE,
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+
g_object_class_install_property (object_class,
PROP_LAUNCH_ENVIRONMENT,
g_param_spec_object ("launch-environment",
diff --git a/daemon/gdm-manager.c b/daemon/gdm-manager.c
index 980aa62d..23e3b85d 100644
--- a/daemon/gdm-manager.c
+++ b/daemon/gdm-manager.c
@@ -803,6 +803,35 @@ gdm_manager_handle_register_display (GdmDBusManager *manager,
return TRUE;
}
+static gboolean
+gdm_manager_handle_register_session (GdmDBusManager *manager,
+ GDBusMethodInvocation *invocation,
+ GVariant *details)
+{
+ GdmManager *self = GDM_MANAGER (manager);
+ GdmDisplay *display;
+ const char *sender;
+ GDBusConnection *connection;
+
+ 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, NULL);
+
+ g_debug ("GdmManager: trying to register new session on display %p", display);
+
+ if (display != NULL)
+ g_object_set (G_OBJECT (display), "session-registered", TRUE, NULL);
+ else
+ g_debug ("GdmManager: No display, not registering");
+
+ gdm_dbus_manager_complete_register_session (GDM_DBUS_MANAGER (manager),
+ invocation);
+
+ return TRUE;
+}
+
static gboolean
gdm_manager_handle_open_session (GdmDBusManager *manager,
GDBusMethodInvocation *invocation)
@@ -1159,6 +1188,7 @@ static void
manager_interface_init (GdmDBusManagerIface *interface)
{
interface->handle_register_display = gdm_manager_handle_register_display;
+ interface->handle_register_session = gdm_manager_handle_register_session;
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 f11f3fb7..92ef1d02 100644
--- a/daemon/gdm-manager.xml
+++ b/daemon/gdm-manager.xml
@@ -4,6 +4,9 @@
<method name="RegisterDisplay">
<arg name="details" direction="in" type="a{ss}"/>
</method>
+ <method name="RegisterSession">
+ <arg name="details" direction="in" type="a{sv}"/>
+ </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]