diff options
author | Ted Gould <ted@canonical.com> | 2009-10-06 20:28:06 -0400 |
---|---|---|
committer | Ted Gould <ted@canonical.com> | 2009-10-06 20:28:06 -0400 |
commit | d6c6861081cd6133fd605bae27a9c199b41b1555 (patch) | |
tree | 9fea5e459c9e5fb9e5c4baa4f23312d41956cc9c | |
parent | f6fc44d8020fb20200b961359ad581dade9e231b (diff) | |
download | ayatana-indicator-session-d6c6861081cd6133fd605bae27a9c199b41b1555.tar.gz ayatana-indicator-session-d6c6861081cd6133fd605bae27a9c199b41b1555.tar.bz2 ayatana-indicator-session-d6c6861081cd6133fd605bae27a9c199b41b1555.zip |
Setting up the callback
-rw-r--r-- | src/lock-helper.c | 12 | ||||
-rw-r--r-- | src/lock-helper.h | 1 | ||||
-rw-r--r-- | src/users-service.c | 7 |
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); |