Replace LoginManager:sessionActive with GnomeSession:SessionIsActive

Gnome session started to track the session's active state a while
ago, so use that instead of our own ConsoleKit/logind abstraction
in LoginManager.

https://bugzilla.gnome.org/show_bug.cgi?id=693161
This commit is contained in:
Florian Müllner 2013-02-03 22:24:33 +01:00
parent 443f02cd92
commit 526a16298c
3 changed files with 6 additions and 10 deletions

View File

@ -58,6 +58,7 @@ const SessionManagerIface = <interface name="org.gnome.SessionManager">
<arg type="u" direction="in" /> <arg type="u" direction="in" />
<arg type="b" direction="out" /> <arg type="b" direction="out" />
</method> </method>
<property name="SessionIsActive" type="b" access="read"/>
<signal name="InhibitorAdded"> <signal name="InhibitorAdded">
<arg type="o" direction="out"/> <arg type="o" direction="out"/>
</signal> </signal>

View File

@ -8,7 +8,6 @@ const Params = imports.misc.params;
const Shell = imports.gi.Shell; const Shell = imports.gi.Shell;
const GnomeSession = imports.misc.gnomeSession; const GnomeSession = imports.misc.gnomeSession;
const LoginManager = imports.misc.loginManager;
const Main = imports.ui.main; const Main = imports.ui.main;
const ShellMountOperation = imports.ui.shellMountOperation; const ShellMountOperation = imports.ui.shellMountOperation;
@ -33,7 +32,6 @@ const AutomountManager = new Lang.Class({
Lang.bind(this, this._InhibitorsChanged)); Lang.bind(this, this._InhibitorsChanged));
this._inhibited = false; this._inhibited = false;
this._loginManager = LoginManager.getLoginManager();
this._volumeMonitor = Gio.VolumeMonitor.get(); this._volumeMonitor = Gio.VolumeMonitor.get();
}, },
@ -85,7 +83,7 @@ const AutomountManager = new Lang.Class({
_onDriveConnected: function() { _onDriveConnected: function() {
// if we're not in the current ConsoleKit session, // if we're not in the current ConsoleKit session,
// or screensaver is active, don't play sounds // or screensaver is active, don't play sounds
if (!this._loginManager.sessionActive) if (!this._session.SessionIsActive)
return; return;
global.play_theme_sound(0, 'device-added-media', global.play_theme_sound(0, 'device-added-media',
@ -96,7 +94,7 @@ const AutomountManager = new Lang.Class({
_onDriveDisconnected: function() { _onDriveDisconnected: function() {
// if we're not in the current ConsoleKit session, // if we're not in the current ConsoleKit session,
// or screensaver is active, don't play sounds // or screensaver is active, don't play sounds
if (!this._loginManager.sessionActive) if (!this._session.SessionIsActive)
return; return;
global.play_theme_sound(0, 'device-removed-media', global.play_theme_sound(0, 'device-removed-media',
@ -107,7 +105,7 @@ const AutomountManager = new Lang.Class({
_onDriveEjectButton: function(monitor, drive) { _onDriveEjectButton: function(monitor, drive) {
// TODO: this code path is not tested, as the GVfs volume monitor // TODO: this code path is not tested, as the GVfs volume monitor
// doesn't emit this signal just yet. // doesn't emit this signal just yet.
if (!this._loginManager.sessionActive) if (!this._session.SessionIsActive)
return; return;
// we force stop/eject in this case, so we don't have to pass a // we force stop/eject in this case, so we don't have to pass a
@ -147,7 +145,7 @@ const AutomountManager = new Lang.Class({
if (params.checkSession) { if (params.checkSession) {
// if we're not in the current ConsoleKit session, // if we're not in the current ConsoleKit session,
// don't attempt automount // don't attempt automount
if (!this._loginManager.sessionActive) if (!this._session.SessionIsActive)
return; return;
} }

View File

@ -4,7 +4,6 @@ const Lang = imports.lang;
const Gio = imports.gi.Gio; const Gio = imports.gi.Gio;
const St = imports.gi.St; const St = imports.gi.St;
const LoginManager = imports.misc.loginManager;
const Main = imports.ui.main; const Main = imports.ui.main;
const MessageTray = imports.ui.messageTray; const MessageTray = imports.ui.messageTray;
const ShellMountOperation = imports.ui.shellMountOperation; const ShellMountOperation = imports.ui.shellMountOperation;
@ -162,8 +161,6 @@ const AutorunManager = new Lang.Class({
Name: 'AutorunManager', Name: 'AutorunManager',
_init: function() { _init: function() {
this._loginManager = LoginManager.getLoginManager();
this._volumeMonitor = Gio.VolumeMonitor.get(); this._volumeMonitor = Gio.VolumeMonitor.get();
this._transDispatcher = new AutorunTransientDispatcher(this); this._transDispatcher = new AutorunTransientDispatcher(this);
@ -215,7 +212,7 @@ const AutorunManager = new Lang.Class({
_onMountAdded: function(monitor, mount) { _onMountAdded: function(monitor, mount) {
// don't do anything if our session is not the currently // don't do anything if our session is not the currently
// active one // active one
if (!this._loginManager.sessionActive) if (!this._session.SessionIsActive)
return; return;
this._processMount(mount, true); this._processMount(mount, true);