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(). --- plugins/bbdb/bbdb.c | 30 ++++-------------------------- plugins/bbdb/bbdb.h | 4 ---- plugins/bbdb/gaimbuddies.c | 12 ------------ 3 files changed, 4 insertions(+), 42 deletions(-) (limited to 'plugins/bbdb') diff --git a/plugins/bbdb/bbdb.c b/plugins/bbdb/bbdb.c index 7187f6e376..568bd90733 100644 --- a/plugins/bbdb/bbdb.c +++ b/plugins/bbdb/bbdb.c @@ -137,7 +137,7 @@ bbdb_do_in_thread (gpointer data) EBookClient *client = data; /* Open the addressbook */ - if (!client || !bbdb_open_book_client (client)) { + if (client == NULL) { G_LOCK (todo); g_slist_foreach (todo, (GFunc) free_todo_struct, NULL); @@ -370,7 +370,7 @@ bbdb_create_book_client (gint type) EShell *shell; ESource *source = NULL; ESourceRegistry *registry; - EBookClient *client = NULL; + EClient *client = NULL; GSettings *settings; gboolean enable = TRUE; gchar *uid; @@ -406,7 +406,7 @@ bbdb_create_book_client (gint type) if (source == NULL) source = e_source_registry_ref_builtin_address_book (registry); - client = e_book_client_new (source, &error); + client = e_book_client_connect_sync (source, NULL, &error); if (client == NULL) { g_warning ( "bbdb: Failed to get addressbook: %s\n", @@ -416,29 +416,7 @@ bbdb_create_book_client (gint type) g_object_unref (source); - return client; -} - -gboolean -bbdb_open_book_client (EBookClient *client) -{ - GError *error = NULL; - - if (!client) - return FALSE; - - e_client_open_sync (E_CLIENT (client), FALSE, NULL, &error); - - if (error != NULL) { - g_warning ( - "bbdb: failed to open addressbook: %s", - error->message); - g_object_unref (client); - g_error_free (error); - return FALSE; - } - - return TRUE; + return (EBookClient *) client; } gboolean diff --git a/plugins/bbdb/bbdb.h b/plugins/bbdb/bbdb.h index 8681592921..6759921192 100644 --- a/plugins/bbdb/bbdb.h +++ b/plugins/bbdb/bbdb.h @@ -44,10 +44,6 @@ * this function should be called in a main thread. */ EBookClient *bbdb_create_book_client (gint type); -/* opens an EBookClient. Returns false if it fails, and unrefs the book too; - * this function can be called in any thread */ -gboolean bbdb_open_book_client (EBookClient *client); - gboolean bbdb_check_gaim_enabled (void); /* gaimbuddies.c */ diff --git a/plugins/bbdb/gaimbuddies.c b/plugins/bbdb/gaimbuddies.c index 228eae2613..9ef3db263b 100644 --- a/plugins/bbdb/gaimbuddies.c +++ b/plugins/bbdb/gaimbuddies.c @@ -199,18 +199,6 @@ bbdb_sync_buddy_list_in_thread (gpointer data) g_return_val_if_fail (std != NULL, NULL); - if (!bbdb_open_book_client (std->client)) { - /* client got freed in bbdb_open_book_client on a failure */ - free_buddy_list (std->blist); - g_free (std); - - G_LOCK (syncing); - syncing = FALSE; - G_UNLOCK (syncing); - - return NULL; - } - printf ("bbdb: Synchronizing buddy list to contacts...\n"); /* Walk the buddy list */ for (l = std->blist; l != NULL; l = l->next) { -- cgit v1.2.3