aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook/util
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2013-01-24 03:59:41 +0800
committerMatthew Barnes <mbarnes@redhat.com>2013-01-30 21:37:15 +0800
commite583928e0401a4baea4432c5b7e12a1b1eff8c2e (patch)
tree786d3c1b3ed24456d88f3b8c6987755a08f310db /addressbook/util
parent5125cdac38ced3898bdd59ed29259e4c747374f7 (diff)
downloadgsoc2013-evolution-e583928e0401a4baea4432c5b7e12a1b1eff8c2e.tar
gsoc2013-evolution-e583928e0401a4baea4432c5b7e12a1b1eff8c2e.tar.gz
gsoc2013-evolution-e583928e0401a4baea4432c5b7e12a1b1eff8c2e.tar.bz2
gsoc2013-evolution-e583928e0401a4baea4432c5b7e12a1b1eff8c2e.tar.lz
gsoc2013-evolution-e583928e0401a4baea4432c5b7e12a1b1eff8c2e.tar.xz
gsoc2013-evolution-e583928e0401a4baea4432c5b7e12a1b1eff8c2e.tar.zst
gsoc2013-evolution-e583928e0401a4baea4432c5b7e12a1b1eff8c2e.zip
Use e_book_client_connect().
Instead of e_client_utils_open_new() and e_book_client_new().
Diffstat (limited to 'addressbook/util')
-rw-r--r--addressbook/util/eab-book-util.c32
-rw-r--r--addressbook/util/eab-book-util.h6
2 files changed, 21 insertions, 17 deletions
diff --git a/addressbook/util/eab-book-util.c b/addressbook/util/eab-book-util.c
index 161d848ce6..d7c0941c69 100644
--- a/addressbook/util/eab-book-util.c
+++ b/addressbook/util/eab-book-util.c
@@ -150,21 +150,24 @@ eab_contact_list_to_string (const GSList *contacts)
}
gboolean
-eab_book_and_contact_list_from_string (ESourceRegistry *registry,
- const gchar *str,
- EBookClient **book_client,
- GSList **contacts)
+eab_source_and_contact_list_from_string (ESourceRegistry *registry,
+ const gchar *str,
+ ESource **out_source,
+ GSList **out_contacts)
{
ESource *source;
const gchar *s0, *s1;
gchar *uid;
+ gboolean success = FALSE;
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);
- *contacts = eab_contact_list_from_string (str);
+ if (out_source != NULL)
+ *out_source = NULL; /* in case we fail */
+
+ if (out_contacts != NULL)
+ *out_contacts = NULL; /* in case we fail */
if (!strncmp (str, "Book: ", 6)) {
s0 = str + 6;
@@ -177,22 +180,23 @@ eab_book_and_contact_list_from_string (ESourceRegistry *registry,
s1 = NULL;
}
- if (!s0 || !s1) {
- *book_client = NULL;
+ if (!s0 || !s1)
return FALSE;
- }
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);
+ if (out_source != NULL)
+ *out_source = g_object_ref (source);
g_object_unref (source);
- } else {
- *book_client = NULL;
+ success = TRUE;
}
g_free (uid);
- return (*book_client != NULL);
+ if (success && out_contacts != NULL)
+ *out_contacts = eab_contact_list_from_string (str);
+
+ return success;
}
gchar *
diff --git a/addressbook/util/eab-book-util.h b/addressbook/util/eab-book-util.h
index 45602c2547..559aa79714 100644
--- a/addressbook/util/eab-book-util.h
+++ b/addressbook/util/eab-book-util.h
@@ -31,11 +31,11 @@ G_BEGIN_DECLS
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
+gboolean eab_source_and_contact_list_from_string
(ESourceRegistry *registry,
const gchar *str,
- EBookClient **book_client,
- GSList **contacts);
+ ESource **out_source,
+ GSList **out_contacts);
gchar * eab_book_and_contact_list_to_string
(EBookClient *book_client,
const GSList *contacts);