[gnome-shell/wip/rstrode/login-screen-extensions: 133/134] shellEntry: Handle password item from dedication function




commit 96396cfe9f328f98237be9c49598da9014fa2456
Author: Ray Strode <rstrode redhat com>
Date:   Wed Aug 21 15:06:46 2019 -0400

    shellEntry: Handle password item from dedication function
    
    At the moment, shellEntry handles creating and destroying its
    "Show Text" password menu item directly from its isPassword
    setter function.
    
    This commit moves that handling to a dedicated _resetPasswordItem
    function, as prep work for adding lockdown support of the "Show Text"
    menu item.
    
    https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/687

 js/ui/shellEntry.js | 23 +++++++++++++++++------
 1 file changed, 17 insertions(+), 6 deletions(-)
---
diff --git a/js/ui/shellEntry.js b/js/ui/shellEntry.js
index 603a9c64ae..765cede062 100644
--- a/js/ui/shellEntry.js
+++ b/js/ui/shellEntry.js
@@ -41,6 +41,19 @@ var EntryMenu = class extends PopupMenu.PopupMenu {
         this._updatePasswordItem();
     }
 
+    _resetPasswordItem() {
+        if (!this.isPassword) {
+            if (this._passwordItem) {
+                this._passwordItem.destroy();
+                this._passwordItem = null;
+            }
+            this._entry.clutter_text.set_password_char('\u25cf');
+        } else {
+            if (!this._passwordItem)
+                this._makePasswordItem();
+        }
+    }
+
     get isPassword() {
         return this._entry.input_purpose == Clutter.InputContentPurpose.PASSWORD;
     }
@@ -49,14 +62,12 @@ var EntryMenu = class extends PopupMenu.PopupMenu {
         if (v == this.isPassword)
             return;
 
-        if (v) {
-            this._makePasswordItem();
+        if (v)
             this._entry.input_purpose = Clutter.InputContentPurpose.PASSWORD;
-        } else {
-            this._passwordItem.destroy();
-            this._passwordItem = null;
+        else
             this._entry.input_purpose = Clutter.InputContentPurpose.NORMAL;
-        }
+
+        this._resetPasswordItem();
     }
 
     open(animate) {


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