[evolution/account-mgmt: 11/50] Adapt addressbook/util to the new ESource API.
- From: Matthew Barnes <mbarnes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution/account-mgmt: 11/50] Adapt addressbook/util to the new ESource API.
- Date: Wed, 7 Sep 2011 16:08:40 +0000 (UTC)
commit a59fc3f3cec13428d8229e85d9772e3f1156c747
Author: Matthew Barnes <mbarnes redhat com>
Date: Wed Dec 8 00:15:26 2010 -0500
Adapt addressbook/util to the new ESource API.
addressbook/util/eab-book-util.c | 33 +++++++++++++++++++++++----------
1 files changed, 23 insertions(+), 10 deletions(-)
---
diff --git a/addressbook/util/eab-book-util.c b/addressbook/util/eab-book-util.c
index 5c8d335..c3e052b 100644
--- a/addressbook/util/eab-book-util.c
+++ b/addressbook/util/eab-book-util.c
@@ -26,6 +26,7 @@
#endif
#include <string.h>
+#include <libedataserver/e-source-registry.h>
#include "eab-book-util.h"
@@ -151,8 +152,10 @@ eab_book_and_contact_list_from_string (const gchar *str,
EBookClient **book_client,
GSList **contacts)
{
+ ESourceRegistry *registry;
+ ESource *source;
const gchar *s0, *s1;
- gchar *uri;
+ gchar *uid;
g_return_val_if_fail (str != NULL, FALSE);
g_return_val_if_fail (book_client != NULL, FALSE);
@@ -176,11 +179,16 @@ eab_book_and_contact_list_from_string (const gchar *str,
return FALSE;
}
- uri = g_strndup (s0, s1 - s0);
- *book_client = e_book_client_new_from_uri (uri, NULL);
- g_free (uri);
+ uid = g_strndup (s0, s1 - s0);
+ registry = e_source_registry_get_default ();
+ source = e_source_registry_lookup_by_uid (registry, uid);
+ if (source != NULL)
+ *book_client = e_book_client_new (source, NULL);
+ else
+ *book_client = NULL;
+ g_free (uid);
- return *book_client ? TRUE : FALSE;
+ return (*book_client != NULL);
}
gchar *
@@ -193,11 +201,16 @@ eab_book_and_contact_list_to_string (EBookClient *book_client,
if (!s0)
s0 = g_strdup ("");
- if (book_client)
- s1 = g_strconcat (
- "Book: ", e_client_get_uri (
- E_CLIENT (book_client)), "\r\n", s0, NULL);
- else
+ if (book_client != NULL) {
+ EClient *client;
+ ESource *source;
+ const gchar *uid;
+
+ client = E_CLIENT (book_client);
+ source = e_client_get_source (client);
+ uid = e_source_get_uid (source);
+ s1 = g_strconcat ("Book: ", uid, "\r\n", s0, NULL);
+ } else
s1 = g_strdup (s0);
g_free (s0);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]