[Xfce4-commits] <xfce4-session:master> Add the DBus manager methods.
Nick Schermer
noreply at xfce.org
Sat Mar 24 22:50:04 CET 2012
Updating branch refs/heads/master
to 3b6888784ccfb9045745e04057b367cdfd41493c (commit)
from 4002e8d4ef3905e878e44633c076f8e7d42fd91b (commit)
commit 3b6888784ccfb9045745e04057b367cdfd41493c
Author: Nick Schermer <nick at xfce.org>
Date: Thu Dec 1 20:08:56 2011 +0100
Add the DBus manager methods.
xfce4-session/main.c | 18 +++--
xfce4-session/xfsm-logout-dialog.c | 142 ++++++++++++++---------------------
xfce4-session/xfsm-manager-dbus.xml | 53 +++++++------
xfce4-session/xfsm-manager.c | 111 ++++++++++++++++++++++------
xfce4-session/xfsm-shutdown.c | 67 ++++++++++++++++
xfce4-session/xfsm-shutdown.h | 2 +
6 files changed, 255 insertions(+), 138 deletions(-)
diff --git a/xfce4-session/main.c b/xfce4-session/main.c
index ddac407..e7ac755 100644
--- a/xfce4-session/main.c
+++ b/xfce4-session/main.c
@@ -200,8 +200,8 @@ main (int argc, char **argv)
GdkDisplay *dpy;
XfconfChannel *channel;
XfsmShutdownType shutdown_type;
- XfsmShutdown *shutdown;
- gboolean succeed;
+ XfsmShutdown *shutdown_helper;
+ gboolean succeed = TRUE;
xfce_textdomain (GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR, "UTF-8");
@@ -263,9 +263,12 @@ main (int argc, char **argv)
xfsm_manager_restart (manager);
gtk_main ();
-
+
shutdown_type = xfsm_manager_get_shutdown_type (manager);
+ /* take over the ref before we release the manager */
+ shutdown_helper = xfsm_shutdown_get ();
+
g_object_unref (manager);
g_object_unref (channel);
@@ -275,13 +278,12 @@ main (int argc, char **argv)
if (shutdown_type == XFSM_SHUTDOWN_SHUTDOWN
|| shutdown_type == XFSM_SHUTDOWN_RESTART)
{
- shutdown = xfsm_shutdown_get ();
- succeed = xfsm_shutdown_try_type (shutdown, shutdown_type, &error);
+ succeed = xfsm_shutdown_try_type (shutdown_helper, shutdown_type, &error);
if (!succeed)
g_warning ("Failed to shutdown/restart: %s", ERROR_MSG (error));
- g_object_unref (shutdown);
- return succeed ? EXIT_SUCCESS : EXIT_FAILURE;
}
- return EXIT_SUCCESS;
+ g_object_unref (shutdown_helper);
+
+ return succeed ? EXIT_SUCCESS : EXIT_FAILURE;
}
diff --git a/xfce4-session/xfsm-logout-dialog.c b/xfce4-session/xfsm-logout-dialog.c
index 32c92c2..eb2812c 100644
--- a/xfce4-session/xfsm-logout-dialog.c
+++ b/xfce4-session/xfsm-logout-dialog.c
@@ -145,10 +145,7 @@ xfsm_logout_dialog_init (XfsmLogoutDialog *dialog)
GtkWidget *main_vbox;
GtkWidget *hbox;
GtkWidget *button;
- XfceKiosk *kiosk;
gboolean can_shutdown;
- gboolean kiosk_can_shutdown;
- gboolean kiosk_can_save_session;
gboolean save_session = FALSE;
gboolean can_restart;
gboolean can_suspend = FALSE;
@@ -160,21 +157,16 @@ xfsm_logout_dialog_init (XfsmLogoutDialog *dialog)
GtkWidget *separator;
dialog->type_clicked = XFSM_SHUTDOWN_LOGOUT;
+ dialog->shutdown = xfsm_shutdown_get ();
gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_CANCEL);
gtk_dialog_set_has_separator (GTK_DIALOG (dialog), FALSE);
gtk_window_set_position (GTK_WINDOW (dialog), GTK_WIN_POS_CENTER);
gtk_window_set_resizable (GTK_WINDOW (dialog), FALSE);
- /* load kiosk settings */
- kiosk = xfce_kiosk_new ("xfce4-session");
- kiosk_can_shutdown = xfce_kiosk_query (kiosk, "Shutdown");
- kiosk_can_save_session = xfce_kiosk_query (kiosk, "SaveSession");
- xfce_kiosk_free (kiosk);
-
/* load xfconf settings */
channel = xfsm_open_config ();
- if (kiosk_can_save_session)
+ if (xfsm_shutdown_can_save_session (dialog->shutdown))
save_session = xfconf_channel_get_bool (channel, "/general/SaveOnExit", TRUE);
main_vbox = gtk_vbox_new (FALSE, BORDER);
@@ -214,8 +206,6 @@ xfsm_logout_dialog_init (XfsmLogoutDialog *dialog)
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, TRUE, 0);
gtk_widget_show (hbox);
- dialog->shutdown = xfsm_shutdown_get ();
-
/**
* Cancel
**/
@@ -253,17 +243,13 @@ xfsm_logout_dialog_init (XfsmLogoutDialog *dialog)
/**
* Reboot
**/
- can_restart = kiosk_can_shutdown;
- if (can_restart)
+ if (!xfsm_shutdown_can_restart (dialog->shutdown, &can_restart, &error))
{
- if (!xfsm_shutdown_can_restart (dialog->shutdown, &can_restart, &error))
- {
- g_printerr ("%s: Querying CanRestart failed, %s\n\n",
- PACKAGE_NAME, ERROR_MSG (error));
- g_clear_error (&error);
+ g_printerr ("%s: Querying CanRestart failed, %s\n\n",
+ PACKAGE_NAME, ERROR_MSG (error));
+ g_clear_error (&error);
- can_restart = FALSE;
- }
+ can_restart = FALSE;
}
button = xfsm_logout_dialog_button (_("_Restart"), "system-reboot",
@@ -277,17 +263,13 @@ xfsm_logout_dialog_init (XfsmLogoutDialog *dialog)
/**
* Shutdown
**/
- can_shutdown = kiosk_can_shutdown;
- if (can_shutdown)
+ if (!xfsm_shutdown_can_shutdown (dialog->shutdown, &can_shutdown, &error))
{
- if (!xfsm_shutdown_can_shutdown (dialog->shutdown, &can_shutdown, &error))
- {
- g_printerr ("%s: Querying CanShutdown failed. %s\n\n",
- PACKAGE_NAME, ERROR_MSG (error));
- g_clear_error (&error);
+ g_printerr ("%s: Querying CanShutdown failed. %s\n\n",
+ PACKAGE_NAME, ERROR_MSG (error));
+ g_clear_error (&error);
- can_shutdown = FALSE;
- }
+ can_shutdown = FALSE;
}
button = xfsm_logout_dialog_button (_("Shut _Down"), "system-shutdown",
@@ -299,65 +281,59 @@ xfsm_logout_dialog_init (XfsmLogoutDialog *dialog)
gtk_widget_show (button);
/**
- * Suspend and Hibernate
+ * Suspend
+ *
+ * Hide the button if Xfpm is not installed
**/
- if (kiosk_can_shutdown)
+ if (xfconf_channel_get_bool (channel, "/shutdown/ShowSuspend", TRUE))
{
- /**
- * Suspend
- *
- * Hide the button if Xfpm is not installed
- **/
- if (xfconf_channel_get_bool (channel, "/shutdown/ShowSuspend", TRUE))
+ if (xfsm_shutdown_can_suspend (dialog->shutdown, &can_suspend, &error))
{
- if (xfsm_shutdown_can_suspend (dialog->shutdown, &can_suspend, &error))
- {
- button = xfsm_logout_dialog_button (_("Sus_pend"), "system-suspend",
- "xfsm-suspend", XFSM_SHUTDOWN_SUSPEND,
- dialog);
+ button = xfsm_logout_dialog_button (_("Sus_pend"), "system-suspend",
+ "xfsm-suspend", XFSM_SHUTDOWN_SUSPEND,
+ dialog);
- gtk_box_pack_start (GTK_BOX (hbox), button, TRUE, TRUE, 0);
- gtk_widget_set_sensitive (button, can_suspend);
- gtk_widget_show (button);
- }
- else
- {
- g_printerr ("%s: Querying CanSuspend failed. %s\n\n",
- PACKAGE_NAME, ERROR_MSG (error));
- g_clear_error (&error);
- }
+ gtk_box_pack_start (GTK_BOX (hbox), button, TRUE, TRUE, 0);
+ gtk_widget_set_sensitive (button, can_suspend);
+ gtk_widget_show (button);
+ }
+ else
+ {
+ g_printerr ("%s: Querying CanSuspend failed. %s\n\n",
+ PACKAGE_NAME, ERROR_MSG (error));
+ g_clear_error (&error);
}
+ }
- /**
- * Hibernate
- *
- * Hide the button if Xfpm is not installed
- **/
- if (xfconf_channel_get_bool (channel, "/shutdown/ShowHibernate", TRUE))
+ /**
+ * Hibernate
+ *
+ * Hide the button if Xfpm is not installed
+ **/
+ if (xfconf_channel_get_bool (channel, "/shutdown/ShowHibernate", TRUE))
+ {
+ if (xfsm_shutdown_can_hibernate (dialog->shutdown, &can_hibernate, &error))
{
- if (xfsm_shutdown_can_hibernate (dialog->shutdown, &can_hibernate, &error))
- {
- button = xfsm_logout_dialog_button (_("_Hibernate"), "system-hibernate",
- "xfsm-hibernate", XFSM_SHUTDOWN_HIBERNATE,
- dialog);
+ button = xfsm_logout_dialog_button (_("_Hibernate"), "system-hibernate",
+ "xfsm-hibernate", XFSM_SHUTDOWN_HIBERNATE,
+ dialog);
- gtk_box_pack_start (GTK_BOX (hbox), button, TRUE, TRUE, 0);
- gtk_widget_set_sensitive (button, can_hibernate);
- gtk_widget_show (button);
- }
- else
- {
- g_printerr ("%s: Querying CanHibernate failed. %s\n\n",
- PACKAGE_NAME, ERROR_MSG (error));
- g_clear_error (&error);
- }
+ gtk_box_pack_start (GTK_BOX (hbox), button, TRUE, TRUE, 0);
+ gtk_widget_set_sensitive (button, can_hibernate);
+ gtk_widget_show (button);
+ }
+ else
+ {
+ g_printerr ("%s: Querying CanHibernate failed. %s\n\n",
+ PACKAGE_NAME, ERROR_MSG (error));
+ g_clear_error (&error);
}
}
/**
* Save session
**/
- if (kiosk_can_save_session
+ if (xfsm_shutdown_can_save_session (dialog->shutdown)
&& !xfconf_channel_get_bool (channel, "/general/AutoSave", FALSE))
{
dialog->save_session = gtk_check_button_new_with_mnemonic (_("_Save session for future logins"));
@@ -717,24 +693,20 @@ xfsm_logout_dialog (const gchar *session_name,
XfsmFadeout *fadeout = NULL;
XfsmLogoutDialog *xfsm_dialog;
XfconfChannel *channel = xfsm_open_config ();
- XfceKiosk *kiosk;
gboolean autosave;
- gboolean kiosk_can_save_session;
const gchar *text;
XfsmPassState state;
+ XfsmShutdown *shutdown;
g_return_val_if_fail (return_type != NULL, FALSE);
g_return_val_if_fail (return_save_session != NULL, FALSE);
- /* get autosave state */
- kiosk = xfce_kiosk_new ("xfce4-session");
- kiosk_can_save_session = xfce_kiosk_query (kiosk, "SaveSession");
- xfce_kiosk_free (kiosk);
-
- if (kiosk_can_save_session)
+ shutdown = xfsm_shutdown_get ();
+ if (xfsm_shutdown_can_save_session (shutdown))
autosave = xfconf_channel_get_bool (channel, "/general/AutoSave", FALSE);
else
autosave = FALSE;
+ g_object_unref (shutdown);
/* check if we need to bother the user */
if (!xfconf_channel_get_bool (channel, "/general/PromptOnLogout", TRUE))
diff --git a/xfce4-session/xfsm-manager-dbus.xml b/xfce4-session/xfsm-manager-dbus.xml
index 69c652c..08ebd11 100644
--- a/xfce4-session/xfsm-manager-dbus.xml
+++ b/xfce4-session/xfsm-manager-dbus.xml
@@ -79,37 +79,44 @@
<method name="Checkpoint">
<arg direction="in" name="session_name" type="s"/>
</method>
+
+ <!--
+ void org.Xfce.Session.Manager.Logout
+ -->
+ <method name="Logout">
+ <arg direction="in" name="show_dialog" type="b"/>
+ <arg direction="in" name="allow_save" type="b"/>
+ </method>
<!--
- void org.xfce.Session.Manager.Shutdown(Unsigned Int type,
- Boolean save)
-
- @type: Type of shutdown to request. Valid values are:
- 0 Prompt user for type.
- 1 Log out of current session.
- 2 Shut down the computer/device.
- 3 Restart the computer/device.
- 4 Suspend the computer/device.
- 5 Hibernate the computer/device.
- @allow_save: Whether or not to give applications a
- chance to save themselves, or to shut down
- immediately. Note that this parameter is
- ignored for type==0.
-
- Instructs the session manager to shut down. Type 0 will
- prompt the user for a shutdown type. All other types will
- take immediate action without user input.
-
- Implementation note: types 2 through 5 may be implemented
- by simply passing the message along to a power management
- daemon after taking any SM-specific actions needed.
+ void org.Xfce.Session.Manager.Shutdown
-->
<method name="Shutdown">
- <arg direction="in" name="type" type="u"/>
<arg direction="in" name="allow_save" type="b"/>
</method>
<!--
+ void org.Xfce.Session.Manager.CanShutdown
+ -->
+ <method name="CanShutdown">
+ <arg direction="out" name="can_shutdown" type="b"/>
+ </method>
+
+ <!--
+ void org.Xfce.Session.Manager.Restart
+ -->
+ <method name="Restart">
+ <arg direction="in" name="allow_save" type="b"/>
+ </method>
+
+ <!--
+ void org.Xfce.Session.Manager.CanRestart
+ -->
+ <method name="CanRestart">
+ <arg direction="out" name="can_restart" type="b"/>
+ </method>
+
+ <!--
void org.xfce.Session.Manager.StateChanged(Unsigned Int old_state,
Unsigned Int new_state)
diff --git a/xfce4-session/xfsm-manager.c b/xfce4-session/xfsm-manager.c
index 367c11c..4aab1d8 100644
--- a/xfce4-session/xfsm-manager.c
+++ b/xfce4-session/xfsm-manager.c
@@ -95,7 +95,9 @@ struct _XfsmManager
GObject parent;
XfsmManagerState state;
- XfsmShutdownType shutdown_type;
+
+ XfsmShutdownType shutdown_type;
+ XfsmShutdown *shutdown_helper;
gboolean session_chooser;
gchar *session_name;
@@ -227,6 +229,7 @@ xfsm_manager_init (XfsmManager *manager)
manager->session_chooser = FALSE;
manager->failsafe_mode = TRUE;
manager->shutdown_type = XFSM_SHUTDOWN_LOGOUT;
+ manager->shutdown_helper = xfsm_shutdown_get ();
manager->pending_properties = g_queue_new ();
manager->starting_properties = g_queue_new ();
@@ -245,6 +248,8 @@ xfsm_manager_finalize (GObject *obj)
if (manager->die_timeout_id != 0)
g_source_remove (manager->die_timeout_id);
+ g_object_unref (manager->shutdown_helper);
+
g_queue_foreach (manager->pending_properties, (GFunc) xfsm_properties_free, NULL);
g_queue_free (manager->pending_properties);
@@ -1084,10 +1089,9 @@ xfsm_manager_save_yourself_global (XfsmManager *manager,
XfsmShutdownType shutdown_type,
gboolean allow_shutdown_save)
{
- gboolean shutdown_save = allow_shutdown_save;
- GList *lp;
- XfsmShutdown *shutdown_helper;
- GError *error = NULL;
+ gboolean shutdown_save = allow_shutdown_save;
+ GList *lp;
+ GError *error = NULL;
if (shutdown)
{
@@ -1112,9 +1116,7 @@ xfsm_manager_save_yourself_global (XfsmManager *manager,
if (manager->shutdown_type == XFSM_SHUTDOWN_SUSPEND
|| manager->shutdown_type == XFSM_SHUTDOWN_HIBERNATE)
{
- shutdown_helper = xfsm_shutdown_get ();
-
- if (!xfsm_shutdown_try_type (shutdown_helper,
+ if (!xfsm_shutdown_try_type (manager->shutdown_helper,
manager->shutdown_type,
&error))
{
@@ -1129,8 +1131,6 @@ xfsm_manager_save_yourself_global (XfsmManager *manager,
g_error_free (error);
}
- g_object_unref (shutdown_helper);
-
/* at this point, either we failed to suspend/hibernate, or we
* successfully suspended/hibernated, and we've been woken back
* up, so return control to the user */
@@ -1211,6 +1211,8 @@ xfsm_manager_save_yourself (XfsmManager *manager,
{
if (G_UNLIKELY (xfsm_client_get_state (client) != XFSM_CLIENT_IDLE))
{
+
+
xfsm_verbose ("Client Id = %s, requested SAVE YOURSELF, but client is not in IDLE mode.\n"
" Client will be nuked now.\n\n",
xfsm_client_get_id (client));
@@ -1803,10 +1805,22 @@ static gboolean xfsm_manager_dbus_get_state (XfsmManager *manager,
static gboolean xfsm_manager_dbus_checkpoint (XfsmManager *manager,
const gchar *session_name,
GError **error);
+static gboolean xfsm_manager_dbus_logout (XfsmManager *manager,
+ gboolean show_dialog,
+ gboolean allow_save,
+ GError **error);
static gboolean xfsm_manager_dbus_shutdown (XfsmManager *manager,
- guint type,
gboolean allow_save,
GError **error);
+static gboolean xfsm_manager_dbus_can_shutdown (XfsmManager *manager,
+ gboolean *can_shutdown,
+ GError **error);
+static gboolean xfsm_manager_dbus_restart (XfsmManager *manager,
+ gboolean allow_save,
+ GError **error);
+static gboolean xfsm_manager_dbus_can_restart (XfsmManager *manager,
+ gboolean *can_restart,
+ GError **error);
/* eader needs the above fwd decls */
@@ -1980,10 +1994,10 @@ xfsm_manager_dbus_shutdown_idled (gpointer data)
static gboolean
-xfsm_manager_dbus_shutdown (XfsmManager *manager,
- guint type,
- gboolean allow_save,
- GError **error)
+xfsm_manager_save_yourself_dbus (XfsmManager *manager,
+ XfsmShutdownType type,
+ gboolean allow_save,
+ GError **error)
{
ShutdownIdleData *idata;
@@ -1994,13 +2008,6 @@ xfsm_manager_dbus_shutdown (XfsmManager *manager,
return FALSE;
}
- if (type > XFSM_SHUTDOWN_HIBERNATE)
- {
- g_set_error (error, XFSM_ERROR, XFSM_ERROR_BAD_VALUE,
- _("Invalid shutdown type \"%u\""), type);
- return FALSE;
- }
-
idata = g_new (ShutdownIdleData, 1);
idata->manager = manager;
idata->type = type;
@@ -2010,3 +2017,63 @@ xfsm_manager_dbus_shutdown (XfsmManager *manager,
return TRUE;
}
+
+
+static gboolean
+xfsm_manager_dbus_logout (XfsmManager *manager,
+ gboolean show_dialog,
+ gboolean allow_save,
+ GError **error)
+{
+ XfsmShutdownType type;
+
+ g_return_val_if_fail (XFSM_IS_MANAGER (manager), FALSE);
+
+ type = show_dialog ? XFSM_SHUTDOWN_ASK : XFSM_SHUTDOWN_LOGOUT;
+ return xfsm_manager_save_yourself_dbus (manager, type,
+ allow_save, error);
+}
+
+
+static gboolean
+xfsm_manager_dbus_shutdown (XfsmManager *manager,
+ gboolean allow_save,
+ GError **error)
+{
+ g_return_val_if_fail (XFSM_IS_MANAGER (manager), FALSE);
+ return xfsm_manager_save_yourself_dbus (manager, XFSM_SHUTDOWN_SHUTDOWN,
+ allow_save, error);
+}
+
+
+static gboolean
+xfsm_manager_dbus_can_shutdown (XfsmManager *manager,
+ gboolean *can_shutdown,
+ GError **error)
+{
+ g_return_val_if_fail (XFSM_IS_MANAGER (manager), FALSE);
+ return xfsm_shutdown_can_shutdown (manager->shutdown_helper,
+ can_shutdown, error);
+}
+
+
+static gboolean
+xfsm_manager_dbus_restart (XfsmManager *manager,
+ gboolean allow_save,
+ GError **error)
+{
+ g_return_val_if_fail (XFSM_IS_MANAGER (manager), FALSE);
+ return xfsm_manager_save_yourself_dbus (manager, XFSM_SHUTDOWN_RESTART,
+ allow_save, error);
+}
+
+
+static gboolean
+xfsm_manager_dbus_can_restart (XfsmManager *manager,
+ gboolean *can_restart,
+ GError **error)
+{
+ g_return_val_if_fail (XFSM_IS_MANAGER (manager), FALSE);
+ return xfsm_shutdown_can_restart (manager->shutdown_helper,
+ can_restart, error);
+}
diff --git a/xfce4-session/xfsm-shutdown.c b/xfce4-session/xfsm-shutdown.c
index 2436dcd..a29afff 100644
--- a/xfce4-session/xfsm-shutdown.c
+++ b/xfce4-session/xfsm-shutdown.c
@@ -88,6 +88,10 @@ struct _XfsmShutdown
XfsmConsolekit *consolekit;
+ /* kiosk settingw */
+ gboolean kiosk_can_shutdown;
+ gboolean kiosk_can_save_session;
+
/* sudo helper */
HelperState helper_state;
pid_t helper_pid;
@@ -117,9 +121,17 @@ xfsm_shutdown_class_init (XfsmShutdownClass *klass)
static void
xfsm_shutdown_init (XfsmShutdown *shutdown)
{
+ XfceKiosk *kiosk;
+
shutdown->consolekit = xfsm_consolekit_get ();
shutdown->helper_state = SUDO_NOT_INITIAZED;
shutdown->helper_require_password = FALSE;
+
+ /* check kiosk */
+ kiosk = xfce_kiosk_new ("xfce4-session");
+ shutdown->kiosk_can_shutdown = xfce_kiosk_query (kiosk, "Shutdown");
+ shutdown->kiosk_can_save_session = xfce_kiosk_query (kiosk, "SaveSession");
+ xfce_kiosk_free (kiosk);
}
@@ -547,6 +559,22 @@ xfsm_shutdown_query_xfpm (XfsmShutdown *shutdown,
+static gboolean
+xfsm_shutdown_kiosk_can_shutdown (XfsmShutdown *shutdown,
+ GError **error)
+{
+ if (!shutdown->kiosk_can_shutdown)
+ {
+ if (error != NULL)
+ g_set_error_literal (error, 1, 0, _("Shutdown is blocked by the kiosk settings"));
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+
+
XfsmShutdown *
xfsm_shutdown_get (void)
{
@@ -636,6 +664,9 @@ xfsm_shutdown_try_restart (XfsmShutdown *shutdown,
{
g_return_val_if_fail (XFSM_IS_SHUTDOWN (shutdown), FALSE);
+ if (!xfsm_shutdown_kiosk_can_shutdown (shutdown, error))
+ return FALSE;
+
if (shutdown->helper_state == SUDO_AVAILABLE)
return xfsm_shutdown_sudo_try_action (shutdown, XFSM_SHUTDOWN_RESTART, error);
else
@@ -650,6 +681,9 @@ xfsm_shutdown_try_shutdown (XfsmShutdown *shutdown,
{
g_return_val_if_fail (XFSM_IS_SHUTDOWN (shutdown), FALSE);
+ if (!xfsm_shutdown_kiosk_can_shutdown (shutdown, error))
+ return FALSE;
+
if (shutdown->helper_state == SUDO_AVAILABLE)
return xfsm_shutdown_sudo_try_action (shutdown, XFSM_SHUTDOWN_SHUTDOWN, error);
else
@@ -687,6 +721,12 @@ xfsm_shutdown_can_restart (XfsmShutdown *shutdown,
{
g_return_val_if_fail (XFSM_IS_SHUTDOWN (shutdown), FALSE);
+ if (!xfsm_shutdown_kiosk_can_shutdown (shutdown, NULL))
+ {
+ *can_restart = FALSE;
+ return TRUE;
+ }
+
if (xfsm_consolekit_can_restart (shutdown->consolekit, can_restart, error))
return TRUE;
@@ -702,6 +742,12 @@ xfsm_shutdown_can_shutdown (XfsmShutdown *shutdown,
{
g_return_val_if_fail (XFSM_IS_SHUTDOWN (shutdown), FALSE);
+ if (!xfsm_shutdown_kiosk_can_shutdown (shutdown, NULL))
+ {
+ *can_shutdown = FALSE;
+ return TRUE;
+ }
+
if (xfsm_consolekit_can_shutdown (shutdown->consolekit, can_shutdown, error))
return TRUE;
@@ -720,6 +766,12 @@ xfsm_shutdown_can_suspend (XfsmShutdown *shutdown,
{
g_return_val_if_fail (XFSM_IS_SHUTDOWN (shutdown), FALSE);
+ if (!xfsm_shutdown_kiosk_can_shutdown (shutdown, NULL))
+ {
+ *can_suspend = FALSE;
+ return TRUE;
+ }
+
return xfsm_shutdown_query_xfpm (shutdown, "CanSuspend",
can_suspend, error);
}
@@ -736,6 +788,21 @@ xfsm_shutdown_can_hibernate (XfsmShutdown *shutdown,
{
g_return_val_if_fail (XFSM_IS_SHUTDOWN (shutdown), FALSE);
+ if (!xfsm_shutdown_kiosk_can_shutdown (shutdown, NULL))
+ {
+ *can_hibernate = FALSE;
+ return TRUE;
+ }
+
return xfsm_shutdown_query_xfpm (shutdown, "CanHibernate",
can_hibernate, error);
}
+
+
+
+gboolean
+xfsm_shutdown_can_save_session (XfsmShutdown *shutdown)
+{
+ g_return_val_if_fail (XFSM_IS_SHUTDOWN (shutdown), FALSE);
+ return shutdown->kiosk_can_save_session;
+}
diff --git a/xfce4-session/xfsm-shutdown.h b/xfce4-session/xfsm-shutdown.h
index 2ec61f0..2be627f 100644
--- a/xfce4-session/xfsm-shutdown.h
+++ b/xfce4-session/xfsm-shutdown.h
@@ -94,4 +94,6 @@ gboolean xfsm_shutdown_can_hibernate (XfsmShutdown *shutdown,
gboolean *can_hibernate,
GError **error);
+gboolean xfsm_shutdown_can_save_session (XfsmShutdown *shutdown);
+
#endif /* !__XFSM_SHUTDOWN_H__ */
More information about the Xfce4-commits
mailing list