[gnome-shell] panel: Add closeQuickSettings() method
- From: Marge Bot <marge-bot src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] panel: Add closeQuickSettings() method
- Date: Tue, 2 Aug 2022 16:09:06 +0000 (UTC)
commit 7834372acbaad177c6f0649fa9f328186e22b8eb
Author: Florian Müllner <fmuellner gnome org>
Date: Sat Jul 30 02:24:17 2022 +0200
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>
js/ui/panel.js | 22 ++++++++++++++--------
1 file changed, 14 insertions(+), 8 deletions(-)
---
diff --git a/js/ui/panel.js b/js/ui/panel.js
index 850d4f06c1..d259fcbb23 100644
--- a/js/ui/panel.js
+++ b/js/ui/panel.js
@@ -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;
-
- let menu = indicator.menu;
- if (!indicator.reactive)
- return;
+ this._closeMenu(this.statusArea.dateMenu);
+ }
- menu.close();
+ closeQuickSettings() {
+ this._closeMenu(this.statusArea.quickSettings);
}
set boxOpacity(value) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]