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
This commit is contained in:
Colin Walters 2009-09-24 18:34:43 -04:00
parent 0f63ae1869
commit 1da4837d98

View File

@ -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();
}
},