[folks] e-d-s: use UID instead of relative URI to track ESources



commit 73647bc63e66c085bf0a1a7080df9734734c77b7
Author: Raul Gutierrez Segales <rgs collabora co uk>
Date:   Wed Sep 21 16:24:30 2011 +0100

    e-d-s: use UID instead of relative URI to track ESources
    
    Some e-d-s backends (i.e.: the Exchange one) might not have
    a relative URI so we can't rely on it as an address book
    identifier. So from now on we use the ESource's UID.
    
    Fixes: https://bugzilla.gnome.org/show_bug.cgi?id=659732

 backends/eds/eds-backend.vala            |   12 +++++-------
 backends/eds/lib/edsf-persona-store.vala |    9 +++------
 2 files changed, 8 insertions(+), 13 deletions(-)
---
diff --git a/backends/eds/eds-backend.vala b/backends/eds/eds-backend.vala
index b4549e5..7b162e2 100644
--- a/backends/eds/eds-backend.vala
+++ b/backends/eds/eds-backend.vala
@@ -175,9 +175,8 @@ public class Folks.Backends.Eds.Backend : Folks.Backend
                   continue;
                 }
 
-              var source_uri = s.peek_relative_uri ();
-
-              if (!this._persona_stores.has_key (source_uri))
+              var uid = s.peek_uid ();
+              if (!this._persona_stores.has_key (uid))
                 {
                   added_sources.add (s);
                 }
@@ -197,12 +196,11 @@ public class Folks.Backends.Eds.Backend : Folks.Backend
    */
   private void _add_address_book (E.Source s)
     {
-      string relative_uri = s.peek_relative_uri ();
-
-      if (this._persona_stores.has_key (relative_uri))
+      string uid = s.peek_uid ();
+      if (this._persona_stores.has_key (uid))
         return;
 
-      debug ("Adding address book '%s'.", relative_uri);
+      debug ("Adding address book '%s'.", uid);
 
       var store = new Edsf.PersonaStore (s);
 
diff --git a/backends/eds/lib/edsf-persona-store.vala b/backends/eds/lib/edsf-persona-store.vala
index d1febb3..c92b34e 100644
--- a/backends/eds/lib/edsf-persona-store.vala
+++ b/backends/eds/lib/edsf-persona-store.vala
@@ -40,7 +40,6 @@ public class Edsf.PersonaStore : Folks.PersonaStore
   private bool _is_quiescent = false;
   private E.BookClient _addressbook;
   private E.BookClientView _ebookview;
-  private string _addressbook_uri = null;
   private E.SourceList? _source_list = null;
   private E.Source _source;
   private string _query_str;
@@ -202,10 +201,9 @@ public class Edsf.PersonaStore : Folks.PersonaStore
    */
   public PersonaStore (E.Source s)
     {
-      string uri = s.peek_relative_uri ();
-      Object (id: uri, display_name: uri);
+      string eds_uid = s.peek_uid ();
+      Object (id: eds_uid, display_name: eds_uid);
       this._source = s;
-      this._addressbook_uri =  uri;
       this._personas = new HashMap<string, Persona> ();
       this._personas_ro = this._personas.read_only_view;
       this._query_str = "(contains \"x-evolution-any-field\" \"\")";
@@ -1878,8 +1876,7 @@ public class Edsf.PersonaStore : Folks.PersonaStore
         {
           foreach (var s in g.peek_sources ())
             {
-              if (s.peek_relative_uri () == this.id &&
-                  s.peek_uid () == this._addressbook.get_source ().peek_uid ())
+              if (s.peek_uid () == this.id)
                 {
                   /* We've found ourself. */
                   return true;



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