From 990eb92bd91b08b6943ba969b0e00a4a98f75fbf Mon Sep 17 00:00:00 2001 From: Andy Holmes Date: Sun, 4 Sep 2022 17:21:29 -0700 Subject: [PATCH] panel: Add `PanelMenu.Button` menu when `menu-set` is emitted When a `PanelMenu.Button` is added to the `statusArea`, its menu is added to the `PopupMenuManager` if it has one at the time. If a menu is added later or a new one set, the new menu is never added. Move the call to `PopupMenuManager.addMenu()` from `_addToPanelBox()` to `_onMenuSet()`, which is called when the `PanelMenu.Button` is added and whenever it emits the `menu-set` signal. Part-of: --- js/ui/panel.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/js/ui/panel.js b/js/ui/panel.js index 24248865b..94dffda73 100644 --- a/js/ui/panel.js +++ b/js/ui/panel.js @@ -707,8 +707,6 @@ class Panel extends St.Widget { box.insert_child_at_index(container, position); - if (indicator.menu) - this.menuManager.addMenu(indicator.menu); this.statusArea[role] = indicator; let destroyId = indicator.connect('destroy', emitter => { delete this.statusArea[role]; @@ -741,6 +739,8 @@ class Panel extends St.Widget { if (!indicator.menu || indicator.menu._openChangedId) return; + this.menuManager.addMenu(indicator.menu); + indicator.menu._openChangedId = indicator.menu.connect('open-state-changed', (menu, isOpen) => { let boxAlignment;