aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2010-12-08 13:15:26 +0800
committerMatthew Barnes <mbarnes@redhat.com>2012-06-03 11:00:39 +0800
commitc20cd3645b593061eb564aabcc0e224b8a1b744c (patch)
treea955739babcdc536ad99cecbc48fa8f40dbfa3c7 /addressbook
parent7e8696ec5bb2721a769234fc4527b98e6a0c8a36 (diff)
downloadgsoc2013-evolution-c20cd3645b593061eb564aabcc0e224b8a1b744c.tar
gsoc2013-evolution-c20cd3645b593061eb564aabcc0e224b8a1b744c.tar.gz
gsoc2013-evolution-c20cd3645b593061eb564aabcc0e224b8a1b744c.tar.bz2
gsoc2013-evolution-c20cd3645b593061eb564aabcc0e224b8a1b744c.tar.lz
gsoc2013-evolution-c20cd3645b593061eb564aabcc0e224b8a1b744c.tar.xz
gsoc2013-evolution-c20cd3645b593061eb564aabcc0e224b8a1b744c.tar.zst
gsoc2013-evolution-c20cd3645b593061eb564aabcc0e224b8a1b744c.zip
Adapt addressbook/util to the new ESource API.
Diffstat (limited to 'addressbook')
-rw-r--r--addressbook/util/eab-book-util.c31
-rw-r--r--addressbook/util/eab-book-util.h4
2 files changed, 26 insertions, 9 deletions
diff --git a/addressbook/util/eab-book-util.c b/addressbook/util/eab-book-util.c
index 30cd2acb96..b25bbce513 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"
@@ -149,13 +150,16 @@ eab_contact_list_to_string (const GSList *contacts)
}
gboolean
-eab_book_and_contact_list_from_string (const gchar *str,
+eab_book_and_contact_list_from_string (ESourceRegistry *registry,
+ const gchar *str,
EBookClient **book_client,
GSList **contacts)
{
+ ESource *source;
const gchar *s0, *s1;
- gchar *uri;
+ gchar *uid;
+ g_return_val_if_fail (E_IS_SOURCE_REGISTRY (registry), FALSE);
g_return_val_if_fail (str != NULL, FALSE);
g_return_val_if_fail (book_client != NULL, FALSE);
g_return_val_if_fail (contacts != NULL, FALSE);
@@ -178,9 +182,15 @@ 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);
+ source = e_source_registry_ref_source (registry, uid);
+ if (source != NULL) {
+ *book_client = e_book_client_new (source, NULL);
+ g_object_unref (source);
+ } else {
+ *book_client = NULL;
+ }
+ g_free (uid);
return (*book_client != NULL);
}
@@ -196,9 +206,14 @@ eab_book_and_contact_list_to_string (EBookClient *book_client,
s0 = g_strdup ("");
if (book_client != NULL) {
- s1 = g_strconcat (
- "Book: ", e_client_get_uri (
- E_CLIENT (book_client)), "\r\n", s0, 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);
diff --git a/addressbook/util/eab-book-util.h b/addressbook/util/eab-book-util.h
index 4376863973..99e92b95b5 100644
--- a/addressbook/util/eab-book-util.h
+++ b/addressbook/util/eab-book-util.h
@@ -25,6 +25,7 @@
#define EAB_BOOK_UTIL_H
#include <libebook/e-book-client.h>
+#include <libedataserver/e-source-registry.h>
G_BEGIN_DECLS
@@ -32,7 +33,8 @@ GSList * eab_contact_list_from_string (const gchar *str);
gchar * eab_contact_list_to_string (const GSList *contacts);
gboolean eab_book_and_contact_list_from_string
- (const gchar *str,
+ (ESourceRegistry *registry,
+ const gchar *str,
EBookClient **book_client,
GSList **contacts);
gchar * eab_book_and_contact_list_to_string