2008-10-22 Dan Williams <dcbw@redhat.com>

* include/NetworkManager.h
	  introspection/nm-device.xml
		- Add device state change reason for carrier changes

	* src/nm-device-ethernet.c
		- (set_carrier): use the carrier change reason when changing device
			state in response to carrier changes



git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@4203 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
This commit is contained in:
Dan Williams 2008-10-22 13:35:07 +00:00
parent f2cabde0f9
commit f029b6f4e9
4 changed files with 20 additions and 2 deletions

View File

@ -1,3 +1,13 @@
2008-10-22 Dan Williams <dcbw@redhat.com>
* include/NetworkManager.h
introspection/nm-device.xml
- Add device state change reason for carrier changes
* src/nm-device-ethernet.c
- (set_carrier): use the carrier change reason when changing device
state in response to carrier changes
2008-10-21 Dan Williams <dcbw@redhat.com>
* src/NetworkManagerPolicy.c

View File

@ -337,6 +337,9 @@ typedef enum {
/* Device disconnected by user or client */
NM_DEVICE_STATE_REASON_USER_REQUESTED,
/* Carrier/link changed */
NM_DEVICE_STATE_REASON_CARRIER,
/* Unused */
NM_DEVICE_STATE_REASON_LAST = 0xFFFF
} NMDeviceStateReason;

View File

@ -339,6 +339,11 @@
<tp:docstring>
A user or client requested the disconnection.
</tp:docstring>
</tp:enumvalue>
<tp:enumvalue suffix="CARRIER" value="40">
<tp:docstring>
The device's carrier/link changed.
</tp:docstring>
</tp:enumvalue>
</tp:enum>

View File

@ -190,10 +190,10 @@ set_carrier (NMDeviceEthernet *self, const gboolean carrier)
nm_info ("(%s): carrier now %s (device state %d)", nm_device_get_iface (NM_DEVICE (self)), carrier ? "ON" : "OFF", state);
if (state == NM_DEVICE_STATE_UNAVAILABLE) {
if (carrier)
nm_device_state_changed (NM_DEVICE (self), NM_DEVICE_STATE_DISCONNECTED, NM_DEVICE_STATE_REASON_NONE);
nm_device_state_changed (NM_DEVICE (self), NM_DEVICE_STATE_DISCONNECTED, NM_DEVICE_STATE_REASON_CARRIER);
} else if (state >= NM_DEVICE_STATE_DISCONNECTED) {
if (!carrier)
nm_device_state_changed (NM_DEVICE (self), NM_DEVICE_STATE_UNAVAILABLE, NM_DEVICE_STATE_REASON_NONE);
nm_device_state_changed (NM_DEVICE (self), NM_DEVICE_STATE_UNAVAILABLE, NM_DEVICE_STATE_REASON_CARRIER);
}
}