[gnome-shell] Login: sensitivity fixes



commit c3cab28c9b1b722582592afa97f3f16f1c9bd1cf
Author: StÃphane DÃmurget <stephane demurget free fr>
Date:   Sun Nov 18 22:36:17 2012 +0100

    Login: sensitivity fixes
    
    The login dialog had these issues:
      - the entry was not really disabled, you could still edit text
      - the sensitivity state was not reset on verification failure
      - the session list was not disabled
    
    The unlock dialog had these issues:
      - "Login as another user..." was not insensitive
      - redundant password char setting, overwriting the one given by the
        question
    
    The entry insensitive style was also wrong.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=687113

 data/theme/gnome-shell.css |   12 +++++----
 js/gdm/loginDialog.js      |   58 ++++++++++++++++++++++++++++++++++---------
 js/ui/unlockDialog.js      |    8 +++---
 3 files changed, 57 insertions(+), 21 deletions(-)
---
diff --git a/data/theme/gnome-shell.css b/data/theme/gnome-shell.css
index 4038120..e99acb0 100644
--- a/data/theme/gnome-shell.css
+++ b/data/theme/gnome-shell.css
@@ -405,11 +405,13 @@ StScrollBar StButton#vhandle:active {
     padding: 0 4px;
 }
 
-.login-dialog-prompt-entry:insensitive {
-    color: rgba(0,0,0,0.7);
-    border: 2px solid #565656;
-    background-gradient-start: rgb(200,200,200);
-    background-gradient-end: rgb(210,210,210);
+.modal-dialog StEntry:insensitive {
+    border-color: #666666;
+    color: #9f9f9f;
+    border: 2px solid #9f9f9f;
+    background-gradient-direction: none;
+    background-color: rgba(102, 102, 102, 0.15);
+    box-shadow: inset 0 0 rgba(0,0,0,1.0);
 }
 
 /* Panel */
diff --git a/js/gdm/loginDialog.js b/js/gdm/loginDialog.js
index 3db832e..c72ce47 100644
--- a/js/gdm/loginDialog.js
+++ b/js/gdm/loginDialog.js
@@ -604,6 +604,14 @@ const SessionList = new Lang.Class({
             this.close();
     },
 
+    updateSensitivity: function(sensitive) {
+        this._button.reactive = sensitive;
+        this._button.can_focus = sensitive;
+
+        for (let id in this._items)
+            this._items[id].actor.reactive = sensitive;
+    },
+
     setActiveSession: function(sessionId) {
          if (sessionId == this._activeSessionId)
              return;
@@ -685,6 +693,7 @@ const LoginDialog = new Lang.Class({
         this._userVerifier = new GdmUtil.ShellUserVerifier(this._greeterClient);
         this._userVerifier.connect('ask-question', Lang.bind(this, this._askQuestion));
         this._userVerifier.connect('show-message', Lang.bind(this, this._showMessage));
+        this._userVerifier.connect('verification-failed', Lang.bind(this, this._verificationFailed));
         this._userVerifier.connect('reset', Lang.bind(this, this._reset));
         this._userVerifier.connect('show-login-hint', Lang.bind(this, this._showLoginHint));
         this._userVerifier.connect('hide-login-hint', Lang.bind(this, this._hideLoginHint));
@@ -750,6 +759,8 @@ const LoginDialog = new Lang.Class({
         this._promptLoginHint.hide();
         this._promptBox.add(this._promptLoginHint);
 
+        this._signInButton = null;
+
         this._sessionList = new SessionList();
         this._sessionList.connect('session-activated',
                                   Lang.bind(this, function(list, sessionId) {
@@ -829,6 +840,7 @@ const LoginDialog = new Lang.Class({
     },
 
     _reset: function() {
+        this._updateSensitivity(true);
         this._promptMessage.hide();
         this._user = null;
         this._verifyingUser = false;
@@ -839,6 +851,12 @@ const LoginDialog = new Lang.Class({
             this._showUserList();
     },
 
+    _verificationFailed: function() {
+        this._promptEntry.text = '';
+
+        this._updateSensitivity(true);
+    },
+
     _onDefaultSessionChanged: function(client, sessionId) {
         this._sessionList.setActiveSession(sessionId);
     },
@@ -928,16 +946,15 @@ const LoginDialog = new Lang.Class({
 
                      function() {
                          this.setButtons(buttons);
+                         this._signInButton = okButtonInfo.button;
 
-                         let updateOkButtonEnabled = Lang.bind(this, function() {
-                             let sensitive = this._promptEntry.text.length > 0;
-                             okButtonInfo.button.reactive = sensitive;
-                             okButtonInfo.button.can_focus = sensitive;
-                         });
-
-                         updateOkButtonEnabled();
+                         this._updateSignInButtonSensitivity(this._promptEntry.text.length > 0);
 
-                         this._promptEntryTextChangedId = this._promptEntry.clutter_text.connect('text-changed', updateOkButtonEnabled);
+                         this._promptEntryTextChangedId =
+                             this._promptEntry.clutter_text.connect('text-changed',
+                                                                    Lang.bind(this, function() {
+                                                                        this._updateSignInButtonSensitivity(this._promptEntry.text.length > 0);
+                                                                    }));
                      },
 
                      hold];
@@ -947,6 +964,20 @@ const LoginDialog = new Lang.Class({
         return batch.run();
     },
 
+    _updateSensitivity: function(sensitive) {
+        this._promptEntry.reactive = sensitive;
+        this._promptEntry.clutter_text.editable = sensitive;
+        this._sessionList.updateSensitivity(sensitive);
+        this._updateSignInButtonSensitivity(sensitive);
+    },
+
+    _updateSignInButtonSensitivity: function(sensitive) {
+        if (this._signInButton) {
+            this._signInButton.reactive = sensitive;
+            this._signInButton.can_focus = sensitive;
+        }
+    },
+
     _hidePrompt: function() {
         this.setButtons([]);
 
@@ -961,8 +992,11 @@ const LoginDialog = new Lang.Class({
 
                      function() {
                          this._promptLoginHint.hide();
-                         this._promptEntry.reactive = true;
+
+                         this._updateSensitivity(true);
                          this._promptEntry.set_text('');
+
+                         this._signInButton = null;
                      }];
 
         let batch = new Batch.ConsecutiveBatch(this, tasks);
@@ -981,9 +1015,9 @@ const LoginDialog = new Lang.Class({
                      },
 
                      function() {
-                         let _text = this._promptEntry.get_text();
-                         this._promptEntry.reactive = false;
-                         this._userVerifier.answerQuery(serviceName, _text);
+                         let text = this._promptEntry.get_text();
+                         this._updateSensitivity(false);
+                         this._userVerifier.answerQuery(serviceName, text);
                      }];
 
         let batch = new Batch.ConsecutiveBatch(this, tasks);
diff --git a/js/ui/unlockDialog.js b/js/ui/unlockDialog.js
index 98ff22a..548bbe7 100644
--- a/js/ui/unlockDialog.js
+++ b/js/ui/unlockDialog.js
@@ -176,8 +176,6 @@ const UnlockDialog = new Lang.Class({
                            default: true };
         this.setButtons([cancelButton, this._okButton]);
 
-        this._updateSensitivity(true);
-
         let otherUserLabel = new St.Label({ text: _("Log in as another user"),
                                             style_class: 'login-dialog-not-listed-label' });
         this._otherUserButton = new St.Button({ style_class: 'login-dialog-not-listed-button',
@@ -191,6 +189,8 @@ const UnlockDialog = new Lang.Class({
                               { x_align: St.Align.START,
                                 x_fill: false });
 
+        this._updateSensitivity(true);
+
         let batch = new Batch.Hold();
         this._userVerifier.begin(this._userName, batch);
 
@@ -209,6 +209,8 @@ const UnlockDialog = new Lang.Class({
         this._promptEntry.reactive = sensitive;
         this._promptEntry.clutter_text.editable = sensitive;
         this._updateOkButtonSensitivity(sensitive && this._promptEntry.text.length > 0);
+        this._otherUserButton.reactive = sensitive;
+        this._otherUserButton.can_focus = sensitive;
     },
 
     _updateOkButtonSensitivity: function(sensitive) {
@@ -292,8 +294,6 @@ const UnlockDialog = new Lang.Class({
         this._firstQuestion = true;
 
         this._promptEntry.text = '';
-        this._promptEntry.clutter_text.set_password_char('\u25cf');
-        this._promptEntry.menu.isPassword = true;
 
         this._updateSensitivity(false);
     },



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