diff options
-rw-r--r-- | libempathy-gtk/empathy-individual-widget.c | 41 | ||||
-rw-r--r-- | libempathy-gtk/empathy-persona-store.c | 26 |
2 files changed, 52 insertions, 15 deletions
diff --git a/libempathy-gtk/empathy-individual-widget.c b/libempathy-gtk/empathy-individual-widget.c index 20f3403b7..e5441748b 100644 --- a/libempathy-gtk/empathy-individual-widget.c +++ b/libempathy-gtk/empathy-individual-widget.c @@ -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); diff --git a/libempathy-gtk/empathy-persona-store.c b/libempathy-gtk/empathy-persona-store.c index aea205932..a3877788b 100644 --- a/libempathy-gtk/empathy-persona-store.c +++ b/libempathy-gtk/empathy-persona-store.c @@ -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); } |