aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhilip Withnall <philip@tecnocode.co.uk>2011-08-30 03:43:22 +0800
committerPhilip Withnall <philip@tecnocode.co.uk>2011-09-13 05:09:58 +0800
commitdafc0ff233c2d02c607bb6ee67e714ba698319fc (patch)
treeba753890ae50131a8517fe568b217a79f123a2df
parent03eeddb4c836614b2bf1f935472bd66c98003aa1 (diff)
downloadgsoc2013-empathy-dafc0ff233c2d02c607bb6ee67e714ba698319fc.tar
gsoc2013-empathy-dafc0ff233c2d02c607bb6ee67e714ba698319fc.tar.gz
gsoc2013-empathy-dafc0ff233c2d02c607bb6ee67e714ba698319fc.tar.bz2
gsoc2013-empathy-dafc0ff233c2d02c607bb6ee67e714ba698319fc.tar.lz
gsoc2013-empathy-dafc0ff233c2d02c607bb6ee67e714ba698319fc.tar.xz
gsoc2013-empathy-dafc0ff233c2d02c607bb6ee67e714ba698319fc.tar.zst
gsoc2013-empathy-dafc0ff233c2d02c607bb6ee67e714ba698319fc.zip
individual-manager: Port to the new individuals_changed_detailed signal
Closes: bgo#657746
-rw-r--r--configure.ac2
-rw-r--r--libempathy/empathy-individual-manager.c35
2 files changed, 27 insertions, 10 deletions
diff --git a/configure.ac b/configure.ac
index d369cbeef..11c190cd0 100644
--- a/configure.ac
+++ b/configure.ac
@@ -34,7 +34,7 @@ AC_COPYRIGHT([
# Minimal version required
# Hardp deps
-FOLKS_REQUIRED=0.6.0
+FOLKS_REQUIRED=0.6.2
GLIB_REQUIRED=2.28.0
GNUTLS_REQUIRED=2.8.5
GTK_REQUIRED=3.0.2
diff --git a/libempathy/empathy-individual-manager.c b/libempathy/empathy-individual-manager.c
index 4e8034373..8d140178c 100644
--- a/libempathy/empathy-individual-manager.c
+++ b/libempathy/empathy-individual-manager.c
@@ -162,16 +162,20 @@ individual_notify_personas_cb (FolksIndividual *individual,
static void
aggregator_individuals_changed_cb (FolksIndividualAggregator *aggregator,
- GeeSet *added,
- GeeSet *removed,
- const char *message,
- FolksPersona *actor,
- guint reason,
+ GeeMultiMap *changes,
EmpathyIndividualManager *self)
{
EmpathyIndividualManagerPriv *priv = GET_PRIV (self);
GeeIterator *iter;
- GList *added_filtered = NULL, *removed_list = NULL;
+ GeeSet *removed;
+ GeeCollection *added;
+ GList *added_set = NULL, *added_filtered = NULL, *removed_list = NULL;
+
+ /* We're not interested in the relationships between the added and removed
+ * individuals, so just extract collections of them. Note that the added
+ * collection may contain duplicates, while the removed set won't. */
+ removed = gee_multi_map_get_keys (changes);
+ added = gee_multi_map_get_values (changes);
/* Handle the removals first, as one of the added Individuals might have the
* same ID as one of the removed Individuals (due to linking). */
@@ -180,6 +184,9 @@ aggregator_individuals_changed_cb (FolksIndividualAggregator *aggregator,
{
FolksIndividual *ind = gee_iterator_get (iter);
+ if (ind == NULL)
+ continue;
+
g_signal_handlers_disconnect_by_func (ind,
individual_notify_personas_cb, self);
@@ -200,6 +207,11 @@ aggregator_individuals_changed_cb (FolksIndividualAggregator *aggregator,
{
FolksIndividual *ind = gee_iterator_get (iter);
+ /* Make sure we handle each added individual only once. */
+ if (ind == NULL || g_list_find (added_set, ind) != NULL)
+ continue;
+ added_set = g_list_prepend (added_set, ind);
+
g_signal_connect (ind, "notify::personas",
G_CALLBACK (individual_notify_personas_cb), self);
@@ -213,15 +225,20 @@ aggregator_individuals_changed_cb (FolksIndividualAggregator *aggregator,
}
g_clear_object (&iter);
+ g_list_free (added_set);
+
+ g_object_unref (added);
+ g_object_unref (removed);
+
/* Bail if we have no individuals left */
if (added_filtered == NULL && removed == NULL)
return;
added_filtered = g_list_reverse (added_filtered);
- g_signal_emit (self, signals[MEMBERS_CHANGED], 0, message,
+ g_signal_emit (self, signals[MEMBERS_CHANGED], 0, NULL,
added_filtered, removed_list,
- tp_channel_group_change_reason_from_folks_groups_change_reason (reason),
+ TP_CHANNEL_GROUP_CHANGE_REASON_NONE,
TRUE);
g_list_free (added_filtered);
@@ -334,7 +351,7 @@ empathy_individual_manager_init (EmpathyIndividualManager *self)
g_free, g_object_unref);
priv->aggregator = folks_individual_aggregator_new ();
- g_signal_connect (priv->aggregator, "individuals-changed",
+ g_signal_connect (priv->aggregator, "individuals-changed-detailed",
G_CALLBACK (aggregator_individuals_changed_cb), self);
folks_individual_aggregator_prepare (priv->aggregator, NULL, NULL);
}