From 88262a104263a4c4ae6b527dea050d35c1db9e16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Wed, 3 Aug 2022 06:44:36 +0200 Subject: [PATCH] status/network: Add activate() in NMSection As the sections are about to turn into quick toggles, they need to be able to perform an action on click. Add an activate() method for that purpose, which either disconnects all active items, or connects the primary item. Part-of: --- js/ui/status/network.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/js/ui/status/network.js b/js/ui/status/network.js index 1beab28c1..994c35c13 100644 --- a/js/ui/status/network.js +++ b/js/ui/status/network.js @@ -1343,6 +1343,15 @@ const NMSection = GObject.registerClass({ this.menu.actor.visible = visible; } + activate() { + const activeItems = [...this._getActiveItems()]; + + if (activeItems.length > 0) + activeItems.forEach(i => i.activate()); + else + this._itemBinding.source?.activate(); + } + _loadInitialItems() { throw new GObject.NotImplementedError(); }