[gnome-shell] viewSelector: Make the search canceling behavior consistent



commit d2ba9eb967500707d7cd8e930069a80046a5cd26
Author: Rui Matos <tiagomatos gmail com>
Date:   Mon Feb 27 15:17:33 2012 +0100

    viewSelector: Make the search canceling behavior consistent
    
    When canceling a search pressing Escape while the focus is on the
    search entry we clear the entry, set its text to the hint and go back
    to the previously selected tab. Make this the behavior also for when
    the focus is on search results and not on the entry itself.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=663901

 js/ui/viewSelector.js |   19 +++++++++++--------
 1 files changed, 11 insertions(+), 8 deletions(-)
---
diff --git a/js/ui/viewSelector.js b/js/ui/viewSelector.js
index 8826556..22d95ab 100644
--- a/js/ui/viewSelector.js
+++ b/js/ui/viewSelector.js
@@ -187,14 +187,14 @@ const SearchTab = new Lang.Class({
         // incorrectly when we remove focus
         // (https://bugzilla.gnome.org/show_bug.cgi?id=636341) */
         if (this._text.text != '')
-            this._reset();
+            this.reset();
     },
 
-    _reset: function () {
-        this._text.text = '';
-
+    reset: function () {
         global.stage.set_key_focus(null);
 
+        this._entry.text = '';
+
         this._text.set_cursor_visible(true);
         this._text.set_selection(0, 0);
     },
@@ -252,7 +252,7 @@ const SearchTab = new Lang.Class({
             if (this._iconClickedId == 0) {
                 this._iconClickedId = this._entry.connect('secondary-icon-clicked',
                     Lang.bind(this, function() {
-                        this._reset();
+                        this.reset();
                     }));
             }
             this._activate();
@@ -280,7 +280,7 @@ const SearchTab = new Lang.Class({
         let symbol = event.get_key_symbol();
         if (symbol == Clutter.Escape) {
             if (this._isActivated()) {
-                this._reset();
+                this.reset();
                 return true;
             }
         } else if (this.active) {
@@ -305,7 +305,7 @@ const SearchTab = new Lang.Class({
                 // the user clicked outside after activating the entry, but
                 // with no search term entered and no keyboard button pressed
                 // - cancel the search
-                this._reset();
+                this.reset();
             }
         }
 
@@ -536,7 +536,10 @@ const ViewSelector = new Lang.Class({
         let symbol = event.get_key_symbol();
 
         if (symbol == Clutter.Escape) {
-            Main.overview.hide();
+            if (this._searchTab.active)
+                this._searchTab.reset();
+            else
+                Main.overview.hide();
             return true;
         } else if (Clutter.keysym_to_unicode(symbol) ||
                    (symbol == Clutter.BackSpace && this._searchTab.active)) {



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