aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook/gui/widgets
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2013-01-24 03:59:41 +0800
committerMatthew Barnes <mbarnes@redhat.com>2013-01-30 21:37:15 +0800
commite583928e0401a4baea4432c5b7e12a1b1eff8c2e (patch)
tree786d3c1b3ed24456d88f3b8c6987755a08f310db /addressbook/gui/widgets
parent5125cdac38ced3898bdd59ed29259e4c747374f7 (diff)
downloadgsoc2013-evolution-e583928e0401a4baea4432c5b7e12a1b1eff8c2e.tar
gsoc2013-evolution-e583928e0401a4baea4432c5b7e12a1b1eff8c2e.tar.gz
gsoc2013-evolution-e583928e0401a4baea4432c5b7e12a1b1eff8c2e.tar.bz2
gsoc2013-evolution-e583928e0401a4baea4432c5b7e12a1b1eff8c2e.tar.lz
gsoc2013-evolution-e583928e0401a4baea4432c5b7e12a1b1eff8c2e.tar.xz
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 'addressbook/gui/widgets')
-rw-r--r--addressbook/gui/widgets/e-addressbook-selector.c34
-rw-r--r--addressbook/gui/widgets/eab-gui-util.c24
2 files changed, 27 insertions, 31 deletions
diff --git a/addressbook/gui/widgets/e-addressbook-selector.c b/addressbook/gui/widgets/e-addressbook-selector.c
index 2441a0bc89..eedc776a6c 100644
--- a/addressbook/gui/widgets/e-addressbook-selector.c
+++ b/addressbook/gui/widgets/e-addressbook-selector.c
@@ -247,29 +247,30 @@ addressbook_selector_constructed (GObject *object)
}
static void
-target_client_open_ready_cb (GObject *source_object,
- GAsyncResult *result,
- gpointer user_data)
+target_client_connect_cb (GObject *source_object,
+ GAsyncResult *result,
+ gpointer user_data)
{
- ESource *source = E_SOURCE (source_object);
MergeContext *merge_context = user_data;
- EClient *client = NULL;
+ EClient *client;
GError *error = NULL;
g_return_if_fail (merge_context != 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) {
- g_warn_if_fail (client == NULL);
g_warning (
"%s: Failed to open targer client: %s",
G_STRFUNC, error->message);
g_error_free (error);
}
- g_return_if_fail (E_IS_CLIENT (client));
-
merge_context->target_client = client ? E_BOOK_CLIENT (client) : NULL;
if (!merge_context->target_client) {
@@ -299,7 +300,7 @@ addressbook_selector_data_dropped (ESourceSelector *selector,
EAddressbookSelectorPrivate *priv;
MergeContext *merge_context;
EAddressbookModel *model;
- EBookClient *source_client = NULL;
+ EBookClient *source_client;
ESourceRegistry *registry;
GSList *list;
const gchar *string;
@@ -314,12 +315,8 @@ addressbook_selector_data_dropped (ESourceSelector *selector,
model = e_addressbook_view_get_model (priv->current_view);
registry = e_addressbook_model_get_registry (model);
- /* XXX Function assumes both out arguments are provided. All we
- * care about is the contact list; source_client will be NULL. */
- eab_book_and_contact_list_from_string (
- registry, string, &source_client, &list);
- if (source_client)
- g_object_unref (source_client);
+ eab_source_and_contact_list_from_string (
+ registry, string, NULL, &list);
if (list == NULL)
return FALSE;
@@ -332,9 +329,8 @@ addressbook_selector_data_dropped (ESourceSelector *selector,
merge_context->remove_from_source = remove_from_source;
merge_context->pending_adds = TRUE;
- e_client_utils_open_new (
- destination, E_CLIENT_SOURCE_TYPE_CONTACTS, FALSE, NULL,
- target_client_open_ready_cb, merge_context);
+ e_book_client_connect (
+ destination, NULL, target_client_connect_cb, merge_context);
return TRUE;
}
diff --git a/addressbook/gui/widgets/eab-gui-util.c b/addressbook/gui/widgets/eab-gui-util.c
index 089c12b573..2f0f29ea23 100644
--- a/addressbook/gui/widgets/eab-gui-util.c
+++ b/addressbook/gui/widgets/eab-gui-util.c
@@ -524,19 +524,22 @@ do_copy (gpointer data,
}
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)
{
- ESource *destination = E_SOURCE (source_object);
ContactCopyProcess *process = user_data;
- EClient *client = NULL;
+ EClient *client;
GError *error = NULL;
- e_client_utils_open_new_finish (destination, 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) {
- g_warn_if_fail (client == NULL);
g_warning (
"%s: Failed to open destination client: %s",
G_STRFUNC, error->message);
@@ -544,8 +547,6 @@ book_loaded_cb (GObject *source_object,
goto exit;
}
- g_return_if_fail (E_IS_CLIENT (client));
-
process->destination = E_BOOK_CLIENT (client);
process->book_status = TRUE;
g_slist_foreach (process->contacts, do_copy, process);
@@ -612,9 +613,8 @@ eab_transfer_contacts (ESourceRegistry *registry,
process->alert_sink = alert_sink;
process->delete_from_source = delete_from_source;
- e_client_utils_open_new (
- destination, E_CLIENT_SOURCE_TYPE_CONTACTS, FALSE, NULL,
- book_loaded_cb, process);
+ e_book_client_connect (
+ destination, NULL, book_client_connect_cb, process);
}
/*