[gnome-shell/wip/aggregate-menu: 29/36] network: Remove setActiveConnection/clearActiveConnection
- From: Jasper St. Pierre <jstpierre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell/wip/aggregate-menu: 29/36] network: Remove setActiveConnection/clearActiveConnection
- Date: Wed, 29 May 2013 20:18:41 +0000 (UTC)
commit fbc2a25671a13517138131161956acba331da56e
Author: Jasper St. Pierre <jstpierre mecheye net>
Date: Fri Apr 26 21:44:59 2013 -0400
network: Remove setActiveConnection/clearActiveConnection
This can be more easily achieved by listening for changes to the
device's active-connection property. VPN will still need support to
track active connections, as it does not have an associated
device. But as VPN can track multiple active connections, the names
"set" and "clear" don't quite fit. Rename them to the more-standard
"add" and "remove".
js/ui/status/network.js | 28 ++++++++++++++--------------
1 files changed, 14 insertions(+), 14 deletions(-)
---
diff --git a/js/ui/status/network.js b/js/ui/status/network.js
index ac14b83..e61ea7e 100644
--- a/js/ui/status/network.js
+++ b/js/ui/status/network.js
@@ -248,6 +248,7 @@ const NMDevice = new Lang.Class({
this.device = device;
this.device._delegate = this;
this._stateChangedId = this.device.connect('state-changed', Lang.bind(this,
this._deviceStateChanged));
+ this._activeConnectionChangedId = this.device.connect('notify::active-connection',
Lang.bind(this, this._activeConnectionChanged));
} else if (this.device) {
this.device._delegate = null;
@@ -303,11 +304,9 @@ const NMDevice = new Lang.Class({
return this.device && this.device.state == NetworkManager.DeviceState.ACTIVATED;
},
- clearActiveConnection: function(activeConnection) {
- this.setActiveConnection(null);
- },
+ _activeConnectionChanged: function() {
+ let activeConnection = this.device.active_connection;
- setActiveConnection: function(activeConnection) {
if (activeConnection == this._activeConnection)
// nothing to do
return;
@@ -725,7 +724,7 @@ const NMDeviceWireless = new Lang.Class({
this._activeNetwork = this._networks[res.network];
}
- // we don't refresh the view here, setActiveConnection will
+ // we don't refresh the view here, _activeConnectionChanged will
},
_getApSecurityType: function(accessPoint) {
@@ -1201,13 +1200,13 @@ const NMVPNSection = new Lang.Class({
this._syncConnectionItem(activeConnection, activeConnection._connection);
},
- clearActiveConnection: function(activeConnection) {
+ removeActiveConnection: function(activeConnection) {
activeConnection._connection._activeConnection = null;
activeConnection.disconnect(activeConnection._stateChangedId);
this._syncConnectionItem(null, activeConnection._connection);
},
- setActiveConnection: function(activeConnection) {
+ addActiveConnection: function(activeConnection) {
activeConnection._connection._activeConnection = activeConnection;
activeConnection._stateChangedId = activeConnection.connect('vpn-state-changed',
Lang.bind(this,
this._connectionStateChanged));
@@ -1485,9 +1484,9 @@ const NMApplet = new Lang.Class({
for (let i = 0; i < closedConnections.length; i++) {
let active = closedConnections[i];
- if (active._primaryDevice) {
- active._primaryDevice.clearActiveConnection(active);
- active._primaryDevice = null;
+ if (active._vpnSection) {
+ active._vpnSection.removeDevice(active);
+ active._vpnSection = null;
}
if (active._inited) {
active.disconnect(active._notifyStateId);
@@ -1547,14 +1546,15 @@ const NMApplet = new Lang.Class({
active_vpn = a;
if (!a._primaryDevice) {
- if (a._type != NetworkManager.SETTING_VPN_SETTING_NAME)
+ if (a._type != NetworkManager.SETTING_VPN_SETTING_NAME) {
// This list is guaranteed to have one device in it.
a._primaryDevice = a.get_devices()[0]._delegate;
- else
+ } else {
a._primaryDevice = this._vpnSection;
+ a._vpnSection = this._vpnSection;
- if (a._primaryDevice)
- a._primaryDevice.setActiveConnection(a);
+ this._vpnSection.addActiveConnection(a);
+ }
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]