Disable the login button when there is no input

You can't login until something has been entered in the password field.
We should therefore make the login button insensitive until you have
entered some text.

https://bugzilla.gnome.org/show_bug.cgi?id=687112
This commit is contained in:
Stéphane Démurget
2012-11-01 16:19:17 +01:00
committed by Allan Day
parent a508bece36
commit ae0821e07b
2 changed files with 32 additions and 9 deletions

View File

@ -151,6 +151,9 @@ const UnlockDialog = new Lang.Class({
ShellEntry.addContextMenu(this._promptEntry, { isPassword: true });
this.setInitialKeyFocus(this._promptEntry);
this._promptEntry.clutter_text.connect('activate', Lang.bind(this, this._doUnlock));
this._promptEntry.clutter_text.connect('text-changed', Lang.bind(this, function() {
this._updateOkButtonSensitivity(this._promptEntry.text.length > 0);
}));
this._promptLayout.add(this._promptEntry,
{ expand: true,
@ -203,6 +206,10 @@ const UnlockDialog = new Lang.Class({
_updateSensitivity: function(sensitive) {
this._promptEntry.reactive = sensitive;
this._promptEntry.clutter_text.editable = sensitive;
this._updateOkButtonSensitivity(sensitive && this._promptEntry.text.length > 0);
},
_updateOkButtonSensitivity: function(sensitive) {
this._okButton.button.reactive = sensitive;
this._okButton.button.can_focus = sensitive;
},