From 0c5d87d79b5c9b99a4d263b016498511041301f2 Mon Sep 17 00:00:00 2001 From: Giovanni Campagna Date: Tue, 16 Nov 2010 20:35:51 +0100 Subject: [PATCH] PopupMenu: allow insertion of items at any point Add a "position" argument to addMenuItem, and pass it to the underlying box layout. If undefined or null, it adds at the end. --- js/ui/popupMenu.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/js/ui/popupMenu.js b/js/ui/popupMenu.js index 7227f90e5..8f84805ca 100644 --- a/js/ui/popupMenu.js +++ b/js/ui/popupMenu.js @@ -679,8 +679,11 @@ PopupMenu.prototype = { })); }, - addMenuItem: function(menuItem) { - this._box.add(menuItem.actor); + addMenuItem: function(menuItem, position) { + if (position == undefined) + this._box.add(menuItem.actor); + else + this._box.insert_actor(menuItem.actor, position); menuItem._activeChangeId = menuItem.connect('active-changed', Lang.bind(this, function (menuItem, active) { if (active && this._activeMenuItem != menuItem) { if (this._activeMenuItem)