js: Use StPasswordEntry for password entry fields
Use the new StPasswordEntry for password entry fields and remove all direct handling of clutter text of the entry via clutter_text_set_password_char to show/hide the password text. StPasswordEntry will provides a peek-password-icon which will allow to show/hide the password present in the field to the user in subsequent commits. https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/619
This commit is contained in:

committed by
Florian Müllner

parent
b166de08dc
commit
684b918915
@ -54,12 +54,18 @@ class NetworkSecretDialog extends ModalDialog.ModalDialog {
|
||||
|
||||
let reactive = secret.key != null;
|
||||
|
||||
secret.entry = new St.Entry({ style_class: 'prompt-dialog-password-entry',
|
||||
text: secret.value, can_focus: reactive,
|
||||
reactive,
|
||||
x_expand: true });
|
||||
ShellEntry.addContextMenu(secret.entry,
|
||||
{ isPassword: secret.password });
|
||||
let entryParams = {
|
||||
style_class: 'prompt-dialog-password-entry',
|
||||
text: secret.value,
|
||||
can_focus: reactive,
|
||||
reactive,
|
||||
x_expand: true,
|
||||
};
|
||||
if (secret.password)
|
||||
secret.entry = new St.PasswordEntry(entryParams);
|
||||
else
|
||||
secret.entry = new St.Entry(entryParams);
|
||||
ShellEntry.addContextMenu(secret.entry);
|
||||
|
||||
if (secret.validate)
|
||||
secret.valid = secret.validate(secret);
|
||||
@ -93,9 +99,6 @@ class NetworkSecretDialog extends ModalDialog.ModalDialog {
|
||||
layout.attach(secret.entry, 1, pos, 1, 1);
|
||||
}
|
||||
pos++;
|
||||
|
||||
if (secret.password)
|
||||
secret.entry.clutter_text.set_password_char('\u25cf');
|
||||
}
|
||||
|
||||
contentBox.messageBox.add(secretTable);
|
||||
|
Reference in New Issue
Block a user