[folks/edsport] Use SourceRegistry.ref_source rather than iterate to find a source.



commit e3a0882c1a4374ccc7ce71995f9e63a269ff9d9b
Author: Jeremy Whiting <jpwhiting kde org>
Date:   Fri Jun 8 18:14:24 2012 -0600

    Use SourceRegistry.ref_source rather than iterate to find a source.

 backends/eds/lib/edsf-persona-store.vala |   13 ++++---------
 1 files changed, 4 insertions(+), 9 deletions(-)
---
diff --git a/backends/eds/lib/edsf-persona-store.vala b/backends/eds/lib/edsf-persona-store.vala
index 0c2c699..eca8c8e 100644
--- a/backends/eds/lib/edsf-persona-store.vala
+++ b/backends/eds/lib/edsf-persona-store.vala
@@ -2210,16 +2210,11 @@ public class Edsf.PersonaStore : Folks.PersonaStore
        * so we can assert that the source list is non-null. */
       assert (this._source_registry != null);
 
-      GLib.List<E.Source> books =
-          ((!) this._source_registry).list_sources (SOURCE_EXTENSION_ADDRESS_BOOK);
-
-      foreach (var s in books)
+      E.Source? needle = ((!) this._source_registry).ref_source(this.id);
+      if (needle != null && needle.has_extension (SOURCE_EXTENSION_ADDRESS_BOOK))
         {
-          if (s.get_uid () == this.id)
-            {
-              /* We've found ourself. */
-              return true;
-            }
+          /* We've found ourself. */
+          return true;
         }
 
       return false;



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