summaryrefslogtreecommitdiff
path: root/mate-session/gsm-logout-dialog.c
diff options
context:
space:
mode:
authorStefano Karapetsas <[email protected]>2014-07-08 11:43:04 +0200
committerStefano Karapetsas <[email protected]>2014-07-08 11:43:04 +0200
commit1cc02144b717d503fe285361f75819ca48089c79 (patch)
tree10ca1d696139665fdfafd98411d1024a2ceab40e /mate-session/gsm-logout-dialog.c
parent06778518d38fc40cd106ac1a2a525ee2f416dc10 (diff)
downloadmate-session-manager-1cc02144b717d503fe285361f75819ca48089c79.tar.bz2
mate-session-manager-1cc02144b717d503fe285361f75819ca48089c79.tar.xz
Add key in GSettings schema to set logout timeout in seconds
0 disables timeout
Diffstat (limited to 'mate-session/gsm-logout-dialog.c')
-rw-r--r--mate-session/gsm-logout-dialog.c32
1 files changed, 22 insertions, 10 deletions
diff --git a/mate-session/gsm-logout-dialog.c b/mate-session/gsm-logout-dialog.c
index da3d651..8b48ced 100644
--- a/mate-session/gsm-logout-dialog.c
+++ b/mate-session/gsm-logout-dialog.c
@@ -41,11 +41,12 @@
#define GSM_LOGOUT_DIALOG_GET_PRIVATE(o) \
(G_TYPE_INSTANCE_GET_PRIVATE ((o), GSM_TYPE_LOGOUT_DIALOG, GsmLogoutDialogPrivate))
-#define AUTOMATIC_ACTION_TIMEOUT 60
-
#define GSM_ICON_LOGOUT "system-log-out"
#define GSM_ICON_SHUTDOWN "system-shutdown"
+#define SESSION_SCHEMA "org.mate.session"
+#define KEY_LOGOUT_TIMEOUT "logout-timeout"
+
typedef enum {
GSM_DIALOG_LOGOUT_TYPE_LOGOUT,
GSM_DIALOG_LOGOUT_TYPE_SHUTDOWN
@@ -397,18 +398,29 @@ gsm_logout_dialog_timeout (gpointer data)
static void
gsm_logout_dialog_set_timeout (GsmLogoutDialog *logout_dialog)
{
- logout_dialog->priv->timeout = AUTOMATIC_ACTION_TIMEOUT;
+ GSettings *settings;
- /* Sets the secondary text */
- gsm_logout_dialog_timeout (logout_dialog);
+ settings = g_settings_new (SESSION_SCHEMA);
- if (logout_dialog->priv->timeout_id != 0) {
- g_source_remove (logout_dialog->priv->timeout_id);
+ logout_dialog->priv->timeout = g_settings_get_int (settings, KEY_LOGOUT_TIMEOUT);
+
+ if (logout_dialog->priv->timeout > 0) {
+ /* Sets the secondary text */
+ gsm_logout_dialog_timeout (logout_dialog);
+
+ if (logout_dialog->priv->timeout_id != 0) {
+ g_source_remove (logout_dialog->priv->timeout_id);
+ }
+
+ logout_dialog->priv->timeout_id = g_timeout_add (1000,
+ gsm_logout_dialog_timeout,
+ logout_dialog);
+ }
+ else {
+ gtk_widget_hide (logout_dialog->priv->progressbar);
}
- logout_dialog->priv->timeout_id = g_timeout_add (1000,
- gsm_logout_dialog_timeout,
- logout_dialog);
+ g_object_unref (settings);
}
static GtkWidget *