diff options
author | Alexander Larsson <alexl@redhat.com> | 2011-09-08 21:37:07 +0200 |
---|---|---|
committer | Alexander Larsson <alexl@redhat.com> | 2011-09-09 14:18:04 +0200 |
commit | e782402d5c9aa6b6234a764fd23c6394841ca1b7 (patch) | |
tree | 7b107d9736f0341db7cfe3e85a9e6f01a5a7af3c /src/contacts-linking.vala | |
parent | ac136fd82c2eb4355db44591d704b2a5e0a75c46 (diff) | |
download | gnome-contacts-e782402d5c9aa6b6234a764fd23c6394841ca1b7.tar.gz |
Don't unnecessarily create a main persona
If for instance there is only only one persona left, there is no need
to relink it
Diffstat (limited to 'src/contacts-linking.vala')
-rw-r--r-- | src/contacts-linking.vala | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/contacts-linking.vala b/src/contacts-linking.vala index 95663c0..697ed4d 100644 --- a/src/contacts-linking.vala +++ b/src/contacts-linking.vala @@ -715,7 +715,9 @@ namespace Contacts { other_personas.add (p3); } - if (main_persona == null) { + // If we didn't find a main persona, and we need one because there are + // other personas that we need to ensure linking in, then create one + if (main_persona == null && other_personas.size > 1) { var details = new HashTable<string, Value?> (str_hash, str_equal); try { main_persona = yield contact.store.aggregator.primary_store.add_persona_from_details (details); @@ -729,9 +731,8 @@ namespace Contacts { // First apply all additions on the primary persona so that we avoid temporarily being // unlinked and then relinked - // Note, this may cause a new persona to be added to the individual if - // main_persona is null - yield persona_apply_attributes (main_persona, main_persona_additions, other_personas_removals); + if (main_persona != null) + yield persona_apply_attributes (main_persona, main_persona_additions, other_personas_removals); foreach (var p in other_personas) { yield persona_apply_attributes (p, null, other_personas_removals); } |