[gnome-shell-extensions/wip/fmuellner/misc-cleanups: 9/12] apps-menu: Remove unnecessary check



commit 95b40069bf0c8d57fe90419453ba31a7c5711db9
Author: Florian Müllner <fmuellner gnome org>
Date:   Sun Mar 3 04:17:05 2019 +0100

    apps-menu: Remove unnecessary check
    
    The function is always called with an array parameter (albeit it may
    be empty), so remove the unnecessary check and cut down on indentation.
    
    https://gitlab.gnome.org/GNOME/gnome-shell-extensions/merge_requests/60

 extensions/apps-menu/extension.js | 28 +++++++++++++---------------
 1 file changed, 13 insertions(+), 15 deletions(-)
---
diff --git a/extensions/apps-menu/extension.js b/extensions/apps-menu/extension.js
index b3c3cff..0a3b24a 100644
--- a/extensions/apps-menu/extension.js
+++ b/extensions/apps-menu/extension.js
@@ -721,22 +721,20 @@ class ApplicationsButton extends PanelMenu.Button {
     }
 
     _displayButtons(apps) {
-        if (apps) {
-            for (let i = 0; i < apps.length; i++) {
-                let app = apps[i];
-                let item;
-                if (app instanceof Shell.App)
-                    item = this._applicationsButtons.get(app);
-                else
-                    item = new PopupMenu.PopupSeparatorMenuItem();
-                if (!item) {
-                    item = new ApplicationMenuItem(this, app);
-                    item.setDragEnabled(this._desktopTarget.hasDesktop);
-                    this._applicationsButtons.set(app, item);
-                }
-                if (!item.actor.get_parent())
-                    this.applicationsBox.add_actor(item.actor);
+        for (let i = 0; i < apps.length; i++) {
+            let app = apps[i];
+            let item;
+            if (app instanceof Shell.App)
+                item = this._applicationsButtons.get(app);
+            else
+                item = new PopupMenu.PopupSeparatorMenuItem();
+            if (!item) {
+                item = new ApplicationMenuItem(this, app);
+                item.setDragEnabled(this._desktopTarget.hasDesktop);
+                this._applicationsButtons.set(app, item);
             }
+            if (!item.actor.get_parent())
+                this.applicationsBox.add_actor(item.actor);
         }
     }
 


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