[folks/folks-0-2] Combine personas_changed() emissions for Individuals replaced due to relinking
- From: Philip Withnall <pwithnall src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [folks/folks-0-2] Combine personas_changed() emissions for Individuals replaced due to relinking
- Date: Sat, 13 Nov 2010 11:40:57 +0000 (UTC)
commit c9b7b62af75aa0037ca8871e37f0858808c7c11e
Author: Philip Withnall <philip withnall collabora co uk>
Date: Sun Oct 31 16:26:51 2010 +0000
Combine personas_changed() emissions for Individuals replaced due to relinking
This re-fixes bgo#632564 so that the optimisation of grouping emissions of
the personas_changed() signal is preserved. Closes: bgo#632564
folks/individual-aggregator.vala | 17 +++++++++++++++++
1 files changed, 17 insertions(+), 0 deletions(-)
---
diff --git a/folks/individual-aggregator.vala b/folks/individual-aggregator.vala
index c91c429..c7c0e03 100644
--- a/folks/individual-aggregator.vala
+++ b/folks/individual-aggregator.vala
@@ -501,6 +501,18 @@ public class Folks.IndividualAggregator : Object
this.add_personas (relinked_personas, ref added_individuals,
ref replaced_individuals);
+ /* Signal the removal of the replaced_individuals at the same time as the
+ * removed_individuals. (The only difference between replaced individuals
+ * and removed ones is that replaced individuals specify a replacement
+ * when they emit their Individual:removed signal. */
+ if (replaced_individuals != null)
+ {
+ MapIterator<Individual, Individual> iter =
+ replaced_individuals.map_iterator ();
+ while (iter.next () == true)
+ removed_individuals.prepend (iter.get_key ());
+ }
+
/* Signal the addition of new individuals and removal of old ones to the
* aggregator */
if (added_individuals != null || removed_individuals != null)
@@ -541,6 +553,11 @@ public class Folks.IndividualAggregator : Object
private void individual_removed_cb (Individual i, Individual? replacement)
{
+ /* Only signal if the individual is still in this.individuals. This allows
+ * us to group removals together in, e.g., personas_changed_cb(). */
+ if (this.individuals.lookup (i.id) == null)
+ return;
+
var i_list = new GLib.List<Individual> ();
i_list.append (i);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]