aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTed Gould <ted@canonical.com>2009-07-26 21:45:37 -0500
committerTed Gould <ted@canonical.com>2009-07-26 21:45:37 -0500
commita2e7239aa75ffd691adc72372af67808253f5bdc (patch)
treeafcd0b4a9117aebbe21f82a63c6774edd99ddc39
parent2931dc6bf7552849a54f1c1eed83cff275ec63b2 (diff)
downloadayatana-indicator-session-a2e7239aa75ffd691adc72372af67808253f5bdc.tar.gz
ayatana-indicator-session-a2e7239aa75ffd691adc72372af67808253f5bdc.tar.bz2
ayatana-indicator-session-a2e7239aa75ffd691adc72372af67808253f5bdc.zip
A function to lock the saver
-rw-r--r--src/status-service.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/status-service.c b/src/status-service.c
index e02e70f..dbb597c 100644
--- a/src/status-service.c
+++ b/src/status-service.c
@@ -41,10 +41,30 @@ static const gchar * status_icons[STATUS_PROVIDER_STATUS_LAST] = {
static DbusmenuMenuitem * root_menuitem = NULL;
static GMainLoop * mainloop = NULL;
+/* A fun little function to actually lock the screen. If,
+ that's what you want, let's do it! */
static void
lock_screen (DbusmenuMenuitem * mi, gpointer data)
{
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;
}