network: fix two warnings when removing a network device

NMApplet connects to each NMDevice's state-changed signal and stores
the signal handler id on the NMDevice itself. However, it was using
the same name as NMDevice itself was using to store the handler ID for
the underlying GObject's state-changed signal, thus overwriting it,
and resulting in *neither* signal handler getting removed if the
device went away. (This probably isn't a problem, since the device is
going away, but it causes a warning.)

Also, at least for WWAN devices, the device state changes to UNMANAGED
immediately before disappearing, but getStatusLabel() wasn't handling
that case and printed a warning instead. Fix that.

https://bugzilla.gnome.org/show_bug.cgi?id=646708
This commit is contained in:
Dan Winship 2011-04-04 08:31:55 -04:00
parent 529b6ca935
commit 5b1a76aeff

View File

@ -492,6 +492,7 @@ NMDevice.prototype = {
getStatusLabel: function() {
switch(this.device.state) {
case NetworkManager.DeviceState.UNMANAGED:
case NetworkManager.DeviceState.DISCONNECTED:
case NetworkManager.DeviceState.ACTIVATED:
return null;
@ -1711,13 +1712,13 @@ NMApplet.prototype = {
{ icon: icon });
this._source.notify(notification);
})); */
wrapper._stateChangedId = wrapper.connect('state-changed', Lang.bind(this, function(dev) {
wrapper._deviceStateChangedId = wrapper.connect('state-changed', Lang.bind(this, function(dev) {
this._syncSectionTitle(dev.category);
}));
wrapper._destroyId = wrapper.connect('destroy', function(wrapper) {
//wrapper.disconnect(wrapper._networkLostId);
//wrapper.disconnect(wrapper._activationFailedId);
wrapper.disconnect(wrapper._stateChangedId);
wrapper.disconnect(wrapper._deviceStateChangedId);
});
let section = this._devices[wrapper.category].section;
let devices = this._devices[wrapper.category].devices;