[gnome-shell] ScreenShield: listen to login managers to unlock the session



commit b6375d3e4066a34d530b91e89035a9f2408ff81d
Author: Giovanni Campagna <gcampagna src gnome org>
Date:   Fri Aug 17 14:24:17 2012 +0200

    ScreenShield: listen to login managers to unlock the session
    
    Handle locking and unlocking from outside. This fixes coming
    back from fast user switching.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=682096

 js/ui/screenShield.js |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)
---
diff --git a/js/ui/screenShield.js b/js/ui/screenShield.js
index c4a23b6..0fb4107 100644
--- a/js/ui/screenShield.js
+++ b/js/ui/screenShield.js
@@ -8,11 +8,13 @@ const Meta = imports.gi.Meta;
 const Signals = imports.signals;
 const St = imports.gi.St;
 
+const ConsoleKit = imports.misc.consoleKit;
 const GnomeSession = imports.misc.gnomeSession;
 const Layout = imports.ui.layout;
 const Lightbox = imports.ui.lightbox;
 const Main = imports.ui.main;
 const MessageTray = imports.ui.messageTray;
+const Systemd = imports.misc.systemd;
 const Tweener = imports.ui.tweener;
 
 const SCREENSAVER_SCHEMA = 'org.gnome.desktop.screensaver';
@@ -340,6 +342,16 @@ const ScreenShield = new Lang.Class({
             this._onStatusChanged(status);
         }));
 
+        if (Systemd.haveSystemd()) {
+            this._systemdProxy = new Systemd.SystemdLoginSession(GLib.getenv('XDG_SESSION_ID'));
+            this._systemdProxy.connectSignal('Lock', Lang.bind(this, function() { this.lock(false); }));
+            this._systemdProxy.connectSignal('Unlock', Lang.bind(this, function() { this.unlock(); }));
+        } else {
+            this._consoleKitProxy = new ConsoleKit.ConsoleKitManager();
+            this._consoleKitProxy.ckSession.connectSignal('Lock', Lang.bind(this, function() { this.lock(false); }));
+            this._consoleKitProxy.ckSession.connectSignal('Unlock', Lang.bind(this, function() { this.unlock(); }));
+        }
+
         this._settings = new Gio.Settings({ schema: SCREENSAVER_SCHEMA });
 
         this._isModal = false;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]