[gnome-shell/gnome-3-8] shellEntry: Set the input-purpose property for password entries



commit d43c5ec27a6ebf1c7993bad0da775ab5d5e2a45b
Author: Rui Matos <tiagomatos gmail com>
Date:   Fri May 10 03:35:05 2013 +0200

    shellEntry: Set the input-purpose property for password entries
    
    This way input methods can disable themselves automatically for
    entries holding passwords.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=700043

 js/ui/shellEntry.js |   33 +++++++++++++++++----------------
 1 files changed, 17 insertions(+), 16 deletions(-)
---
diff --git a/js/ui/shellEntry.js b/js/ui/shellEntry.js
index e9a94a6..b7251d1 100644
--- a/js/ui/shellEntry.js
+++ b/js/ui/shellEntry.js
@@ -14,9 +14,7 @@ const EntryMenu = new Lang.Class({
     Name: 'ShellEntryMenu',
     Extends: PopupMenu.PopupMenu,
 
-    _init: function(entry, params) {
-        params = Params.parse (params, { isPassword: false });
-
+    _init: function(entry) {
         this.parent(entry, 0, St.Side.TOP);
 
         this.actor.add_style_class_name('entry-context-menu');
@@ -37,8 +35,6 @@ const EntryMenu = new Lang.Class({
         this._pasteItem = item;
 
         this._passwordItem = null;
-        if (params.isPassword)
-           this._makePasswordItem();
 
         Main.uiGroup.add_actor(this.actor);
         this.actor.hide();
@@ -53,19 +49,21 @@ const EntryMenu = new Lang.Class({
     },
 
     get isPassword() {
-       return this._passwordItem != null;
+        return this._passwordItem != null;
     },
 
     set isPassword(v) {
-       if (v == this.isPassword)
-           return;
-
-       if (v)
-           this._makePasswordItem();
-       else {
-           this._passwordItem.destroy();
-           this._passwordItem = null;
-       }
+        if (v == this.isPassword)
+            return;
+
+        if (v) {
+            this._makePasswordItem();
+            this._entry.input_purpose = Gtk.InputPurpose.PASSWORD;
+        } else {
+            this._passwordItem.destroy();
+            this._passwordItem = null;
+            this._entry.input_purpose = Gtk.InputPurpose.FREE_FORM;
+        }
     },
 
     open: function(animate) {
@@ -155,7 +153,10 @@ function addContextMenu(entry, params) {
     if (entry.menu)
         return;
 
-    entry.menu = new EntryMenu(entry, params);
+    params = Params.parse (params, { isPassword: false });
+
+    entry.menu = new EntryMenu(entry);
+    entry.menu.isPassword = params.isPassword;
     entry._menuManager = new PopupMenu.PopupMenuManager({ actor: entry });
     entry._menuManager.addMenu(entry.menu);
 


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