]> git.0d.be Git - empathy.git/commitdiff
add empathy_connection_aggregator_get_all_groups()
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>
Tue, 29 Nov 2011 13:01:12 +0000 (14:01 +0100)
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>
Tue, 29 Nov 2011 13:24:17 +0000 (14:24 +0100)
https://bugzilla.gnome.org/show_bug.cgi?id=665121

libempathy/empathy-connection-aggregator.c
libempathy/empathy-connection-aggregator.h

index 0a8560327dcce330cb4a3f6ea88ccfaef8972008..7074e5186b7d35e9b67bdd2011060c5595d5b2d5 100644 (file)
@@ -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;
+}
index a6a2726b78db64c730abe0b1fedcf294b9085b88..6a7fb656e78feb90b63bf9da31fc2eb60af8777d 100644 (file)
@@ -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__*/