[gnome-shell-extensions/wip/fmuellner/misc-cleanups: 8/12] apps-menu: Avoid deep nesting
- From: Florian Müllner <fmuellner src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell-extensions/wip/fmuellner/misc-cleanups: 8/12] apps-menu: Avoid deep nesting
- Date: Mon, 4 Mar 2019 18:37:29 +0000 (UTC)
commit bd9f1cfd918eb18e7394946e11f6737d01e6fd3a
Author: Florian Müllner <fmuellner gnome org>
Date: Sun Mar 3 04:16:35 2019 +0100
apps-menu: Avoid deep nesting
https://gitlab.gnome.org/GNOME/gnome-shell-extensions/merge_requests/60
extensions/apps-menu/extension.js | 24 +++++++++++++-----------
1 file changed, 13 insertions(+), 11 deletions(-)
---
diff --git a/extensions/apps-menu/extension.js b/extensions/apps-menu/extension.js
index 0c99123..b3c3cff 100644
--- a/extensions/apps-menu/extension.js
+++ b/extensions/apps-menu/extension.js
@@ -680,17 +680,19 @@ class ApplicationsButton extends PanelMenu.Button {
let iter = root.iter();
let nextType;
while ((nextType = iter.next()) != GMenu.TreeItemType.INVALID) {
- if (nextType == GMenu.TreeItemType.DIRECTORY) {
- let dir = iter.get_directory();
- if (!dir.get_is_nodisplay()) {
- let categoryId = dir.get_menu_id();
- this.applicationsByCategory[categoryId] = [];
- this._loadCategory(categoryId, dir);
- if (this.applicationsByCategory[categoryId].length > 0) {
- let categoryMenuItem = new CategoryMenuItem(this, dir);
- this.categoriesBox.add_actor(categoryMenuItem.actor);
- }
- }
+ if (nextType != GMenu.TreeItemType.DIRECTORY)
+ continue;
+
+ let dir = iter.get_directory();
+ if (dir.get_is_nodisplay())
+ continue;
+
+ let categoryId = dir.get_menu_id();
+ this.applicationsByCategory[categoryId] = [];
+ this._loadCategory(categoryId, dir);
+ if (this.applicationsByCategory[categoryId].length > 0) {
+ let categoryMenuItem = new CategoryMenuItem(this, dir);
+ this.categoriesBox.add_actor(categoryMenuItem.actor);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]