[gnome-shell] Bug 587951 - Don't show empty categories



commit 3e0f5aec0c0b459ebfef90f7202c1679ffe4e24d
Author: Colin Walters <walters verbum org>
Date:   Thu Aug 13 14:16:58 2009 -0400

    Bug 587951 - Don't show empty categories
    
    When loading menus, skip ones which entirely consist of NoDisplay=true
    items.

 js/ui/appDisplay.js |   14 ++++++++++----
 1 files changed, 10 insertions(+), 4 deletions(-)
---
diff --git a/js/ui/appDisplay.js b/js/ui/appDisplay.js
index f12c3c2..a278e5e 100644
--- a/js/ui/appDisplay.js
+++ b/js/ui/appDisplay.js
@@ -335,12 +335,18 @@ AppDisplay.prototype = {
         this._allItems = {};
         this._appCategories = {};
 
-        this._menus = this._appSystem.get_menus();
         // Loop over the toplevel menu items, load the set of desktop file ids
-        // associated with each one
-        for (let i = 0; i < this._menus.length; i++) {
-            let menu = this._menus[i];
+        // associated with each one, skipping empty menus
+        let allMenus = this._appSystem.get_menus();
+        this._menus = [];
+        for (let i = 0; i < allMenus.length; i++) {
+            let menu = allMenus[i];
             let menuApps = this._appSystem.get_applications_for_menu(menu.id);
+            let hasVisibleApps = menuApps.some(function (app) { return !app.get_is_nodisplay(); });
+            if (!hasVisibleApps) {
+                continue;
+            }
+            this._menus.push(menu);
             for (let j = 0; j < menuApps.length; j++) {
                 let app = menuApps[j];
                 this._addApp(app);



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