[evolution-kolab] kolab-util-backend: rewrite of the KolabMailAccess deployment helper
- From: Christian Hilberg <chilberg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-kolab] kolab-util-backend: rewrite of the KolabMailAccess deployment helper
- Date: Thu, 20 Sep 2012 15:30:41 +0000 (UTC)
commit 788f367811ed6f456df81ebf8f8f51bcfba9a683
Author: Christian Hilberg <hilberg kernelconcepts de>
Date: Thu Sep 20 15:03:38 2012 +0200
kolab-util-backend: rewrite of the KolabMailAccess deployment helper
* simplified code
* fixed error handling
src/libekolab/kolab-util-backend.c | 36 ++++++++++++++++++------------------
1 files changed, 18 insertions(+), 18 deletions(-)
---
diff --git a/src/libekolab/kolab-util-backend.c b/src/libekolab/kolab-util-backend.c
index dce3cf4..a5c140b 100644
--- a/src/libekolab/kolab-util-backend.c
+++ b/src/libekolab/kolab-util-backend.c
@@ -523,37 +523,37 @@ kolab_util_backend_deploy_mode_by_backend (KolabMailAccess *koma,
GCancellable *cancellable,
GError **error)
{
- KolabMailAccessOpmodeID koma_mode = KOLAB_MAIL_ACCESS_OPMODE_INVAL;
+ KolabMailAccessOpmodeID koma_mode = KOLAB_MAIL_ACCESS_OPMODE_OFFLINE;
KolabMailAccessOpmodeID tmp_mode = KOLAB_MAIL_ACCESS_OPMODE_INVAL;
GError *tmp_err = NULL;
g_debug ("%s()[%u] called.", __func__, __LINE__);
- if (koma != NULL) g_assert (KOLAB_IS_MAIL_ACCESS (koma));
- g_assert (koma_mode < KOLAB_MAIL_ACCESS_LAST_OPMODE);
+ g_return_val_if_fail (KOLAB_IS_MAIL_ACCESS (koma), FALSE);
/* cancellable may be NULL */
g_return_val_if_fail (error == NULL || *error == NULL, KOLAB_MAIL_ACCESS_OPMODE_INVAL);
- if (koma == NULL) {
- g_debug ("%s()[%u] error: KolabMailAccess object not existent.",
- __func__, __LINE__);
- /* FIXME set GError */
- return KOLAB_MAIL_ACCESS_OPMODE_INVAL;
- }
-
- switch (online) {
- case FALSE:
- koma_mode = KOLAB_MAIL_ACCESS_OPMODE_OFFLINE;
- break;
- default:
+ if (online)
koma_mode = KOLAB_MAIL_ACCESS_OPMODE_ONLINE;
- }
+
tmp_mode = kolab_util_backend_deploy_mode_by_koma (koma,
koma_mode,
cancellable,
&tmp_err);
- if (tmp_err != NULL)
+ if (tmp_err != NULL) {
g_propagate_error (error, tmp_err);
+ return FALSE;
+ }
- return tmp_mode == koma_mode;
+ if (tmp_mode != koma_mode) {
+ g_warning ("%s()[%u] KolabMailAccess did not set its GError on failure",
+ __func__, __LINE__);
+ g_set_error (error,
+ KOLAB_BACKEND_ERROR,
+ KOLAB_BACKEND_ERROR_INTERNAL,
+ _("Kolab engine did not switch into requested operational mode"));
+ return FALSE;
+ }
+
+ return TRUE;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]