Notify of Tpf.PersonaStore's Personas being removed when disabling accounts
authorPhilip Withnall <philip.withnall@collabora.co.uk>
Thu, 9 Sep 2010 11:33:22 +0000 (12:33 +0100)
committerPhilip Withnall <philip.withnall@collabora.co.uk>
Fri, 10 Sep 2010 11:23:11 +0000 (12:23 +0100)
When disabling, removing or marking an account as invalid, we need to signal
that the account's contacts (i.e. the Tpf.PersonaStore's Personas) have been
removed. Closes: bgo#629082

backends/telepathy/lib/tpf-persona-store.vala

index 5039dbd..1d30cc2 100644 (file)
@@ -145,17 +145,29 @@ public class Tpf.PersonaStore : Folks.PersonaStore
       this.account_manager.account_disabled.connect ((a) =>
         {
           if (this.account == a)
-            this.removed ();
+            {
+              this.personas_changed (null, this._personas.get_values (), null,
+                  null, 0);
+              this.removed ();
+            }
         });
       this.account_manager.account_removed.connect ((a) =>
         {
           if (this.account == a)
-            this.removed ();
+            {
+              this.personas_changed (null, this._personas.get_values (), null,
+                  null, 0);
+              this.removed ();
+            }
         });
       this.account_manager.account_validity_changed.connect ((a, valid) =>
         {
           if (!valid && this.account == a)
-            this.removed ();
+            {
+              this.personas_changed (null, this._personas.get_values (), null,
+                  null, 0);
+              this.removed ();
+            }
         });
 
       this.account.status_changed.connect (this.account_status_changed_cb);
@@ -324,6 +336,9 @@ public class Tpf.PersonaStore : Folks.PersonaStore
 
       if (new_status == TelepathyGLib.ConnectionStatus.DISCONNECTED)
         {
+          /* When disconnecting, we want the PersonaStore to remain alive, but
+           * all its Personas to be removed. We do *not* want the PersonaStore
+           * to be destroyed, as that makes coming back online hard. */
           this.personas_changed (null, this._personas.get_values (), null, null,
               0);
           this.reset ();