telepathy-glib: Examples: Stop using tp_list_connection_managers()
Xavier Claessens
xclaesse at kemper.freedesktop.org
Mon Jun 4 06:16:04 PDT 2012
Module: telepathy-glib
Branch: master
Commit: 6d179e6e6ead222f7d8c1b0f3e16a30571014303
URL: http://cgit.freedesktop.org/telepathy/telepathy-glib/commit/?id=6d179e6e6ead222f7d8c1b0f3e16a30571014303
Author: Xavier Claessens <xavier.claessens at collabora.co.uk>
Date: Mon Jun 4 14:30:28 2012 +0200
Examples: Stop using tp_list_connection_managers()
It is soon to be deprecated
---
examples/client/list-managers.c | 33 +++++++++++++++------------------
1 files changed, 15 insertions(+), 18 deletions(-)
diff --git a/examples/client/list-managers.c b/examples/client/list-managers.c
index 5ba49a1..bffd19b 100644
--- a/examples/client/list-managers.c
+++ b/examples/client/list-managers.c
@@ -19,36 +19,33 @@ typedef struct {
} ExampleData;
static void
-got_connection_managers (TpConnectionManager * const *cms,
- gsize n_cms,
- const GError *error,
- gpointer user_data,
- GObject *unused)
+got_connection_managers (GObject *source,
+ GAsyncResult *result,
+ gpointer user_data)
{
ExampleData *data = user_data;
+ GList *cms;
+ GError *error = NULL;
+ cms = tp_list_connection_managers_finish (result, &error);
if (error != NULL)
{
g_warning ("%s", error->message);
+ g_clear_error (&error);
data->exit_code = 1;
}
else
{
- TpConnectionManager * const *iter = cms;
-
- g_message ("Found %" G_GSIZE_FORMAT " connection managers:", n_cms);
+ g_message ("Found %u connection managers:", g_list_length (cms));
- for (iter = cms; *iter != NULL; iter++)
+ while (cms != NULL)
{
- gchar *name;
-
- g_object_get (*iter,
- "connection-manager", &name,
- NULL);
+ TpConnectionManager *cm = cms->data;
- g_message ("- %s", name);
+ g_message ("- %s", tp_connection_manager_get_name (cm));
- g_free (name);
+ g_object_unref (cm);
+ cms = g_list_delete_link (cms, cms);
}
}
@@ -76,8 +73,8 @@ main (int argc,
goto out;
}
- tp_list_connection_managers (bus_daemon, got_connection_managers, &data,
- NULL, NULL);
+ tp_list_connection_managers_async (bus_daemon,
+ got_connection_managers, &data);
g_main_loop_run (data.mainloop);
More information about the telepathy-commits
mailing list