[folks/folks-0-8] eds: handle removal of store without removal of personas



commit 58cefd577d8a919ef17f771767d01306320cb2cc
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 78b900d..a92241c 100644
--- a/NEWS
+++ b/NEWS
@@ -4,6 +4,7 @@ Overview of changes from libfolks 0.8.0 to libfolks 0.8.1
 Bugs fixed:
 â 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
 
 Overview of changes from libfolks 0.7.4.1 to libfolks 0.8.0
 ===========================================================
diff --git a/folks/individual-aggregator.vala b/folks/individual-aggregator.vala
index 6f09c60..bf21b07 100644
--- a/folks/individual-aggregator.vala
+++ b/folks/individual-aggregator.vala
@@ -886,9 +886,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]