mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager
synced 2024-07-22 02:35:25 +00:00
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 git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3723 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
This commit is contained in:
parent
2d643070f0
commit
ee59cd2df8
|
@ -1,3 +1,10 @@
|
|||
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
|
||||
|
||||
2008-06-05 Tambet Ingo <tambet@gmail.com>
|
||||
|
||||
Fix memory leaks.
|
||||
|
|
|
@ -198,11 +198,14 @@ static void
|
|||
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 @@ detail_device (gpointer data, gpointer user_data)
|
|||
|
||||
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 @@ main (int argc, char *argv[])
|
|||
}
|
||||
|
||||
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);
|
||||
|
||||
|
|
Loading…
Reference in a new issue