Skip to content

Commit d368157

Browse files
JosephMccclefebvre
authored andcommitted
polkitAuthenticationDialog: Use the new StPasswordEntry
1 parent 9ea9d8f commit d368157

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

js/ui/polkitAuthenticationAgent.js

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -105,14 +105,14 @@ var AuthenticationDialog = GObject.registerClass({
105105
vertical: true,
106106
});
107107

108-
this._passwordEntry = new St.Entry({
108+
this._passwordEntry = new St.PasswordEntry({
109109
style_class: 'prompt-dialog-password-entry',
110110
text: "",
111111
can_focus: true,
112112
visible: false,
113113
x_align: Clutter.ActorAlign.CENTER,
114114
});
115-
CinnamonEntry.addContextMenu(this._passwordEntry, { isPassword: true });
115+
CinnamonEntry.addContextMenu(this._passwordEntry);
116116
this._passwordEntry.clutter_text.connect('activate', this._onEntryActivate.bind(this));
117117
this._passwordEntry.bind_property('reactive',
118118
this._passwordEntry.clutter_text, 'editable',
@@ -121,6 +121,12 @@ var AuthenticationDialog = GObject.registerClass({
121121

122122
let warningBox = new St.BoxLayout({ vertical: true });
123123

124+
let capsLockWarning = new CinnamonEntry.CapsLockWarning();
125+
this._passwordEntry.bind_property('visible',
126+
capsLockWarning, 'visible',
127+
GObject.BindingFlags.SYNC_CREATE);
128+
warningBox.add_child(capsLockWarning);
129+
124130
this._errorMessageLabel = new St.Label({
125131
style_class: 'prompt-dialog-error-label',
126132
visible: false,
@@ -292,10 +298,7 @@ var AuthenticationDialog = GObject.registerClass({
292298
else
293299
this._passwordEntry.hint_text = request;
294300

295-
if (echoOn)
296-
this._passwordEntry.clutter_text.set_password_char('');
297-
else
298-
this._passwordEntry.clutter_text.set_password_char('\u25cf'); // ● U+25CF BLACK CIRCLE
301+
this._passwordEntry.password_visible = echoOn;
299302

300303
this._passwordEntry.show();
301304
this._passwordEntry.set_text('');

0 commit comments

Comments
 (0)