diff options
Diffstat (limited to 'e-util')
-rw-r--r-- | e-util/e-name-selector-dialog.c | 27 | ||||
-rw-r--r-- | e-util/e-name-selector-entry.c | 26 | ||||
-rw-r--r-- | e-util/e-name-selector.c | 23 |
3 files changed, 42 insertions, 34 deletions
diff --git a/e-util/e-name-selector-dialog.c b/e-util/e-name-selector-dialog.c index 0a647637a8..36b426b0f5 100644 --- a/e-util/e-name-selector-dialog.c +++ b/e-util/e-name-selector-dialog.c @@ -36,7 +36,6 @@ #include "e-source-combo-box.h" #include "e-destination-store.h" #include "e-contact-store.h" -#include "e-client-utils.h" #include "e-name-selector-dialog.h" #include "e-name-selector-entry.h" @@ -1134,21 +1133,25 @@ stop_client_view_cb (EContactStore *store, } static void -book_loaded_cb (GObject *source_object, - GAsyncResult *result, - gpointer user_data) +book_client_connect_cb (GObject *source_object, + GAsyncResult *result, + gpointer user_data) { ENameSelectorDialog *name_selector_dialog = user_data; - EClient *client = NULL; + EClient *client; EBookClient *book_client; EContactStore *store; ENameSelectorModel *model; GError *error = NULL; - e_client_utils_open_new_finish (E_SOURCE (source_object), result, &client, &error); + client = e_book_client_connect_finish (result, &error); + + /* Sanity check. */ + g_return_if_fail ( + ((client != NULL) && (error == NULL)) || + ((client == NULL) && (error != NULL))); if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) { - g_warn_if_fail (client == NULL); g_error_free (error); goto exit; } @@ -1162,7 +1165,6 @@ book_loaded_cb (GObject *source_object, name_selector_dialog->priv->status_label, message); g_free (message); - g_warn_if_fail (client == NULL); g_error_free (error); goto exit; } @@ -1204,10 +1206,11 @@ source_changed (ENameSelectorDialog *name_selector_dialog, cancellable = g_cancellable_new (); name_selector_dialog->priv->cancellable = cancellable; - /* Start loading selected book */ - e_client_utils_open_new ( - source, E_CLIENT_SOURCE_TYPE_CONTACTS, TRUE, cancellable, - book_loaded_cb, g_object_ref (name_selector_dialog)); + /* Connect to the selected book. */ + e_book_client_connect ( + source, cancellable, + book_client_connect_cb, + g_object_ref (name_selector_dialog)); g_object_unref (source); } diff --git a/e-util/e-name-selector-entry.c b/e-util/e-name-selector-entry.c index 45038c0fee..58c7b391fd 100644 --- a/e-util/e-name-selector-entry.c +++ b/e-util/e-name-selector-entry.c @@ -28,7 +28,6 @@ #include <camel/camel.h> #include <libebackend/libebackend.h> -#include "e-client-utils.h" #include "e-name-selector-entry.h" #define E_NAME_SELECTOR_ENTRY_GET_PRIVATE(obj) \ @@ -2206,27 +2205,29 @@ setup_contact_store (ENameSelectorEntry *name_selector_entry) } static void -book_loaded_cb (GObject *source_object, - GAsyncResult *result, - gpointer user_data) +book_client_connect_cb (GObject *source_object, + GAsyncResult *result, + gpointer user_data) { EContactStore *contact_store = user_data; - ESource *source = E_SOURCE (source_object); EBookClient *book_client; - EClient *client = NULL; + EClient *client; GError *error = NULL; - e_client_utils_open_new_finish (source, result, &client, &error); + client = e_book_client_connect_finish (result, &error); + + /* Sanity check. */ + g_return_if_fail ( + ((client != NULL) && (error == NULL)) || + ((client == NULL) && (error != NULL))); if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) { - g_warn_if_fail (client == NULL); g_error_free (error); goto exit; } if (error != NULL) { g_warning ("%s", error->message); - g_warn_if_fail (client == NULL); g_error_free (error); goto exit; } @@ -2287,9 +2288,10 @@ setup_default_contact_store (ENameSelectorEntry *name_selector_entry) &name_selector_entry->priv->cancellables, cancellable); - e_client_utils_open_new ( - source, E_CLIENT_SOURCE_TYPE_CONTACTS, TRUE, cancellable, - book_loaded_cb, g_object_ref (contact_store)); + e_book_client_connect ( + source, cancellable, + book_client_connect_cb, + g_object_ref (contact_store)); } g_list_free_full (list, (GDestroyNotify) g_object_unref); diff --git a/e-util/e-name-selector.c b/e-util/e-name-selector.c index a94b6ff5f3..66d93512d0 100644 --- a/e-util/e-name-selector.c +++ b/e-util/e-name-selector.c @@ -32,7 +32,6 @@ #include "e-name-selector.h" -#include "e-client-utils.h" #include "e-contact-store.h" #include "e-destination-store.h" @@ -91,20 +90,25 @@ reset_pointer_cb (gpointer data, } static void -name_selector_book_loaded_cb (GObject *source_object, - GAsyncResult *result, - gpointer user_data) +name_selector_book_client_connect_cb (GObject *source_object, + GAsyncResult *result, + gpointer user_data) { ENameSelector *name_selector = user_data; ESource *source = E_SOURCE (source_object); EBookClient *book_client; - EClient *client = NULL; + EClient *client; GArray *sections; SourceBook source_book; guint ii; GError *error = NULL; - e_client_utils_open_new_finish (source, result, &client, &error); + client = e_book_client_connect_finish (result, &error); + + /* Sanity check. */ + g_return_if_fail ( + ((client != NULL) && (error == NULL)) || + ((client == NULL) && (error != NULL))); if (error != NULL) { if (!g_error_matches (error, E_CLIENT_ERROR, E_CLIENT_ERROR_REPOSITORY_OFFLINE) @@ -186,10 +190,9 @@ e_name_selector_load_books (ENameSelector *name_selector) if (!e_source_autocomplete_get_include_me (extension)) continue; - e_client_utils_open_new ( - source, E_CLIENT_SOURCE_TYPE_CONTACTS, - TRUE, name_selector->priv->cancellable, - name_selector_book_loaded_cb, + e_book_client_connect ( + source, name_selector->priv->cancellable, + name_selector_book_client_connect_cb, g_object_ref (name_selector)); } |