← Back to team overview

ayatana-commits team mailing list archive

[Merge] lp:~ted/indicator-session/lock-on-sleep into lp:indicator-session

 

Ted Gould has proposed merging lp:~ted/indicator-session/lock-on-sleep into lp:indicator-session.

    Requested reviews:
    Indicator Applet Developers (indicator-applet-developers)


Adding code to lock the screen when one of the sleep commands is issued.
-- 
https://code.launchpad.net/~ted/indicator-session/lock-on-sleep/+merge/12321
Your team ayatana-commits is subscribed to branch lp:indicator-session.
=== modified file 'src/session-service.c'
--- src/session-service.c	2009-09-16 16:34:26 +0000
+++ src/session-service.c	2009-09-24 01:50:21 +0000
@@ -53,6 +53,33 @@
 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 @@
 		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,


Follow ups