]> git.0d.be Git - empathy.git/commitdiff
Adapt to API change in folks_group_details_get_groups().
authorTravis Reitter <travis.reitter@collabora.co.uk>
Mon, 2 May 2011 20:17:23 +0000 (13:17 -0700)
committerTravis Reitter <travis.reitter@collabora.co.uk>
Mon, 6 Jun 2011 16:30:52 +0000 (09:30 -0700)
Helps: bgo#648822 - Port Empathy to Folks 0.5.1

libempathy-gtk/empathy-groups-widget.c
libempathy-gtk/empathy-individual-store.c

index 68e7efd095c5ea0638055eb854a230dd9cdf1860..33e4d8d5adb9ed13fb6800a1d9cfd156ddc5744e 100644 (file)
@@ -152,7 +152,7 @@ populate_data (EmpathyGroupsWidget *self)
   EmpathyGroupsWidgetPriv *priv = GET_PRIV (self);
   EmpathyContactManager *manager;
   GtkTreeIter iter;
-  GHashTable *my_groups;
+  GeeSet *member_groups;
   GList *all_groups, *l;
 
   /* Remove the old groups */
@@ -166,14 +166,15 @@ populate_data (EmpathyGroupsWidget *self)
   g_object_unref (manager);
 
   /* Get the list of groups that this #FolksGroupDetails is currently in */
-  my_groups = folks_group_details_get_groups (priv->group_details);
+  member_groups = folks_group_details_get_groups (priv->group_details);
 
   for (l = all_groups; l != NULL; l = l->next)
     {
       const gchar *group_str = l->data;
       gboolean enabled;
 
-      enabled = GPOINTER_TO_UINT (g_hash_table_lookup (my_groups, group_str));
+      enabled = gee_collection_contains (GEE_COLLECTION (member_groups),
+          group_str);
 
       gtk_list_store_append (priv->group_store, &iter);
       gtk_list_store_set (priv->group_store, &iter,
index 331a0e8a569fb76f36c025ace58c6c0a348dceef..01ec8943688f0218314707478e84c265329ad98c 100644 (file)
@@ -418,8 +418,7 @@ individual_store_add_individual (EmpathyIndividualStore *self,
 {
   EmpathyIndividualStorePriv *priv;
   GtkTreeIter iter;
-  GHashTable *group_set = NULL;
-  GList *groups = NULL, *l;
+  GeeIterator *group_iter = NULL;
   EmpathyContact *contact;
   TpConnection *connection;
   gchar *protocol_name;
@@ -432,9 +431,13 @@ individual_store_add_individual (EmpathyIndividualStore *self,
 
   if (priv->show_groups)
     {
+      GeeSet *group_set = NULL;
+
       group_set = folks_group_details_get_groups (
           FOLKS_GROUP_DETAILS (individual));
-      groups = g_hash_table_get_keys (group_set);
+
+      if (gee_collection_get_size (GEE_COLLECTION (group_set)) > 0)
+        group_iter = gee_iterable_iterator (GEE_ITERABLE (group_set));
     }
 
   contact = empathy_contact_dup_from_folks_individual (individual);
@@ -442,7 +445,8 @@ individual_store_add_individual (EmpathyIndividualStore *self,
 
   tp_connection_parse_object_path (connection, &protocol_name, NULL);
 
-  if (groups == NULL)
+  /* fall-back groups, in case there are no named groups */
+  if (group_iter == NULL)
     {
       GtkTreeIter iter_group, *parent;
 
@@ -471,17 +475,20 @@ individual_store_add_individual (EmpathyIndividualStore *self,
   g_free (protocol_name);
 
   /* Else add to each group. */
-  for (l = groups; l; l = l->next)
+  while (group_iter != NULL && gee_iterator_next (group_iter))
     {
+      gchar *group_name = gee_iterator_get (group_iter);
       GtkTreeIter iter_group;
 
-      individual_store_get_group (self, l->data, &iter_group, NULL, NULL,
+      individual_store_get_group (self, group_name, &iter_group, NULL, NULL,
           FALSE);
 
       add_individual_to_store (GTK_TREE_STORE (self), &iter, &iter_group,
           individual);
+
+      g_free (group_name);
     }
-  g_list_free (groups);
+  g_clear_object (&group_iter);
 
   if (priv->show_groups &&
       folks_favourite_details_get_is_favourite (