searchDisplay: Remove pendingClear

It turns out that every time we call getResultsForDisplay is
directly after a setResults, so pendingClear is always true.

https://bugzilla.gnome.org/show_bug.cgi?id=693836
This commit is contained in:
Jasper St. Pierre 2013-02-08 16:05:28 -05:00
parent 37e2b60cd3
commit 62e1c08dd6

View File

@ -205,13 +205,10 @@ const ListSearchResults = new Lang.Class({
this._notDisplayedResult = []; this._notDisplayedResult = [];
this._terms = []; this._terms = [];
this._pendingClear = false;
}, },
getResultsForDisplay: function() { getResultsForDisplay: function() {
let alreadyVisible = this._pendingClear ? 0 : this.getVisibleResultCount(); let canDisplay = MAX_LIST_SEARCH_RESULTS_ROWS;
let canDisplay = MAX_LIST_SEARCH_RESULTS_ROWS - alreadyVisible;
let newResults = this._notDisplayedResult.splice(0, canDisplay); let newResults = this._notDisplayedResult.splice(0, canDisplay);
return newResults; return newResults;
}, },
@ -228,7 +225,6 @@ const ListSearchResults = new Lang.Class({
// copy the lists // copy the lists
this._notDisplayedResult = results.slice(0); this._notDisplayedResult = results.slice(0);
this._terms = terms.slice(0); this._terms = terms.slice(0);
this._pendingClear = true;
}, },
_keyFocusIn: function(icon) { _keyFocusIn: function(icon) {
@ -245,7 +241,6 @@ const ListSearchResults = new Lang.Class({
clear: function () { clear: function () {
this._content.destroy_all_children(); this._content.destroy_all_children();
this._pendingClear = false;
}, },
getFirstResult: function() { getFirstResult: function() {
@ -271,14 +266,10 @@ const GridSearchResults = new Lang.Class({
this._notDisplayedResult = []; this._notDisplayedResult = [];
this._terms = []; this._terms = [];
this._pendingClear = false;
}, },
getResultsForDisplay: function() { getResultsForDisplay: function() {
let alreadyVisible = this._pendingClear ? 0 : this._grid.visibleItemsCount(); let canDisplay = this._grid.childrenInRow(this.actor.width) * this._grid.getRowLimit();
let canDisplay = this._grid.childrenInRow(this.actor.width) * this._grid.getRowLimit()
- alreadyVisible;
let newResults = this._notDisplayedResult.splice(0, canDisplay); let newResults = this._notDisplayedResult.splice(0, canDisplay);
return newResults; return newResults;
}, },
@ -295,7 +286,6 @@ const GridSearchResults = new Lang.Class({
// copy the lists // copy the lists
this._notDisplayedResult = results.slice(0); this._notDisplayedResult = results.slice(0);
this._terms = terms.slice(0); this._terms = terms.slice(0);
this._pendingClear = true;
}, },
_keyFocusIn: function(icon) { _keyFocusIn: function(icon) {
@ -312,7 +302,6 @@ const GridSearchResults = new Lang.Class({
clear: function () { clear: function () {
this._grid.removeAll(); this._grid.removeAll();
this._pendingClear = false;
}, },
getFirstResult: function() { getFirstResult: function() {