screenSaver: bugfixes
Fix the signal handling; you can't use this.connect('ActiveChanged') to connect to a D-Bus signal after replacing the signal methods with the lang.signals versions. Just leave it using the D-Bus signal names, just like it uses the D-Bus method names. Also, remove the "_" from "_screenSaverActive", to match what AutomountManager checks for, and remove getActive(), since it's not needed. https://bugzilla.gnome.org/show_bug.cgi?id=654550
This commit is contained in:
parent
579ae59eca
commit
5f86e29830
@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
const DBus = imports.dbus;
|
const DBus = imports.dbus;
|
||||||
const Lang = imports.lang;
|
const Lang = imports.lang;
|
||||||
const Signals = imports.signals;
|
|
||||||
|
|
||||||
const ScreenSaverIface = {
|
const ScreenSaverIface = {
|
||||||
name: 'org.gnome.ScreenSaver',
|
name: 'org.gnome.ScreenSaver',
|
||||||
@ -32,28 +31,23 @@ ScreenSaverProxy.prototype = {
|
|||||||
Lang.bind(this, this._onSSAppeared),
|
Lang.bind(this, this._onSSAppeared),
|
||||||
Lang.bind(this, this._onSSVanished));
|
Lang.bind(this, this._onSSVanished));
|
||||||
|
|
||||||
|
this.screenSaverActive = false;
|
||||||
this.connect('ActiveChanged',
|
this.connect('ActiveChanged',
|
||||||
Lang.bind(this, this._onActiveChanged));
|
Lang.bind(this, this._onActiveChanged));
|
||||||
},
|
},
|
||||||
|
|
||||||
_onSSAppeared: function(owner) {
|
_onSSAppeared: function(owner) {
|
||||||
this.GetActiveRemote(Lang.bind(this, function(isActive) {
|
this.GetActiveRemote(Lang.bind(this, function(isActive) {
|
||||||
this._screenSaverActive = isActive;
|
this.screenSaverActive = isActive;
|
||||||
}))
|
}))
|
||||||
},
|
},
|
||||||
|
|
||||||
_onSSVanished: function(oldOwner) {
|
_onSSVanished: function(oldOwner) {
|
||||||
this._screenSaverActive = false;
|
this.screenSaverActive = false;
|
||||||
},
|
},
|
||||||
|
|
||||||
_onActiveChanged: function(object, isActive) {
|
_onActiveChanged: function(object, isActive) {
|
||||||
this._screenSaverActive = isActive;
|
this.screenSaverActive = isActive;
|
||||||
this.emit('active-changed', this._screenSaverActive);
|
|
||||||
},
|
|
||||||
|
|
||||||
getActive: function() {
|
|
||||||
return this._screenSaverActive;
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
DBus.proxifyPrototype(ScreenSaverProxy.prototype, ScreenSaverIface);
|
DBus.proxifyPrototype(ScreenSaverProxy.prototype, ScreenSaverIface);
|
||||||
Signals.addSignalMethods(ScreenSaverProxy.prototype);
|
|
||||||
|
@ -86,7 +86,7 @@ AutomountManager.prototype = {
|
|||||||
this.ckListener = new ConsoleKitManager();
|
this.ckListener = new ConsoleKitManager();
|
||||||
|
|
||||||
this._ssProxy = new ScreenSaver.ScreenSaverProxy();
|
this._ssProxy = new ScreenSaver.ScreenSaverProxy();
|
||||||
this._ssProxy.connect('active-changed',
|
this._ssProxy.connect('ActiveChanged',
|
||||||
Lang.bind(this,
|
Lang.bind(this,
|
||||||
this._screenSaverActiveChanged));
|
this._screenSaverActiveChanged));
|
||||||
|
|
||||||
@ -201,7 +201,7 @@ AutomountManager.prototype = {
|
|||||||
if (!this.ckListener.sessionActive)
|
if (!this.ckListener.sessionActive)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (this._ssProxy.getActive()) {
|
if (this._ssProxy.screenSaverActive) {
|
||||||
if (this._volumeQueue.indexOf(volume) == -1)
|
if (this._volumeQueue.indexOf(volume) == -1)
|
||||||
this._volumeQueue.push(volume);
|
this._volumeQueue.push(volume);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user