aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook/tools
diff options
context:
space:
mode:
Diffstat (limited to 'addressbook/tools')
-rw-r--r--addressbook/tools/evolution-addressbook-export-list-cards.c13
-rw-r--r--addressbook/tools/evolution-addressbook-export-list-folders.c14
2 files changed, 15 insertions, 12 deletions
diff --git a/addressbook/tools/evolution-addressbook-export-list-cards.c b/addressbook/tools/evolution-addressbook-export-list-cards.c
index 977fd9cac4..eee2fe92b7 100644
--- a/addressbook/tools/evolution-addressbook-export-list-cards.c
+++ b/addressbook/tools/evolution-addressbook-export-list-cards.c
@@ -771,6 +771,7 @@ guint
action_list_cards_init (ESourceRegistry *registry,
ActionContext *p_actctx)
{
+ EClient *client;
EBookClient *book_client;
EBookQuery *query;
ESource *source;
@@ -788,12 +789,14 @@ action_list_cards_init (ESourceRegistry *registry,
else
source = e_source_registry_ref_default_address_book (registry);
- book_client = e_book_client_new (source, &error);
+ client = e_book_client_connect_sync (source, NULL, &error);
g_object_unref (source);
- if (book_client != NULL)
- e_client_open_sync (E_CLIENT (book_client), TRUE, NULL, &error);
+ /* Sanity check. */
+ g_return_val_if_fail (
+ ((client != NULL) && (error == NULL)) ||
+ ((client == NULL) && (error != NULL)), FAILED);
if (error != NULL) {
g_warning (
@@ -801,13 +804,11 @@ action_list_cards_init (ESourceRegistry *registry,
p_actctx->action_list_cards.addressbook_source_uid ?
p_actctx->action_list_cards.addressbook_source_uid :
"'default'", error->message);
- if (book_client != NULL)
- g_object_unref (book_client);
g_error_free (error);
exit (-1);
}
- g_return_val_if_fail (E_IS_BOOK_CLIENT (book_client), FAILED);
+ book_client = E_BOOK_CLIENT (client);
query = e_book_query_any_field_contains ("");
query_str = e_book_query_to_string (query);
diff --git a/addressbook/tools/evolution-addressbook-export-list-folders.c b/addressbook/tools/evolution-addressbook-export-list-folders.c
index bfaf110cb9..29c44dbeba 100644
--- a/addressbook/tools/evolution-addressbook-export-list-folders.c
+++ b/addressbook/tools/evolution-addressbook-export-list-folders.c
@@ -52,6 +52,7 @@ action_list_folders_init (ESourceRegistry *registry,
list = e_source_registry_list_sources (registry, extension_name);
for (iter = list; iter != NULL; iter = g_list_next (iter)) {
+ EClient *client;
EBookClient *book_client;
EBookQuery *query;
ESource *source;
@@ -63,23 +64,24 @@ action_list_folders_init (ESourceRegistry *registry,
source = E_SOURCE (iter->data);
- book_client = e_book_client_new (source, &error);
+ client = e_book_client_connect_sync (source, NULL, &error);
- if (book_client != NULL)
- e_client_open_sync (
- E_CLIENT (book_client), TRUE, NULL, &error);
+ /* Sanity check. */
+ g_return_val_if_fail (
+ ((client != NULL) && (error == NULL)) ||
+ ((client == NULL) && (error != NULL)), FAILED);
if (error != NULL) {
g_warning (
_("Failed to open client '%s': %s"),
e_source_get_display_name (source),
error->message);
- if (book_client != NULL)
- g_object_unref (book_client);
g_error_free (error);
continue;
}
+ book_client = E_BOOK_CLIENT (client);
+
query = e_book_query_any_field_contains ("");
query_str = e_book_query_to_string (query);
e_book_query_unref (query);