diff --git a/js/ui/screenShield.js b/js/ui/screenShield.js index 2cae2732f..6c2fe25c2 100644 --- a/js/ui/screenShield.js +++ b/js/ui/screenShield.js @@ -94,12 +94,8 @@ var ScreenShield = class extends Signals.EventEmitter { this._activateDialog(); }); - this._oVirtCredentialsManager = OVirt.getOVirtCredentialsManager(); - this._oVirtCredentialsManager.connect('user-authenticated', - () => { - if (this._isLocked) - this._activateDialog(); - }); + this._credentialManagers = {}; + this.addCredentialManager(OVirt.SERVICE_NAME, OVirt.getOVirtCredentialsManager()); this._loginManager = LoginManager.getLoginManager(); this._loginManager.connect('prepare-for-sleep', @@ -641,6 +637,26 @@ var ScreenShield = class extends Signals.EventEmitter { // activate without animation in that case. } + addCredentialManager(serviceName, credentialManager) { + if (this._credentialManagers[serviceName]) + return; + + this._credentialManagers[serviceName] = credentialManager; + credentialManager.connectObject('user-authenticated', () => { + if (this._isLocked) + this._activateDialog(); + }, this); + } + + removeCredentialManager(serviceName) { + let credentialManager = this._credentialManagers[serviceName]; + if (!credentialManager) + return; + + credentialManager.disconnectObject(this); + delete this._credentialManagers[serviceName]; + } + lock(animate) { if (this._lockSettings.get_boolean(DISABLE_LOCK_KEY)) { log('Screen lock is locked down, not locking'); // lock, lock - who's there?