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



commit d86044f383b286cb58709736550a94e880998215
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]