diff --git a/js/ui/remoteSearch.js b/js/ui/remoteSearch.js index bf391d24c..2004dc31b 100644 --- a/js/ui/remoteSearch.js +++ b/js/ui/remoteSearch.js @@ -34,16 +34,17 @@ var SearchProviderProxy = Gio.DBusProxy.makeProxyWrapper(SearchProviderIface); function loadRemoteSearchProviders(addProviderCallback) { let dataDirs = GLib.get_system_data_dirs(); + let loadedProviders = {}; for (let i = 0; i < dataDirs.length; i++) { let path = GLib.build_filenamev([dataDirs[i], 'gnome-shell', 'search-providers']); let dir = Gio.file_new_for_path(path); if (!dir.query_exists(null)) continue; - loadRemoteSearchProvidersFromDir(dir, addProviderCallback); + loadRemoteSearchProvidersFromDir(dir, loadedProviders, addProviderCallback); } }; -function loadRemoteSearchProvidersFromDir(dir, addProviderCallback) { +function loadRemoteSearchProvidersFromDir(dir, loadedProviders, addProviderCallback) { let dirPath = dir.get_path(); FileUtils.listDirAsync(dir, Lang.bind(this, function(files) { for (let i = 0; i < files.length; i++) { @@ -65,6 +66,9 @@ function loadRemoteSearchProvidersFromDir(dir, addProviderCallback) { let busName = keyfile.get_string(group, 'BusName'); let objectPath = keyfile.get_string(group, 'ObjectPath'); + if (loadedProviders[objectPath]) + continue; + let appInfo = null; try { let desktopId = keyfile.get_string(group, 'DesktopId'); @@ -86,6 +90,7 @@ function loadRemoteSearchProvidersFromDir(dir, addProviderCallback) { icon, busName, objectPath); + loadedProviders[objectPath] = remoteProvider; } catch(e) { log('Failed to add search provider "%s": %s'.format(title, e.toString())); continue;