status/network: Use ActiveConnection:state in VPN item
The separate :vpn-state property is more fine-grained, but as we aren't using anything beyond what :state provides, we can just as well use that. Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2406>
This commit is contained in:
parent
9bca544dd6
commit
79f6ee25bd
@ -1437,13 +1437,6 @@ var NMWireguardItem = class extends NMConnectionItem {
|
|||||||
};
|
};
|
||||||
|
|
||||||
var NMVpnConnectionItem = class extends NMConnectionItem {
|
var NMVpnConnectionItem = class extends NMConnectionItem {
|
||||||
isActive() {
|
|
||||||
if (this._activeConnection == null)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
return this._activeConnection.vpn_state != NM.VpnConnectionState.DISCONNECTED;
|
|
||||||
}
|
|
||||||
|
|
||||||
_buildUI() {
|
_buildUI() {
|
||||||
this.labelItem = new PopupMenu.PopupMenuItem('');
|
this.labelItem = new PopupMenu.PopupMenuItem('');
|
||||||
this.labelItem.connect('activate', this._toggle.bind(this));
|
this.labelItem.connect('activate', this._toggle.bind(this));
|
||||||
@ -1459,29 +1452,22 @@ var NMVpnConnectionItem = class extends NMConnectionItem {
|
|||||||
this.emit('icon-changed');
|
this.emit('icon-changed');
|
||||||
}
|
}
|
||||||
|
|
||||||
_connectionStateChanged(ac, newstate, reason) {
|
_connectionStateChanged() {
|
||||||
if (newstate === NM.VpnConnectionState.FAILED &&
|
const state = this._activeConnection?.get_state();
|
||||||
reason !== NM.VpnConnectionStateReason.NO_SECRETS)
|
const reason = this._activeConnection?.get_state_reason();
|
||||||
|
|
||||||
|
if (state === NM.ActiveConnectionState.DEACTIVATED &&
|
||||||
|
reason !== NM.ActiveConnectionStateReason.NO_SECRETS &&
|
||||||
|
reason !== NM.ActiveConnectionStateReason.USER_DISCONNECTED)
|
||||||
this.emit('activation-failed');
|
this.emit('activation-failed');
|
||||||
|
|
||||||
this.emit('icon-changed');
|
this.emit('icon-changed');
|
||||||
super._connectionStateChanged();
|
super._connectionStateChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
setActiveConnection(activeConnection) {
|
|
||||||
this._activeConnection?.disconnectObject(this);
|
|
||||||
|
|
||||||
this._activeConnection = activeConnection;
|
|
||||||
|
|
||||||
this._activeConnection?.connectObject('vpn-state-changed',
|
|
||||||
this._connectionStateChanged.bind(this), this);
|
|
||||||
|
|
||||||
this._sync();
|
|
||||||
}
|
|
||||||
|
|
||||||
getIndicatorIcon() {
|
getIndicatorIcon() {
|
||||||
if (this._activeConnection) {
|
if (this._activeConnection) {
|
||||||
if (this._activeConnection.vpn_state < NM.VpnConnectionState.ACTIVATED)
|
if (this._activeConnection.state < NM.ActiveConnectionState.ACTIVATED)
|
||||||
return 'network-vpn-acquiring-symbolic';
|
return 'network-vpn-acquiring-symbolic';
|
||||||
else
|
else
|
||||||
return 'network-vpn-symbolic';
|
return 'network-vpn-symbolic';
|
||||||
|
Loading…
Reference in New Issue
Block a user