[folks] eds: Reach quiescence in Edsf.PersonaStore for address books with no contacts
- From: Philip Withnall <pwithnall src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [folks] eds: Reach quiescence in Edsf.PersonaStore for address books with no contacts
- Date: Fri, 6 Jan 2012 18:49:24 +0000 (UTC)
commit d4aeea66f0719dc7a77a43372a940735cdfff4f2
Author: Philip Withnall <philip tecnocode co uk>
Date: Fri Jan 6 14:35:01 2012 +0000
eds: Reach quiescence in Edsf.PersonaStore for address books with no contacts
Itâs possible for an address book to have the âdo-initial-queryâ capability
yet not emit any ::objects-added signals on its view, if the address book has
no contacts.
This commit fixes that by listening for the ::complete signal on the address
book view and using that to determine quiescence instead.
This should theoretically also catch cases where the address book encounters
an error part-way through initialisation, since that will be reported via
the ::complete signal.
backends/eds/lib/edsf-persona-store.vala | 41 ++++++++++++++++++++++++------
1 files changed, 33 insertions(+), 8 deletions(-)
---
diff --git a/backends/eds/lib/edsf-persona-store.vala b/backends/eds/lib/edsf-persona-store.vala
index 5ccae83..9351cc4 100644
--- a/backends/eds/lib/edsf-persona-store.vala
+++ b/backends/eds/lib/edsf-persona-store.vala
@@ -241,6 +241,8 @@ public class Edsf.PersonaStore : Folks.PersonaStore
this._contacts_removed_cb);
((!) this._ebookview).objects_modified.disconnect (
this._contacts_changed_cb);
+ ((!) this._ebookview).complete.disconnect (
+ this._contacts_complete_cb);
((!) this._ebookview).stop ();
this._ebookview = null;
@@ -813,6 +815,8 @@ public class Edsf.PersonaStore : Folks.PersonaStore
this._contacts_removed_cb);
((!) this._ebookview).objects_modified.connect (
this._contacts_changed_cb);
+ ((!) this._ebookview).complete.connect (
+ this._contacts_complete_cb);
((!) this._ebookview).start ();
}
@@ -1880,14 +1884,6 @@ public class Edsf.PersonaStore : Folks.PersonaStore
{
this._emit_personas_changed (added_personas, null);
}
-
- /* If this is the first contacts-added notification, assume we've reached
- * a quiescent state. */
- if (this._is_quiescent == false)
- {
- this._is_quiescent = true;
- this.notify_property ("is-quiescent");
- }
}
private void _contacts_changed_cb (GLib.List<E.Contact> contacts)
@@ -1924,6 +1920,35 @@ public class Edsf.PersonaStore : Folks.PersonaStore
}
}
+ private void _contacts_complete_cb (Error err)
+ {
+ /* Handle errors. We treat an error in the first _contacts_complete_cb()
+ * callback as unrecoverable, since it's being reported from the address
+ * book's view creation code. Subsequent errors may be recoverable, since
+ * they might be transient errors in refreshing the contact list. */
+ if (err != null)
+ {
+ warning ("Error in address book view query: %s", err.message);
+ }
+
+ /* The initial query is complete, so signal that we've reached
+ * quiescence (even if there was an error). */
+ if (this._is_quiescent == false)
+ {
+ /* Handle initial errors. */
+ if (err != null)
+ {
+ warning ("Error is considered unrecoverable. " +
+ "Removing persona store.");
+ this.removed ();
+ return;
+ }
+
+ this._is_quiescent = true;
+ this.notify_property ("is-quiescent");
+ }
+ }
+
/* Convert an EClientError or EBookClientError to a Folks.PropertyError for
* property modifications. */
private PropertyError e_client_error_to_property_error (string property_name,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]