[gnome-shell/wip/rstrode/login-screen-extensions: 27/134] status/network: Consider network-control action
- From: Ray Strode <halfline src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell/wip/rstrode/login-screen-extensions: 27/134] status/network: Consider network-control action
- Date: Thu, 26 Aug 2021 19:30:58 +0000 (UTC)
commit 1234ee21519f9d329bf7fe91c6693b07ffe835b0
Author: Florian Müllner <fmuellner gnome org>
Date: Tue Jun 8 00:17:48 2021 +0200
status/network: Consider network-control action
NetworkManager installs a `network-control` polkit action that can
be used to disallow network configuration, except that we happily
ignore it. Add it to the conditions that turn a network section
insensitive.
js/ui/status/network.js | 20 +++++++++++++++++---
1 file changed, 17 insertions(+), 3 deletions(-)
---
diff --git a/js/ui/status/network.js b/js/ui/status/network.js
index 92413d9b31..d2254a9b93 100644
--- a/js/ui/status/network.js
+++ b/js/ui/status/network.js
@@ -1,5 +1,5 @@
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
-const { Clutter, Gio, GLib, GObject, Meta, NM, St } = imports.gi;
+const { Clutter, Gio, GLib, GObject, Meta, NM, Polkit, St } = imports.gi;
const Mainloop = imports.mainloop;
const Signals = imports.signals;
@@ -1690,11 +1690,25 @@ var NMApplet = class extends PanelMenu.SystemIndicator {
this._client.connect('connection-removed', this._connectionRemoved.bind(this));
Main.sessionMode.connect('updated', this._sessionUpdated.bind(this));
- this._sessionUpdated();
+
+ this._configPermission = null;
+ Polkit.Permission.new(
+ 'org.freedesktop.NetworkManager.network-control', null, null,
+ (o, res) => {
+ try {
+ this._configPermission = Polkit.Permission.new_finish(res);
+ } catch (e) {
+ log('No permission to control network connections: %s'.format(e.toString()));
+ }
+ this._sessionUpdated();
+ });
}
_sessionUpdated() {
- let sensitive = !Main.sessionMode.isLocked && !Main.sessionMode.isGreeter;
+ const sensitive =
+ !Main.sessionMode.isLocked &&
+ !Main.sessionMode.isGreeter &&
+ this._configPermission && this._configPermission.allowed;
this.menu.setSensitive(sensitive);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]