aboutsummaryrefslogtreecommitdiff
path: root/src/session-service.c
diff options
context:
space:
mode:
authorTed Gould <ted@canonical.com>2009-09-23 16:58:54 -0500
committerTed Gould <ted@canonical.com>2009-09-23 16:58:54 -0500
commit159f4132b82d6a3b152fb8164dc5b4b6d76696da (patch)
treeccd8731b51c7a8af14c843172de74e254ec67927 /src/session-service.c
parent9703540eaf33ac50e99f04e9eddf5816557868e1 (diff)
downloadayatana-indicator-session-159f4132b82d6a3b152fb8164dc5b4b6d76696da.tar.gz
ayatana-indicator-session-159f4132b82d6a3b152fb8164dc5b4b6d76696da.tar.bz2
ayatana-indicator-session-159f4132b82d6a3b152fb8164dc5b4b6d76696da.zip
Stealing the lock screen function from the user-service and making it so that we lock on sleep.
Diffstat (limited to 'src/session-service.c')
-rw-r--r--src/session-service.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/session-service.c b/src/session-service.c
index 9c3c4ef..fafcbb1 100644
--- a/src/session-service.c
+++ b/src/session-service.c
@@ -53,6 +53,33 @@ static DbusmenuMenuitem * logout_mi = NULL;
static DbusmenuMenuitem * restart_mi = NULL;
static DbusmenuMenuitem * shutdown_mi = NULL;
+/* A fun little function to actually lock the screen. If,
+ that's what you want, let's do it! */
+static void
+lock_screen (void)
+{
+ g_debug("Lock Screen");
+
+ DBusGConnection * session_bus = dbus_g_bus_get(DBUS_BUS_SESSION, NULL);
+ g_return_if_fail(session_bus != NULL);
+
+ DBusGProxy * proxy = dbus_g_proxy_new_for_name_owner(session_bus,
+ "org.gnome.ScreenSaver",
+ "/",
+ "org.gnome.ScreenSaver",
+ NULL);
+ g_return_if_fail(proxy != NULL);
+
+ dbus_g_proxy_call_no_reply(proxy,
+ "Lock",
+ G_TYPE_INVALID,
+ G_TYPE_INVALID);
+
+ g_object_unref(proxy);
+
+ return;
+}
+
/* Let's put this machine to sleep, with some info on how
it should sleep. */
static void
@@ -64,6 +91,8 @@ sleep (DbusmenuMenuitem * mi, gpointer userdata)
g_warning("Can not %s as no DeviceKit Power Proxy", type);
}
+ lock_screen();
+
dbus_g_proxy_call_no_reply(dkp_main_proxy,
type,
G_TYPE_INVALID,