[gnome-contacts] Make sure we handle the case where multiple individuals are replaced by a new



commit 682ec64d3748457fa3e507b013b246fbd254e140
Author: Alexander Larsson <alexl redhat com>
Date:   Mon Sep 5 21:25:14 2011 +0200

    Make sure we handle the case where multiple individuals are replaced by a new

 src/contacts-store.vala |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
---
diff --git a/src/contacts-store.vala b/src/contacts-store.vala
index 8d0c7be..fcdcae2 100644
--- a/src/contacts-store.vala
+++ b/src/contacts-store.vala
@@ -55,13 +55,19 @@ public class Contacts.Store : GLib.Object {
 	  });
       });
     aggregator.individuals_changed_detailed.connect ( (changes) =>   {
+	var new_seen = new HashSet<Individual> ();
 	foreach (var old_individual in changes.get_keys ()) {
 	  var replacements = changes.get (old_individual);
 	  if (replacements.is_empty) {
 	    this.remove (Contact.from_individual (old_individual));
 	  } else {
 	    bool found_one_replacement = false;
+	    // Note: Apparently the current implementation doesn't necessarily pick
+	    // up unlinked individual as replacements.
 	    foreach (var replacement in replacements) {
+	      if (new_seen.contains (replacement))
+		continue;
+	      new_seen.add (replacement);
 	      if (old_individual != null &&
 		  !found_one_replacement
 		  /* TODO: && !has-unlinked-persona */) {



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]