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