network-agent: Focus the first reactive entry

Currently network dialogs don't focus password entries, which means
that rather than entering their password directly, users first have
to click the entry (or tab around the dialog).
Instead, put keyboard focus on the first entry that requires user
input.

https://bugzilla.gnome.org/show_bug.cgi?id=659133
This commit is contained in:
Florian Müllner 2011-09-15 01:22:29 +02:00
parent bc0c490ec3
commit 4e4ce0dd21

View File

@ -91,6 +91,7 @@ NetworkSecretDialog.prototype = {
}
let secretTable = new St.Table({ style_class: 'network-dialog-secret-table' });
let initialFocusSet = false;
let pos = 0;
for (let i = 0; i < this._content.secrets.length; i++) {
let secret = this._content.secrets[i];
@ -109,6 +110,11 @@ NetworkSecretDialog.prototype = {
secret.valid = secret.value.length > 0;
if (reactive) {
if (!initialFocusSet) {
this.setInitialKeyFocus(secret.entry);
initialFocusSet = true;
}
secret.entry.clutter_text.connect('text-changed', Lang.bind(this, function() {
secret.value = secret.entry.get_text();
if (secret.validate)