[gnome-shell/wip/chergert/3-28-perf-fixes: 2/5] appDisplay: use ShellAppCache to translate folder names



commit 9a7cb505cabbe677396dc2cb1b26d7167c76c068
Author: Christian Hergert <chergert redhat com>
Date:   Wed Feb 26 23:09:23 2020 -0800

    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.

 js/ui/appDisplay.js | 10 +---------
 1 file changed, 1 insertion(+), 9 deletions(-)
---
diff --git a/js/ui/appDisplay.js b/js/ui/appDisplay.js
index 74c772d504..18bad24310 100644
--- a/js/ui/appDisplay.js
+++ b/js/ui/appDisplay.js
@@ -93,15 +93,7 @@ function _getFolderName(folder) {
     let name = folder.get_string('name');
 
     if (folder.get_boolean('translate')) {
-        let keyfile = new GLib.KeyFile();
-        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 Shell.AppCache.get_default().translate_folder(name);
     }
 
     return name;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]