[gnome-shell] popupMenu: Move child menus to be a PopupMenu-only thing



commit c9783b38c4a7cd877deb8df5fd133ea19c3fe222
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Sat Feb 16 13:42:17 2013 -0500

    popupMenu: Move child menus to be a PopupMenu-only thing
    
    It doesn't make sense for combo menus, sections, or submenus
    to have child menus.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=693572

 js/ui/popupMenu.js |   47 ++++++++++++++++++++++++++---------------------
 1 files changed, 26 insertions(+), 21 deletions(-)
---
diff --git a/js/ui/popupMenu.js b/js/ui/popupMenu.js
index eb3bd30..538d9b6 100644
--- a/js/ui/popupMenu.js
+++ b/js/ui/popupMenu.js
@@ -867,7 +867,6 @@ const PopupMenuBase = new Lang.Class({
         this.blockSourceEvents = false;
 
         this._activeMenuItem = null;
-        this._childMenus = [];
         this._settingsActions = { };
 
         this._sessionUpdatedId = Main.sessionMode.connect('updated', Lang.bind(this, this._sessionUpdated));
@@ -921,26 +920,8 @@ const PopupMenuBase = new Lang.Class({
         return !hasVisibleChildren;
     },
 
-    isChildMenu: function(menu) {
-        return this._childMenus.indexOf(menu) != -1;
-    },
-
-    addChildMenu: function(menu) {
-        if (this.isChildMenu(menu))
-            return;
-
-        this._childMenus.push(menu);
-        this.emit('child-menu-added', menu);
-    },
-
-    removeChildMenu: function(menu) {
-        let index = this._childMenus.indexOf(menu);
-
-        if (index == -1)
-            return;
-
-        this._childMenus.splice(index, 1);
-        this.emit('child-menu-removed', menu);
+    isChildMenu: function() {
+        return false;
     },
 
     /**
@@ -1215,6 +1196,8 @@ const PopupMenu = new Lang.Class({
 
         global.focus_manager.add_group(this.actor);
         this.actor.reactive = true;
+
+        this._childMenus = [];
     },
 
     _boxGetPreferredWidth: function (actor, forHeight, alloc) {
@@ -1241,6 +1224,28 @@ const PopupMenu = new Lang.Class({
         this._boxPointer.setSourceAlignment(alignment);
     },
 
+    isChildMenu: function(menu) {
+        return this._childMenus.indexOf(menu) != -1;
+    },
+
+    addChildMenu: function(menu) {
+        if (this.isChildMenu(menu))
+            return;
+
+        this._childMenus.push(menu);
+        this.emit('child-menu-added', menu);
+    },
+
+    removeChildMenu: function(menu) {
+        let index = this._childMenus.indexOf(menu);
+
+        if (index == -1)
+            return;
+
+        this._childMenus.splice(index, 1);
+        this.emit('child-menu-removed', menu);
+    },
+
     open: function(animate) {
         if (this.isOpen)
             return;


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