Blame SOURCES/apps-menu-support-separators.patch

689e29
From a91f33c152c1f463d21a388727e64945c88e4d54 Mon Sep 17 00:00:00 2001
689e29
From: =?UTF-8?q?Florian=20M=C3=BCllner?= <fmuellner@gnome.org>
689e29
Date: Fri, 13 Oct 2017 01:20:17 +0200
689e29
Subject: [PATCH 1/2] apps-menu: Minor code cleanup
689e29
689e29
The parameter to _clearApplicationBox() has never been used, so
689e29
remove it. In fact, modern javascript makes the function so compact
689e29
that we can just move the code inline.
689e29
689e29
https://bugzilla.gnome.org/show_bug.cgi?id=788939
689e29
---
689e29
 extensions/apps-menu/extension.js | 15 +++------------
689e29
 1 file changed, 3 insertions(+), 12 deletions(-)
689e29
689e29
diff --git a/extensions/apps-menu/extension.js b/extensions/apps-menu/extension.js
689e29
index 600eda3..8138d4c 100644
689e29
--- a/extensions/apps-menu/extension.js
689e29
+++ b/extensions/apps-menu/extension.js
689e29
@@ -712,19 +712,10 @@ const ApplicationsButton = new Lang.Class({
689e29
         this.mainBox.style+=('height: ' + height);
689e29
     },
689e29
 
689e29
-    _clearApplicationsBox: function(selectedActor) {
689e29
-        let actors = this.applicationsBox.get_children();
689e29
-        for (let i = 0; i < actors.length; i++) {
689e29
-            let actor = actors[i];
689e29
-            this.applicationsBox.remove_actor(actor);
689e29
-        }
689e29
-    },
689e29
-
689e29
     selectCategory: function(dir, categoryMenuItem) {
689e29
-        if (categoryMenuItem)
689e29
-            this._clearApplicationsBox(categoryMenuItem.actor);
689e29
-        else
689e29
-            this._clearApplicationsBox(null);
689e29
+        this.applicationsBox.get_children().forEach(c => {
689e29
+            this.applicationsBox.remove_actor(c);
689e29
+        });
689e29
 
689e29
         if (dir)
689e29
             this._displayButtons(this._listApplications(dir.get_menu_id()));
689e29
-- 
689e29
2.14.2
689e29
689e29
689e29
From dd79357f429fabfec63ab1ea772428000bf038d0 Mon Sep 17 00:00:00 2001
689e29
From: =?UTF-8?q?Florian=20M=C3=BCllner?= <fmuellner@gnome.org>
689e29
Date: Fri, 13 Oct 2017 01:44:19 +0200
689e29
Subject: [PATCH 2/2] apps-menu: Support separators
689e29
689e29
We currently only load entries and directories, and ignore any
689e29
separators defined by the user/admin. Make some people happy
689e29
by supporting them ...
689e29
689e29
https://bugzilla.gnome.org/show_bug.cgi?id=788939
689e29
---
689e29
 extensions/apps-menu/extension.js | 13 +++++++++++--
689e29
 1 file changed, 11 insertions(+), 2 deletions(-)
689e29
689e29
diff --git a/extensions/apps-menu/extension.js b/extensions/apps-menu/extension.js
689e29
index 8138d4c..c2ecf5f 100644
689e29
--- a/extensions/apps-menu/extension.js
689e29
+++ b/extensions/apps-menu/extension.js
689e29
@@ -592,6 +592,8 @@ const ApplicationsButton = new Lang.Class({
689e29
                     app = new Shell.App({ app_info: entry.get_app_info() });
689e29
                 if (app.get_app_info().should_show())
689e29
                     this.applicationsByCategory[categoryId].push(app);
689e29
+            } else if (nextType == GMenu.TreeItemType.SEPARATOR) {
689e29
+                this.applicationsByCategory[categoryId].push('separator');
689e29
             } else if (nextType == GMenu.TreeItemType.DIRECTORY) {
689e29
                 let subdir = iter.get_directory();
689e29
                 if (!subdir.get_is_nodisplay())
689e29
@@ -714,7 +716,10 @@ const ApplicationsButton = new Lang.Class({
689e29
 
689e29
     selectCategory: function(dir, categoryMenuItem) {
689e29
         this.applicationsBox.get_children().forEach(c => {
689e29
-            this.applicationsBox.remove_actor(c);
689e29
+            if (c._delegate instanceof PopupMenu.PopupSeparatorMenuItem)
689e29
+                c._delegate.destroy();
689e29
+            else
689e29
+                this.applicationsBox.remove_actor(c);
689e29
         });
689e29
 
689e29
         if (dir)
689e29
@@ -727,7 +732,11 @@ const ApplicationsButton = new Lang.Class({
689e29
          if (apps) {
689e29
             for (let i = 0; i < apps.length; i++) {
689e29
                let app = apps[i];
689e29
-               let item = this._applicationsButtons.get(app);
689e29
+               let item;
689e29
+               if (app instanceof Shell.App)
689e29
+                   item = this._applicationsButtons.get(app);
689e29
+               else
689e29
+                   item = new PopupMenu.PopupSeparatorMenuItem();
689e29
                if (!item) {
689e29
                   item = new ApplicationMenuItem(this, app);
689e29
                   item.setDragEnabled(this._desktopTarget.hasDesktop);
689e29
-- 
689e29
2.14.2
689e29