Make it possible to register new search providers for the dash after it has been created.

Factors out meta creation from SearchResults._init to SearchResults.createProviderMeta(provider).

Adds Dash.addSearchProvider(provider).

https://bugzilla.gnome.org/show_bug.cgi?id=625954
This commit is contained in:
Tor-björn Claesson 2010-08-07 19:43:41 +02:00 committed by Owen W. Taylor
parent d9169d27f5
commit 039229f340

View File

@ -416,8 +416,11 @@ SearchResults.prototype = {
this._selectedProvider = -1;
this._providers = this._searchSystem.getProviders();
this._providerMeta = [];
for (let i = 0; i < this._providers.length; i++) {
let provider = this._providers[i];
for (let i = 0; i < this._providers.length; i++)
this.createProviderMeta(this._providers[i]);
},
createProviderMeta: function(provider) {
let providerBox = new St.BoxLayout({ style_class: 'dash-search-section',
vertical: true });
let titleButton = new St.Button({ style_class: 'dash-search-section-header',
@ -447,7 +450,6 @@ SearchResults.prototype = {
resultDisplay: resultDisplay,
count: count });
this.actor.add(providerBox);
}
},
_clearDisplay: function() {
@ -864,6 +866,13 @@ Dash.prototype = {
return false;
},
addSearchProvider: function(provider) {
//Add a new search provider to the dash.
this._searchSystem.registerProvider(provider);
this.searchResults.createProviderMeta(provider);
},
show: function() {
this._searchEntry.show();
if (this._keyPressId == 0)