[folks] Fixed reseting the individual interaction details upon connection state changes in the Telepathy bac
- From: Seif Lotfy <seiflotfy src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [folks] Fixed reseting the individual interaction details upon connection state changes in the Telepathy bac
- Date: Tue, 12 Jun 2012 11:15:24 +0000 (UTC)
commit 09b27d0fc9ada08755b852070c0e43da9473a469
Author: Seif Lotfy <seif lotfy collabora co uk>
Date: Tue Jun 12 03:01:37 2012 +0200
Fixed reseting the individual interaction details upon connection
state changes in the Telepathy backend.
backends/telepathy/lib/tpf-persona-store.vala | 32 +++++++++++-------------
backends/telepathy/lib/tpf-persona.vala | 8 ++++++
2 files changed, 23 insertions(+), 17 deletions(-)
---
diff --git a/backends/telepathy/lib/tpf-persona-store.vala b/backends/telepathy/lib/tpf-persona-store.vala
index 61189c2..05419ab 100644
--- a/backends/telepathy/lib/tpf-persona-store.vala
+++ b/backends/telepathy/lib/tpf-persona-store.vala
@@ -1030,10 +1030,7 @@ public class Tpf.PersonaStore : Folks.PersonaStore
this._got_initial_members = true;
#if HAVE_ZEITGEIST
- if (this._monitor == null)
- {
- this._populate_counters ();
- }
+ this._populate_counters ();
#endif
this._notify_if_is_quiescent ();
}
@@ -1606,16 +1603,9 @@ public class Tpf.PersonaStore : Folks.PersonaStore
private async void _populate_counters ()
{
- this._log = new Zeitgeist.Log ();
-
- /* Prepare a monitor for this account to populate the counters upon
- * interaction changes */
- if (this._monitor == null)
+ if (this._log == null)
{
- PtrArray monitor_events = this._get_zeitgeist_event_templates ();
- this._monitor = new Zeitgeist.Monitor (new Zeitgeist.TimeRange.from_now (),
- (owned) monitor_events);
- this._monitor.events_inserted.connect (this._handle_new_interaction);
+ this._log = new Zeitgeist.Log ();
}
/* Get all events for this account from Zeitgeist and increase the
@@ -1627,9 +1617,10 @@ public class Tpf.PersonaStore : Folks.PersonaStore
(owned) events, StorageState.ANY, 0, ResultType.MOST_RECENT_EVENTS,
null);
- foreach (var persona in this.personas.values)
+ foreach (var persona in this._personas.values)
{
persona.freeze_notify ();
+ persona._reset_interaction ();
}
foreach (var e in results)
{
@@ -1650,9 +1641,16 @@ public class Tpf.PersonaStore : Folks.PersonaStore
warning ("Failed to fetch events from Zeitgeist");
}
- /* Install the monitor for this account to be notified when a persona has
- * been interacted with */
- this._log.install_monitor (this._monitor);
+ /* Prepare a monitor and install for this account to populate persona
+ * counters upon interaction changes.*/
+ if (this._monitor == null)
+ {
+ PtrArray monitor_events = this._get_zeitgeist_event_templates ();
+ this._monitor = new Zeitgeist.Monitor (new Zeitgeist.TimeRange.from_now (),
+ (owned) monitor_events);
+ this._monitor.events_inserted.connect (this._handle_new_interaction);
+ this._log.install_monitor (this._monitor);
+ }
this._notify_if_is_quiescent ();
}
diff --git a/backends/telepathy/lib/tpf-persona.vala b/backends/telepathy/lib/tpf-persona.vala
index d3c8ded..5a7f8e3 100644
--- a/backends/telepathy/lib/tpf-persona.vala
+++ b/backends/telepathy/lib/tpf-persona.vala
@@ -1238,5 +1238,13 @@ public class Tpf.Persona : Folks.Persona,
id, this._call_interaction_count, this._last_call_interaction_datetime.format ("%H %M %S - %d %m %y"));
}
}
+
+ internal void _reset_interaction ()
+ {
+ this._call_interaction_count = 0;
+ this._im_interaction_count = 0;
+ this._last_call_interaction_datetime = null;
+ this._last_im_interaction_datetime = null;
+ }
#endif
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]