[gnome-contacts] Fix split handling in individuals_changed
- From: Alexander Larsson <alexl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-contacts] Fix split handling in individuals_changed
- Date: Fri, 9 Sep 2011 12:19:07 +0000 (UTC)
commit 9b92cb193f3331736ce0a3bddd0586bde46b55be
Author: Alexander Larsson <alexl redhat com>
Date: Fri Sep 9 12:08:46 2011 +0200
Fix split handling in individuals_changed
We must always keep the contact alive, only apply the contacts-new-contact
data in the case of an actual split (i.e. more than one replacement).
Its often the case that we get multiple one-to-one replacements before
the actual split happens.
src/contacts-store.vala | 18 +++++++++---------
1 files changed, 9 insertions(+), 9 deletions(-)
---
diff --git a/src/contacts-store.vala b/src/contacts-store.vala
index 2ab77d2..f8bed35 100644
--- a/src/contacts-store.vala
+++ b/src/contacts-store.vala
@@ -91,24 +91,24 @@ public class Contacts.Store : GLib.Object {
if (replacements != null) {
Individual? main_individual = null;
foreach (var i in replacements) {
- bool new_contact = false;
+ bool new_contact_if_split = false;
foreach (var p in i.personas) {
if (p.get_data<bool> ("contacts-new-contact")) {
- new_contact = true;
+ new_contact_if_split = true;
break;
}
}
- if (!new_contact) {
- main_individual = i;
+ main_individual = i;
+ // If this was marked new_contact_if_split then we
+ // need to look for other possible replacements
+ // that we should reuse, otherwise bail immediately
+ if (!new_contact_if_split)
break;
- }
}
- if (main_individual != null) {
- var c = Contact.from_individual (old_individual);
- c.replace_individual (main_individual);
- }
+ var c = Contact.from_individual (old_individual);
+ c.replace_individual (main_individual);
foreach (var i in replacements) {
if (i != main_individual) {
/* Already replaced this old_individual, i.e. we're splitting
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]