remoteSearch: Fetch enabled/disabled list once

GLib should be caching the values but it seems unnecessary to fetch
and marshal what should be the same lists N times instead of just once

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1791>
This commit is contained in:
Zander Brown 2021-04-02 04:39:31 +01:00 committed by Marge Bot
parent 4bfb91c5cd
commit 2f70e524c3

View File

@ -142,16 +142,16 @@ function loadRemoteSearchProviders(searchSettings, callback) {
// Special case gnome-control-center to be always active and always first // Special case gnome-control-center to be always active and always first
sortOrder.unshift('gnome-control-center.desktop'); sortOrder.unshift('gnome-control-center.desktop');
const disabled = searchSettings.get_strv('disabled');
const enabled = searchSettings.get_strv('enabled');
loadedProviders = loadedProviders.filter(provider => { loadedProviders = loadedProviders.filter(provider => {
let appId = provider.appInfo.get_id(); let appId = provider.appInfo.get_id();
if (provider.defaultEnabled) { if (provider.defaultEnabled)
let disabled = searchSettings.get_strv('disabled');
return !disabled.includes(appId); return !disabled.includes(appId);
} else { else
let enabled = searchSettings.get_strv('enabled');
return enabled.includes(appId); return enabled.includes(appId);
}
}); });
loadedProviders.sort((providerA, providerB) => { loadedProviders.sort((providerA, providerB) => {