Blame SOURCES/0003-shellEntry-Handle-password-item-from-dedication-func.patch

477568
From 39cf97176e2a92506081ee151ea546e2c6cf213a Mon Sep 17 00:00:00 2001
477568
From: Ray Strode <rstrode@redhat.com>
477568
Date: Wed, 21 Aug 2019 15:06:46 -0400
477568
Subject: [PATCH 3/4] shellEntry: Handle password item from dedication function
477568
477568
At the moment, shellEntry handles creating and destroying its
477568
"Show Text" password menu item directly from its isPassword
477568
setter function.
477568
477568
This commit moves that handling to a dedicated _resetPasswordItem
477568
function, as prep work for adding lockdown support of the "Show Text"
477568
menu item.
477568
477568
https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/687
477568
---
477568
 js/ui/shellEntry.js | 23 +++++++++++++++++------
477568
 1 file changed, 17 insertions(+), 6 deletions(-)
477568
477568
diff --git a/js/ui/shellEntry.js b/js/ui/shellEntry.js
477568
index 603a9c64a..765cede06 100644
477568
--- a/js/ui/shellEntry.js
477568
+++ b/js/ui/shellEntry.js
477568
@@ -14,76 +14,87 @@ var EntryMenu = class extends PopupMenu.PopupMenu {
477568
 
477568
         this._entry = entry;
477568
         this._clipboard = St.Clipboard.get_default();
477568
 
477568
         // Populate menu
477568
         let item;
477568
         item = new PopupMenu.PopupMenuItem(_("Copy"));
477568
         item.connect('activate', this._onCopyActivated.bind(this));
477568
         this.addMenuItem(item);
477568
         this._copyItem = item;
477568
 
477568
         item = new PopupMenu.PopupMenuItem(_("Paste"));
477568
         item.connect('activate', this._onPasteActivated.bind(this));
477568
         this.addMenuItem(item);
477568
         this._pasteItem = item;
477568
 
477568
         this._passwordItem = null;
477568
 
477568
         Main.uiGroup.add_actor(this.actor);
477568
         this.actor.hide();
477568
     }
477568
 
477568
     _makePasswordItem() {
477568
         let item = new PopupMenu.PopupMenuItem('');
477568
         item.connect('activate', this._onPasswordActivated.bind(this));
477568
         this.addMenuItem(item);
477568
         this._passwordItem = item;
477568
         this._updatePasswordItem();
477568
     }
477568
 
477568
+    _resetPasswordItem() {
477568
+        if (!this.isPassword) {
477568
+            if (this._passwordItem) {
477568
+                this._passwordItem.destroy();
477568
+                this._passwordItem = null;
477568
+            }
477568
+            this._entry.clutter_text.set_password_char('\u25cf');
477568
+        } else {
477568
+            if (!this._passwordItem)
477568
+                this._makePasswordItem();
477568
+        }
477568
+    }
477568
+
477568
     get isPassword() {
477568
         return this._entry.input_purpose == Clutter.InputContentPurpose.PASSWORD;
477568
     }
477568
 
477568
     set isPassword(v) {
477568
         if (v == this.isPassword)
477568
             return;
477568
 
477568
-        if (v) {
477568
-            this._makePasswordItem();
477568
+        if (v)
477568
             this._entry.input_purpose = Clutter.InputContentPurpose.PASSWORD;
477568
-        } else {
477568
-            this._passwordItem.destroy();
477568
-            this._passwordItem = null;
477568
+        else
477568
             this._entry.input_purpose = Clutter.InputContentPurpose.NORMAL;
477568
-        }
477568
+
477568
+        this._resetPasswordItem();
477568
     }
477568
 
477568
     open(animate) {
477568
         this._updatePasteItem();
477568
         this._updateCopyItem();
477568
         if (this._passwordItem)
477568
             this._updatePasswordItem();
477568
 
477568
         super.open(animate);
477568
         this._entry.add_style_pseudo_class('focus');
477568
 
477568
         let direction = St.DirectionType.TAB_FORWARD;
477568
         if (!this.actor.navigate_focus(null, direction, false))
477568
             this.actor.grab_key_focus();
477568
     }
477568
 
477568
     _updateCopyItem() {
477568
         let selection = this._entry.clutter_text.get_selection();
477568
         this._copyItem.setSensitive(!this._entry.clutter_text.password_char &&
477568
                                     selection && selection != '');
477568
     }
477568
 
477568
     _updatePasteItem() {
477568
         this._clipboard.get_text(St.ClipboardType.CLIPBOARD,
477568
             (clipboard, text) => {
477568
                 this._pasteItem.setSensitive(text && text != '');
477568
             });
477568
     }
477568
 
477568
     _updatePasswordItem() {
477568
-- 
477568
2.27.0
477568