Consolidate systemd and consolekit in a common abstract class
Various code around had different paths for ConsoleKit and logind. Consolidate it by making an abstract class that all callers can use, which hides the implementation details of the two daemons. https://bugzilla.gnome.org/show_bug.cgi?id=682096
This commit is contained in:
@ -9,13 +9,12 @@ 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 LoginManager = imports.misc.loginManager;
|
||||
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';
|
||||
@ -341,15 +340,10 @@ 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._loginManager = LoginManager.getLoginManager();
|
||||
this._loginSession = this._loginManager.getCurrentSessionProxy();
|
||||
this._loginSession.connectSignal('Lock', Lang.bind(this, function() { this.lock(false); }));
|
||||
this._loginSession.connectSignal('Unlock', Lang.bind(this, function() { this.unlock(); }));
|
||||
|
||||
this._settings = new Gio.Settings({ schema: SCREENSAVER_SCHEMA });
|
||||
|
||||
|
Reference in New Issue
Block a user