[gnome-shell/gnome-3-8] gdm: Fix regression where domain login hint not shown



commit 47dee22b053f09d0f7f6a0f4044cf36d75037f89
Author: Stef Walter <stefw gnome org>
Date:   Fri Apr 19 09:07:04 2013 +0200

    gdm: Fix regression where domain login hint not shown
    
    Also only keep around realmd while we're actually using it, allow it
    to quit if no other clients are active.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=698200

 js/gdm/loginDialog.js |   24 ++++++++++++++++++++++++
 js/gdm/realmd.js      |   16 ++++++++++++++--
 js/gdm/util.js        |   26 --------------------------
 3 files changed, 38 insertions(+), 28 deletions(-)
---
diff --git a/js/gdm/loginDialog.js b/js/gdm/loginDialog.js
index c023f4c..f9c5894 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 e64b0b2..78c94b4 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 36ee4ab..6075e66 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);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]