network: fix logic bug in checking whether to activate or deactive

A cosmetic change recommended in review of the patch to fix the
VPN Connections switch ended up introducing a logic error that
made the switch not work properly. Fix.

https://bugzilla.gnome.org/show_bug.cgi?id=646380
This commit is contained in:
Owen W. Taylor 2011-04-02 15:05:06 -04:00
parent d1a110d4ca
commit 6c3300bc2f

View File

@ -254,12 +254,14 @@ NMWiredSectionTitleMenuItem.prototype = {
return; return;
} }
let newState = this._switch.state;
// Immediately reset the switch to false, it will be updated appropriately // Immediately reset the switch to false, it will be updated appropriately
// by state-changed signals in devices (but fixes the VPN not being in sync // by state-changed signals in devices (but fixes the VPN not being in sync
// if the ActiveConnection object is never seen by libnm-glib) // if the ActiveConnection object is never seen by libnm-glib)
this._switch.setToggleState(false); this._switch.setToggleState(false);
if (this._switch.state) if (newState)
this._device.activate(); this._device.activate();
else else
this._device.deactivate(); this._device.deactivate();