aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/lock-helper.c12
-rw-r--r--src/lock-helper.h1
-rw-r--r--src/users-service.c7
3 files changed, 16 insertions, 4 deletions
diff --git a/src/lock-helper.c b/src/lock-helper.c
index 0df840e..e717968 100644
--- a/src/lock-helper.c
+++ b/src/lock-helper.c
@@ -10,6 +10,18 @@ static gboolean is_guest = FALSE;
static gdm_autologin_cb_t gdm_autologin_cb = NULL;
+/* Setting up a call back */
+void
+lock_screen_gdm_cb_set (gdm_autologin_cb_t cb)
+{
+ if (gdm_autologin_cb) {
+ g_warning("Already had a callback, setting up a new one...");
+ }
+
+ gdm_autologin_cb = cb;
+ return;
+}
+
/* This is our logic on whether the screen should be locked
or not. It effects everything else. */
gboolean
diff --git a/src/lock-helper.h b/src/lock-helper.h
index 5103242..9a0571c 100644
--- a/src/lock-helper.h
+++ b/src/lock-helper.h
@@ -8,5 +8,6 @@ typedef void (*gdm_autologin_cb_t) (void);
gboolean will_lock_screen (void);
void lock_screen (DbusmenuMenuitem * mi, gpointer data);
gboolean lock_screen_setup (gpointer data);
+void lock_screen_gdm_cb_set (gdm_autologin_cb_t cb);
#endif /* LOCK_HELPER_H__ */
diff --git a/src/users-service.c b/src/users-service.c
index 576574b..b4310da 100644
--- a/src/users-service.c
+++ b/src/users-service.c
@@ -59,13 +59,12 @@ static DbusmenuMenuitem *lock_menuitem = NULL;
static gint count;
static GList *users;
-#if 0
/* Respond to the signal of autologin changing to see if the
setting for timed login changes. */
static void
-gdm_settings_change (gboolean autologin)
+gdm_settings_change (void)
{
- if (autologin) {
+ if (!will_lock_screen()) {
dbusmenu_menuitem_property_set(lock_menuitem, DBUSMENU_MENUITEM_PROP_SENSITIVE, "false");
} else {
dbusmenu_menuitem_property_set(lock_menuitem, DBUSMENU_MENUITEM_PROP_SENSITIVE, "true");
@@ -73,7 +72,6 @@ gdm_settings_change (gboolean autologin)
return;
}
-#endif
static gboolean
check_guest_session (void)
@@ -299,6 +297,7 @@ main (int argc, char ** argv)
}
g_idle_add(lock_screen_setup, NULL);
+ lock_screen_gdm_cb_set(gdm_settings_change);
dbus_interface = g_object_new (USERS_SERVICE_DBUS_TYPE, NULL);