diff --git a/js/gdm/loginDialog.js b/js/gdm/loginDialog.js index c023f4c8e..f9c5894c4 100644 --- a/js/gdm/loginDialog.js +++ b/js/gdm/loginDialog.js @@ -28,6 +28,7 @@ const Mainloop = imports.mainloop; const Meta = imports.gi.Meta; const Lang = imports.lang; const Pango = imports.gi.Pango; +const Realmd = imports.gdm.realmd; const Signals = imports.signals; const Shell = imports.gi.Shell; const St = imports.gi.St; @@ -914,17 +915,40 @@ const LoginDialog = new Lang.Class({ return batch.run(); }, + _showRealmLoginHint: function(realmManager, hint) { + if (!hint) + return; + + hint = hint.replace(/%U/g, 'user'); + hint = hint.replace(/%D/g, 'DOMAIN'); + hint = hint.replace(/%[^UD]/g, ''); + + // Translators: this message is shown below the username entry field + // to clue the user in on how to login to the local network realm + this._showLoginHint(null, _("(e.g., user or %s)").format(hint)); + }, + _askForUsernameAndLogIn: function() { this._promptLabel.set_text(_("Username: ")); this._promptEntry.set_text(''); this._promptEntry.clutter_text.set_password_char(''); + let realmManager = new Realmd.Manager(); + let signalId = realmManager.connect('login-format-changed', + Lang.bind(this, this._showRealmLoginHint)); + this._showRealmLoginHint(realmManager.loginFormat); + let tasks = [this._showPrompt, function() { let userName = this._promptEntry.get_text(); this._promptEntry.reactive = false; return this._beginVerificationForUser(userName); + }, + + function() { + realmManager.disconnect(signalId) + realmManager.release(); }]; let batch = new Batch.ConsecutiveBatch(this, tasks); diff --git a/js/gdm/realmd.js b/js/gdm/realmd.js index e64b0b27b..78c94b4be 100644 --- a/js/gdm/realmd.js +++ b/js/gdm/realmd.js @@ -63,7 +63,7 @@ const Manager = new Lang.Class({ Lang.bind(this, this._reloadRealms)) this._realms = {}; - this._aggregateProvider.connect('g-properties-changed', + this._signalId = this._aggregateProvider.connect('g-properties-changed', Lang.bind(this, function(proxy, properties) { if ('Realms' in properties.deep_unpack()) this._reloadRealms(); @@ -106,7 +106,7 @@ const Manager = new Lang.Class({ realm.connect('g-properties-changed', Lang.bind(this, function(proxy, properties) { if ('Configured' in properties.deep_unpack()) - this._reloadRealm(); + this._reloadRealm(realm); })); }, @@ -134,6 +134,18 @@ const Manager = new Lang.Class({ this._updateLoginFormat(); return this._loginFormat; + }, + + release: function() { + Service(Gio.DBus.system, + 'org.freedesktop.realmd', + '/org/freedesktop/realmd', + function(service) { + service.ReleaseRemote(); + }); + this._aggregateProvider.disconnect(this._signalId); + this._realms = { }; + this._updateLoginFormat(); } }); Signals.addSignalMethods(Manager.prototype) diff --git a/js/gdm/util.js b/js/gdm/util.js index 36ee4abed..6075e660f 100644 --- a/js/gdm/util.js +++ b/js/gdm/util.js @@ -9,7 +9,6 @@ const Signals = imports.signals; const Batch = imports.gdm.batch; const Fprint = imports.gdm.fingerprint; -const Realmd = imports.gdm.realmd; const Main = imports.ui.main; const Params = imports.misc.params; const Tweener = imports.ui.tweener; @@ -117,7 +116,6 @@ const ShellUserVerifier = new Lang.Class({ this._settings = new Gio.Settings({ schema: LOGIN_SCREEN_SCHEMA }); this._fprintManager = new Fprint.FprintManager(); - this._realmManager = new Realmd.Manager(); this._messageQueue = []; this._messageQueueTimeoutId = 0; this.hasPendingMessages = false; @@ -377,30 +375,11 @@ const ShellUserVerifier = new Lang.Class({ this._queueMessage(problem, 'login-dialog-message-warning'); }, - _showRealmLoginHint: function() { - if (this._realmManager.loginFormat) { - let hint = this._realmManager.loginFormat; - - hint = hint.replace(/%U/g, 'user'); - hint = hint.replace(/%D/g, 'DOMAIN'); - hint = hint.replace(/%[^UD]/g, ''); - - // Translators: this message is shown below the username entry field - // to clue the user in on how to login to the local network realm - this.emit('show-login-hint', - _("(e.g., user or %s)").format(hint)); - } - }, - _onInfoQuery: function(client, serviceName, question) { // We only expect questions to come from the main auth service if (serviceName != PASSWORD_SERVICE_NAME) return; - this._showRealmLoginHint(); - this._realmLoginHintSignalId = this._realmManager.connect('login-format-changed', - Lang.bind(this, this._showRealmLoginHint)); - this.emit('ask-question', serviceName, question, ''); }, @@ -476,11 +455,6 @@ const ShellUserVerifier = new Lang.Class({ } this.emit('hide-login-hint'); - - if (this._realmLoginHintSignalId) { - this._realmManager.disconnect(this._realmLoginHintSignalId); - this._realmLoginHintSignalId = 0; - } }, }); Signals.addSignalMethods(ShellUserVerifier.prototype);