network: Fix the AP strength indicator never getting updated

I intended to make a few code cleanups, but I apparently forgot
to hook up _updateAccessPoint. Merge it with _activeApChanged,
which is where the notify::active-access-point signal is actually
hooked up to.

https://bugzilla.gnome.org/show_bug.cgi?id=704670
This commit is contained in:
Jasper St. Pierre 2013-07-16 17:46:09 -04:00
parent bbadfce65a
commit 8e9e583b79

View File

@ -777,6 +777,11 @@ const NMDeviceWireless = new Lang.Class({
this._apRemovedId = 0; this._apRemovedId = 0;
} }
if (this._strengthChangedId) {
this._activeAccessPoint.disconnect(this._strengthChangedId);
this._strengthChangedId = 0;
}
this.parent(); this.parent();
}, },
@ -806,18 +811,31 @@ const NMDeviceWireless = new Lang.Class({
}, },
_activeApChanged: function() { _activeApChanged: function() {
this._activeNetwork = null; let ap = this._device.active_access_point;
if (this._activeAccessPoint == ap)
return;
let activeAp = this._device.active_access_point; if (this._activeAccessPoint) {
this._activeAccessPoint.disconnect(this._strengthChangedId);
this._strengthChangedId = 0;
}
this._activeAccessPoint = ap;
if (this._activeAccessPoint) {
this._strengthChangedId = this._activeAccessPoint.connect('notify::strength',
Lang.bind(this, this._strengthChanged));
if (activeAp) {
let res = this._findExistingNetwork(activeAp); let res = this._findExistingNetwork(activeAp);
if (res != null) if (res != null)
this._activeNetwork = this._networks[res.network]; this._activeNetwork = this._networks[res.network];
} }
// we don't refresh the view here, _activeConnectionChanged will this.emit('icon-changed');
},
_strengthChanged: function() {
this.emit('icon-changed');
}, },
_getApSecurityType: function(accessPoint) { _getApSecurityType: function(accessPoint) {
@ -1217,30 +1235,6 @@ const NMDeviceWireless = new Lang.Class({
} }
}, },
_updateAccessPoint: function() {
let ap = this._device.active_access_point;
if (this._activeAccessPoint == ap)
return;
if (this._activeAccessPoint) {
this._activeAccessPoint.disconnect(this._strengthChangedId);
this._strengthChangedId = 0;
}
this._activeAccessPoint = ap;
if (this._activeAccessPoint) {
this._strengthChangedId = this._activeAccessPoint.connect('notify::strength',
Lang.bind(this, this._strengthChanged));
}
this._syncStatusLabel();
},
_strengthChanged: function() {
this.emit('icon-changed');
},
getIndicatorIcon: function() { getIndicatorIcon: function() {
if (this._device.active_connection.state == NetworkManager.ActiveConnectionState.ACTIVATING) if (this._device.active_connection.state == NetworkManager.ActiveConnectionState.ACTIVATING)
return 'network-wireless-acquiring-symbolic'; return 'network-wireless-acquiring-symbolic';