summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRay Strode <rstrode@redhat.com>2009-06-23 22:48:06 -0400
committerRay Strode <rstrode@redhat.com>2009-08-03 15:50:57 -0400
commitfe3ea128aade76fe759110dd3b801a14ee331ef6 (patch)
tree2106074345e8816eaf9fc00515b80c6812b7adaf
parentbb7c5cc01dbef5b5f8e4cfba9ccd825cfcaecb3e (diff)
downloadgdm-fe3ea128aade76fe759110dd3b801a14ee331ef6.tar.gz
Add block-console-session-requests display property
This property is just a hint for the display factory to queue SessionToAdd requests from consolekit instead of processing them immediately. This will be useful for the slave to lock a display during the critical moment after the login window session is closed before the user's session is opened. Note, the display factory doesn't look at the hint yet, and the slave doesn't set it, yet, either.
-rw-r--r--daemon/gdm-display.c44
-rw-r--r--daemon/gdm-display.h5
-rw-r--r--daemon/gdm-display.xml4
-rw-r--r--daemon/gdm-slave.c53
-rw-r--r--daemon/gdm-slave.h3
5 files changed, 109 insertions, 0 deletions
diff --git a/daemon/gdm-display.c b/daemon/gdm-display.c
index ff0f2a70..24be2455 100644
--- a/daemon/gdm-display.c
+++ b/daemon/gdm-display.c
@@ -70,6 +70,7 @@ struct GdmDisplayPrivate
gboolean is_local;
gboolean is_dynamic;
gboolean use_auth;
+ gboolean block_console_session_requests;
guint finish_idle_id;
GdmSlaveProxy *slave_proxy;
@@ -93,6 +94,7 @@ enum {
PROP_IS_DYNAMIC,
PROP_USE_AUTH,
PROP_SLAVE_COMMAND,
+ PROP_BLOCK_CONSOLE_SESSION_REQUESTS,
};
static void gdm_display_class_init (GdmDisplayClass *klass);
@@ -939,6 +941,13 @@ _gdm_display_set_slave_command (GdmDisplay *display,
}
static void
+_gdm_display_set_block_console_session_requests (GdmDisplay *display,
+ gboolean block_console_session_requests)
+{
+ display->priv->block_console_session_requests = block_console_session_requests;
+}
+
+static void
gdm_display_set_property (GObject *object,
guint prop_id,
const GValue *value,
@@ -988,6 +997,9 @@ gdm_display_set_property (GObject *object,
case PROP_SLAVE_COMMAND:
_gdm_display_set_slave_command (self, g_value_get_string (value));
break;
+ case PROP_BLOCK_CONSOLE_SESSION_REQUESTS:
+ _gdm_display_set_block_console_session_requests (self, g_value_get_boolean (value));
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@@ -1048,6 +1060,9 @@ gdm_display_get_property (GObject *object,
case PROP_SLAVE_COMMAND:
g_value_set_string (value, self->priv->slave_command);
break;
+ case PROP_BLOCK_CONSOLE_SESSION_REQUESTS:
+ g_value_set_boolean (value, self->priv->block_console_session_requests);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@@ -1250,6 +1265,13 @@ gdm_display_class_init (GdmDisplayClass *klass)
DEFAULT_SLAVE_COMMAND,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
g_object_class_install_property (object_class,
+ PROP_BLOCK_CONSOLE_SESSION_REQUESTS,
+ g_param_spec_boolean ("block-console-session-requests",
+ "Block Console Session Requests",
+ "Block session requests from ConsoleKit",
+ FALSE,
+ G_PARAM_READWRITE));
+ g_object_class_install_property (object_class,
PROP_STATUS,
g_param_spec_int ("status",
"status",
@@ -1310,3 +1332,25 @@ gdm_display_finalize (GObject *object)
G_OBJECT_CLASS (gdm_display_parent_class)->finalize (object);
}
+
+gboolean
+gdm_display_block_console_session_requests (GdmDisplay *display,
+ GError **error)
+{
+ if (!display->priv->block_console_session_requests) {
+ _gdm_display_set_block_console_session_requests (display, TRUE);
+ g_object_notify (G_OBJECT (display), "block-console-session-requests");
+ }
+ return TRUE;
+}
+
+gboolean
+gdm_display_unblock_console_session_requests (GdmDisplay *display,
+ GError **error)
+{
+ if (display->priv->block_console_session_requests) {
+ _gdm_display_set_block_console_session_requests (display, FALSE);
+ g_object_notify (G_OBJECT (display), "block-console-session-requests");
+ }
+ return TRUE;
+}
diff --git a/daemon/gdm-display.h b/daemon/gdm-display.h
index 6c494fd1..d615af88 100644
--- a/daemon/gdm-display.h
+++ b/daemon/gdm-display.h
@@ -155,6 +155,11 @@ gboolean gdm_display_remove_user_authorization (GdmDisplay *disp
gboolean gdm_display_set_slave_bus_name (GdmDisplay *display,
const char *name,
GError **error);
+gboolean gdm_display_block_console_session_requests (GdmDisplay *display,
+ GError **error);
+
+gboolean gdm_display_unblock_console_session_requests (GdmDisplay *display,
+ GError **error);
G_END_DECLS
diff --git a/daemon/gdm-display.xml b/daemon/gdm-display.xml
index 21b98c82..65e26b5f 100644
--- a/daemon/gdm-display.xml
+++ b/daemon/gdm-display.xml
@@ -25,6 +25,10 @@
<method name="GetSessionId">
<arg name="session_id" direction="out" type="s"/>
</method>
+ <method name="BlockConsoleSessionRequests">
+ </method>
+ <method name="UnblockConsoleSessionRequests">
+ </method>
<method name="GetRemoteHostname">
<arg name="hostname" direction="out" type="s"/>
</method>
diff --git a/daemon/gdm-slave.c b/daemon/gdm-slave.c
index e88111d9..513fcf9a 100644
--- a/daemon/gdm-slave.c
+++ b/daemon/gdm-slave.c
@@ -1231,6 +1231,59 @@ gdm_slave_switch_to_user_session (GdmSlave *slave,
return ret;
}
+void
+gdm_slave_block_console_session_requests_on_display (GdmSlave *slave)
+{
+ gboolean res;
+ GError *error;
+
+ g_debug ("GdmSlave: Asking display to ignore ConsoleKit");
+
+ error = NULL;
+ res = dbus_g_proxy_call (slave->priv->display_proxy,
+ "BlockConsoleSessionRequests",
+ &error,
+ G_TYPE_INVALID, G_TYPE_INVALID);
+
+ if (! res) {
+ if (error != NULL) {
+ g_warning ("Failed to get display to ignore ConsoleKit: %s", error->message);
+ g_error_free (error);
+ } else {
+ g_warning ("Failed to get display to ignore ConsoleKit");
+ }
+ } else {
+ g_debug ("GdmSlave: Display is now ignoring ConsoleKit");
+ }
+}
+
+void
+gdm_slave_unblock_console_session_requests_on_display (GdmSlave *slave)
+{
+ gboolean res;
+ GError *error;
+
+ g_debug ("GdmSlave: Informing display to stop ignoring ConsoleKit");
+
+ error = NULL;
+ res = dbus_g_proxy_call (slave->priv->display_proxy,
+ "UnblockConsoleSessionRequests",
+ &error,
+ G_TYPE_INVALID, G_TYPE_INVALID);
+
+ if (! res) {
+ if (error != NULL) {
+ g_warning ("Failed to get display to stop ignoring ConsoleKit: %s", error->message);
+ g_error_free (error);
+ } else {
+ g_warning ("Failed to get display to stop ignoring ConsoleKit");
+ }
+ } else {
+ g_debug ("GdmSlave: Display is no longer ignoring ConsoleKit");
+ }
+}
+
+
static void
_gdm_slave_set_display_id (GdmSlave *slave,
const char *id)
diff --git a/daemon/gdm-slave.h b/daemon/gdm-slave.h
index ca370267..3783c2aa 100644
--- a/daemon/gdm-slave.h
+++ b/daemon/gdm-slave.h
@@ -72,6 +72,9 @@ gboolean gdm_slave_add_user_authorization (GdmSlave *slave,
gboolean gdm_slave_switch_to_user_session (GdmSlave *slave,
const char *username);
+void gdm_slave_block_console_session_requests_on_display (GdmSlave *slave);
+void gdm_slave_unblock_console_session_requests_on_display (GdmSlave *slave);
+
gboolean gdm_slave_connect_to_x11_display (GdmSlave *slave);
void gdm_slave_set_busy_cursor (GdmSlave *slave);
gboolean gdm_slave_run_script (GdmSlave *slave,