aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTravis Reitter <travis.reitter@collabora.co.uk>2011-05-06 02:05:04 +0800
committerTravis Reitter <travis.reitter@collabora.co.uk>2011-06-07 00:30:52 +0800
commita6f6a3b008a9da3e437488b480fdbb2b5d07e9fd (patch)
tree7d9cc0bd4a7bf07a92449626343f4902041779a2
parenta922c5d3011ce0be0d57f26835d20758cf4c320e (diff)
downloadgsoc2013-empathy-a6f6a3b008a9da3e437488b480fdbb2b5d07e9fd.tar
gsoc2013-empathy-a6f6a3b008a9da3e437488b480fdbb2b5d07e9fd.tar.gz
gsoc2013-empathy-a6f6a3b008a9da3e437488b480fdbb2b5d07e9fd.tar.bz2
gsoc2013-empathy-a6f6a3b008a9da3e437488b480fdbb2b5d07e9fd.tar.lz
gsoc2013-empathy-a6f6a3b008a9da3e437488b480fdbb2b5d07e9fd.tar.xz
gsoc2013-empathy-a6f6a3b008a9da3e437488b480fdbb2b5d07e9fd.tar.zst
gsoc2013-empathy-a6f6a3b008a9da3e437488b480fdbb2b5d07e9fd.zip
Adapt to API change in FolksIndividual::personas-changed.
Helps: bgo#648822 - Port Empathy to Folks 0.5.1
-rw-r--r--libempathy-gtk/empathy-individual-widget.c41
-rw-r--r--libempathy-gtk/empathy-persona-store.c26
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);
}