]> git.0d.be Git - empathy.git/commitdiff
Adapt to API change in FolksIndividual::personas-changed.
authorTravis Reitter <travis.reitter@collabora.co.uk>
Thu, 5 May 2011 18:05:04 +0000 (11:05 -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-individual-widget.c
libempathy-gtk/empathy-persona-store.c

index 20f3403b7a692de55ce1053ea2827436abcd1aef..e5441748b7b8d45a776fa49044c62cb6d61283ad 100644 (file)
@@ -1711,8 +1711,8 @@ individual_table_destroy (EmpathyIndividualWidget *self)
 
 static void
 personas_changed_cb (FolksIndividual *individual,
-    GList *added,
-    GList *removed,
+    GeeSet *added,
+    GeeSet *removed,
     EmpathyIndividualWidget *self)
 {
   EmpathyIndividualWidgetPriv *priv = GET_PRIV (self);
@@ -1769,13 +1769,27 @@ personas_changed_cb (FolksIndividual *individual,
 
   if (was_showing_personas && will_show_personas)
     {
+      GeeIterator *iter_changed;
+
       /* Remove outdated Personas */
-      for (l = removed; l != NULL; l = l->next)
-        remove_persona (self, FOLKS_PERSONA (l->data));
+      iter_changed = gee_iterable_iterator (GEE_ITERABLE (removed));
+      while (gee_iterator_next (iter_changed))
+        {
+          FolksPersona *persona = gee_iterator_get (iter_changed);
+          remove_persona (self, persona);
+          g_clear_object (&persona);
+        }
+      g_clear_object (&iter_changed);
 
       /* Add new Personas */
-      for (l = added; l != NULL; l = l->next)
-        add_persona (self, FOLKS_PERSONA (l->data));
+      iter_changed = gee_iterable_iterator (GEE_ITERABLE (added));
+      while (gee_iterator_next (iter_changed))
+        {
+          FolksPersona *persona = gee_iterator_get (iter_changed);
+          add_persona (self, persona);
+          g_clear_object (&persona);
+        }
+      g_clear_object (&iter_changed);
     }
   else if (!was_showing_personas && will_show_personas)
     {
@@ -1804,8 +1818,19 @@ personas_changed_cb (FolksIndividual *individual,
           g_clear_object (&persona);
         }
 
-      for (l = removed; l != NULL; l = l->next)
-        remove_persona (self, FOLKS_PERSONA (l->data));
+      if (removed != NULL)
+        {
+          GeeIterator *iter_changed;
+
+          iter_changed = gee_iterable_iterator (GEE_ITERABLE (removed));
+          while (gee_iterator_next (iter_changed))
+            {
+              FolksPersona *persona = gee_iterator_get (iter_changed);
+              remove_persona (self, persona);
+              g_clear_object (&persona);
+            }
+          g_clear_object (&iter_changed);
+        }
 
       /* Set up the Individual table instead */
       individual_table_set_up (self);
index aea205932c6d4211aee8de971d0e12c36f0b3374..a3877788ba91f91fe915861475140aa9aed3a664 100644 (file)
@@ -526,11 +526,11 @@ update_persona (EmpathyPersonaStore *self,
 
 static void
 individual_personas_changed_cb (GObject *object,
-    GList *added,
-    GList *removed,
+    GeeSet *added,
+    GeeSet *removed,
     EmpathyPersonaStore *self)
 {
-  GList *l;
+  GeeIterator *iter;
 
   /* One of the personas' row references might hold the last reference to the
    * PersonaStore, so we need to keep a reference ourselves so we don't get
@@ -538,12 +538,24 @@ individual_personas_changed_cb (GObject *object,
   g_object_ref (self);
 
   /* Remove the old personas. */
-  for (l = removed; l != NULL; l = l->next)
-    remove_persona_and_disconnect (self, FOLKS_PERSONA (l->data));
+  iter = gee_iterable_iterator (GEE_ITERABLE (removed));
+  while (gee_iterator_next (iter))
+    {
+      FolksPersona *persona = gee_iterator_get (iter);
+      remove_persona_and_disconnect (self, persona);
+      g_clear_object (&persona);
+    }
+  g_clear_object (&iter);
 
   /* Add each of the new personas to the tree model */
-  for (l = added; l != NULL; l = l->next)
-    add_persona_and_connect (self, FOLKS_PERSONA (l->data));
+  iter = gee_iterable_iterator (GEE_ITERABLE (added));
+  while (gee_iterator_next (iter))
+    {
+      FolksPersona *persona = gee_iterator_get (iter);
+      add_persona_and_connect (self, persona);
+      g_clear_object (&persona);
+    }
+  g_clear_object (&iter);
 
   g_object_unref (self);
 }