[folks] eds: handle removal of store without removal of personas



commit 4cf5ab69e98cf9e39f81a6765974ad7d73ea77f6
Author: Patrick Ohly <patrick ohly intel com>
Date:   Wed Dec 5 15:57:21 2012 +0100

    eds: handle removal of store without removal of personas
    
    The assumption in the IndividualAggregator that all backends remove
    their personas before removing a store did not hold for the EDS
    backend when stores were removed via set_persona_stores() or
    disable_store().
    
    Fixing that in EDS is tricky, so better make the IndividualAggregator
    more resilient and remove any remaining personas when the store gets
    removed.
    
    Closes: https://bugzilla.gnome.org/show_bug.cgi?id=689146

 NEWS                             |    1 +
 folks/individual-aggregator.vala |   21 ++++++++++++++++++---
 2 files changed, 19 insertions(+), 3 deletions(-)
---
diff --git a/NEWS b/NEWS
index e12228b..540d396 100644
--- a/NEWS
+++ b/NEWS
@@ -20,6 +20,7 @@ Bugs fixed:
   functions
 â Bug 688834 â getting properties creates data structures over and over again
 â Bug 688923 â remove URLs (blog, free/busy, video, home page)
+â Bug 689146 â disabling EDS address books does not remove personas
 
 API changes:
 â Add Backend.enable_persona_store and disable_persona_store.
diff --git a/folks/individual-aggregator.vala b/folks/individual-aggregator.vala
index 13e052c..18865f1 100644
--- a/folks/individual-aggregator.vala
+++ b/folks/individual-aggregator.vala
@@ -904,9 +904,24 @@ public class Folks.IndividualAggregator : Object
           this._notify_if_is_quiescent ();
         }
 
-      /* no need to remove this store's personas from all the individuals, since
-       * they'll do that themselves (and emit their own 'removed' signal if
-       * necessary) */
+      /* Not all stores emit a 'removed' signal under all circumstances.
+       * The EDS backend doesn't do it when set_persona_stores() or disable_store()
+       * are used to disable a store.
+       * Therefore remove this store's personas from all the individuals. Should
+       * not have any effect if a store already triggered the 'removed' signals,
+       * because then we won't have anything here.
+       * See https://bugzilla.gnome.org/show_bug.cgi?id=689146
+       */
+
+      var removed_personas = new HashSet<Persona> ();
+      var iter = store.personas.map_iterator ();
+
+      while (iter.next () == true)
+        {
+          removed_personas.add (iter.get_value ());
+        }
+      this._personas_changed_cb (store, new HashSet<Persona> (), removed_personas,
+          null, null, GroupDetails.ChangeReason.NONE);
 
       if (this._primary_store == store)
         {



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]