pidgin/plugins/gevolution/gevo-util.c

changeset 35522
82139d173179
parent 35313
d299a8680115
child 35958
1d8446f396b6
child 37109
94d1a2589d5a
--- a/pidgin/plugins/gevolution/gevo-util.c	Mon Feb 10 17:27:03 2014 +0100
+++ b/pidgin/plugins/gevolution/gevo-util.c	Mon Feb 10 18:19:16 2014 +0100
@@ -126,16 +126,39 @@
 }
 
 gboolean
-gevo_load_addressbook(const gchar* uri, EBook **book, GError **error)
+gevo_load_addressbook(const gchar* uid, EBook **book, GError **error)
+{
+	gboolean result = FALSE;
+	ESourceRegistry *registry;
+	ESource *source;
+
+	g_return_val_if_fail(book != NULL, FALSE);
+
+	registry = e_source_registry_new_sync(NULL, error);
+
+	if (!registry)
+		return FALSE;
+
+	if (uid == NULL)
+		source = e_source_registry_ref_default_address_book(registry);
+	else
+		source = e_source_registry_ref_source(registry, uid);
+
+	g_object_unref(registry);
+
+	result = gevo_load_addressbook_from_source(source, book, error);
+
+	g_object_unref(source);
+
+	return result;
+}
+
+gboolean
+gevo_load_addressbook_from_source(ESource *source, EBook **book, GError **error)
 {
 	gboolean result = FALSE;
 
-	g_return_val_if_fail(book != NULL, FALSE);
-
-	if (uri == NULL)
-		*book = e_book_new_system_addressbook(error);
-	else
-		*book = e_book_new_from_uri(uri, error);
+	*book = e_book_new(source, error);
 
 	if (*book == NULL)
 		return FALSE;

mercurial