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: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2408>
This commit is contained in:
Florian Müllner 2022-08-03 06:44:36 +02:00 committed by Marge Bot
parent be98e5b314
commit 88262a1042

View File

@ -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();
}