Commit adc11731 authored by Milan Crha's avatar Milan Crha Committed by Rodrigo Moya
Browse files

Check for cancelled GIO operation error code too

parent 8894b72f
......@@ -213,7 +213,8 @@ e_contact_editor_contact_added (EABEditor *editor,
if (!error)
return;
if (g_error_matches (error, E_CLIENT_ERROR, E_CLIENT_ERROR_CANCELLED))
if (g_error_matches (error, E_CLIENT_ERROR, E_CLIENT_ERROR_CANCELLED) ||
g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
return;
eab_error_dialog (NULL, _("Error adding contact"), error);
......@@ -227,7 +228,8 @@ e_contact_editor_contact_modified (EABEditor *editor,
if (!error)
return;
if (g_error_matches (error, E_CLIENT_ERROR, E_CLIENT_ERROR_CANCELLED))
if (g_error_matches (error, E_CLIENT_ERROR, E_CLIENT_ERROR_CANCELLED) ||
g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
return;
eab_error_dialog (NULL, _("Error modifying contact"), error);
......@@ -241,7 +243,8 @@ e_contact_editor_contact_deleted (EABEditor *editor,
if (!error)
return;
if (g_error_matches (error, E_CLIENT_ERROR, E_CLIENT_ERROR_CANCELLED))
if (g_error_matches (error, E_CLIENT_ERROR, E_CLIENT_ERROR_CANCELLED) ||
g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
return;
eab_error_dialog (NULL, _("Error removing contact"), error);
......@@ -2983,8 +2986,8 @@ contact_editor_book_loaded_cb (GObject *source_object,
if (!e_client_utils_open_new_finish (source, result, &client, &error))
client = NULL;
if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED) ||
g_error_matches (error, E_CLIENT_ERROR, E_CLIENT_ERROR_CANCELLED)) {
if (g_error_matches (error, E_CLIENT_ERROR, E_CLIENT_ERROR_CANCELLED) ||
g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) {
g_warn_if_fail (client == NULL);
g_error_free (error);
} else if (error != NULL) {
......
......@@ -132,8 +132,8 @@ merge_cb (GObject *source_object, GAsyncResult *result, gpointer user_data)
client = NULL;
/* Ignore cancellations. */
if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED) ||
g_error_matches (error, E_CLIENT_ERROR, E_CLIENT_ERROR_CANCELLED)) {
if (g_error_matches (error, E_CLIENT_ERROR, E_CLIENT_ERROR_CANCELLED) ||
g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) {
g_error_free (error);
return;
}
......@@ -277,8 +277,8 @@ ce_have_book (GObject *source_object, GAsyncResult *result, gpointer user_data)
client = NULL;
/* Ignore cancellations. */
if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED) ||
g_error_matches (error, E_CLIENT_ERROR, E_CLIENT_ERROR_CANCELLED)) {
if (g_error_matches (error, E_CLIENT_ERROR, E_CLIENT_ERROR_CANCELLED) ||
g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) {
g_error_free (error);
return;
}
......
......@@ -1410,7 +1410,8 @@ contact_list_editor_contact_added (EABEditor *editor,
if (!error)
return;
if (g_error_matches (error, E_CLIENT_ERROR, E_CLIENT_ERROR_CANCELLED))
if (g_error_matches (error, E_CLIENT_ERROR, E_CLIENT_ERROR_CANCELLED) ||
g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
return;
eab_error_dialog (NULL, _("Error adding list"), error);
......@@ -1424,7 +1425,8 @@ contact_list_editor_contact_modified (EABEditor *editor,
if (!error)
return;
if (g_error_matches (error, E_CLIENT_ERROR, E_CLIENT_ERROR_CANCELLED))
if (g_error_matches (error, E_CLIENT_ERROR, E_CLIENT_ERROR_CANCELLED) ||
g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
return;
eab_error_dialog (NULL, _("Error modifying list"), error);
......@@ -1438,7 +1440,8 @@ contact_list_editor_contact_deleted (EABEditor *editor,
if (!error)
return;
if (g_error_matches (error, E_CLIENT_ERROR, E_CLIENT_ERROR_CANCELLED))
if (g_error_matches (error, E_CLIENT_ERROR, E_CLIENT_ERROR_CANCELLED) ||
g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
return;
eab_error_dialog (NULL, _("Error removing list"), error);
......
......@@ -1259,7 +1259,8 @@ report_and_free_error_if_any (GError *error)
if (!error)
return;
if (g_error_matches (error, E_CLIENT_ERROR, E_CLIENT_ERROR_CANCELLED)) {
if (g_error_matches (error, E_CLIENT_ERROR, E_CLIENT_ERROR_CANCELLED) ||
g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) {
g_error_free (error);
return;
}
......
......@@ -441,11 +441,12 @@ contact_added_cb (EBookClient *book_client, const GError *error, const gchar *id
{
ContactCopyProcess *process = user_data;
if (error && !g_error_matches (error, E_CLIENT_ERROR, E_CLIENT_ERROR_CANCELLED)) {
if (error && !g_error_matches (error, E_CLIENT_ERROR, E_CLIENT_ERROR_CANCELLED) &&
!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) {
process->book_status = FALSE;
eab_error_dialog (process->alert_sink, _("Error adding contact"), error);
}
else if (g_error_matches (error, E_CLIENT_ERROR, E_CLIENT_ERROR_CANCELLED)) {
} else if (g_error_matches (error, E_CLIENT_ERROR, E_CLIENT_ERROR_CANCELLED) ||
g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) {
process->book_status = FALSE;
}
else {
......
......@@ -378,7 +378,8 @@ changes_view_ready_cb (GObject *source_object, GAsyncResult *result, gpointer us
g_error_free (error);
}
} else if (error) {
if (!g_error_matches (error, E_CLIENT_ERROR, E_CLIENT_ERROR_CANCELLED))
if (!g_error_matches (error, E_CLIENT_ERROR, E_CLIENT_ERROR_CANCELLED) &&
!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
g_debug ("%s: Failed to get view: %s", G_STRFUNC, error->message);
g_error_free (error);
}
......
......@@ -1654,7 +1654,8 @@ search_address_in_addressbooks (const gchar *address,
book_client = e_book_client_new (source, &err);
if (book_client == NULL) {
if (err && g_error_matches (err, E_CLIENT_ERROR, E_CLIENT_ERROR_CANCELLED)) {
if (err && (g_error_matches (err, E_CLIENT_ERROR, E_CLIENT_ERROR_CANCELLED) ||
g_error_matches (err, G_IO_ERROR, G_IO_ERROR_CANCELLED))) {
stop = TRUE;
} else if (err) {
gchar *source_uid;
......@@ -1677,7 +1678,8 @@ search_address_in_addressbooks (const gchar *address,
g_object_unref (book_client);
book_client = NULL;
if (err && g_error_matches (err, E_CLIENT_ERROR, E_CLIENT_ERROR_CANCELLED)) {
if (err && (g_error_matches (err, E_CLIENT_ERROR, E_CLIENT_ERROR_CANCELLED) ||
g_error_matches (err, G_IO_ERROR, G_IO_ERROR_CANCELLED))) {
stop = TRUE;
} else if (err) {
gchar *source_uid;
......@@ -1724,8 +1726,9 @@ search_address_in_addressbooks (const gchar *address,
g_slist_free (contacts);
}
} else if (book_client) {
stop = stop || (err && g_error_matches (
err, E_CLIENT_ERROR, E_CLIENT_ERROR_CANCELLED));
stop = stop || (err &&
(g_error_matches (err, E_CLIENT_ERROR, E_CLIENT_ERROR_CANCELLED) ||
g_error_matches (err, G_IO_ERROR, G_IO_ERROR_CANCELLED)));
if (err && !stop) {
gchar *source_uid = g_strdup (e_source_peek_uid (source));
......
......@@ -325,8 +325,8 @@ cal_shell_sidebar_default_loaded_cb (GObject *source_object, GAsyncResult *resul
if (!e_client_utils_open_new_finish (E_SOURCE (source_object), result, &client, &error))
client = NULL;
if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED) ||
g_error_matches (error, E_CLIENT_ERROR, E_CLIENT_ERROR_CANCELLED)) {
if (g_error_matches (error, E_CLIENT_ERROR, E_CLIENT_ERROR_CANCELLED) ||
g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) {
g_error_free (error);
goto exit;
}
......
......@@ -319,8 +319,8 @@ memo_shell_sidebar_default_loaded_cb (GObject *source_object, GAsyncResult *resu
if (!e_client_utils_open_new_finish (E_SOURCE (source_object), result, &client, &error))
client = NULL;
if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED) ||
g_error_matches (error, E_CLIENT_ERROR, E_CLIENT_ERROR_CANCELLED)) {
if (g_error_matches (error, E_CLIENT_ERROR, E_CLIENT_ERROR_CANCELLED) ||
g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) {
g_error_free (error);
goto exit;
}
......
......@@ -319,8 +319,8 @@ task_shell_sidebar_default_loaded_cb (GObject *source_object, GAsyncResult *resu
if (!e_client_utils_open_new_finish (E_SOURCE (source_object), result, &client, &error))
client = NULL;
if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED) ||
g_error_matches (error, E_CLIENT_ERROR, E_CLIENT_ERROR_CANCELLED)) {
if (g_error_matches (error, E_CLIENT_ERROR, E_CLIENT_ERROR_CANCELLED) ||
g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) {
g_error_free (error);
goto exit;
}
......
......@@ -508,7 +508,8 @@ cal_opened_cb (GObject *source_object, GAsyncResult *result, gpointer user_data)
if (!e_client_utils_open_new_finish (source, result, &client, &error)) {
client = NULL;
if (g_error_matches (error, E_CLIENT_ERROR, E_CLIENT_ERROR_CANCELLED)) {
if (g_error_matches (error, E_CLIENT_ERROR, E_CLIENT_ERROR_CANCELLED) ||
g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) {
g_error_free (error);
return;
}
......@@ -801,6 +802,16 @@ get_object_without_rid_ready_cb (GObject *source_object, GAsyncResult *result, g
if (!e_cal_client_get_object_finish (cal_client, result, &icalcomp, &error))
icalcomp = 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_error_free (error);
find_cal_update_ui (fd, cal_client);
decrease_find_data (fd);
return;
}
g_clear_error (&error);
if (icalcomp) {
fd->puri->current_client = cal_client;
fd->keep_alarm_check = (fd->puri->method == ICAL_METHOD_PUBLISH || fd->puri->method == ICAL_METHOD_REQUEST) &&
......@@ -816,9 +827,6 @@ get_object_without_rid_ready_cb (GObject *source_object, GAsyncResult *result, g
return;
}
if (error)
g_error_free (error);
find_cal_update_ui (fd, cal_client);
decrease_find_data (fd);
}
......@@ -834,6 +842,16 @@ get_object_with_rid_ready_cb (GObject *source_object, GAsyncResult *result, gpoi
if (!e_cal_client_get_object_finish (cal_client, result, &icalcomp, &error))
icalcomp = 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_error_free (error);
find_cal_update_ui (fd, cal_client);
decrease_find_data (fd);
return;
}
g_clear_error (&error);
if (icalcomp) {
fd->puri->current_client = cal_client;
fd->keep_alarm_check = (fd->puri->method == ICAL_METHOD_PUBLISH || fd->puri->method == ICAL_METHOD_REQUEST) &&
......@@ -849,17 +867,6 @@ get_object_with_rid_ready_cb (GObject *source_object, GAsyncResult *result, gpoi
return;
}
if (error) {
if (g_error_matches (error, E_CLIENT_ERROR, E_CLIENT_ERROR_CANCELLED)) {
g_error_free (error);
find_cal_update_ui (fd, cal_client);
decrease_find_data (fd);
return;
}
g_error_free (error);
}
if (fd->rid && *fd->rid) {
e_cal_client_get_object (cal_client, fd->uid, NULL, fd->cancellable, get_object_without_rid_ready_cb, fd);
return;
......@@ -881,7 +888,8 @@ get_object_list_ready_cb (GObject *source_object, GAsyncResult *result, gpointer
objects = NULL;
if (error) {
if (g_error_matches (error, E_CLIENT_ERROR, E_CLIENT_ERROR_CANCELLED)) {
if (g_error_matches (error, E_CLIENT_ERROR, E_CLIENT_ERROR_CANCELLED) ||
g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) {
g_error_free (error);
decrease_find_data (fd);
return;
......@@ -910,7 +918,8 @@ find_cal_opened_cb (GObject *source_object, GAsyncResult *result, gpointer user_
source = E_SOURCE (source_object);
if (!e_client_utils_open_new_finish (source, result, &client, &error)) {
if (g_error_matches (error, E_CLIENT_ERROR, E_CLIENT_ERROR_CANCELLED)) {
if (g_error_matches (error, E_CLIENT_ERROR, E_CLIENT_ERROR_CANCELLED) ||
g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) {
g_error_free (error);
decrease_find_data (fd);
return;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment