[folks] Actually fall back to eds:system in case there's no default address book.



commit cbf4373f265914e179d64457f74d209f28beffdd
Author: Travis Reitter <travis reitter collabora co uk>
Date:   Mon Sep 26 09:44:39 2011 -0700

    Actually fall back to eds:system in case there's no default address book.
    
    Closes: bgo#660140 - contacts_contact_find_persona_from_store: assertion `store
    != NULL' failed

 NEWS                                     |    2 ++
 backends/eds/lib/edsf-persona-store.vala |   20 ++++++++++++++++++--
 2 files changed, 20 insertions(+), 2 deletions(-)
---
diff --git a/NEWS b/NEWS
index 3c22e2c..5d97b51 100644
--- a/NEWS
+++ b/NEWS
@@ -1,5 +1,7 @@
 Overview of changes from libfolks 0.6.3.1 to libfolks 0.6.4
 ===========================================================
+* Bug 660140 â contacts_contact_find_persona_from_store: assertion `store !=
+  NULL' failed
 
 Overview of changes from libfolks 0.6.3 to libfolks 0.6.3.1
 ===========================================================
diff --git a/backends/eds/lib/edsf-persona-store.vala b/backends/eds/lib/edsf-persona-store.vala
index c92b34e..61d5d6f 100644
--- a/backends/eds/lib/edsf-persona-store.vala
+++ b/backends/eds/lib/edsf-persona-store.vala
@@ -1946,9 +1946,25 @@ public class Edsf.PersonaStore : Folks.PersonaStore
   private void _notify_if_default ()
     {
       bool is_default = false;
-      if (this._source.get_property ("default") == "true")
+
+      E.SourceList sources;
+      try
+        {
+          /* By peeking at the default source instead of checking the value of
+           * the "default" property, we include EDS's fallback logic for the
+           * "system" address book */
+          E.BookClient.get_sources (out sources);
+          var default_source = sources.peek_default_source ();
+          if (default_source != null &&
+              this._source.peek_uid () == default_source.peek_uid ())
+            {
+              is_default = true;
+            }
+        }
+      catch (GLib.Error e)
         {
-          is_default = true;
+          warning ("Failed to get the set of ESources while looking for a " +
+              "default address book: %s", e);
         }
 
       if (is_default != this.is_user_set_default)



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