Blob Blame History Raw
From e21ce17c0a8a9e9b4c54cc6380056ec05a61d376 Mon Sep 17 00:00:00 2001
From: Ray Strode <rstrode@redhat.com>
Date: Wed, 21 Aug 2019 15:48:33 -0400
Subject: [PATCH 2/3] shellEntry: if password menu item a label when it's
 created

At the moment, the "Show Text" menu item is only given its label
at the time the menu is opened.  This is because the text might
be "Hide Text" or "Show Text" depending on state, so the text
is set up lazily.

That behavior means the menu item can't get added after the
menu is already shown, which is something we'ree going to need
in the future to support lockdown of the "Show Text" item.

This commit ensures the menu item is given text when it's first
created, in addition to when the menu is opened.
---
 js/ui/shellEntry.js | 1 +
 1 file changed, 1 insertion(+)

diff --git a/js/ui/shellEntry.js b/js/ui/shellEntry.js
index 159357eb3..5ce0a40a0 100644
--- a/js/ui/shellEntry.js
+++ b/js/ui/shellEntry.js
@@ -16,60 +16,61 @@ var EntryMenu = new Lang.Class({
 
     _init(entry) {
         this.parent(entry, 0, St.Side.TOP);
 
         this._entry = entry;
         this._clipboard = St.Clipboard.get_default();
 
         // Populate menu
         let item;
         item = new PopupMenu.PopupMenuItem(_("Copy"));
         item.connect('activate', this._onCopyActivated.bind(this));
         this.addMenuItem(item);
         this._copyItem = item;
 
         item = new PopupMenu.PopupMenuItem(_("Paste"));
         item.connect('activate', this._onPasteActivated.bind(this));
         this.addMenuItem(item);
         this._pasteItem = item;
 
         this._passwordItem = null;
 
         Main.uiGroup.add_actor(this.actor);
         this.actor.hide();
     },
 
     _makePasswordItem() {
         let item = new PopupMenu.PopupMenuItem('');
         item.connect('activate', this._onPasswordActivated.bind(this));
         this.addMenuItem(item);
         this._passwordItem = item;
+        this._updatePasswordItem();
     },
 
     get isPassword() {
         return this._entry.input_purpose == Clutter.InputContentPurpose.PASSWORD;
     },
 
     set isPassword(v) {
         if (v == this.isPassword)
             return;
 
         if (v) {
             this._makePasswordItem();
             this._entry.input_purpose = Clutter.InputContentPurpose.PASSWORD;
         } else {
             this._passwordItem.destroy();
             this._passwordItem = null;
             this._entry.input_purpose = Clutter.InputContentPurpose.NORMAL;
         }
     },
 
     open(animate) {
         this._updatePasteItem();
         this._updateCopyItem();
         if (this._passwordItem)
             this._updatePasswordItem();
 
         this.parent(animate);
         this._entry.add_style_pseudo_class('focus');
 
         let direction = Gtk.DirectionType.TAB_FORWARD;
-- 
2.21.0