view-selector: add support for disable-external search setting

https://bugzilla.gnome.org/show_bug.cgi?id=687491
This commit is contained in:
Cosimo Cecchi 2012-11-01 16:18:12 -04:00
parent cf363171aa
commit f25832d1b6

View File

@ -96,6 +96,7 @@ const ViewSelector = new Lang.Class({
this._searchSettings = new Gio.Settings({ schema: Search.SEARCH_PROVIDERS_SCHEMA });
this._searchSettings.connect('changed::disabled', Lang.bind(this, this._reloadRemoteProviders));
this._searchSettings.connect('changed::disable-external', Lang.bind(this, this._reloadRemoteProviders));
this._searchSettings.connect('changed::sort-order', Lang.bind(this, this._reloadRemoteProviders));
// Default search providers
@ -440,9 +441,13 @@ const ViewSelector = new Lang.Class({
},
_shouldUseSearchProvider: function(provider) {
// the disable-external GSetting only affects remote providers
if (!provider.isRemoteProvider)
return true;
if (this._searchSettings.get_boolean('disable-external'))
return false;
let appId = provider.appInfo.get_id();
let disable = this._searchSettings.get_strv('disabled');
return disable.indexOf(appId) == -1;