[gnome-shell-extensions/gnome-3-18] apps-menu: Fix .desktop entries in subdirectories



commit 5a46645948dc643ce77e2fcf95a3c1634393ec03
Author: Florian Müllner <fmuellner gnome org>
Date:   Wed Dec 16 18:46:42 2015 +0100

    apps-menu: Fix .desktop entries in subdirectories
    
    GMenu's TreeEntries return an AppInfo that is created from the
    .desktop filename, not from a desktop ID as expected by the
    AppSystem. As a result, g_app_info_get_id() will simply return
    the file's basename, which only matches the desktop ID if no
    prefix-to-subdirectory mapping as described in the menu spec
    is involved.
    Fix this by basing the app lookup on the entry's desktop ID instead
    of the AppInfo.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=759004

 extensions/apps-menu/extension.js |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)
---
diff --git a/extensions/apps-menu/extension.js b/extensions/apps-menu/extension.js
index 925d344..796d235 100644
--- a/extensions/apps-menu/extension.js
+++ b/extensions/apps-menu/extension.js
@@ -397,15 +397,14 @@ const ApplicationsButton = new Lang.Class({
         while ((nextType = iter.next()) != GMenu.TreeItemType.INVALID) {
             if (nextType == GMenu.TreeItemType.ENTRY) {
                 let entry = iter.get_entry();
-                let appInfo = entry.get_app_info();
                 let id;
                 try {
-                    id = appInfo.get_id(); // catch non-UTF8 filenames
+                    id = entry.get_desktop_file_id(); // catch non-UTF8 filenames
                 } catch(e) {
                     continue;
                 }
                 let app = appSys.lookup_app(id);
-                if (appInfo.should_show())
+                if (app.get_app_info().should_show())
                     this.applicationsByCategory[categoryId].push(app);
             } else if (nextType == GMenu.TreeItemType.DIRECTORY) {
                 let subdir = iter.get_directory();


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