[gnome-shell] searchDisplay: Make the results display in charge of updating the actor
- From: Jasper St. Pierre <jstpierre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] searchDisplay: Make the results display in charge of updating the actor
- Date: Wed, 29 May 2013 15:33:28 +0000 (UTC)
commit 19749bb37fda75b2b021ec802e66c394de1a4b04
Author: Jasper St. Pierre <jstpierre mecheye net>
Date: Fri Feb 8 17:45:53 2013 -0500
searchDisplay: Make the results display in charge of updating the actor
While this is a very simple translation right now, soon enough it will
be so that it will have a less crazy "public" API and can do things like
cache result metas.
https://bugzilla.gnome.org/show_bug.cgi?id=693836
js/ui/searchDisplay.js | 75 +++++++++++++++++++++++++++---------------------
1 files changed, 42 insertions(+), 33 deletions(-)
---
diff --git a/js/ui/searchDisplay.js b/js/ui/searchDisplay.js
index 8dbd00e..8f8ccd4 100644
--- a/js/ui/searchDisplay.js
+++ b/js/ui/searchDisplay.js
@@ -202,6 +202,41 @@ const SearchResultsBase = new Lang.Class({
// copy the lists
this._notDisplayedResult = results.slice(0);
this._terms = terms.slice(0);
+ },
+
+ _setMoreIconVisible: function(visible) {
+ },
+
+ updateSearch: function(providerResults, terms, callback) {
+ this.setResults(providerResults, terms);
+ if (providerResults.length == 0) {
+ this.clear();
+ callback();
+ } else {
+ let results = this.getResultsForDisplay();
+
+ this.provider.getResultMetas(results, Lang.bind(this, function(metas) {
+ this.clear();
+
+ // Hiding drops the key focus if we have it
+ let focus = global.stage.get_key_focus();
+
+ // To avoid CSS transitions causing flickering when
+ // the first search result stays the same, we hide the
+ // content while filling in the results.
+ this.actor.hide();
+
+ this.renderResults(metas);
+
+ this._setMoreIconVisible(this.hasMoreResults() && this.provider.canLaunchSearch);
+
+ this.actor.show();
+ if (this.actor.contains(focus))
+ global.stage.set_key_focus(focus);
+
+ callback();
+ }));
+ }
}
});
@@ -230,6 +265,10 @@ const ListSearchResults = new Lang.Class({
this.actor.add(this._content, { expand: true });
},
+ _setMoreIconVisible: function(visible) {
+ this.providerIcon.moreIcon.visible = true;
+ },
+
getResultsForDisplay: function() {
let canDisplay = MAX_LIST_SEARCH_RESULTS_ROWS;
let newResults = this._notDisplayedResult.splice(0, canDisplay);
@@ -482,41 +521,11 @@ const SearchResults = new Lang.Class({
let [provider, providerResults] = results;
let meta = this._metaForProvider(provider);
- if (providerResults.length == 0) {
- meta.resultDisplay.clear();
- meta.actor.hide();
- meta.resultDisplay.setResults([], []);
+ meta.actor.visible = providerResults.length > 0;
+ meta.resultDisplay.updateSearch(providerResults, terms, Lang.bind(this, function() {
this._maybeSetInitialSelection();
this._updateStatusText();
- } else {
- meta.resultDisplay.setResults(providerResults, terms);
- let results = meta.resultDisplay.getResultsForDisplay();
-
- if (meta.icon)
- meta.icon.moreIcon.visible =
- meta.resultDisplay.hasMoreResults() &&
- provider.canLaunchSearch;
-
- provider.getResultMetas(results, Lang.bind(this, function(metas) {
- meta.resultDisplay.clear();
- meta.actor.show();
-
- // Hiding drops the key focus if we have it
- let focus = global.stage.get_key_focus();
- // To avoid CSS transitions causing flickering when
- // the first search result stays the same, we hide the
- // content while filling in the results.
- this._content.hide();
-
- meta.resultDisplay.renderResults(metas);
- this._maybeSetInitialSelection();
- this._updateStatusText();
-
- this._content.show();
- if (this._content.contains(focus))
- global.stage.set_key_focus(focus);
- }));
- }
+ }));
},
activateDefault: function() {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]