diff --git a/js/ui/remoteSearch.js b/js/ui/remoteSearch.js index 8ebb55052..d9eef287f 100644 --- a/js/ui/remoteSearch.js +++ b/js/ui/remoteSearch.js @@ -60,7 +60,13 @@ const SearchProvider2Iface = ` var SearchProviderProxyInfo = Gio.DBusInterfaceInfo.new_for_xml(SearchProviderIface); var SearchProvider2ProxyInfo = Gio.DBusInterfaceInfo.new_for_xml(SearchProvider2Iface); -function loadRemoteSearchProviders(searchSettings, callback) { +/** + * loadRemoteSearchProviders: + * + * @param {Gio.Settings} searchSettings - search settings + * @returns {RemoteSearchProvider[]} - the list of remote providers + */ +function loadRemoteSearchProviders(searchSettings) { let objectPaths = {}; let loadedProviders = []; @@ -130,10 +136,8 @@ function loadRemoteSearchProviders(searchSettings, callback) { } } - if (searchSettings.get_boolean('disable-external')) { - callback([]); - return; - } + if (searchSettings.get_boolean('disable-external')) + return []; FileUtils.collectFromDatadirs('search-providers', false, loadRemoteSearchProvider); @@ -184,7 +188,7 @@ function loadRemoteSearchProviders(searchSettings, callback) { return idxA - idxB; }); - callback(loadedProviders); + return loadedProviders; } var RemoteSearchProvider = class { diff --git a/js/ui/search.js b/js/ui/search.js index 3bfb83f9f..5375e7fc6 100644 --- a/js/ui/search.js +++ b/js/ui/search.js @@ -615,9 +615,8 @@ var SearchResultsView = GObject.registerClass({ this._unregisterProvider(provider); }); - RemoteSearch.loadRemoteSearchProviders(this._searchSettings, providers => { - providers.forEach(this._registerProvider.bind(this)); - }); + const providers = RemoteSearch.loadRemoteSearchProviders(this._searchSettings); + providers.forEach(this._registerProvider.bind(this)); } _registerProvider(provider) {