[empathy] add empathy_connection_aggregator_get_all_groups()
- From: Guillaume Desmottes <gdesmott src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [empathy] add empathy_connection_aggregator_get_all_groups()
- Date: Tue, 29 Nov 2011 13:28:15 +0000 (UTC)
commit 97f3aec6da2eed048d878611667381a773980e59
Author: Guillaume Desmottes <guillaume desmottes collabora co uk>
Date: Tue Nov 29 14:01:12 2011 +0100
add empathy_connection_aggregator_get_all_groups()
https://bugzilla.gnome.org/show_bug.cgi?id=665121
libempathy/empathy-connection-aggregator.c | 28 ++++++++++++++++++++++++++++
libempathy/empathy-connection-aggregator.h | 3 +++
2 files changed, 31 insertions(+), 0 deletions(-)
---
diff --git a/libempathy/empathy-connection-aggregator.c b/libempathy/empathy-connection-aggregator.c
index 0a85603..7074e51 100644
--- a/libempathy/empathy-connection-aggregator.c
+++ b/libempathy/empathy-connection-aggregator.c
@@ -188,3 +188,31 @@ empathy_connection_aggregator_dup_singleton (void)
g_object_add_weak_pointer (G_OBJECT (aggregator), (gpointer *) &aggregator);
return aggregator;
}
+
+GList *
+empathy_connection_aggregator_get_all_groups (EmpathyConnectionAggregator *self)
+{
+ GList *keys, *l;
+ GHashTable *set;
+
+ set = g_hash_table_new (g_str_hash, g_str_equal);
+
+ for (l = self->priv->conns; l != NULL; l = g_list_next (l))
+ {
+ TpConnection *conn = l->data;
+ const gchar * const *groups;
+ guint i;
+
+ groups = tp_connection_get_contact_groups (conn);
+ if (groups == NULL)
+ continue;
+
+ for (i = 0; groups[i] != NULL; i++)
+ g_hash_table_insert (set, (gchar *) groups[i], GUINT_TO_POINTER (TRUE));
+ }
+
+ keys = g_hash_table_get_keys (set);
+ g_hash_table_unref (set);
+
+ return keys;
+}
diff --git a/libempathy/empathy-connection-aggregator.h b/libempathy/empathy-connection-aggregator.h
index a6a2726..6a7fb65 100644
--- a/libempathy/empathy-connection-aggregator.h
+++ b/libempathy/empathy-connection-aggregator.h
@@ -61,6 +61,9 @@ GType empathy_connection_aggregator_get_type (void);
EmpathyConnectionAggregator * empathy_connection_aggregator_dup_singleton (void);
+GList * empathy_connection_aggregator_get_all_groups (
+ EmpathyConnectionAggregator *self);
+
G_END_DECLS
#endif /* #ifndef __EMPATHY_CONNECTION_AGGREGATOR_H__*/
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]