status/network: Keep sensitive when locked

Unlike the old menu that restricted almost everything on the lock
screen, we went into the completely opposite direction with quick
settings and kept everything that does not launch windows available.

Extend that line to the network items, but still respect the
`network-control` permission.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2408>
This commit is contained in:
Florian Müllner 2022-08-07 02:10:22 +02:00 committed by Marge Bot
parent cd9284e48f
commit dc09f990c4

View File

@ -1890,20 +1890,16 @@ class Indicator extends PanelMenu.SystemIndicator {
try {
this._configPermission = await Polkit.Permission.new(
'org.freedesktop.NetworkManager.network-control', null, null);
this._allSections.forEach(section => {
this._configPermission.bind_property('allowed',
section, 'reactive',
GObject.BindingFlags.SYNC_CREATE);
});
} catch (e) {
log(`No permission to control network connections: ${e}`);
this._configPermission = null;
}
Main.sessionMode.connect('updated', this._sessionUpdated.bind(this));
this._sessionUpdated();
}
_sessionUpdated() {
const sensitive =
!Main.sessionMode.isLocked &&
this._configPermission && this._configPermission.allowed;
this.menu.setSensitive(sensitive);
}
_onActivationFailed() {