aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/gui
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2013-01-24 05:05:08 +0800
committerMatthew Barnes <mbarnes@redhat.com>2013-01-30 22:35:27 +0800
commitf19241d136043d5cfffbfbaf5b2d6d1affc70682 (patch)
tree6abc10286b092dfc9b046bde599f24767ad0c177 /calendar/gui
parente583928e0401a4baea4432c5b7e12a1b1eff8c2e (diff)
downloadgsoc2013-evolution-f19241d136043d5cfffbfbaf5b2d6d1affc70682.tar
gsoc2013-evolution-f19241d136043d5cfffbfbaf5b2d6d1affc70682.tar.gz
gsoc2013-evolution-f19241d136043d5cfffbfbaf5b2d6d1affc70682.tar.bz2
gsoc2013-evolution-f19241d136043d5cfffbfbaf5b2d6d1affc70682.tar.lz
gsoc2013-evolution-f19241d136043d5cfffbfbaf5b2d6d1affc70682.tar.xz
gsoc2013-evolution-f19241d136043d5cfffbfbaf5b2d6d1affc70682.tar.zst
gsoc2013-evolution-f19241d136043d5cfffbfbaf5b2d6d1affc70682.zip
Use e_cal_client_connect().
Instead of e_client_utils_open_new() or e_cal_client_new().
Diffstat (limited to 'calendar/gui')
-rw-r--r--calendar/gui/dialogs/copy-source-dialog.c59
-rw-r--r--calendar/gui/dialogs/event-page.c59
-rw-r--r--calendar/gui/dialogs/memo-page.c58
-rw-r--r--calendar/gui/dialogs/task-page.c59
-rw-r--r--calendar/gui/e-calendar-selector.c25
-rw-r--r--calendar/gui/e-memo-list-selector.c50
-rw-r--r--calendar/gui/e-task-list-selector.c50
7 files changed, 195 insertions, 165 deletions
diff --git a/calendar/gui/dialogs/copy-source-dialog.c b/calendar/gui/dialogs/copy-source-dialog.c
index f8b668b933..0f0dc0545e 100644
--- a/calendar/gui/dialogs/copy-source-dialog.c
+++ b/calendar/gui/dialogs/copy-source-dialog.c
@@ -36,7 +36,7 @@
typedef struct {
GtkWindow *parent;
ESource *orig_source;
- EClientSourceType obj_type;
+ ECalClientSourceType obj_type;
ESource *selected_source;
ECalClient *source_client, *dest_client;
} CopySourceDialogData;
@@ -99,27 +99,28 @@ free_copy_data (CopySourceDialogData *csdd)
}
static void
-dest_source_opened_cb (GObject *source_object,
- GAsyncResult *result,
- gpointer user_data)
+dest_source_connected_cb (GObject *source_object,
+ GAsyncResult *result,
+ gpointer user_data)
{
- ESource *source = E_SOURCE (source_object);
CopySourceDialogData *csdd = user_data;
- EClient *client = NULL;
+ EClient *client;
GError *error = NULL;
- e_client_utils_open_new_finish (source, result, &client, &error);
+ client = e_cal_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);
show_error (csdd, _("Could not open destination"), error);
g_error_free (error);
free_copy_data (csdd);
return;
}
- g_return_if_fail (E_IS_CLIENT (client));
-
csdd->dest_client = E_CAL_CLIENT (client);
/* check if the destination is read only */
@@ -174,32 +175,33 @@ dest_source_opened_cb (GObject *source_object,
}
static void
-orig_source_opened_cb (GObject *source_object,
- GAsyncResult *result,
- gpointer user_data)
+orig_source_connected_cb (GObject *source_object,
+ GAsyncResult *result,
+ gpointer user_data)
{
- ESource *source = E_SOURCE (source_object);
CopySourceDialogData *csdd = user_data;
- EClient *client = NULL;
+ EClient *client;
GError *error = NULL;
- e_client_utils_open_new_finish (source, result, &client, &error);
+ client = e_cal_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);
show_error (csdd, _("Could not open source"), error);
g_error_free (error);
free_copy_data (csdd);
return;
}
- g_return_if_fail (E_IS_CLIENT (client));
-
csdd->source_client = E_CAL_CLIENT (client);
- e_client_utils_open_new (
- csdd->selected_source, csdd->obj_type, FALSE, NULL,
- dest_source_opened_cb, csdd);
+ e_cal_client_connect (
+ csdd->selected_source, csdd->obj_type, NULL,
+ dest_source_connected_cb, csdd);
}
static void
@@ -210,17 +212,15 @@ copy_source (const CopySourceDialogData *const_csdd)
if (!const_csdd->selected_source)
return;
- g_return_if_fail (const_csdd->obj_type != E_CLIENT_SOURCE_TYPE_LAST);
-
csdd = g_new0 (CopySourceDialogData, 1);
csdd->parent = const_csdd->parent;
csdd->orig_source = g_object_ref (const_csdd->orig_source);
csdd->obj_type = const_csdd->obj_type;
csdd->selected_source = g_object_ref (const_csdd->selected_source);
- e_client_utils_open_new (
- csdd->orig_source, csdd->obj_type, FALSE, NULL,
- orig_source_opened_cb, csdd);
+ e_cal_client_connect (
+ csdd->orig_source, csdd->obj_type, NULL,
+ orig_source_connected_cb, csdd);
}
/**
@@ -246,10 +246,7 @@ copy_source_dialog (GtkWindow *parent,
csdd.parent = parent;
csdd.orig_source = source;
csdd.selected_source = NULL;
- csdd.obj_type = obj_type == E_CAL_CLIENT_SOURCE_TYPE_EVENTS ? E_CLIENT_SOURCE_TYPE_EVENTS :
- obj_type == E_CAL_CLIENT_SOURCE_TYPE_TASKS ? E_CLIENT_SOURCE_TYPE_TASKS :
- obj_type == E_CAL_CLIENT_SOURCE_TYPE_MEMOS ? E_CLIENT_SOURCE_TYPE_MEMOS :
- E_CLIENT_SOURCE_TYPE_LAST;
+ csdd.obj_type = obj_type;
csdd.selected_source = select_source_dialog (
parent, registry, obj_type, source);
diff --git a/calendar/gui/dialogs/event-page.c b/calendar/gui/dialogs/event-page.c
index c12b7c7360..6850a3b151 100644
--- a/calendar/gui/dialogs/event-page.c
+++ b/calendar/gui/dialogs/event-page.c
@@ -183,7 +183,7 @@ struct _EventPagePrivate {
/* either with-user-time or without it */
const gint *alarm_map;
- GCancellable *open_cancellable;
+ GCancellable *connect_cancellable;
};
static void event_page_set_dates (CompEditorPage *page, CompEditorPageDates *dates);
@@ -878,10 +878,10 @@ event_page_dispose (GObject *object)
priv = EVENT_PAGE_GET_PRIVATE (object);
- if (priv->open_cancellable) {
- g_cancellable_cancel (priv->open_cancellable);
- g_object_unref (priv->open_cancellable);
- priv->open_cancellable = NULL;
+ if (priv->connect_cancellable != NULL) {
+ g_cancellable_cancel (priv->connect_cancellable);
+ g_object_unref (priv->connect_cancellable);
+ priv->connect_cancellable = NULL;
}
if (priv->location_completion != NULL) {
@@ -1842,7 +1842,6 @@ event_page_init (EventPage *epage)
epage->priv->alarm_interval = -1;
epage->priv->alarm_map = alarm_map_with_user_time;
epage->priv->location_completion = gtk_entry_completion_new ();
- epage->priv->open_cancellable = NULL;
}
void
@@ -2988,23 +2987,27 @@ event_page_send_options_clicked_cb (EventPage *epage)
}
static void
-epage_client_opened_cb (GObject *source_object,
- GAsyncResult *result,
- gpointer user_data)
+epage_client_connect_cb (GObject *source_object,
+ GAsyncResult *result,
+ gpointer user_data)
{
- ESource *source = E_SOURCE (source_object);
- EClient *client = NULL;
+ EClient *client;
EventPage *epage = user_data;
EventPagePrivate *priv;
CompEditor *editor;
GError *error = NULL;
- if (!e_client_utils_open_new_finish (source, result, &client, &error)) {
- if (g_error_matches (error, E_CLIENT_ERROR, E_CLIENT_ERROR_CANCELLED) ||
- g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) {
- g_clear_error (&error);
- return;
- }
+ client = e_cal_client_connect_finish (result, &error);
+
+ /* Sanity check. */
+ g_return_if_fail (
+ ((client != NULL) && (error == NULL)) ||
+ ((client == NULL) && (error != NULL)));
+
+ if (g_error_matches (error, E_CLIENT_ERROR, E_CLIENT_ERROR_CANCELLED) ||
+ g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) {
+ g_clear_error (&error);
+ return;
}
editor = comp_editor_page_get_editor (COMP_EDITOR_PAGE (epage));
@@ -3013,9 +3016,13 @@ epage_client_opened_cb (GObject *source_object,
if (error) {
GtkWidget *dialog;
ECalClient *old_client;
+ ESource *source;
old_client = comp_editor_get_client (editor);
+ source = e_source_combo_box_ref_active (
+ E_SOURCE_COMBO_BOX (priv->source_combo_box));
+
e_source_combo_box_set_active (
E_SOURCE_COMBO_BOX (priv->source_combo_box),
e_client_get_source (E_CLIENT (old_client)));
@@ -3029,6 +3036,8 @@ epage_client_opened_cb (GObject *source_object,
gtk_dialog_run (GTK_DIALOG (dialog));
gtk_widget_destroy (dialog);
+ g_object_unref (source);
+
g_clear_error (&error);
} else {
gchar *backend_addr = NULL;
@@ -3074,16 +3083,16 @@ source_changed_cb (ESourceComboBox *source_combo_box,
source = e_source_combo_box_ref_active (source_combo_box);
g_return_if_fail (source != NULL);
- if (priv->open_cancellable) {
- g_cancellable_cancel (priv->open_cancellable);
- g_object_unref (priv->open_cancellable);
+ if (priv->connect_cancellable != NULL) {
+ g_cancellable_cancel (priv->connect_cancellable);
+ g_object_unref (priv->connect_cancellable);
}
- priv->open_cancellable = g_cancellable_new ();
+ priv->connect_cancellable = g_cancellable_new ();
- e_client_utils_open_new (
- source, E_CLIENT_SOURCE_TYPE_EVENTS,
- FALSE, priv->open_cancellable,
- epage_client_opened_cb, epage);
+ e_cal_client_connect (
+ source, E_CAL_CLIENT_SOURCE_TYPE_EVENTS,
+ priv->connect_cancellable,
+ epage_client_connect_cb, epage);
g_object_unref (source);
}
diff --git a/calendar/gui/dialogs/memo-page.c b/calendar/gui/dialogs/memo-page.c
index d6f9d93ffc..a93068cb14 100644
--- a/calendar/gui/dialogs/memo-page.c
+++ b/calendar/gui/dialogs/memo-page.c
@@ -85,7 +85,7 @@ struct _MemoPagePrivate {
ENameSelector *name_selector;
- GCancellable *open_cancellable;
+ GCancellable *connect_cancellable;
};
static void set_subscriber_info_string (MemoPage *mpage, const gchar *backend_address);
@@ -187,10 +187,10 @@ memo_page_dispose (GObject *object)
priv = MEMO_PAGE_GET_PRIVATE (object);
- if (priv->open_cancellable) {
- g_cancellable_cancel (priv->open_cancellable);
- g_object_unref (priv->open_cancellable);
- priv->open_cancellable = NULL;
+ if (priv->connect_cancellable != NULL) {
+ g_cancellable_cancel (priv->connect_cancellable);
+ g_object_unref (priv->connect_cancellable);
+ priv->connect_cancellable = NULL;
}
g_strfreev (priv->address_strings);
@@ -941,23 +941,27 @@ categories_clicked_cb (GtkWidget *button,
}
static void
-mpage_client_opened_cb (GObject *source_object,
- GAsyncResult *result,
- gpointer user_data)
+mpage_client_connect_cb (GObject *source_object,
+ GAsyncResult *result,
+ gpointer user_data)
{
- ESource *source = E_SOURCE (source_object);
- EClient *client = NULL;
+ EClient *client;
MemoPage *mpage = user_data;
MemoPagePrivate *priv;
CompEditor *editor;
GError *error = NULL;
- if (!e_client_utils_open_new_finish (source, result, &client, &error)) {
- if (g_error_matches (error, E_CLIENT_ERROR, E_CLIENT_ERROR_CANCELLED) ||
- g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) {
- g_clear_error (&error);
- return;
- }
+ client = e_cal_client_connect_finish (result, &error);
+
+ /* Sanity check. */
+ g_return_if_fail (
+ ((client != NULL) && (error == NULL)) ||
+ ((client == NULL) && (error != NULL)));
+
+ if (g_error_matches (error, E_CLIENT_ERROR, E_CLIENT_ERROR_CANCELLED) ||
+ g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) {
+ g_clear_error (&error);
+ return;
}
editor = comp_editor_page_get_editor (COMP_EDITOR_PAGE (mpage));
@@ -966,9 +970,13 @@ mpage_client_opened_cb (GObject *source_object,
if (error != NULL) {
GtkWidget *dialog;
ECalClient *old_client;
+ ESource *source;
old_client = comp_editor_get_client (editor);
+ source = e_source_combo_box_ref_active (
+ E_SOURCE_COMBO_BOX (priv->source_combo_box));
+
e_source_combo_box_set_active (
E_SOURCE_COMBO_BOX (priv->source_combo_box),
e_client_get_source (E_CLIENT (old_client)));
@@ -982,6 +990,8 @@ mpage_client_opened_cb (GObject *source_object,
gtk_dialog_run (GTK_DIALOG (dialog));
gtk_widget_destroy (dialog);
+ g_object_unref (source);
+
g_clear_error (&error);
} else {
icaltimezone *zone;
@@ -1025,16 +1035,16 @@ source_changed_cb (ESourceComboBox *source_combo_box,
source = e_source_combo_box_ref_active (source_combo_box);
g_return_if_fail (source != NULL);
- if (priv->open_cancellable) {
- g_cancellable_cancel (priv->open_cancellable);
- g_object_unref (priv->open_cancellable);
+ if (priv->connect_cancellable != NULL) {
+ g_cancellable_cancel (priv->connect_cancellable);
+ g_object_unref (priv->connect_cancellable);
}
- priv->open_cancellable = g_cancellable_new ();
+ priv->connect_cancellable = g_cancellable_new ();
- e_client_utils_open_new (
- source, E_CLIENT_SOURCE_TYPE_MEMOS,
- FALSE, priv->open_cancellable,
- mpage_client_opened_cb, mpage);
+ e_cal_client_connect (
+ source, E_CAL_CLIENT_SOURCE_TYPE_MEMOS,
+ priv->connect_cancellable,
+ mpage_client_connect_cb, mpage);
g_object_unref (source);
}
diff --git a/calendar/gui/dialogs/task-page.c b/calendar/gui/dialogs/task-page.c
index b8324331c8..b728b6f873 100644
--- a/calendar/gui/dialogs/task-page.c
+++ b/calendar/gui/dialogs/task-page.c
@@ -113,7 +113,7 @@ struct _TaskPagePrivate {
ESendOptionsDialog *sod;
- GCancellable *open_cancellable;
+ GCancellable *connect_cancellable;
};
static const gint classification_map[] = {
@@ -399,10 +399,10 @@ task_page_dispose (GObject *object)
priv = TASK_PAGE_GET_PRIVATE (object);
- if (priv->open_cancellable) {
- g_cancellable_cancel (priv->open_cancellable);
- g_object_unref (priv->open_cancellable);
- priv->open_cancellable = NULL;
+ if (priv->connect_cancellable != NULL) {
+ g_cancellable_cancel (priv->connect_cancellable);
+ g_object_unref (priv->connect_cancellable);
+ priv->connect_cancellable = NULL;
}
if (priv->main != NULL) {
@@ -1049,7 +1049,6 @@ task_page_init (TaskPage *tpage)
{
tpage->priv = TASK_PAGE_GET_PRIVATE (tpage);
tpage->priv->deleted_attendees = g_ptr_array_new ();
- tpage->priv->open_cancellable = NULL;
}
void
@@ -1785,23 +1784,27 @@ due_date_changed_cb (TaskPage *tpage)
}
static void
-tpage_client_opened_cb (GObject *source_object,
- GAsyncResult *result,
- gpointer user_data)
+tpage_client_connect_cb (GObject *source_object,
+ GAsyncResult *result,
+ gpointer user_data)
{
- ESource *source = E_SOURCE (source_object);
- EClient *client = NULL;
+ EClient *client;
TaskPage *tpage = user_data;
TaskPagePrivate *priv;
CompEditor *editor;
GError *error = NULL;
- if (!e_client_utils_open_new_finish (source, result, &client, &error)) {
- if (g_error_matches (error, E_CLIENT_ERROR, E_CLIENT_ERROR_CANCELLED) ||
- g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) {
- g_clear_error (&error);
- return;
- }
+ client = e_cal_client_connect_finish (result, &error);
+
+ /* Sanity check. */
+ g_return_if_fail (
+ ((client != NULL) && (error == NULL)) ||
+ ((client == NULL) && (error != NULL)));
+
+ if (g_error_matches (error, E_CLIENT_ERROR, E_CLIENT_ERROR_CANCELLED) ||
+ g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) {
+ g_clear_error (&error);
+ return;
}
editor = comp_editor_page_get_editor (COMP_EDITOR_PAGE (tpage));
@@ -1809,9 +1812,13 @@ tpage_client_opened_cb (GObject *source_object,
if (error) {
GtkWidget *dialog;
ECalClient *old_client;
+ ESource *source;
old_client = comp_editor_get_client (editor);
+ source = e_source_combo_box_ref_active (
+ E_SOURCE_COMBO_BOX (priv->source_combo_box));
+
e_source_combo_box_set_active (
E_SOURCE_COMBO_BOX (priv->source_combo_box),
e_client_get_source (E_CLIENT (old_client)));
@@ -1825,6 +1832,8 @@ tpage_client_opened_cb (GObject *source_object,
gtk_dialog_run (GTK_DIALOG (dialog));
gtk_widget_destroy (dialog);
+ g_object_unref (source);
+
g_clear_error (&error);
} else {
icaltimezone *zone;
@@ -1871,16 +1880,16 @@ source_changed_cb (ESourceComboBox *source_combo_box,
source = e_source_combo_box_ref_active (source_combo_box);
g_return_if_fail (source != NULL);
- if (priv->open_cancellable) {
- g_cancellable_cancel (priv->open_cancellable);
- g_object_unref (priv->open_cancellable);
+ if (priv->connect_cancellable != NULL) {
+ g_cancellable_cancel (priv->connect_cancellable);
+ g_object_unref (priv->connect_cancellable);
}
- priv->open_cancellable = g_cancellable_new ();
+ priv->connect_cancellable = g_cancellable_new ();
- e_client_utils_open_new (
- source, E_CLIENT_SOURCE_TYPE_TASKS,
- FALSE, priv->open_cancellable,
- tpage_client_opened_cb, tpage);
+ e_cal_client_connect (
+ source, E_CAL_CLIENT_SOURCE_TYPE_TASKS,
+ priv->connect_cancellable,
+ tpage_client_connect_cb, tpage);
g_object_unref (source);
}
diff --git a/calendar/gui/e-calendar-selector.c b/calendar/gui/e-calendar-selector.c
index 19eb4335b1..798280f852 100644
--- a/calendar/gui/e-calendar-selector.c
+++ b/calendar/gui/e-calendar-selector.c
@@ -117,29 +117,30 @@ calendar_selector_update_objects (ECalClient *client,
}
static void
-client_opened_cb (GObject *source_object,
- GAsyncResult *result,
- gpointer user_data)
+client_connect_cb (GObject *source_object,
+ GAsyncResult *result,
+ gpointer user_data)
{
- ESource *source = E_SOURCE (source_object);
- EClient *client = NULL;
+ EClient *client;
icalcomponent *icalcomp = user_data;
GError *error = NULL;
g_return_if_fail (icalcomp != NULL);
- e_client_utils_open_new_finish (source, result, &client, &error);
+ client = e_cal_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 client: %s",
G_STRFUNC, error->message);
g_error_free (error);
}
- g_return_if_fail (E_IS_CLIENT (client));
-
calendar_selector_update_objects (E_CAL_CLIENT (client), icalcomp);
g_object_unref (client);
@@ -191,9 +192,9 @@ calendar_selector_data_dropped (ESourceSelector *selector,
icalcomponent_set_uid (icalcomp, uid);
}
- e_client_utils_open_new (
- destination, E_CLIENT_SOURCE_TYPE_EVENTS, FALSE, NULL,
- client_opened_cb, icalcomp);
+ e_cal_client_connect (
+ destination, E_CAL_CLIENT_SOURCE_TYPE_EVENTS, NULL,
+ client_connect_cb, icalcomp);
success = TRUE;
diff --git a/calendar/gui/e-memo-list-selector.c b/calendar/gui/e-memo-list-selector.c
index 366d41e702..74ca1d1b64 100644
--- a/calendar/gui/e-memo-list-selector.c
+++ b/calendar/gui/e-memo-list-selector.c
@@ -118,21 +118,24 @@ memo_list_selector_update_objects (ECalClient *client,
}
static void
-client_opened_cb (GObject *source_object,
- GAsyncResult *result,
- gpointer user_data)
+client_connect_cb (GObject *source_object,
+ GAsyncResult *result,
+ gpointer user_data)
{
- ESource *source = E_SOURCE (source_object);
- EClient *client = NULL;
+ EClient *client;
gchar *uid = user_data;
GError *error = NULL;
g_return_if_fail (uid != NULL);
- e_client_utils_open_new_finish (source, result, &client, &error);
+ client = e_cal_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 memo list: %s",
G_STRFUNC, error->message);
@@ -140,8 +143,6 @@ client_opened_cb (GObject *source_object,
goto exit;
}
- g_return_if_fail (E_IS_CLIENT (client));
-
if (!e_client_is_readonly (client))
e_cal_client_remove_object_sync (
E_CAL_CLIENT (client), uid, NULL,
@@ -205,9 +206,9 @@ memo_list_selector_process_data (ESourceSelector *selector,
source = e_source_registry_ref_source (registry, source_uid);
if (source != NULL) {
- e_client_utils_open_new (
- source, E_CLIENT_SOURCE_TYPE_MEMOS, TRUE, NULL,
- client_opened_cb, g_strdup (old_uid));
+ e_cal_client_connect (
+ source, E_CAL_CLIENT_SOURCE_TYPE_MEMOS, NULL,
+ client_connect_cb, g_strdup (old_uid));
g_object_unref (source);
}
@@ -225,23 +226,26 @@ struct DropData
};
static void
-client_opened_for_drop_cb (GObject *source_object,
- GAsyncResult *result,
- gpointer user_data)
+client_connect_for_drop_cb (GObject *source_object,
+ GAsyncResult *result,
+ gpointer user_data)
{
- ESource *source = E_SOURCE (source_object);
struct DropData *dd = user_data;
- EClient *client = NULL;
+ EClient *client;
ECalClient *cal_client;
GSList *iter;
GError *error = NULL;
g_return_if_fail (dd != NULL);
- e_client_utils_open_new_finish (source, result, &client, &error);
+ client = e_cal_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 memo list: %s",
G_STRFUNC, error->message);
@@ -249,8 +253,6 @@ client_opened_for_drop_cb (GObject *source_object,
goto exit;
}
- g_return_if_fail (E_IS_CLIENT (client));
-
cal_client = E_CAL_CLIENT (client);
for (iter = dd->list; iter != NULL; iter = iter->next) {
@@ -316,9 +318,9 @@ memo_list_selector_data_dropped (ESourceSelector *selector,
dd->action = action;
dd->list = cal_comp_selection_get_string_list (selection_data);
- e_client_utils_open_new (
- destination, E_CLIENT_SOURCE_TYPE_MEMOS, TRUE, NULL,
- client_opened_for_drop_cb, dd);
+ e_cal_client_connect (
+ destination, E_CAL_CLIENT_SOURCE_TYPE_MEMOS, NULL,
+ client_connect_for_drop_cb, dd);
return TRUE;
}
diff --git a/calendar/gui/e-task-list-selector.c b/calendar/gui/e-task-list-selector.c
index 0989e7436c..151967f7f4 100644
--- a/calendar/gui/e-task-list-selector.c
+++ b/calendar/gui/e-task-list-selector.c
@@ -119,21 +119,24 @@ task_list_selector_update_objects (ECalClient *client,
}
static void
-client_opened_cb (GObject *source_object,
- GAsyncResult *result,
- gpointer user_data)
+client_connect_cb (GObject *source_object,
+ GAsyncResult *result,
+ gpointer user_data)
{
- ESource *source = E_SOURCE (source_object);
- EClient *client = NULL;
+ EClient *client;
gchar *uid = user_data;
GError *error = NULL;
g_return_if_fail (uid != NULL);
- e_client_utils_open_new_finish (source, result, &client, &error);
+ client = e_cal_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 task list: %s",
G_STRFUNC, error->message);
@@ -141,8 +144,6 @@ client_opened_cb (GObject *source_object,
goto exit;
}
- g_return_if_fail (E_IS_CLIENT (client));
-
if (!e_client_is_readonly (client))
e_cal_client_remove_object_sync (
E_CAL_CLIENT (client), uid, NULL,
@@ -207,9 +208,9 @@ task_list_selector_process_data (ESourceSelector *selector,
source = e_source_registry_ref_source (registry, source_uid);
if (source != NULL) {
- e_client_utils_open_new (
- source, E_CLIENT_SOURCE_TYPE_MEMOS, TRUE, NULL,
- client_opened_cb, g_strdup (old_uid));
+ e_cal_client_connect (
+ source, E_CAL_CLIENT_SOURCE_TYPE_MEMOS, NULL,
+ client_connect_cb, g_strdup (old_uid));
g_object_unref (source);
}
@@ -227,23 +228,26 @@ struct DropData
};
static void
-client_opened_for_drop_cb (GObject *source_object,
- GAsyncResult *result,
- gpointer user_data)
+client_connect_for_drop_cb (GObject *source_object,
+ GAsyncResult *result,
+ gpointer user_data)
{
- ESource *source = E_SOURCE (source_object);
struct DropData *dd = user_data;
- EClient *client = NULL;
+ EClient *client;
ECalClient *cal_client;
GSList *iter;
GError *error = NULL;
g_return_if_fail (dd != NULL);
- e_client_utils_open_new_finish (source, result, &client, &error);
+ client = e_cal_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 task list: %s",
G_STRFUNC, error->message);
@@ -251,8 +255,6 @@ client_opened_for_drop_cb (GObject *source_object,
goto exit;
}
- g_return_if_fail (E_IS_CLIENT (client));
-
cal_client = E_CAL_CLIENT (client);
for (iter = dd->list; iter != NULL; iter = iter->next) {
@@ -318,9 +320,9 @@ task_list_selector_data_dropped (ESourceSelector *selector,
dd->action = action;
dd->list = cal_comp_selection_get_string_list (selection_data);
- e_client_utils_open_new (
- destination, E_CLIENT_SOURCE_TYPE_TASKS, TRUE, NULL,
- client_opened_for_drop_cb, dd);
+ e_cal_client_connect (
+ destination, E_CAL_CLIENT_SOURCE_TYPE_TASKS, NULL,
+ client_connect_for_drop_cb, dd);
return TRUE;
}