aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2010-03-16 16:52:17 -0500
committerTed Gould <ted@gould.cx>2010-03-16 16:52:17 -0500
commit6eea2650dc1b6b0ecc16b9de2b1c2471f90454e7 (patch)
tree3996fc48e67bd333c4e0d3a514a9901c3f098204 /src
parentc0b109efe19528618028937b092a7f86d51add41 (diff)
downloadayatana-indicator-session-6eea2650dc1b6b0ecc16b9de2b1c2471f90454e7.tar.gz
ayatana-indicator-session-6eea2650dc1b6b0ecc16b9de2b1c2471f90454e7.tar.bz2
ayatana-indicator-session-6eea2650dc1b6b0ecc16b9de2b1c2471f90454e7.zip
Make sure to call to activate teh screensaver if we can't lock it. Oh, and that takes a reply.
Diffstat (limited to 'src')
-rw-r--r--src/lock-helper.c37
1 files changed, 29 insertions, 8 deletions
diff --git a/src/lock-helper.c b/src/lock-helper.c
index 86669f6..ba6b182 100644
--- a/src/lock-helper.c
+++ b/src/lock-helper.c
@@ -186,24 +186,45 @@ activate_timeout (gpointer data)
return FALSE;
}
+/* Handle errors from activating the screensaver */
+static void
+active_cb (DBusGProxy * proxy, DBusGProxyCall * call, gpointer user_data)
+{
+ GError * error = NULL;
+
+ dbus_g_proxy_end_call(proxy, call, &error, G_TYPE_INVALID);
+
+ if (error != NULL) {
+ g_warning("Unable to activate screensaver: %s", error->message);
+ g_error_free(error);
+ }
+
+ return;
+}
+
/* A fun little function to actually lock the screen. If,
that's what you want, let's do it! */
void
lock_screen (DbusmenuMenuitem * mi, guint timestamp, gpointer data)
{
g_debug("Lock Screen");
- if (!will_lock_screen()) {
- g_debug("\tUser is guest, blocking lock");
- return;
- }
build_gss_proxy();
g_return_if_fail(gss_proxy != NULL);
- dbus_g_proxy_call_no_reply(gss_proxy,
- "Lock",
- G_TYPE_INVALID,
- G_TYPE_INVALID);
+ if (will_lock_screen()) {
+ dbus_g_proxy_call_no_reply(gss_proxy,
+ "Lock",
+ G_TYPE_INVALID,
+ G_TYPE_INVALID);
+ } else {
+ dbus_g_proxy_begin_call(gss_proxy,
+ "SetActive",
+ active_cb, NULL,
+ NULL,
+ G_TYPE_BOOLEAN, TRUE,
+ G_TYPE_INVALID);
+ }
if (gss_mainloop == NULL) {
gss_mainloop = g_main_loop_new(NULL, FALSE);