[folks] individual: Remove a Persona if its ‘indi vidual’ property changes
- From: Philip Withnall <pwithnall src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [folks] individual: Remove a Persona if its ‘indi vidual’ property changes
- Date: Thu, 21 Nov 2013 19:45:45 +0000 (UTC)
commit 1ec050efc4f7135e9958c74da2028daf669077a0
Author: Philip Withnall <philip withnall collabora co uk>
Date: Thu Nov 21 19:43:44 2013 +0000
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
folks/individual.vala | 18 +++++++++++++++++-
1 files changed, 17 insertions(+), 1 deletions(-)
---
diff --git a/folks/individual.vala b/folks/individual.vala
index 01004c2..87e8f7a 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. */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]