[gnome-shell-extensions/gnome-3-16] apps-menu: Handle non-UTF8 filename encodings more gracefully



commit d61bbe6f8306b9b9d0707608063931895a38823b
Author: Florian Müllner <fmuellner gnome org>
Date:   Fri Jul 31 02:14:58 2015 +0200

    apps-menu: Handle non-UTF8 filename encodings more gracefully
    
    Instead of failing completely if any .desktop file uses a filename
    encoding other than UTF-8, just filter out the offending apps.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=651503

 extensions/apps-menu/extension.js |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)
---
diff --git a/extensions/apps-menu/extension.js b/extensions/apps-menu/extension.js
index 9d2a86a..5952c86 100644
--- a/extensions/apps-menu/extension.js
+++ b/extensions/apps-menu/extension.js
@@ -411,7 +411,13 @@ const ApplicationsButton = new Lang.Class({
             if (nextType == GMenu.TreeItemType.ENTRY) {
                 let entry = iter.get_entry();
                 let appInfo = entry.get_app_info();
-                let app = appSys.lookup_app(entry.get_desktop_file_id());
+                let id;
+                try {
+                    id = appInfo.get_id(); // catch non-UTF8 filenames
+                } catch(e) {
+                    continue;
+                }
+                let app = appSys.lookup_app(id);
                 if (appInfo.should_show()) {
                     let menu_id = dir.get_menu_id();
                     this.applicationsByCategory[categoryId].push(app);


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