[gnome-shell-extensions/wip/fmuellner/alacarte-compat: 3/4] apps-menu: Minor code cleanup



commit 7a1a751cba05de03b811a14da114fda6af391f8b
Author: Florian Müllner <fmuellner gnome org>
Date:   Fri Oct 13 01:20:17 2017 +0200

    apps-menu: Minor code cleanup
    
    The parameter to _clearApplicationBox() has never been used, so
    remove it. In fact, modern javascript makes the function so compact
    that we can just move the code inline.
    
    Fixes https://gitlab.gnome.org/GNOME/gnome-shell-extensions/issues/27

 extensions/apps-menu/extension.js | 15 +++------------
 1 file changed, 3 insertions(+), 12 deletions(-)
---
diff --git a/extensions/apps-menu/extension.js b/extensions/apps-menu/extension.js
index 600eda3..8138d4c 100644
--- a/extensions/apps-menu/extension.js
+++ b/extensions/apps-menu/extension.js
@@ -712,19 +712,10 @@ const ApplicationsButton = new Lang.Class({
         this.mainBox.style+=('height: ' + height);
     },
 
-    _clearApplicationsBox: function(selectedActor) {
-        let actors = this.applicationsBox.get_children();
-        for (let i = 0; i < actors.length; i++) {
-            let actor = actors[i];
-            this.applicationsBox.remove_actor(actor);
-        }
-    },
-
     selectCategory: function(dir, categoryMenuItem) {
-        if (categoryMenuItem)
-            this._clearApplicationsBox(categoryMenuItem.actor);
-        else
-            this._clearApplicationsBox(null);
+        this.applicationsBox.get_children().forEach(c => {
+            this.applicationsBox.remove_actor(c);
+        });
 
         if (dir)
             this._displayButtons(this._listApplications(dir.get_menu_id()));


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