gnome-shell/SOURCES/0002-shellEntry-Give-password-menu-item-text-when-it-s-cr.patch
2021-10-08 11:28:52 +00:00

93 lines
2.9 KiB
Diff

From de7df6c7248c39d7cce1c70485df72a398da92a3 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/4] shellEntry: Give password menu item text when it's
created
At the moment, the "Show Text" menu item is only given its text
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.
https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/687
---
js/ui/shellEntry.js | 1 +
1 file changed, 1 insertion(+)
diff --git a/js/ui/shellEntry.js b/js/ui/shellEntry.js
index cac4ec9c2..603a9c64a 100644
--- a/js/ui/shellEntry.js
+++ b/js/ui/shellEntry.js
@@ -11,60 +11,61 @@ const Tweener = imports.ui.tweener;
var EntryMenu = class extends PopupMenu.PopupMenu {
constructor(entry) {
super(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();
super.open(animate);
this._entry.add_style_pseudo_class('focus');
let direction = St.DirectionType.TAB_FORWARD;
--
2.27.0