panel: Add closeQuickSettings() method

Like the aggregate menu currently, the quick settings menu will
eventually contain some items that should dismiss the menu. And
as those items may appear in child menus or otherwise be nested,
a public method on a global object is more convenient than handing
the main menu down the hierarchy.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2392>
This commit is contained in:
Florian Müllner 2022-07-30 02:24:17 +02:00 committed by Marge Bot
parent 84a62cc868
commit 7834372acb

View File

@ -643,6 +643,16 @@ class Panel extends St.Widget {
menu.actor.navigate_focus(null, St.DirectionType.TAB_FORWARD, false);
}
_closeMenu(indicator) {
if (!indicator || !indicator.mapped)
return; // menu not supported by current session mode
if (!indicator.reactive)
return;
indicator.menu.close();
}
toggleAppMenu() {
this._toggleMenu(this.statusArea.appMenu);
}
@ -652,15 +662,11 @@ class Panel extends St.Widget {
}
closeCalendar() {
let indicator = this.statusArea.dateMenu;
if (!indicator) // calendar not supported by current session mode
return;
this._closeMenu(this.statusArea.dateMenu);
}
let menu = indicator.menu;
if (!indicator.reactive)
return;
menu.close();
closeQuickSettings() {
this._closeMenu(this.statusArea.quickSettings);
}
set boxOpacity(value) {