summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon McVittie <simon.mcvittie@collabora.co.uk>2008-01-17 11:22:25 +0000
committerSimon McVittie <simon.mcvittie@collabora.co.uk>2008-01-17 11:22:25 +0000
commit93826863cc1bf8cf81f5e530b66bbb74278203b5 (patch)
treef07d9d4d3b19011f2cc335f147fe274f9c449db6
parent6b5ad7194813c8fe86455af3f3b087e7d1845318 (diff)
tp_list_connection_managers: pass number of CMs to callback too
-rw-r--r--examples/client/list-managers.c5
-rw-r--r--telepathy-glib/connection-manager.c6
-rw-r--r--telepathy-glib/connection-manager.h3
3 files changed, 10 insertions, 4 deletions
diff --git a/examples/client/list-managers.c b/examples/client/list-managers.c
index c093bdb4f..f7466943b 100644
--- a/examples/client/list-managers.c
+++ b/examples/client/list-managers.c
@@ -14,6 +14,7 @@
void
got_connection_managers (TpConnectionManager * const *cms,
+ gsize n_cms,
const GError *error,
gpointer user_data,
GObject *unused)
@@ -28,6 +29,8 @@ got_connection_managers (TpConnectionManager * const *cms,
{
TpConnectionManager * const *iter = cms;
+ g_message ("Found %" G_GSIZE_FORMAT " connection managers:", n_cms);
+
for (iter = cms; *iter != NULL; iter++)
{
gchar *name;
@@ -36,7 +39,7 @@ got_connection_managers (TpConnectionManager * const *cms,
"connection-manager", &name,
NULL);
- g_message ("Found connection manager: %s", name);
+ g_message ("- %s", name);
g_free (name);
}
diff --git a/telepathy-glib/connection-manager.c b/telepathy-glib/connection-manager.c
index cecea8052..ed3c41184 100644
--- a/telepathy-glib/connection-manager.c
+++ b/telepathy-glib/connection-manager.c
@@ -1248,7 +1248,7 @@ tp_list_connection_managers_got_names (TpDBusDaemon *bus_daemon,
if (error != NULL)
{
- list_context->callback (NULL, error, list_context->user_data,
+ list_context->callback (NULL, 0, error, list_context->user_data,
list_context->weak_object);
return;
}
@@ -1279,13 +1279,15 @@ tp_list_connection_managers_got_names (TpDBusDaemon *bus_daemon,
(list_context->table));
TpConnectionManager **cms;
TpConnectionManager * const *iter;
+ gsize n_cms;
g_hash_table_foreach_steal (list_context->table, steal_into_ptr_array,
arr);
+ n_cms = arr->len;
g_ptr_array_add (arr, NULL);
cms = (TpConnectionManager **) g_ptr_array_free (arr, FALSE);
- list_context->callback (cms, NULL, list_context->user_data,
+ list_context->callback (cms, n_cms, NULL, list_context->user_data,
list_context->weak_object);
list_context->callback = NULL;
diff --git a/telepathy-glib/connection-manager.h b/telepathy-glib/connection-manager.h
index 55e7d4a08..4e0fd52f3 100644
--- a/telepathy-glib/connection-manager.h
+++ b/telepathy-glib/connection-manager.h
@@ -107,7 +107,8 @@ TpConnectionManager *tp_connection_manager_new (TpDBusDaemon *dbus,
gboolean tp_connection_manager_activate (TpConnectionManager *self);
typedef void (*TpConnectionManagerListCb) (TpConnectionManager * const *cms,
- const GError *error, gpointer user_data, GObject *weak_object);
+ gsize n_cms, const GError *error, gpointer user_data,
+ GObject *weak_object);
void tp_list_connection_managers (TpDBusDaemon *bus_daemon,
TpConnectionManagerListCb callback,