search: Be a bit more careful in _doSearch about timeouts

This commit is contained in:
Jasper St. Pierre 2014-09-11 17:51:12 -06:00
parent 08ece4c186
commit 9208473e59

View File

@ -470,7 +470,15 @@ const SearchResults = new Lang.Class({
this._updateSearchProgress(); this._updateSearchProgress();
if (this._searchTimeoutId > 0) {
GLib.source_remove(this._searchTimeoutId);
this._searchTimeoutId = 0; this._searchTimeoutId = 0;
}
},
_onSearchTimeout: function() {
this._searchTimeoutId = 0;
this._doSearch();
return GLib.SOURCE_REMOVE; return GLib.SOURCE_REMOVE;
}, },
@ -502,7 +510,7 @@ const SearchResults = new Lang.Class({
this._updateSearchProgress(); this._updateSearchProgress();
if (this._searchTimeoutId == 0) if (this._searchTimeoutId == 0)
this._searchTimeoutId = GLib.timeout_add(GLib.PRIORITY_DEFAULT, 150, Lang.bind(this, this._doSearch)); this._searchTimeoutId = GLib.timeout_add(GLib.PRIORITY_DEFAULT, 150, Lang.bind(this, this._onSearchTimeout));
}, },
_onPan: function(action) { _onPan: function(action) {