diff options
author | Ted Gould <ted@gould.cx> | 2010-03-16 10:06:31 -0500 |
---|---|---|
committer | Ted Gould <ted@gould.cx> | 2010-03-16 10:06:31 -0500 |
commit | 87d0374245134a7a723ee6dd8a1a1aec90ca4776 (patch) | |
tree | c879e896d4a49d9bbfac63762110a835fba1b6f7 /src | |
parent | e1afff18303f973f944c2df8081bae4d9a1a177d (diff) | |
parent | 9efeb48b00b52c8c2886c1c3a69d96d80b92d84d (diff) | |
download | ayatana-indicator-session-87d0374245134a7a723ee6dd8a1a1aec90ca4776.tar.gz ayatana-indicator-session-87d0374245134a7a723ee6dd8a1a1aec90ca4776.tar.bz2 ayatana-indicator-session-87d0374245134a7a723ee6dd8a1a1aec90ca4776.zip |
When switching users try to lock the screen
Diffstat (limited to 'src')
-rw-r--r-- | src/lock-helper.c | 2 | ||||
-rw-r--r-- | src/session-service.c | 23 |
2 files changed, 23 insertions, 2 deletions
diff --git a/src/lock-helper.c b/src/lock-helper.c index b38be65..47dcb71 100644 --- a/src/lock-helper.c +++ b/src/lock-helper.c @@ -182,7 +182,7 @@ lock_screen (DbusmenuMenuitem * mi, guint timestamp, gpointer data) { g_debug("Lock Screen"); if (!will_lock_screen()) { - g_debug("\tGDM set to autologin, blocking lock"); + g_debug("\tUser is guest, blocking lock"); return; } diff --git a/src/session-service.c b/src/session-service.c index 691734b..fb20f3b 100644 --- a/src/session-service.c +++ b/src/session-service.c @@ -132,6 +132,19 @@ ensure_gconf_client (void) return; } +/* Check to see if the lockdown key is protecting from + locking the screen. If not, lock it. */ +static void +lock_if_possible (void) { + ensure_gconf_client (); + + if (!gconf_client_get_bool (gconf_client, LOCKDOWN_KEY_SCREENSAVER, NULL)) { + lock_screen(NULL, 0, NULL); + } + + return; +} + /* A return from the command to sleep the system. Make sure that we unthrottle the screensaver. */ static void @@ -153,7 +166,7 @@ machine_sleep (DbusmenuMenuitem * mi, guint timestamp, gpointer userdata) } screensaver_throttle(type); - lock_screen(NULL, 0, NULL); + lock_if_possible(); dbus_g_proxy_begin_call(up_main_proxy, type, @@ -370,6 +383,9 @@ static void activate_guest_session (DbusmenuMenuitem * mi, guint timestamp, gpointer user_data) { GError * error = NULL; + + lock_if_possible(); + if (!g_spawn_command_line_async(GUEST_SESSION_LAUNCHER, &error)) { g_warning("Unable to start guest session: %s", error->message); g_error_free(error); @@ -410,6 +426,9 @@ static void activate_new_session (DbusmenuMenuitem * mi, guint timestamp, gpointer user_data) { GError * error = NULL; + + lock_if_possible(); + if (!g_spawn_command_line_async("gdmflexiserver --startnew", &error)) { g_warning("Unable to start new session: %s", error->message); g_error_free(error); @@ -425,6 +444,8 @@ activate_user_session (DbusmenuMenuitem *mi, guint timestamp, gpointer user_data UserData *user = (UserData *)user_data; UsersServiceDbus *service = user->service; + lock_if_possible(); + users_service_dbus_activate_user_session (service, user); } |