[folks: 2/4] Reset the TpfPersonaStore state when going offline



commit 8543f897538d62fa7bea5740588c5c318dfc067e
Author: Philip Withnall <philip withnall collabora co uk>
Date:   Thu Jul 22 14:18:43 2010 +0100

    Reset the TpfPersonaStore state when going offline
    
    Emit a signal to remove all the Personas, then reset the store's state
    so that it can come online again later from a clean slate.

 backends/telepathy/tpf-persona-store.vala |   14 +++++++++++++-
 1 files changed, 13 insertions(+), 1 deletions(-)
---
diff --git a/backends/telepathy/tpf-persona-store.vala b/backends/telepathy/tpf-persona-store.vala
index bf1c58d..9348b86 100644
--- a/backends/telepathy/tpf-persona-store.vala
+++ b/backends/telepathy/tpf-persona-store.vala
@@ -99,6 +99,11 @@ public class Tpf.PersonaStore : Folks.PersonaStore
       this.type_id = "telepathy";
       this.id = account.get_object_path ();
 
+      this.reset ();
+    }
+
+  private void reset ()
+    {
       this._personas = new HashTable<string, Persona> (str_hash,
           str_equal);
       this.conn = null;
@@ -300,7 +305,14 @@ public class Tpf.PersonaStore : Folks.PersonaStore
       uint reason, string? dbus_error_name,
       GLib.HashTable<weak string, weak void*>? details)
     {
-      if (new_status != TelepathyGLib.ConnectionStatus.CONNECTED)
+      if (new_status == TelepathyGLib.ConnectionStatus.DISCONNECTED)
+        {
+          this.personas_changed (null, this._personas.get_values (), null, null,
+              0);
+          this.reset ();
+          return;
+        }
+      else if (new_status != TelepathyGLib.ConnectionStatus.CONNECTED)
         return;
 
       var conn = this.account.get_connection ();



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