summaryrefslogtreecommitdiff
path: root/examples/C
diff options
context:
space:
mode:
authorDan Winship <danw@gnome.org>2014-10-22 12:32:46 -0400
committerDan Winship <danw@gnome.org>2014-10-28 17:17:17 -0400
commit6ae422485004485afd0a64f00e75c17fa5084b2e (patch)
treed364cd6dcd8f63e7aaba1666e3f8db41c2890378 /examples/C
parent9e5c7d915b837e79a2f6d64a7d89bf2a2dec2f50 (diff)
downloadNetworkManager-6ae422485004485afd0a64f00e75c17fa5084b2e.tar.gz
libnm: change GSList to GPtrArray in libnm methods
libnm mostly used GPtrArrays in its APIs, except that arrays of connections were usually GSLists. Fix this and make them GPtrArrays too (and rename nm_client_list_connections() to nm_client_get_connections() to match everything else).
Diffstat (limited to 'examples/C')
-rw-r--r--examples/C/glib/list-connections-libnm.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/examples/C/glib/list-connections-libnm.c b/examples/C/glib/list-connections-libnm.c
index f761bfd77f..f09c028b6b 100644
--- a/examples/C/glib/list-connections-libnm.c
+++ b/examples/C/glib/list-connections-libnm.c
@@ -34,9 +34,8 @@
/* Print details of connection */
static void
-show_connection (gpointer data, gpointer user_data)
+show_connection (NMConnection *connection)
{
- NMConnection *connection = (NMConnection *) data;
NMSettingConnection *s_con;
guint64 timestamp;
char *timestamp_str;
@@ -67,7 +66,8 @@ main (int argc, char *argv[])
{
NMClient *client;
GError *error = NULL;
- GSList *connections;
+ const GPtrArray *connections;
+ int i;
#if !GLIB_CHECK_VERSION (2, 35, 0)
/* Initialize GType system */
@@ -86,13 +86,13 @@ main (int argc, char *argv[])
}
/* Now the connections can be listed. */
- connections = nm_client_list_connections (client);
+ connections = nm_client_get_connections (client);
printf ("Connections:\n===================\n");
- g_slist_foreach (connections, show_connection, NULL);
+ for (i = 0; i < connections->len; i++)
+ show_connection (connections->pdata[i]);
- g_slist_free (connections);
g_object_unref (client);
return EXIT_SUCCESS;