shellEntry: Handle PasswordEntries automatically
shellEntry should not need to query the clutter-text directly in order to know if the entry is for passport-input purpose. shellEntry can easily a password-entry by querying if it is an instance of StPasswordEntry. https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/619
This commit is contained in:
parent
f61a1f3180
commit
97b81a2319
@ -27,7 +27,8 @@ var EntryMenu = class extends PopupMenu.PopupMenu {
|
|||||||
this.addMenuItem(item);
|
this.addMenuItem(item);
|
||||||
this._pasteItem = item;
|
this._pasteItem = item;
|
||||||
|
|
||||||
this._passwordItem = null;
|
if (entry instanceof St.PasswordEntry)
|
||||||
|
this._makePasswordItem();
|
||||||
|
|
||||||
Main.uiGroup.add_actor(this.actor);
|
Main.uiGroup.add_actor(this.actor);
|
||||||
this.actor.hide();
|
this.actor.hide();
|
||||||
@ -86,8 +87,7 @@ var EntryMenu = class extends PopupMenu.PopupMenu {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_updatePasswordItem() {
|
_updatePasswordItem() {
|
||||||
let textHidden = this._entry.clutter_text.password_char;
|
if (!this._entry.password_visible)
|
||||||
if (textHidden)
|
|
||||||
this._passwordItem.label.set_text(_("Show Text"));
|
this._passwordItem.label.set_text(_("Show Text"));
|
||||||
else
|
else
|
||||||
this._passwordItem.label.set_text(_("Hide Text"));
|
this._passwordItem.label.set_text(_("Hide Text"));
|
||||||
@ -110,8 +110,7 @@ var EntryMenu = class extends PopupMenu.PopupMenu {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_onPasswordActivated() {
|
_onPasswordActivated() {
|
||||||
let visible = !!this._entry.clutter_text.password_char;
|
this._entry.password_visible = !this._entry.password_visible;
|
||||||
this._entry.clutter_text.set_password_char(visible ? '' : '\u25cf');
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user