[evolution-data-server] camel_imap_store_connected() cleanup.
- From: Matthew Barnes <mbarnes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-data-server] camel_imap_store_connected() cleanup.
- Date: Tue, 25 Oct 2011 19:00:38 +0000 (UTC)
commit b4717d71cc7c56202ecb62d173c22a8cbf2e6d76
Author: Matthew Barnes <mbarnes redhat com>
Date: Tue Oct 25 14:55:39 2011 -0400
camel_imap_store_connected() cleanup.
If camel_service_connect_sync() set a GError, don't overwrite it with a
generic "you must be working online" message. The connect_sync() error
message has useful information to help identify the real problem.
camel/providers/imap/camel-imap-store.c | 32 +++++++++++++++++++++++-------
1 files changed, 24 insertions(+), 8 deletions(-)
---
diff --git a/camel/providers/imap/camel-imap-store.c b/camel/providers/imap/camel-imap-store.c
index 8664d3a..6844799 100644
--- a/camel/providers/imap/camel-imap-store.c
+++ b/camel/providers/imap/camel-imap-store.c
@@ -3188,22 +3188,38 @@ gboolean
camel_imap_store_connected (CamelImapStore *store,
GError **error)
{
+ CamelService *service;
+ CamelOfflineStore *offline_store;
+ gboolean success;
+ GError *local_error = NULL;
+
/* This looks stupid ... because it is.
*
* camel-service-connect will return OK if we connect in 'offline mode',
* which isn't what we want at all. So we have to recheck we actually
* did connect anyway ... */
- if (store->istream != NULL
- || (((camel_offline_store_get_online (CAMEL_OFFLINE_STORE (store)))
- && camel_service_connect_sync ((CamelService *) store, NULL)
- && store->istream != NULL)))
+ if (store->istream != NULL)
+ return TRUE;
+
+ service = CAMEL_SERVICE (store);
+ offline_store = CAMEL_OFFLINE_STORE (store);
+
+ success =
+ camel_offline_store_get_online (offline_store) &&
+ camel_service_connect_sync (service, &local_error);
+
+ if (success && store->istream != NULL)
return TRUE;
- g_set_error (
- error, CAMEL_SERVICE_ERROR,
- CAMEL_SERVICE_ERROR_UNAVAILABLE,
- _("You must be working online to complete this operation"));
+ if (local_error != NULL)
+ g_propagate_error (error, local_error);
+ else
+ g_set_error (
+ error, CAMEL_SERVICE_ERROR,
+ CAMEL_SERVICE_ERROR_UNAVAILABLE,
+ _("You must be working online "
+ "to complete this operation"));
return FALSE;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]