aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2011-11-29 21:01:12 +0800
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2011-11-29 21:24:17 +0800
commit97f3aec6da2eed048d878611667381a773980e59 (patch)
tree757c758c411cc4490a8354a761e9f3704598c568
parent057fc319fd536f33353bf307e8124dc8fbdd9040 (diff)
downloadgsoc2013-empathy-97f3aec6da2eed048d878611667381a773980e59.tar
gsoc2013-empathy-97f3aec6da2eed048d878611667381a773980e59.tar.gz
gsoc2013-empathy-97f3aec6da2eed048d878611667381a773980e59.tar.bz2
gsoc2013-empathy-97f3aec6da2eed048d878611667381a773980e59.tar.lz
gsoc2013-empathy-97f3aec6da2eed048d878611667381a773980e59.tar.xz
gsoc2013-empathy-97f3aec6da2eed048d878611667381a773980e59.tar.zst
gsoc2013-empathy-97f3aec6da2eed048d878611667381a773980e59.zip
add empathy_connection_aggregator_get_all_groups()
https://bugzilla.gnome.org/show_bug.cgi?id=665121
-rw-r--r--libempathy/empathy-connection-aggregator.c28
-rw-r--r--libempathy/empathy-connection-aggregator.h3
2 files changed, 31 insertions, 0 deletions
diff --git a/libempathy/empathy-connection-aggregator.c b/libempathy/empathy-connection-aggregator.c
index 0a8560327..7074e5186 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 a6a2726b7..6a7fb656e 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__*/