diff --git a/js/ui/status/network.js b/js/ui/status/network.js index 431ca5ad6..28a5cfa0f 100644 --- a/js/ui/status/network.js +++ b/js/ui/status/network.js @@ -1699,9 +1699,32 @@ class NMWirelessSection extends NMDeviceSection { 'gnome-wifi-panel.desktop'); } + setClient(client) { + super.setClient(client); + + this._client?.bind_property('wireless-enabled', + this, 'checked', + GObject.BindingFlags.SYNC_CREATE); + } + + activate() { + this._client.wireless_enabled = !this._client.wireless_enabled; + } + _createDeviceMenuItem(device) { return new NMWirelessDeviceItem(this._client, device); } + + _updateChecked() { + // handled via a property binding + } + + _shouldShowDevice(device) { + // don't disappear if wireless-enabled is false + if (device.state === NM.DeviceState.UNAVAILABLE) + return true; + return super._shouldShowDevice(device); + } }); const NMWiredSection = GObject.registerClass(