[folks] libsocialweb: use the new Contacts interface



commit a7df7da89163b7704c7f40757a765e6749ff4e5f
Author: Alban Crequy <alban crequy collabora co uk>
Date:   Wed Mar 16 16:35:20 2011 +0000

    libsocialweb: use the new Contacts interface

 backends/libsocialweb/lib/swf-persona-store.vala |   40 +++++++++++-----------
 backends/libsocialweb/lib/swf-persona.vala       |   32 +++++++++---------
 2 files changed, 36 insertions(+), 36 deletions(-)
---
diff --git a/backends/libsocialweb/lib/swf-persona-store.vala b/backends/libsocialweb/lib/swf-persona-store.vala
index 956bbb5..53eb034 100644
--- a/backends/libsocialweb/lib/swf-persona-store.vala
+++ b/backends/libsocialweb/lib/swf-persona-store.vala
@@ -36,7 +36,7 @@ public class Swf.PersonaStore : Folks.PersonaStore
   private HashTable<string, Persona> _personas;
   private bool _is_prepared = false;
   private ClientService _service;
-  private ClientItemView _item_view;
+  private ClientContactView _contact_view;
 
   /**
    * The type of persona store this is.
@@ -170,34 +170,34 @@ public class Swf.PersonaStore : Folks.PersonaStore
             {
               var parameters = new HashTable<weak string, weak string> (
                   str_hash, str_equal);
-              this._service.query_open_view("people", parameters,
-                  (query, item_view) =>
+              this._service.contacts_query_open_view("people", parameters,
+                  (query, contact_view) =>
                     {
                       /* The D-Bus call could return an error. In this case,
-                       * item_view is null */
-                      if (item_view == null)
+                       * contact_view is null */
+                      if (contact_view == null)
                         return;
 
-                      item_view.items_added.connect (this.items_added_cb);
-                      item_view.items_changed.connect (this.items_changed_cb);
-                      item_view.items_removed.connect (this.items_removed_cb);
+                      contact_view.contacts_added.connect (this.contacts_added_cb);
+                      contact_view.contacts_changed.connect (this.contacts_changed_cb);
+                      contact_view.contacts_removed.connect (this.contacts_removed_cb);
 
-                      this._item_view = item_view;
+                      this._contact_view = contact_view;
                       this._is_prepared = true;
                       this.notify_property ("is-prepared");
 
-                      this._item_view.start ();
+                      this._contact_view.start ();
                     });
             }
         }
     }
 
-  private void items_added_cb (List<unowned Item> items)
+  private void contacts_added_cb (List<unowned Contact> contacts)
     {
       var added_personas = new Queue<Persona> ();
-      foreach (var item in items)
+      foreach (var contact in contacts)
         {
-          var persona = new Persona(this, item);
+          var persona = new Persona(this, contact);
           _personas.insert(persona.iid, persona);
           added_personas.push_tail(persona);
         }
@@ -206,22 +206,22 @@ public class Swf.PersonaStore : Folks.PersonaStore
         this.personas_changed (added_personas.head, null, null, null, 0);
     }
 
-  private void items_changed_cb (List<unowned Item> items)
+  private void contacts_changed_cb (List<unowned Contact> contacts)
     {
-      foreach (var item in items)
+      foreach (var contact in contacts)
         {
-          var persona = _personas.lookup(Persona.get_item_id (item));
+          var persona = _personas.lookup(Persona.get_contact_id (contact));
           if (persona != null)
-            persona.update (item);
+            persona.update (contact);
         }
     }
 
-  private void items_removed_cb (List<unowned Item> items)
+  private void contacts_removed_cb (List<unowned Contact> contacts)
     {
       var removed_personas = new Queue<Persona> ();
-      foreach (var item in items)
+      foreach (var contact in contacts)
         {
-          var persona = _personas.lookup(Persona.get_item_id (item));
+          var persona = _personas.lookup(Persona.get_contact_id (contact));
           if (persona != null)
             {
               removed_personas.push_tail(persona);
diff --git a/backends/libsocialweb/lib/swf-persona.vala b/backends/libsocialweb/lib/swf-persona.vala
index 4371bd3..dd5ba64 100644
--- a/backends/libsocialweb/lib/swf-persona.vala
+++ b/backends/libsocialweb/lib/swf-persona.vala
@@ -104,11 +104,11 @@ public class Swf.Persona : Folks.Persona,
    * Create a new persona.
    *
    * Create a new persona for the { link PersonaStore} `store`, representing
-   * the libsocialweb contact given by `item`.
+   * the libsocialweb contact given by `contact`.
    */
-  public Persona (PersonaStore store, Item item)
+  public Persona (PersonaStore store, Contact contact)
     {
-      var id = get_item_id (item);
+      var id = get_contact_id (contact);
       var uid = this.build_uid ("folks", store.id, id);
 
       /* This is a hack so that Facebook contacts from libsocialweb are
@@ -158,7 +158,7 @@ public class Swf.Persona : Folks.Persona,
             }
         }
 
-      update (item);
+      update (contact);
     }
 
   ~Persona ()
@@ -166,21 +166,21 @@ public class Swf.Persona : Folks.Persona,
       debug ("Destroying Sw.Persona '%s': %p", this.uid, this);
     }
 
-  public static string? get_item_id (Item item)
+  public static string? get_contact_id (Contact contact)
     {
-      return item.get_value ("id");
+      return contact.get_value ("id");
     }
 
-  public void update (Item item)
+  public void update (Contact contact)
     {
-      var nickname = item.get_value ("name");
+      var nickname = contact.get_value ("name");
       if (nickname != null && this._nickname != nickname)
         {
           this._nickname = nickname;
           this.notify_property ("nickname");
         }
 
-      var avatar_path = item.get_value ("icon");
+      var avatar_path = contact.get_value ("icon");
       if (avatar_path != null)
         {
           var avatar_file = File.new_for_path (avatar_path);
@@ -189,31 +189,31 @@ public class Swf.Persona : Folks.Persona,
         }
 
       var structured_name = new StructuredName.simple (
-          item.get_value ("n.family"), item.get_value ("n.given"));
+          contact.get_value ("n.family"), contact.get_value ("n.given"));
       if (!structured_name.is_empty ())
         this.structured_name = structured_name;
       else if (this.structured_name != null)
         this.structured_name = null;
 
-      var full_name = item.get_value ("fn");
+      var full_name = contact.get_value ("fn");
       if (this.full_name != full_name)
         this.full_name = full_name;
 
       var urls = new List<FieldDetails> ();
 
-      var website = item.get_value ("url");
+      var website = contact.get_value ("url");
       if (website != null)
         urls.prepend (new FieldDetails (website));
 
-/* https://bugzilla.gnome.org/show_bug.cgi?id=645139
-      string[] websites = item.get_value_all ("url");
+      /* https://bugzilla.gnome.org/show_bug.cgi?id=645139
+      string[] websites = contact.get_value_all ("url");
       foreach (string website in websites)
         urls.prepend (new FieldDetails (website));
-*/
+      */
       if (this.urls != urls)
         this.urls = urls;
 
-      var gender_string = item.get_value ("x-gender");
+      var gender_string = contact.get_value ("x-gender");
       Gender gender;
       if (gender_string == "male")
         gender = Gender.MALE;



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