From e583928e0401a4baea4432c5b7e12a1b1eff8c2e Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Wed, 23 Jan 2013 14:59:41 -0500 Subject: Use e_book_client_connect(). Instead of e_client_utils_open_new() and e_book_client_new(). --- addressbook/util/eab-book-util.c | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-) (limited to 'addressbook/util/eab-book-util.c') 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 * -- cgit v1.2.3