aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLaurent Contzen <lcontzen@gmail.com>2012-08-08 18:29:11 +0800
committerLaurent Contzen <lcontzen@gmail.com>2012-08-09 18:51:41 +0800
commitc2d9e976cd89f923c01eaf3801ff57d85889a57f (patch)
tree53a5b5b9460c21c9f3cc73980947ba372943d181
parent2a819c16c9ecd02c929156be39fa1c994cc907e2 (diff)
downloadgsoc2013-empathy-c2d9e976cd89f923c01eaf3801ff57d85889a57f.tar
gsoc2013-empathy-c2d9e976cd89f923c01eaf3801ff57d85889a57f.tar.gz
gsoc2013-empathy-c2d9e976cd89f923c01eaf3801ff57d85889a57f.tar.bz2
gsoc2013-empathy-c2d9e976cd89f923c01eaf3801ff57d85889a57f.tar.lz
gsoc2013-empathy-c2d9e976cd89f923c01eaf3801ff57d85889a57f.tar.xz
gsoc2013-empathy-c2d9e976cd89f923c01eaf3801ff57d85889a57f.tar.zst
gsoc2013-empathy-c2d9e976cd89f923c01eaf3801ff57d85889a57f.zip
Connected the aggregator to individuals-changed signal
-rw-r--r--libempathy-gtk/empathy-roster-model-aggregator.c39
1 files changed, 39 insertions, 0 deletions
diff --git a/libempathy-gtk/empathy-roster-model-aggregator.c b/libempathy-gtk/empathy-roster-model-aggregator.c
index 8aa20f934..f40b0259c 100644
--- a/libempathy-gtk/empathy-roster-model-aggregator.c
+++ b/libempathy-gtk/empathy-roster-model-aggregator.c
@@ -83,6 +83,40 @@ struct _EmpathyRosterModelAggregatorPriv
};
static void
+aggregator_individuals_changed_cb (FolksIndividualAggregator *aggregator,
+ GeeSet *added,
+ GeeSet *removed,
+ gchar *message,
+ FolksPersona *actor,
+ FolksGroupDetailsChangeReason reason,
+ EmpathyRosterModelAggregator *self)
+{
+ if (gee_collection_get_size (GEE_COLLECTION (added)) > 0)
+ {
+ GeeIterator *iter = gee_iterable_iterator (GEE_ITERABLE (added));
+
+ while (iter != NULL && gee_iterator_next (iter))
+ {
+ empathy_roster_model_fire_individual_added (
+ EMPATHY_ROSTER_MODEL (self), gee_iterator_get (iter));
+ }
+ g_clear_object (&iter);
+ }
+
+ if (gee_collection_get_size (GEE_COLLECTION (removed)) > 0)
+ {
+ GeeIterator *iter = gee_iterable_iterator (GEE_ITERABLE (removed));
+
+ while (iter != NULL && gee_iterator_next (iter))
+ {
+ empathy_roster_model_fire_individual_removed (
+ EMPATHY_ROSTER_MODEL (self), gee_iterator_get (iter));
+ }
+ g_clear_object (&iter);
+ }
+}
+
+static void
empathy_roster_model_aggregator_get_property (GObject *object,
guint property_id,
GValue *value,
@@ -134,6 +168,11 @@ empathy_roster_model_aggregator_constructed (GObject *object)
if (self->priv->aggregator == NULL)
self->priv->aggregator = folks_individual_aggregator_new ();
+ tp_g_signal_connect_object (self->priv->aggregator, "individuals-changed",
+ G_CALLBACK (aggregator_individuals_changed_cb), self, 0);
+
+ folks_individual_aggregator_prepare (self->priv->aggregator, NULL, NULL);
+
g_assert (FOLKS_IS_INDIVIDUAL_AGGREGATOR (self->priv->aggregator));
}