aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
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);