[gnome-shell] status/network: Use bindings to update VPN indicator
- From: Marge Bot <marge-bot src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] status/network: Use bindings to update VPN indicator
- Date: Wed, 10 Aug 2022 16:41:15 +0000 (UTC)
commit ded451f3342b84a277cbb624f062868980d59be8
Author: Florian Müllner <fmuellner gnome org>
Date: Wed Aug 3 04:11:15 2022 +0200
status/network: Use bindings to update VPN indicator
Now that the VPN section is a GObject, we can set up proper bindings
for icon-name and visibility.
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2408>
js/ui/status/network.js | 24 ++++++++++--------------
1 file changed, 10 insertions(+), 14 deletions(-)
---
diff --git a/js/ui/status/network.js b/js/ui/status/network.js
index 5212698e03..e9ea5c05e3 100644
--- a/js/ui/status/network.js
+++ b/js/ui/status/network.js
@@ -1528,14 +1528,6 @@ class NMVpnSection extends NMSection {
deactivateConnection(activeConnection) {
this._client.deactivate_connection(activeConnection, null);
}
-
- getIndicatorIcon() {
- for (const item of this._items.values()) {
- if (item.is_active)
- return item.icon_name;
- }
- return '';
- }
});
const NMDeviceSection = GObject.registerClass(
@@ -1746,9 +1738,6 @@ class Indicator extends PanelMenu.SystemIndicator {
_init() {
super._init();
- this._primaryIndicator = this._addIndicator();
- this._vpnIndicator = this._addIndicator();
-
this._connectivityQueue = new Set();
this._mainConnection = null;
@@ -1780,6 +1769,16 @@ class Indicator extends PanelMenu.SystemIndicator {
this.menu.addMenuItem(section.menu);
});
+ this._primaryIndicator = this._addIndicator();
+ this._vpnIndicator = this._addIndicator();
+
+ this._vpnSection.bind_property('checked',
+ this._vpnIndicator, 'visible',
+ GObject.BindingFlags.SYNC_CREATE);
+ this._vpnSection.bind_property('icon-name',
+ this._vpnIndicator, 'icon-name',
+ GObject.BindingFlags.SYNC_CREATE);
+
this._getClient().catch(logError);
}
@@ -1983,8 +1982,5 @@ class Indicator extends PanelMenu.SystemIndicator {
this._primaryIndicator.icon_name = 'network-wired-no-route-symbolic';
}
}
-
- this._vpnIndicator.icon_name = this._vpnSection.getIndicatorIcon();
- this._vpnIndicator.visible = this._vpnIndicator.icon_name !== null;
}
});
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]