[folks] e-d-s: notify when an address book is configured as default



commit 00ada566e82fef5ed87793b2de7c5cb6e2910ef2
Author: Raul Gutierrez Segales <rgs collabora co uk>
Date:   Thu Sep 15 15:38:11 2011 +0100

    e-d-s: notify when an address book is configured as default
    
    Fixes: https://bugzilla.gnome.org/show_bug.cgi?id=657141

 NEWS                                     |    1 +
 backends/eds/lib/edsf-persona-store.vala |   21 +++++++++++++++++++++
 2 files changed, 22 insertions(+), 0 deletions(-)
---
diff --git a/NEWS b/NEWS
index 3a55cf8..288a184 100644
--- a/NEWS
+++ b/NEWS
@@ -15,6 +15,7 @@ Bugs fixed:
 * Bug 658323 â Deprecate FOLKS_WRITEABLE_STORE in favour of FOLKS_PRIMARY_STORE
 * Bug 659095 â Don't distribute typelib file
 * Bug 659128 â If a persona store goes away we don't remove its personas
+* Bug 657141 â Backend should ask eds for the default backend, not hardcode it
 
 API changes:
 * Individual.avatar is now settable using Individual.change_avatar() (not new
diff --git a/backends/eds/lib/edsf-persona-store.vala b/backends/eds/lib/edsf-persona-store.vala
index 07e87e6..5f56492 100644
--- a/backends/eds/lib/edsf-persona-store.vala
+++ b/backends/eds/lib/edsf-persona-store.vala
@@ -209,6 +209,8 @@ public class Edsf.PersonaStore : Folks.PersonaStore
       this._personas = new HashMap<string, Persona> ();
       this._personas_ro = this._personas.read_only_view;
       this._query_str = "(contains \"x-evolution-any-field\" \"\")";
+      this._source.changed.connect (this._source_changed_cb);
+      this._notify_if_default ();
     }
 
   ~PersonaStore ()
@@ -1851,4 +1853,23 @@ public class Edsf.PersonaStore : Folks.PersonaStore
       else
         this.trust_level = PersonaStoreTrust.FULL;
     }
+
+  private void _source_changed_cb ()
+    {
+      this._notify_if_default ();
+    }
+
+  private void _notify_if_default ()
+    {
+      bool is_default = false;
+      if (this._source.get_property ("default") == "true")
+        {
+          is_default = true;
+        }
+
+      if (is_default != this.is_user_set_default)
+        {
+          this.is_user_set_default = is_default;
+        }
+    }
 }



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