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
This commit is contained in:
Giovanni Campagna 2012-08-17 14:24:17 +02:00
parent 8dc9ceb2bc
commit b6375d3e40

View File

@ -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;