summaryrefslogtreecommitdiff
blob: 8764998aac6112db5daf79673aa13ef760e4b0ea (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
From d1bf592539095ed6a1fd5f0f9ff0351e56bfa156 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Florian=20M=C3=BCllner?= <fmuellner@gnome.org>
Date: Fri, 31 Jul 2015 02:14:58 +0200
Subject: 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 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/extensions/apps-menu/extension.js b/extensions/apps-menu/extension.js
index 0c7e6c6..ddd8458 100644
--- a/extensions/apps-menu/extension.js
+++ b/extensions/apps-menu/extension.js
@@ -393,7 +393,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);
-- 
cgit v0.11.2