[gnome-shell] Don't show search results sections until we've actually searched



commit 1da4837d981cf2010edf28d78490f7f547da4863
Author: Colin Walters <walters verbum org>
Date:   Thu Sep 24 18:34:43 2009 -0400

    Don't show search results sections until we've actually searched
    
    We queue a 150ms timeout when the user starts typing to avoid searching
    for the first keystroke.  However, this caused us to change to the search
    mode, but show the leftover state of the search displays from an
    earlier search state.
    
    Instead, just hide the results sections until we've actually performed
    the current search once.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=596119

 js/ui/dash.js |   26 ++++++++++++++++++++------
 1 files changed, 20 insertions(+), 6 deletions(-)
---
diff --git a/js/ui/dash.js b/js/ui/dash.js
index 5e14c53..6d8c1a4 100644
--- a/js/ui/dash.js
+++ b/js/ui/dash.js
@@ -613,6 +613,7 @@ Dash.prototype = {
         /***** Search *****/
 
         this._searchActive = false;
+        this._searchPending = false;
         this._searchEntry = new SearchEntry();
         this.searchArea.append(this._searchEntry.actor, Big.BoxPackFlags.EXPAND);
 
@@ -620,7 +621,9 @@ Dash.prototype = {
         this._searchEntry.entry.connect('text-changed', Lang.bind(this, function (se, prop) {
             let text = this._searchEntry.getText();
             text = text.replace(/^\s+/g, "").replace(/\s+$/g, "")
+            let searchPreviouslyActive = this._searchActive;
             this._searchActive = text != '';
+            this._searchPending = this._searchActive && !searchPreviouslyActive;
             this._updateDashActors();
             if (!this._searchActive) {
                 if (this._searchTimeoutId > 0) {
@@ -871,17 +874,28 @@ Dash.prototype = {
     },
 
     _updateDashActors: function() {
-        if (!this._searchActive && this._searchResultsSection.actor.visible) {
+        if (this._searchPending) {
+            this._searchResultsSection.actor.show();
+            for (let i = 0; i < this._searchSections.length; i++) {
+                let section = this._searchSections[i];
+                section.header.actor.hide();
+                section.resultArea.actor.hide();
+            }
+            this._appsSection.actor.hide();
+            this._placesSection.actor.hide();
+            this._docsSection.actor.hide();
+        } else if (this._searchActive) {
+            for (let i = 0; i < this._searchSections.length; i++) {
+                let section = this._searchSections[i];
+                section.header.actor.show();
+                section.resultArea.actor.show();
+            }
+        } else {
             this._showAllSearchSections();
             this._searchResultsSection.actor.hide();
             this._appsSection.actor.show();
             this._placesSection.actor.show();
             this._docsSection.actor.show();
-        } else if (this._searchActive && !this._searchResultsSection.actor.visible) {
-            this._searchResultsSection.actor.show();
-            this._appsSection.actor.hide();
-            this._placesSection.actor.hide();
-            this._docsSection.actor.hide();
         }
     },
 



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