NetworkManager r3723 - in trunk: . test



Author: dcbw
Date: Fri Jun  6 03:31:58 2008
New Revision: 3723
URL: http://svn.gnome.org/viewvc/NetworkManager?rev=3723&view=rev

Log:
2008-06-05  Dan Williams <dcbw redhat com>

	Patch from Markus Becker <mab comnets uni-bremen de>

	* test/nm-tool.c
		- Show which device is the default device



Modified:
   trunk/ChangeLog
   trunk/test/nm-tool.c

Modified: trunk/test/nm-tool.c
==============================================================================
--- trunk/test/nm-tool.c	(original)
+++ trunk/test/nm-tool.c	Fri Jun  6 03:31:58 2008
@@ -198,11 +198,14 @@
 detail_device (gpointer data, gpointer user_data)
 {
 	NMDevice *device = NM_DEVICE (data);
+	NMClient *client = NM_CLIENT (user_data);
 	char *tmp;
 	NMDeviceState state;
 	guint32 caps;
 	guint32 speed;
 	const GArray *array;
+	const GPtrArray *connections;
+	int j;
 
 	state = nm_device_get_state (device);
 
@@ -223,6 +226,22 @@
 
 	print_string ("State", get_dev_state_string (state));
 
+	connections = nm_client_get_active_connections (client);
+	for (j = 0; connections && (j < connections->len); j++) {
+		NMActiveConnection *candidate = g_ptr_array_index (connections, j);
+		const GPtrArray *devices = nm_active_connection_get_devices (candidate);
+		NMDevice *candidate_dev;
+
+		if (!devices || !devices->len)
+			continue;
+		candidate_dev = g_ptr_array_index (devices, 0);
+
+		if ((candidate_dev == device) && nm_active_connection_get_default(candidate))
+			print_string ("Default", "yes");
+		else
+			print_string ("Default", "no");
+	}
+
 	tmp = NULL;
 	if (NM_IS_DEVICE_802_3_ETHERNET (device))
 		tmp = g_strdup (nm_device_802_3_ethernet_get_hw_address (NM_DEVICE_802_3_ETHERNET (device)));
@@ -362,7 +381,7 @@
 	}
 
 	devices = nm_client_get_devices (client);
-	g_ptr_array_foreach ((GPtrArray *) devices, detail_device, NULL);
+	g_ptr_array_foreach ((GPtrArray *) devices, detail_device, client);
 
 	g_object_unref (client);
 



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