commit 8ebc4e77563d9bdede6ff501854b3cde7751485a
Author: Matthew Barnes <mbarnes@redhat.com>
Date:   Tue May 1 15:38:22 2012 -0400

    Adapt to Evolution-Data-Server API changes.

diff --git a/configure.ac b/configure.ac
index 5b20ff1..95694fe 100644
--- a/configure.ac
+++ b/configure.ac
@@ -223,7 +223,7 @@ if test "x${gm_platform}" != "xmingw" ; then
 fi],enable_eds=yes)
 
   if test "x$enable_eds" = "xyes"; then
-    PKG_CHECK_MODULES([EDS], [libebook-1.2], [found_eds=yes])
+    PKG_CHECK_MODULES([EDS], [libebook-1.2 >= 3.5.3], [found_eds=yes])
     AC_SUBST(EDS_CFLAGS)
     AC_SUBST(EDS_LIBS)
     EDS="enabled"
diff --git a/plugins/evolution/evolution-book.cpp b/plugins/evolution/evolution-book.cpp
index ad3cc18..55c4138 100644
--- a/plugins/evolution/evolution-book.cpp
+++ b/plugins/evolution/evolution-book.cpp
@@ -280,7 +280,7 @@ Evolution::Book::get_name () const
 
   source = e_book_get_source (book);
   if (source && E_IS_SOURCE (source))
-    result = e_source_peek_name (source);
+    result = e_source_get_display_name (source);
 
   return result;
 }
diff --git a/plugins/evolution/evolution-book.h b/plugins/evolution/evolution-book.h
index e49bcf8..a7459cb 100644
--- a/plugins/evolution/evolution-book.h
+++ b/plugins/evolution/evolution-book.h
@@ -38,7 +38,7 @@
 #ifndef __EVOLUTION_BOOK_H__
 #define __EVOLUTION_BOOK_H__
 
-#include <libebook/e-book.h>
+#include <libebook/libebook.h>
 
 #include "filterable.h"
 #include "form.h"
diff --git a/plugins/evolution/evolution-contact.h b/plugins/evolution/evolution-contact.h
index addb4f1..74ccc2e 100644
--- a/plugins/evolution/evolution-contact.h
+++ b/plugins/evolution/evolution-contact.h
@@ -40,7 +40,7 @@
 
 #include <map>
 
-#include <libebook/e-book.h>
+#include <libebook/libebook.h>
 #include "contact-core.h"
 #include "form.h"
 
diff --git a/plugins/evolution/evolution-source.cpp b/plugins/evolution/evolution-source.cpp
index 618c31f..889d734 100644
--- a/plugins/evolution/evolution-source.cpp
+++ b/plugins/evolution/evolution-source.cpp
@@ -39,72 +39,51 @@
 
 #include "evolution-source.h"
 
-#define GCONF_PATH "/apps/evolution/addressbook/sources"
-
 static void
-on_source_list_group_added_c (ESourceList */*source_list*/,
-			      ESourceGroup *group,
-			      gpointer data)
+on_registry_source_added_c (ESourceRegistry */*registry*/,
+			    ESource *source,
+			    gpointer data)
 {
   Evolution::Source *self = NULL;
 
   self = (Evolution::Source *)data;
 
-  self->add_group (group);
+  if (e_source_has_extension (source, E_SOURCE_EXTENSION_ADDRESS_BOOK))
+    self->add_source (source);
 }
 
 void
-Evolution::Source::add_group (ESourceGroup *group)
+Evolution::Source::add_source (ESource *source)
 {
-  GSList *sources = NULL;
-
-  sources = e_source_group_peek_sources (group);
-
-  for ( ; sources != NULL; sources = g_slist_next (sources)) {
-
-    ESource *source = NULL;
-    ESource *s = NULL;
-    gchar *uri = NULL;
-    EBook *ebook = NULL;
-
-    source = E_SOURCE (sources->data);
-
-    s = e_source_copy (source);
+  EBook *ebook = NULL;
 
-    uri = g_strdup_printf("%s/%s",
-			  e_source_group_peek_base_uri (group),
-			  e_source_peek_relative_uri (source));
-    e_source_set_absolute_uri (s, uri);
-    g_free (uri);
+  ebook = e_book_new (source, NULL);
 
-    ebook = e_book_new (s, NULL);
-    g_object_unref (s);
+  BookPtr book (new Evolution::Book (services, ebook));
 
-    BookPtr book (new Evolution::Book (services, ebook));
+  g_object_unref (ebook);
 
-    g_object_unref (ebook);
-
-    add_book (book);
-  }
+  add_book (book);
 }
 
 static void
-on_source_list_group_removed_c (ESourceList */*source_list*/,
-				ESourceGroup *group,
-				gpointer data)
+on_registry_source_removed_c (ESourceRegistry */*registry*/,
+			      ESource *source,
+			      gpointer data)
 {
   Evolution::Source *self = NULL;
 
   self = (Evolution::Source *)data;
 
-  self->remove_group (group);
+  if (e_source_has_extension (source, E_SOURCE_EXTENSION_ADDRESS_BOOK))
+    self->remove_source (source);
 }
 
 class remove_helper
 {
 public :
 
-  remove_helper (ESourceGroup* group_): group(group_)
+  remove_helper (ESource *source_): source(source_)
   { ready (); }
 
   inline void ready ()
@@ -117,10 +96,8 @@ public :
 
       EBook *book_ebook = book->get_ebook ();
       ESource *book_source = e_book_get_source (book_ebook);
-      ESourceGroup *book_group = e_source_peek_group (book_source);
-
-      if (book_group == group) {
 
+      if (e_source_equal (source, book_source)) {
 	book->removed ();
 	found = true;
       }
@@ -133,14 +110,14 @@ public :
   { return found; }
 
 private:
-  ESourceGroup* group;
+  ESource *source;
   bool found;
 };
 
 void
-Evolution::Source::remove_group (ESourceGroup *group)
+Evolution::Source::remove_source (ESource *source)
 {
-  remove_helper helper (group);
+  remove_helper helper (source);
 
   do {
 
@@ -153,28 +130,39 @@ Evolution::Source::remove_group (ESourceGroup *group)
 Evolution::Source::Source (Ekiga::ServiceCore &_services)
   : services(_services)
 {
-  GSList *groups = NULL;
-  ESourceGroup *group = NULL;
+  GList *list, *link;
+  const gchar *extension_name;
+  GError *error = NULL;
 
-  source_list = e_source_list_new_for_gconf_default (GCONF_PATH);
+  /* XXX This blocks.  Should it be created asynchronously? */
+  registry = e_source_registry_new_sync (NULL, &error);
 
-  groups = e_source_list_peek_groups (source_list);
+  if (error != NULL) {
+    g_warning ("%s", error->message);
+    g_error_free (error);
+    return;
+  }
 
-  for ( ; groups != NULL; groups = g_slist_next (groups)) {
+  extension_name = E_SOURCE_EXTENSION_ADDRESS_BOOK;
+  list = e_source_registry_list_sources (registry, extension_name);
 
-    group = E_SOURCE_GROUP (groups->data);
-    add_group (group);
+  for (link = list; link != NULL; link = g_list_next (link)) {
+    ESource *source = E_SOURCE (link->data);
+    add_source (source);
   }
 
-  g_signal_connect (source_list, "group-added",
-		    G_CALLBACK (on_source_list_group_added_c), this);
-  g_signal_connect (source_list, "group-removed",
-		    G_CALLBACK (on_source_list_group_removed_c), this);
+  g_list_foreach (list, (GFunc) g_object_unref, NULL);
+  g_list_free (list);
+
+  g_signal_connect (registry, "source-added",
+		    G_CALLBACK (on_registry_source_added_c), this);
+  g_signal_connect (registry, "source-removed",
+		    G_CALLBACK (on_registry_source_removed_c), this);
 }
 
 Evolution::Source::~Source ()
 {
-  g_object_unref (source_list);
+  g_object_unref (registry);
 }
 
 bool
diff --git a/plugins/evolution/evolution-source.h b/plugins/evolution/evolution-source.h
index 43c7072..516c3f5 100644
--- a/plugins/evolution/evolution-source.h
+++ b/plugins/evolution/evolution-source.h
@@ -38,7 +38,7 @@
 #ifndef __EVOLUTION_SOURCE_H__
 #define __EVOLUTION_SOURCE_H__
 
-#include <libebook/e-book.h>
+#include <libebook/libebook.h>
 
 #include "contact-core.h"
 #include "source-impl.h"
@@ -75,14 +75,14 @@ namespace Evolution
 
     /* those should be private, but need to be called from C */
 
-    void add_group (ESourceGroup *group);
+    void add_source (ESource *source);
 
-    void remove_group (ESourceGroup *group);
+    void remove_source (ESource *source);
 
   private:
 
     Ekiga::ServiceCore &services;
-    ESourceList *source_list;
+    ESourceRegistry *registry;
   };
 
 /**
