diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2013-01-24 03:59:41 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2013-01-30 21:37:15 +0800 |
commit | e583928e0401a4baea4432c5b7e12a1b1eff8c2e (patch) | |
tree | 786d3c1b3ed24456d88f3b8c6987755a08f310db /plugins | |
parent | 5125cdac38ced3898bdd59ed29259e4c747374f7 (diff) | |
download | gsoc2013-evolution-e583928e0401a4baea4432c5b7e12a1b1eff8c2e.tar.gz 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 'plugins')
-rw-r--r-- | plugins/bbdb/bbdb.c | 30 | ||||
-rw-r--r-- | plugins/bbdb/bbdb.h | 4 | ||||
-rw-r--r-- | plugins/bbdb/gaimbuddies.c | 12 | ||||
-rw-r--r-- | plugins/pst-import/pst-importer.c | 20 |
4 files changed, 15 insertions, 51 deletions
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) { diff --git a/plugins/pst-import/pst-importer.c b/plugins/pst-import/pst-importer.c index e20d09a958..0389d25bb6 100644 --- a/plugins/pst-import/pst-importer.c +++ b/plugins/pst-import/pst-importer.c @@ -616,20 +616,24 @@ org_credativ_evolution_readpst_getwidget (EImport *ei, } static void -client_opened_cb (GObject *source_object, - GAsyncResult *result, - gpointer user_data) +client_connect_cb (GObject *source_object, + GAsyncResult *result, + gpointer user_data) { PstImporter *m = user_data; + EClient *client; GError *error = NULL; - EClient *client = NULL; g_return_if_fail (result != NULL); g_return_if_fail (m != NULL); g_return_if_fail (m->waiting_open > 0); - if (!e_client_utils_open_new_finish (E_SOURCE (source_object), result, &client, &error)) - client = NULL; + client = e_book_client_connect_finish (result, &error); + + /* Sanity check. */ + g_return_if_fail ( + ((client != NULL) && (error == NULL)) || + ((client == NULL) && (error != NULL))); if (error) g_debug ("%s: Failed to open client: %s", G_STRFUNC, error->message); @@ -681,9 +685,7 @@ open_client (PstImporter *m, m->waiting_open++; - e_client_utils_open_new ( - source, source_type, FALSE, m->cancellable, - client_opened_cb, m); + e_book_client_connect (source, m->cancellable, client_connect_cb, m); g_object_unref (source); } |