[gnome-session] gsm: Also support disable-log-out for Shutdown/CanShutdown dbus methods
- From: Vincent Untz <vuntz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-session] gsm: Also support disable-log-out for Shutdown/CanShutdown dbus methods
- Date: Mon, 21 Mar 2011 23:50:24 +0000 (UTC)
commit 107cfa7a4f6f43698407772e31472d742bdb219f
Author: Vincent Untz <vuntz gnome org>
Date: Tue Mar 22 00:47:24 2011 +0100
gsm: Also support disable-log-out for Shutdown/CanShutdown dbus methods
On top of that, be a bit paranoid and ensure we don't log out in
end_phase() by checking the lockdown setting there too.
gnome-session/gsm-manager.c | 40 ++++++++++++++++++++++++++++++----------
1 files changed, 30 insertions(+), 10 deletions(-)
---
diff --git a/gnome-session/gsm-manager.c b/gnome-session/gsm-manager.c
index f967d2d..ff0fe04 100644
--- a/gnome-session/gsm-manager.c
+++ b/gnome-session/gsm-manager.c
@@ -180,6 +180,8 @@ static void gsm_manager_finalize (GObject *object);
static gboolean auto_save_is_enabled (GsmManager *manager);
static void maybe_save_session (GsmManager *manager);
+static gboolean _log_out_is_locked_down (GsmManager *manager);
+
static void _handle_client_end_session_response (GsmManager *manager,
GsmClient *client,
gboolean is_ok,
@@ -505,6 +507,8 @@ gsm_manager_quit (GsmManager *manager)
static void
end_phase (GsmManager *manager)
{
+ gboolean start_next_phase = TRUE;
+
g_debug ("GsmManager: ending phase %s\n",
phase_num_to_name (manager->priv->phase));
@@ -533,25 +537,32 @@ end_phase (GsmManager *manager)
case GSM_MANAGER_PHASE_PANEL:
case GSM_MANAGER_PHASE_DESKTOP:
case GSM_MANAGER_PHASE_APPLICATION:
+ break;
case GSM_MANAGER_PHASE_RUNNING:
+ if (_log_out_is_locked_down (manager)) {
+ g_warning ("Unable to logout: Logout has been locked down");
+ start_next_phase = FALSE;
+ }
+ break;
case GSM_MANAGER_PHASE_QUERY_END_SESSION:
- manager->priv->phase++;
- start_phase (manager);
break;
case GSM_MANAGER_PHASE_END_SESSION:
- if (auto_save_is_enabled (manager)) {
+ if (auto_save_is_enabled (manager))
maybe_save_session (manager);
- }
- manager->priv->phase++;
- start_phase (manager);
break;
case GSM_MANAGER_PHASE_EXIT:
+ start_next_phase = FALSE;
gsm_manager_quit (manager);
break;
default:
g_assert_not_reached ();
break;
}
+
+ if (start_next_phase) {
+ manager->priv->phase++;
+ start_phase (manager);
+ }
}
static void
@@ -3305,6 +3316,14 @@ gsm_manager_shutdown (GsmManager *manager,
return FALSE;
}
+ if (_log_out_is_locked_down (manager)) {
+ g_set_error (error,
+ GSM_MANAGER_ERROR,
+ GSM_MANAGER_ERROR_LOCKED_DOWN,
+ "Logout has been locked down");
+ return FALSE;
+ }
+
shell_running = gsm_shell_is_running (manager->priv->shell);
if (!shell_running) {
@@ -3335,10 +3354,11 @@ gsm_manager_can_shutdown (GsmManager *manager,
g_return_val_if_fail (GSM_IS_MANAGER (manager), FALSE);
consolekit = gsm_get_consolekit ();
- *shutdown_available = gsm_consolekit_can_stop (consolekit)
- || gsm_consolekit_can_restart (consolekit)
- || can_suspend
- || can_hibernate;
+ *shutdown_available = !_log_out_is_locked_down (manager) &&
+ (gsm_consolekit_can_stop (consolekit)
+ || gsm_consolekit_can_restart (consolekit)
+ || can_suspend
+ || can_hibernate);
g_object_unref (consolekit);
return TRUE;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]