diff options
author | Alexander Larsson <alexl@redhat.com> | 2011-09-09 14:17:25 +0200 |
---|---|---|
committer | Alexander Larsson <alexl@redhat.com> | 2011-09-09 14:18:04 +0200 |
commit | cb48efa20d8717b7eef57819c6c9e91e27663823 (patch) | |
tree | d0db961e09bad441bc7c2ade6e3706c6093ff21a /src/contacts-linking.vala | |
parent | 7be346196da627b9d7e6165cf7cc5497b80a86b0 (diff) | |
download | gnome-contacts-cb48efa20d8717b7eef57819c6c9e91e27663823.tar.gz |
New method to pick best replacement on join
Diffstat (limited to 'src/contacts-linking.vala')
-rw-r--r-- | src/contacts-linking.vala | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/contacts-linking.vala b/src/contacts-linking.vala index d42563d..00a5120 100644 --- a/src/contacts-linking.vala +++ b/src/contacts-linking.vala @@ -406,7 +406,8 @@ namespace Contacts { public async void link_contacts (Contact main, Contact other) { // This should not be used as being replaced with the new individual // instead we should always pick this contact to keep around - other.individual.set_data ("contacts-not-replaced", true); + var contact_persona = main.individual.personas.to_array()[0]; + contact_persona.set_data ("contacts-master-at-join", true); var main_linkables = get_linkable_attributes_for_individual (main.individual); var other_linkables = get_linkable_attributes_for_individual (other.individual); @@ -416,7 +417,6 @@ namespace Contacts { main_linkables.remove_all (other_linkables); other_linkables.remove_all (main_linkables); - Persona? write_persona = null; foreach (var p1 in main.individual.personas) { if (persona_can_link_to (p1, other_linkables)) { @@ -449,12 +449,15 @@ namespace Contacts { linkables.add_all (other_linkables); yield (write_persona as NameDetails).change_full_name (main.display_name); } catch (GLib.Error e) { + contact_persona.set_data ("contacts-master-at-join", false); warning ("Unable to create new persona when linking: %s\n", e.message); return; } } yield persona_apply_attributes (write_persona, linkables, null); + + contact_persona.set_data ("contacts-master-at-join", false); } public async void unlink_persona (Contact contact, Persona persona_to_unlink) { |