diff options
author | Philip Withnall <philip.withnall@collabora.co.uk> | 2013-11-21 19:43:44 +0000 |
---|---|---|
committer | Philip Withnall <philip.withnall@collabora.co.uk> | 2013-11-21 19:45:28 +0000 |
commit | 1ec050efc4f7135e9958c74da2028daf669077a0 (patch) | |
tree | e45198b2c56d2f1850f55983c99c8c83848d50df /folks | |
parent | f02e2b10c60a2fd5c82c31ef69ca96a87c7c2f9f (diff) |
individual: Remove a Persona if its ‘individual’ property changes
As a follow-on from commit f00534294d7d52ac7e37dfaa075e3465b7755483,
automatically remove a Persona from an Individual if the Individual
receives a property change notification for the Persona.individual
property.
See: https://bugzilla.redhat.com/show_bug.cgi?id=1031252
Diffstat (limited to 'folks')
-rw-r--r-- | folks/individual.vala | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/folks/individual.vala b/folks/individual.vala index 01004c2c..87e8f7ae 100644 --- a/folks/individual.vala +++ b/folks/individual.vala @@ -1243,6 +1243,20 @@ public class Folks.Individual : Object, ps.name, persona, persona.uid, persona.individual, this); return; } + else if (ps.name == "individual") + { + if (persona.individual != this) + { + /* Remove the notified persona from our set of personas. */ + var remaining_personas = new SmallSet<Persona> (); + remaining_personas.add_all (this._persona_set); + remaining_personas.remove (persona); + + this._set_personas (remaining_personas, null); + } + + return; + } foreach (var notifier in Individual._notifiers) { @@ -2124,9 +2138,11 @@ public class Folks.Individual : Object, }, emit_notification, force_update); } + /* Note: This causes the Persona to be stolen away from its current + * Individual. */ private void _connect_to_persona (Persona persona) { - if (persona.individual != null) + if (persona.individual != null && persona.individual != this) { /* Disconnect the previous Individual. This atomically avoids having * two Individuals connected to the same Persona simultaneously. */ |