[folks] Change Backend.persona_stores to be a Map<string, PersonaStore>



commit beef9692895520e335770e0035bbec85240a61b1
Author: Philip Withnall <philip withnall collabora co uk>
Date:   Tue Apr 19 19:13:30 2011 +0100

    Change Backend.persona_stores to be a Map<string, PersonaStore>
    
    Helps: bgo#640092

 NEWS                                            |    1 +
 backends/key-file/kf-backend.vala               |   20 ++++++++++----------
 backends/libsocialweb/sw-backend.vala           |   20 ++++++++++----------
 backends/telepathy/tp-backend.vala              |   22 +++++++++++-----------
 backends/tracker/tr-backend.vala                |   20 ++++++++++----------
 folks/backend.vala                              |    5 ++++-
 folks/individual-aggregator.vala                |    7 +++----
 tests/telepathy/individual-retrieval.vala       |    3 +--
 tests/telepathy/persona-store-capabilities.vala |    2 +-
 tests/tracker/add-persona.vala                  |    2 +-
 tests/tracker/duplicated-emails.vala            |    2 +-
 tests/tracker/duplicated-phones.vala            |    2 +-
 tests/tracker/link-personas-via-local-ids.vala  |    2 +-
 tests/tracker/link-personas.vala                |    2 +-
 tests/tracker/match-all.vala                    |    2 +-
 tests/tracker/match-email-addresses.vala        |    2 +-
 tests/tracker/match-im-addresses.vala           |    2 +-
 tests/tracker/match-known-emails.vala           |    2 +-
 tests/tracker/match-name.vala                   |    2 +-
 tests/tracker/match-phone-number.vala           |    2 +-
 tests/tracker/remove-persona.vala               |    2 +-
 tests/tracker/set-duplicate-email.vala          |    2 +-
 tools/import.vala                               |   15 ++++++++++-----
 tools/inspect/command-backends.vala             |    7 +++----
 tools/inspect/command-persona-stores.vala       |   12 ++++++------
 tools/inspect/utils.vala                        |    9 ++++-----
 26 files changed, 87 insertions(+), 82 deletions(-)
---
diff --git a/NEWS b/NEWS
index e9898f8..04cb364 100644
--- a/NEWS
+++ b/NEWS
@@ -16,6 +16,7 @@ API changes:
 * WebServiceDetails.web_service_addresses is now of type
   MultiMap<string, string>
 * Removed LinkedHashSet in favour of Gee.HashSet
+* Backend.persona_stores is now of type Map<string, PersonaStore>
 
 Overview of changes from libfolks 0.4.0 to libfolks 0.5.0
 =========================================================
diff --git a/backends/key-file/kf-backend.vala b/backends/key-file/kf-backend.vala
index 89c9932..c5a981c 100644
--- a/backends/key-file/kf-backend.vala
+++ b/backends/key-file/kf-backend.vala
@@ -19,6 +19,7 @@
  */
 
 using GLib;
+using Gee;
 using Folks;
 using Folks.Backends.Kf;
 
@@ -34,7 +35,7 @@ extern const string BACKEND_NAME;
 public class Folks.Backends.Kf.Backend : Folks.Backend
 {
   private bool _is_prepared = false;
-  private HashTable<string, PersonaStore> _persona_stores;
+  private HashMap<string, PersonaStore> _persona_stores;
 
   /**
    * Whether this Backend has been prepared.
@@ -56,7 +57,7 @@ public class Folks.Backends.Kf.Backend : Folks.Backend
   /**
    * { inheritDoc}
    */
-  public override HashTable<string, PersonaStore> persona_stores
+  public override Map<string, PersonaStore> persona_stores
     {
       get { return this._persona_stores; }
     }
@@ -66,8 +67,7 @@ public class Folks.Backends.Kf.Backend : Folks.Backend
    */
   public Backend ()
     {
-      this._persona_stores = new HashTable<string, PersonaStore> (str_hash,
-          str_equal);
+      this._persona_stores = new HashMap<string, PersonaStore> ();
     }
 
   /**
@@ -103,7 +103,7 @@ public class Folks.Backends.Kf.Backend : Folks.Backend
               /* Create the PersonaStore for the key file */
               PersonaStore store = new Kf.PersonaStore (file);
 
-              this._persona_stores.insert (store.id, store);
+              this._persona_stores.set (store.id, store);
               store.removed.connect (this._store_removed_cb);
               this.notify_property ("persona-stores");
 
@@ -120,12 +120,12 @@ public class Folks.Backends.Kf.Backend : Folks.Backend
    */
   public override async void unprepare () throws GLib.Error
     {
-      this._persona_stores.foreach ((k, v) =>
+      foreach (var persona_store in this._persona_stores.values)
         {
-          this.persona_store_removed ((PersonaStore) v);
-        });
+          this.persona_store_removed (persona_store);
+        }
 
-      this._persona_stores.remove_all ();
+      this._persona_stores.clear ();
       this.notify_property ("persona-stores");
 
       this._is_prepared = false;
@@ -135,7 +135,7 @@ public class Folks.Backends.Kf.Backend : Folks.Backend
   private void _store_removed_cb (Folks.PersonaStore store)
     {
       this.persona_store_removed (store);
-      this._persona_stores.remove (store.id);
+      this._persona_stores.unset (store.id);
       this.notify_property ("persona-stores");
     }
 }
diff --git a/backends/libsocialweb/sw-backend.vala b/backends/libsocialweb/sw-backend.vala
index 98931fe..efbc9e6 100644
--- a/backends/libsocialweb/sw-backend.vala
+++ b/backends/libsocialweb/sw-backend.vala
@@ -20,6 +20,7 @@
  */
 
 using GLib;
+using Gee;
 using Folks;
 using Folks.Backends.Sw;
 using SocialWebClient;
@@ -34,8 +35,8 @@ public class Folks.Backends.Sw.Backend : Folks.Backend
 {
   private bool _is_prepared = false;
   private Client _client;
-  private HashTable<string, PersonaStore> _persona_stores =
-	  new HashTable<string, PersonaStore> (str_hash, str_equal);
+  private HashMap<string, PersonaStore> _persona_stores =
+      new HashMap<string, PersonaStore> ();
 
   /**
    * { inheritDoc}
@@ -45,7 +46,7 @@ public class Folks.Backends.Sw.Backend : Folks.Backend
   /**
    * { inheritDoc}
    */
-  public override HashTable<string, PersonaStore> persona_stores
+  public override Map<string, PersonaStore> persona_stores
     {
       get { return this._persona_stores; }
     }
@@ -95,16 +96,15 @@ public class Folks.Backends.Sw.Backend : Folks.Backend
    */
   public override async void unprepare () throws GLib.Error
     {
-      this._persona_stores.foreach ((k, v) =>
+      foreach (var store in this._persona_stores.values)
         {
-          PersonaStore store = v;
           store.removed.disconnect (this.store_removed_cb);
           this.persona_store_removed (store);
-        });
+        }
 
       this._client = null;
 
-      this._persona_stores.remove_all ();
+      this._persona_stores.clear ();
       this.notify_property ("persona-stores");
 
       this._is_prepared = false;
@@ -113,11 +113,11 @@ public class Folks.Backends.Sw.Backend : Folks.Backend
 
   private void add_service (string service_name)
     {
-      if (this._persona_stores.lookup (service_name) != null)
+      if (this._persona_stores.get (service_name) != null)
         return;
 
       var store = new Swf.PersonaStore (this._client.get_service (service_name));
-      this._persona_stores.insert (store.id, store);
+      this._persona_stores.set (store.id, store);
       store.removed.connect (this.store_removed_cb);
       this.persona_store_added (store);
     }
@@ -125,6 +125,6 @@ public class Folks.Backends.Sw.Backend : Folks.Backend
   private void store_removed_cb (Folks.PersonaStore store)
     {
       this.persona_store_removed (store);
-      this._persona_stores.remove (store.id);
+      this._persona_stores.unset (store.id);
     }
 }
diff --git a/backends/telepathy/tp-backend.vala b/backends/telepathy/tp-backend.vala
index 35539b1..809372b 100644
--- a/backends/telepathy/tp-backend.vala
+++ b/backends/telepathy/tp-backend.vala
@@ -19,6 +19,7 @@
  */
 
 using GLib;
+using Gee;
 using TelepathyGLib;
 using Folks;
 using Folks.Backends.Tp;
@@ -33,7 +34,7 @@ public class Folks.Backends.Tp.Backend : Folks.Backend
 {
   private AccountManager _account_manager;
   private bool _is_prepared = false;
-  private HashTable<string, PersonaStore> _persona_stores;
+  private HashMap<string, PersonaStore> _persona_stores;
 
   /**
    * { inheritDoc}
@@ -43,7 +44,7 @@ public class Folks.Backends.Tp.Backend : Folks.Backend
   /**
    * { inheritDoc}
    */
-  public override HashTable<string, PersonaStore> persona_stores
+  public override Map<string, PersonaStore> persona_stores
     {
       get { return this._persona_stores; }
     }
@@ -53,8 +54,7 @@ public class Folks.Backends.Tp.Backend : Folks.Backend
    */
   public Backend ()
     {
-      this._persona_stores = new HashTable<string, PersonaStore> (str_hash,
-          str_equal);
+      this._persona_stores = new HashMap<string, PersonaStore> ();
     }
 
   /**
@@ -113,12 +113,12 @@ public class Folks.Backends.Tp.Backend : Folks.Backend
           this._account_validity_changed_cb);
       this._account_manager = null;
 
-      this._persona_stores.foreach ((k, v) =>
+      foreach (var persona_store in this._persona_stores.values)
         {
-          this.persona_store_removed ((PersonaStore) v);
-        });
+          this.persona_store_removed (persona_store);
+        }
 
-      this._persona_stores.remove_all ();
+      this._persona_stores.clear ();
       this.notify_property ("persona-stores");
 
       this._is_prepared = false;
@@ -133,14 +133,14 @@ public class Folks.Backends.Tp.Backend : Folks.Backend
 
   private void _account_enabled_cb (Account account)
     {
-      var store = this._persona_stores.lookup (account.get_object_path ());
+      var store = this._persona_stores.get (account.get_object_path ());
 
       if (store != null)
         return;
 
       store = new Tpf.PersonaStore (account);
 
-      this._persona_stores.insert (store.id, store);
+      this._persona_stores.set (store.id, store);
       store.removed.connect (this._store_removed_cb);
       this.notify_property ("persona-stores");
 
@@ -150,7 +150,7 @@ public class Folks.Backends.Tp.Backend : Folks.Backend
   private void _store_removed_cb (PersonaStore store)
     {
       this.persona_store_removed (store);
-      this._persona_stores.remove (store.id);
+      this._persona_stores.unset (store.id);
       this.notify_property ("persona-stores");
     }
 }
diff --git a/backends/tracker/tr-backend.vala b/backends/tracker/tr-backend.vala
index ef98afb..1dbe4fc 100644
--- a/backends/tracker/tr-backend.vala
+++ b/backends/tracker/tr-backend.vala
@@ -22,6 +22,7 @@
 using Folks;
 using Folks.Backends.Tr;
 using GLib;
+using Gee;
 
 extern const string BACKEND_NAME;
 
@@ -32,7 +33,7 @@ extern const string BACKEND_NAME;
 public class Folks.Backends.Tr.Backend : Folks.Backend
 {
   private bool _is_prepared = false;
-  private HashTable<string, PersonaStore> _persona_stores;
+  private HashMap<string, PersonaStore> _persona_stores;
 
   /**
    * { inheritDoc}
@@ -42,7 +43,7 @@ public class Folks.Backends.Tr.Backend : Folks.Backend
   /**
    * { inheritDoc}
    */
-  public override HashTable<string, PersonaStore> persona_stores
+  public override Map<string, PersonaStore> persona_stores
     {
       get { return this._persona_stores; }
     }
@@ -52,8 +53,7 @@ public class Folks.Backends.Tr.Backend : Folks.Backend
    */
   public Backend ()
     {
-      this._persona_stores = new HashTable<string, PersonaStore>
-          (str_hash, str_equal);
+      this._persona_stores = new HashMap<string, PersonaStore> ();
     }
 
   /**
@@ -88,12 +88,12 @@ public class Folks.Backends.Tr.Backend : Folks.Backend
    */
   public override async void unprepare () throws GLib.Error
     {
-      this._persona_stores.foreach ((k, v) =>
+      foreach (var persona_store in this._persona_stores.values)
         {
-          this.persona_store_removed ((PersonaStore) v);
-        });
+          this.persona_store_removed (persona_store);
+        }
 
-      this._persona_stores.remove_all ();
+      this._persona_stores.clear ();
       this.notify_property ("persona-stores");
 
       this._is_prepared = false;
@@ -106,7 +106,7 @@ public class Folks.Backends.Tr.Backend : Folks.Backend
   private void _add_default_persona_store ()
     {
       var store = new Trf.PersonaStore ();
-      this._persona_stores.insert (store.id, store);
+      this._persona_stores.set (store.id, store);
       store.removed.connect (this._store_removed_cb);
       this.notify_property ("persona-stores");
       this.persona_store_added (store);
@@ -115,6 +115,6 @@ public class Folks.Backends.Tr.Backend : Folks.Backend
   private void _store_removed_cb (Folks.PersonaStore store)
     {
       this.persona_store_removed (store);
-      this.persona_stores.remove (store.id);
+      this.persona_stores.unset (store.id);
     }
 }
diff --git a/folks/backend.vala b/folks/backend.vala
index 39ad5a6..ace439c 100644
--- a/folks/backend.vala
+++ b/folks/backend.vala
@@ -19,6 +19,7 @@
  */
 
 using GLib;
+using Gee;
 
 /**
  * A single backend to libfolks, such as Telepathy or evolution-data-server.
@@ -59,8 +60,10 @@ public abstract class Folks.Backend : Object
    *
    * A backend may expose { link Persona}s from multiple servers or accounts
    * (for example), so may have a { link PersonaStore} for each.
+   *
+   * @since UNRELEASED
    */
-  public abstract HashTable<string, PersonaStore> persona_stores { get; }
+  public abstract Map<string, PersonaStore> persona_stores { get; }
 
   /**
    * Emitted when a { link PersonaStore} is added to the backend.
diff --git a/folks/individual-aggregator.vala b/folks/individual-aggregator.vala
index 7ca4767..ce583b2 100644
--- a/folks/individual-aggregator.vala
+++ b/folks/individual-aggregator.vala
@@ -312,11 +312,10 @@ public class Folks.IndividualAggregator : Object
               this._backend_persona_store_removed_cb);
 
           /* handle the stores that have already been signaled */
-          backend.persona_stores.foreach ((k, v) =>
+          foreach (var persona_store in backend.persona_stores.values)
               {
-                this._backend_persona_store_added_cb (backend,
-                  (PersonaStore) v);
-              });
+                this._backend_persona_store_added_cb (backend, persona_store);
+              }
         }
     }
 
diff --git a/tests/telepathy/individual-retrieval.vala b/tests/telepathy/individual-retrieval.vala
index 31d6955..416ae7d 100644
--- a/tests/telepathy/individual-retrieval.vala
+++ b/tests/telepathy/individual-retrieval.vala
@@ -188,8 +188,7 @@ public class IndividualRetrievalTests : Folks.TestCase
                         }
                     });
 
-                  foreach (var store in
-                      backend.persona_stores.get_values ())
+                  foreach (var store in backend.persona_stores.values)
                     {
                       if (store is Tpf.PersonaStore && !adding_done)
                         {
diff --git a/tests/telepathy/persona-store-capabilities.vala b/tests/telepathy/persona-store-capabilities.vala
index 38a5c2c..821b54a 100644
--- a/tests/telepathy/persona-store-capabilities.vala
+++ b/tests/telepathy/persona-store-capabilities.vala
@@ -54,7 +54,7 @@ public class PersonaStoreCapabilitiesTests : Folks.TestCase
                       this.set_up_persona_store (ps);
                     });
 
-                foreach (var store in b.persona_stores.get_values ())
+                foreach (var store in b.persona_stores.values)
                   {
                     this.set_up_persona_store (store);
                   }
diff --git a/tests/tracker/add-persona.vala b/tests/tracker/add-persona.vala
index 4ead527..5d8f4a3 100644
--- a/tests/tracker/add-persona.vala
+++ b/tests/tracker/add-persona.vala
@@ -159,7 +159,7 @@ public class AddPersonaTests : Folks.TestCase
           foreach (var backend in store.enabled_backends)
             {
               this._pstore =
-                (Trf.PersonaStore) backend.persona_stores.lookup ("tracker");
+                (Trf.PersonaStore) backend.persona_stores.get ("tracker");
               if (this._pstore != null)
                 break;
             }
diff --git a/tests/tracker/duplicated-emails.vala b/tests/tracker/duplicated-emails.vala
index 7ad5e2d..1d8c774 100644
--- a/tests/tracker/duplicated-emails.vala
+++ b/tests/tracker/duplicated-emails.vala
@@ -86,7 +86,7 @@ public class DuplicatedEmailsTests : Folks.TestCase
           foreach (var backend in store.enabled_backends)
             {
               this._pstore =
-                (Trf.PersonaStore) backend.persona_stores.lookup ("tracker");
+                (Trf.PersonaStore) backend.persona_stores.get ("tracker");
               if (this._pstore != null)
                 break;
             }
diff --git a/tests/tracker/duplicated-phones.vala b/tests/tracker/duplicated-phones.vala
index ded93c5..651c27b 100644
--- a/tests/tracker/duplicated-phones.vala
+++ b/tests/tracker/duplicated-phones.vala
@@ -86,7 +86,7 @@ public class DuplicatedPhonesTests : Folks.TestCase
           foreach (var backend in store.enabled_backends)
             {
               this._pstore =
-                (Trf.PersonaStore) backend.persona_stores.lookup ("tracker");
+                (Trf.PersonaStore) backend.persona_stores.get ("tracker");
               if (this._pstore != null)
                 break;
             }
diff --git a/tests/tracker/link-personas-via-local-ids.vala b/tests/tracker/link-personas-via-local-ids.vala
index b955968..6280637 100644
--- a/tests/tracker/link-personas-via-local-ids.vala
+++ b/tests/tracker/link-personas-via-local-ids.vala
@@ -137,7 +137,7 @@ public class LinkPersonasViaLocalIDsTests : Folks.TestCase
           PersonaStore pstore = null;
           foreach (var backend in store.enabled_backends)
             {
-              pstore = backend.persona_stores.lookup ("tracker");
+              pstore = backend.persona_stores.get ("tracker");
               if (pstore != null)
                 break;
             }
diff --git a/tests/tracker/link-personas.vala b/tests/tracker/link-personas.vala
index 2ed7e57..8c19082 100644
--- a/tests/tracker/link-personas.vala
+++ b/tests/tracker/link-personas.vala
@@ -141,7 +141,7 @@ public class LinkPersonasTests : Folks.TestCase
           PersonaStore pstore = null;
           foreach (var backend in store.enabled_backends)
             {
-              pstore = backend.persona_stores.lookup ("tracker");
+              pstore = backend.persona_stores.get ("tracker");
               if (pstore != null)
                 break;
             }
diff --git a/tests/tracker/match-all.vala b/tests/tracker/match-all.vala
index 3c5945a..c9c8f35 100644
--- a/tests/tracker/match-all.vala
+++ b/tests/tracker/match-all.vala
@@ -112,7 +112,7 @@ public class MatchAllTests : Folks.TestCase
           foreach (var backend in store.enabled_backends)
             {
               this._pstore =
-                (Trf.PersonaStore) backend.persona_stores.lookup ("tracker");
+                (Trf.PersonaStore) backend.persona_stores.get ("tracker");
               if (this._pstore != null)
                 break;
             }
diff --git a/tests/tracker/match-email-addresses.vala b/tests/tracker/match-email-addresses.vala
index 0a023c2..7f5f7ba 100644
--- a/tests/tracker/match-email-addresses.vala
+++ b/tests/tracker/match-email-addresses.vala
@@ -87,7 +87,7 @@ public class MatchEmailAddressesTests : Folks.TestCase
           foreach (var backend in store.enabled_backends)
             {
               this._pstore =
-                (Trf.PersonaStore) backend.persona_stores.lookup ("tracker");
+                (Trf.PersonaStore) backend.persona_stores.get ("tracker");
               if (this._pstore != null)
                 break;
             }
diff --git a/tests/tracker/match-im-addresses.vala b/tests/tracker/match-im-addresses.vala
index 06734a9..1e2ede2 100644
--- a/tests/tracker/match-im-addresses.vala
+++ b/tests/tracker/match-im-addresses.vala
@@ -87,7 +87,7 @@ public class MatchIMAddressesTests : Folks.TestCase
           foreach (var backend in store.enabled_backends)
             {
               this._pstore =
-                (Trf.PersonaStore) backend.persona_stores.lookup ("tracker");
+                (Trf.PersonaStore) backend.persona_stores.get ("tracker");
               if (this._pstore != null)
                 break;
             }
diff --git a/tests/tracker/match-known-emails.vala b/tests/tracker/match-known-emails.vala
index e829f52..b901537 100644
--- a/tests/tracker/match-known-emails.vala
+++ b/tests/tracker/match-known-emails.vala
@@ -95,7 +95,7 @@ public class MatchKnownEmailsTests : Folks.TestCase
           foreach (var backend in store.enabled_backends)
             {
               this._pstore =
-                (Trf.PersonaStore) backend.persona_stores.lookup ("tracker");
+                (Trf.PersonaStore) backend.persona_stores.get ("tracker");
               if (this._pstore != null)
                 break;
             }
diff --git a/tests/tracker/match-name.vala b/tests/tracker/match-name.vala
index e3acf85..f7b67d2 100644
--- a/tests/tracker/match-name.vala
+++ b/tests/tracker/match-name.vala
@@ -150,7 +150,7 @@ public class MatchNameTests : Folks.TestCase
           foreach (var backend in store.enabled_backends)
             {
               this._pstore =
-                (Trf.PersonaStore) backend.persona_stores.lookup ("tracker");
+                (Trf.PersonaStore) backend.persona_stores.get ("tracker");
               if (this._pstore != null)
                 break;
             }
diff --git a/tests/tracker/match-phone-number.vala b/tests/tracker/match-phone-number.vala
index 1ee2a61..9e92100 100644
--- a/tests/tracker/match-phone-number.vala
+++ b/tests/tracker/match-phone-number.vala
@@ -89,7 +89,7 @@ public class MatchPhoneNumberTests : Folks.TestCase
           foreach (var backend in store.enabled_backends)
             {
               this._pstore =
-                (Trf.PersonaStore) backend.persona_stores.lookup ("tracker");
+                (Trf.PersonaStore) backend.persona_stores.get ("tracker");
               if (this._pstore != null)
                 break;
             }
diff --git a/tests/tracker/remove-persona.vala b/tests/tracker/remove-persona.vala
index 0c8f612..5ea697c 100644
--- a/tests/tracker/remove-persona.vala
+++ b/tests/tracker/remove-persona.vala
@@ -92,7 +92,7 @@ public class RemovePersonaTests : Folks.TestCase
           this._pstore = null;
           foreach (var backend in store.enabled_backends)
             {
-              this._pstore = backend.persona_stores.lookup ("tracker");
+              this._pstore = backend.persona_stores.get ("tracker");
               if (this._pstore != null)
                 break;
             }
diff --git a/tests/tracker/set-duplicate-email.vala b/tests/tracker/set-duplicate-email.vala
index 0b9d633..0f5b3e8 100644
--- a/tests/tracker/set-duplicate-email.vala
+++ b/tests/tracker/set-duplicate-email.vala
@@ -87,7 +87,7 @@ public class SetDuplicateEmailTests : Folks.TestCase
           foreach (var backend in store.enabled_backends)
             {
               this._pstore =
-                (Trf.PersonaStore) backend.persona_stores.lookup ("tracker");
+                (Trf.PersonaStore) backend.persona_stores.get ("tracker");
               if (this._pstore != null)
                 break;
             }
diff --git a/tools/import.vala b/tools/import.vala
index 5b7ddb4..d29dc6c 100644
--- a/tools/import.vala
+++ b/tools/import.vala
@@ -129,11 +129,10 @@ public class Folks.ImportTool : Object
         }
 
       /* Get its only PersonaStore */
-      PersonaStore destination_store;
-      GLib.List<unowned PersonaStore> stores =
-          kf_backend.persona_stores.get_values ();
+      PersonaStore destination_store = null;
+      var stores = kf_backend.persona_stores.values;
 
-      if (stores == null)
+      if (stores.size == 0)
         {
           stderr.printf (
               _("Couldn't load the 'key-file' backend's persona store.\n"));
@@ -142,7 +141,13 @@ public class Folks.ImportTool : Object
 
       try
         {
-          destination_store = stores.data;
+          /* Get the first persona store */
+          foreach (var persona_store in stores)
+            {
+              destination_store = persona_store;
+              break;
+            }
+
           yield destination_store.prepare ();
         }
       catch (GLib.Error e3)
diff --git a/tools/inspect/command-backends.vala b/tools/inspect/command-backends.vala
index 1bf12a5..db28ed2 100644
--- a/tools/inspect/command-backends.vala
+++ b/tools/inspect/command-backends.vala
@@ -79,16 +79,15 @@ private class Folks.Inspect.Commands.Backends : Folks.Inspect.Command
 
           Utils.print_line ("Backend '%s' with %u persona stores " +
               "(type ID, ID ('display name')):",
-              backend.name, backend.persona_stores.size ());
+              backend.name, backend.persona_stores.size);
 
           /* List the backend's persona stores */
           Utils.indent ();
-          backend.persona_stores.foreach ((k, v) =>
+          foreach (var store in backend.persona_stores.values)
             {
-              PersonaStore store = (PersonaStore) v;
               Utils.print_line ("%s, %s ('%s')", store.type_id, store.id,
                   store.display_name);
-            });
+            }
           Utils.unindent ();
         }
     }
diff --git a/tools/inspect/command-persona-stores.vala b/tools/inspect/command-persona-stores.vala
index 445e75f..40368b4 100644
--- a/tools/inspect/command-persona-stores.vala
+++ b/tools/inspect/command-persona-stores.vala
@@ -63,13 +63,13 @@ private class Folks.Inspect.Commands.PersonaStores : Folks.Inspect.Command
 
           foreach (Backend backend in backends)
             {
-              HashTable<string, PersonaStore> stores = backend.persona_stores;
+              var stores = backend.persona_stores;
 
-              stores.foreach ((k, v) =>
+              foreach (var persona_store in stores.values)
                 {
-                  Utils.print_persona_store ((PersonaStore) v, false);
+                  Utils.print_persona_store (persona_store, false);
                   Utils.print_line ("");
-                });
+                }
             }
         }
       else
@@ -81,8 +81,8 @@ private class Folks.Inspect.Commands.PersonaStores : Folks.Inspect.Command
 
           foreach (Backend backend in backends)
             {
-              HashTable<string, PersonaStore> stores = backend.persona_stores;
-              store = stores.lookup (command_string);
+              var stores = backend.persona_stores;
+              store = stores.get (command_string);
               if (store != null)
                 break;
             }
diff --git a/tools/inspect/utils.vala b/tools/inspect/utils.vala
index 1127b8f..a544f71 100644
--- a/tools/inspect/utils.vala
+++ b/tools/inspect/utils.vala
@@ -525,7 +525,7 @@ private class Folks.Inspect.Utils
 
   /* FIXME: This can't be in the persona_store_id_completion_cb() function
    * because Vala doesn't allow static local variables. Erk. */
-  private static HashTableIter<string, PersonaStore>? persona_store_id_iter =
+  private static MapIterator<string, PersonaStore>? persona_store_id_iter =
       null;
 
   /* Complete a persona store's ID, starting with @word. */
@@ -547,13 +547,12 @@ private class Folks.Inspect.Utils
             {
               Backend backend = Utils.backend_name_iter.get ();
               Utils.persona_store_id_iter =
-                  HashTableIter<string, PersonaStore> (backend.persona_stores);
+                  backend.persona_stores.map_iterator ();
             }
 
-          string id;
-          PersonaStore store;
-          while (Utils.persona_store_id_iter.next (out id, out store) == true)
+          while (Utils.persona_store_id_iter.next () == true)
             {
+              var id = Utils.persona_store_id_iter.get_key ();
               if (id.has_prefix (word))
                 return id;
             }



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