From b6375d3e4066a34d530b91e89035a9f2408ff81d Mon Sep 17 00:00:00 2001 From: Giovanni Campagna Date: Fri, 17 Aug 2012 14:24:17 +0200 Subject: [PATCH] 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 file changed, 12 insertions(+) diff --git a/js/ui/screenShield.js b/js/ui/screenShield.js index c4a23b6e9..0fb410781 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;