From f52b5d58e38c9d8c808861af85bcbdef0d156ccc Mon Sep 17 00:00:00 2001 From: Xavier Claessens Date: Sun, 17 Jul 2011 12:26:47 +0200 Subject: [PATCH] Add _tp_contacts_from_values --- telepathy-glib/util-internal.h | 2 ++ telepathy-glib/util.c | 17 +++++++++++++++++ 2 files changed, 19 insertions(+), 0 deletions(-) diff --git a/telepathy-glib/util-internal.h b/telepathy-glib/util-internal.h index e3f3951..f3f8920 100644 --- a/telepathy-glib/util-internal.h +++ b/telepathy-glib/util-internal.h @@ -97,4 +97,6 @@ gboolean _tp_contacts_to_handles (TpConnection *connection, TpContact * const *contacts, GArray **handles); +GPtrArray *_tp_contacts_from_values (GHashTable *table); + #endif /* __TP_UTIL_INTERNAL_H__ */ diff --git a/telepathy-glib/util.c b/telepathy-glib/util.c index 305cf07..b237775 100644 --- a/telepathy-glib/util.c +++ b/telepathy-glib/util.c @@ -1920,3 +1920,20 @@ _tp_contacts_to_handles (TpConnection *connection, return TRUE; } + +GPtrArray * +_tp_contacts_from_values (GHashTable *table) +{ + GPtrArray *contacts; + GHashTableIter iter; + gpointer value; + + contacts = _tp_g_ptr_array_new_full (g_hash_table_size (table), + g_object_unref); + + g_hash_table_iter_init (&iter, table); + while (g_hash_table_iter_next (&iter, NULL, &value)) + g_ptr_array_add (contacts, g_object_ref (value)); + + return contacts; +} -- 1.7.4.1