status/network: Remove status from VPN item

It's odd to swap out a switch with a status label, and the
information isn't that helpful to begin with: It's either
transient (connecting, deactivating, ...), or too little to
be meaningful (unknown, failed, ...).

We're also perfectly happy to not show it in "label mode"
(i.e. when there's just one VPN).

Just get rid of it.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2406>
This commit is contained in:
Florian Müllner 2022-08-02 11:33:37 +02:00
parent b5fabedd4f
commit 9bca544dd6

View File

@ -1406,30 +1406,9 @@ var NMWireguardItem = class extends NMConnectionItem {
let isActive = this.isActive();
this.labelItem.label.text = isActive ? _('Turn Off') : this._section.getConnectLabel();
this.radioItem.setToggleState(isActive);
this.radioItem.setStatus(this._getStatus());
this.emit('icon-changed');
}
_getStatus() {
if (this._activeConnection === null)
return null;
switch (this._activeConnection.state) {
case NM.ActiveConnectionState.UNKNOWN:
return _('unknown');
case NM.ActiveConnectionState.ACTIVATING:
return _('activating…');
case NM.ActiveConnectionState.ACTIVATED:
return null;
case NM.ActiveConnectionState.DEACTIVATING:
return _('deactivating…');
case NM.ActiveConnectionState.DEACTIVATED:
return _('deactivated');
default:
return 'invalid';
}
}
_connectionStateChanged() {
const state = this._activeConnection?.get_state();
const reason = this._activeConnection?.get_state_reason();
@ -1477,32 +1456,9 @@ var NMVpnConnectionItem = class extends NMConnectionItem {
let isActive = this.isActive();
this.labelItem.label.text = isActive ? _("Turn Off") : this._section.getConnectLabel();
this.radioItem.setToggleState(isActive);
this.radioItem.setStatus(this._getStatus());
this.emit('icon-changed');
}
_getStatus() {
if (this._activeConnection == null)
return null;
switch (this._activeConnection.vpn_state) {
case NM.VpnConnectionState.DISCONNECTED:
case NM.VpnConnectionState.ACTIVATED:
return null;
case NM.VpnConnectionState.PREPARE:
case NM.VpnConnectionState.CONNECT:
case NM.VpnConnectionState.IP_CONFIG_GET:
return _("connecting…");
case NM.VpnConnectionState.NEED_AUTH:
/* Translators: this is for network connections that require some kind of key or password */
return _("authentication required");
case NM.VpnConnectionState.FAILED:
return _("connection failed");
default:
return 'invalid';
}
}
_connectionStateChanged(ac, newstate, reason) {
if (newstate === NM.VpnConnectionState.FAILED &&
reason !== NM.VpnConnectionStateReason.NO_SECRETS)