appDisplay: use ShellAppCache to translate folder names

This was performing quite a bit of I/O on the main thread previously. Now,
all the I/O is deferred to a worker thread and the translated names are
cached for immediate lookup.
This commit is contained in:
Christian Hergert 2020-02-26 23:09:23 -08:00
parent 2c549bfbbe
commit f87b9f374a

View File

@ -93,15 +93,7 @@ function _getFolderName(folder) {
let name = folder.get_string('name'); let name = folder.get_string('name');
if (folder.get_boolean('translate')) { if (folder.get_boolean('translate')) {
let keyfile = new GLib.KeyFile(); return Shell.AppCache.get_default().translate_folder(name);
let path = 'desktop-directories/' + name;
try {
keyfile.load_from_data_dirs(path, GLib.KeyFileFlags.NONE);
name = keyfile.get_locale_string('Desktop Entry', 'Name', null);
} catch(e) {
return name;
}
} }
return name; return name;