NetworkManager r3588 - trunk/src



Author: dcbw
Date: Tue Apr 22 19:07:00 2008
New Revision: 3588
URL: http://svn.gnome.org/viewvc/NetworkManager?rev=3588&view=rev

Log:
Clarify comments and clean up some code

Modified:
   trunk/src/nm-device.c

Modified: trunk/src/nm-device.c
==============================================================================
--- trunk/src/nm-device.c	(original)
+++ trunk/src/nm-device.c	Tue Apr 22 19:07:00 2008
@@ -1717,7 +1717,8 @@
 	case NM_DEVICE_STATE_UNAVAILABLE:
 		if (old_state == NM_DEVICE_STATE_UNMANAGED)
 			nm_device_bring_up (device, TRUE);
-		/* Fall through */
+		/* Fall through, so when the device needs to be deactivated due to
+		 * eg carrier changes we actually deactivate it */
 	case NM_DEVICE_STATE_DISCONNECTED:
 		if (old_state != NM_DEVICE_STATE_UNAVAILABLE)
 			nm_device_interface_deactivate (NM_DEVICE_INTERFACE (device));
@@ -1766,19 +1767,20 @@
 	g_return_if_fail (NM_IS_DEVICE (device));
 
 	priv = NM_DEVICE_GET_PRIVATE (device);
-	if (priv->managed != managed) {
-		priv->managed = managed;
-		nm_info ("(%s): now %s", nm_device_get_iface (device), managed ? "managed" : "unmanaged");
-
-		if (priv->start_timer) {
-			g_source_remove (priv->start_timer);
-			priv->start_timer = 0;
-		}
+	if (priv->managed == managed)
+		return;
 
-		g_object_notify (G_OBJECT (device), NM_DEVICE_INTERFACE_MANAGED);
+	priv->managed = managed;
+	nm_info ("(%s): now %s", nm_device_get_iface (device), managed ? "managed" : "unmanaged");
 
-		/* If now managed, jump to unavailable */
-		nm_device_state_changed (device, managed ? NM_DEVICE_STATE_UNAVAILABLE : NM_DEVICE_STATE_UNMANAGED);
+	if (priv->start_timer) {
+		g_source_remove (priv->start_timer);
+		priv->start_timer = 0;
 	}
+
+	g_object_notify (G_OBJECT (device), NM_DEVICE_INTERFACE_MANAGED);
+
+	/* If now managed, jump to unavailable */
+	nm_device_state_changed (device, managed ? NM_DEVICE_STATE_UNAVAILABLE : NM_DEVICE_STATE_UNMANAGED);
 }
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]