[gnome-shell/uajain/st-entry-password-2: 2/8] shellEntry: Handle PasswordEntries automatically



commit 97b81a231910128960180ff2e608b9b21c33dc5a
Author: Umang Jain <mailumangjain gmail com>
Date:   Thu Dec 12 14:38:42 2019 +0530

    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

 js/ui/shellEntry.js | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)
---
diff --git a/js/ui/shellEntry.js b/js/ui/shellEntry.js
index f7961af394..79a38bf56c 100644
--- a/js/ui/shellEntry.js
+++ b/js/ui/shellEntry.js
@@ -27,7 +27,8 @@ var EntryMenu = class extends PopupMenu.PopupMenu {
         this.addMenuItem(item);
         this._pasteItem = item;
 
-        this._passwordItem = null;
+        if (entry instanceof St.PasswordEntry)
+            this._makePasswordItem();
 
         Main.uiGroup.add_actor(this.actor);
         this.actor.hide();
@@ -86,8 +87,7 @@ var EntryMenu = class extends PopupMenu.PopupMenu {
     }
 
     _updatePasswordItem() {
-        let textHidden = this._entry.clutter_text.password_char;
-        if (textHidden)
+        if (!this._entry.password_visible)
             this._passwordItem.label.set_text(_("Show Text"));
         else
             this._passwordItem.label.set_text(_("Hide Text"));
@@ -110,8 +110,7 @@ var EntryMenu = class extends PopupMenu.PopupMenu {
     }
 
     _onPasswordActivated() {
-        let visible = !!this._entry.clutter_text.password_char;
-        this._entry.clutter_text.set_password_char(visible ? '' : '\u25cf');
+        this._entry.password_visible  = !this._entry.password_visible;
     }
 };
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]