[evolution-kolab/ek-wip-porting: 34/36] KolabMailAccess: reworked handling of folder creation
- From: Christian Hilberg <chilberg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-kolab/ek-wip-porting: 34/36] KolabMailAccess: reworked handling of folder creation
- Date: Tue, 18 Sep 2012 15:22:46 +0000 (UTC)
commit c8c0fc9941f3fdea5500c56269ca64e8808937b7
Author: Christian Hilberg <hilberg kernelconcepts de>
Date: Tue Sep 18 15:20:31 2012 +0200
KolabMailAccess: reworked handling of folder creation
* when creating a new folder, we bypass the whole
transaction handling, which has been implemented
for PIM objects, but is not needed for folder
creation (we may need it, though, for delete)
* fixed error handling so failure of setting the
type annotation of a newly created folder is
properly propagated back to the frontend
src/libekolab/kolab-mail-access.c | 43 +++++++++++++++++++++++-------------
1 files changed, 27 insertions(+), 16 deletions(-)
---
diff --git a/src/libekolab/kolab-mail-access.c b/src/libekolab/kolab-mail-access.c
index 677a82c..a1853ec 100644
--- a/src/libekolab/kolab-mail-access.c
+++ b/src/libekolab/kolab-mail-access.c
@@ -517,9 +517,16 @@ mail_access_local_store (KolabMailAccess *self,
priv = KOLAB_MAIL_ACCESS_PRIVATE (self);
- /* check whether we should create a new folder instead of storing a handle */
- if (kmailhandle == NULL)
+ /* Check whether we should create a new folder instead of storing a handle
+ * (if so, we do bypass the whole transaction handling, which is for handles
+ * only at present). Once we find we need transactions for folder create,
+ * we need to remove the skipping here and actually implement the folder
+ * transactions in KolabMailSynchronizer
+ */
+ if (kmailhandle == NULL) {
+ do_store = TRUE;
goto handle_skip;
+ }
/* get (and replace) local handle */
local_handle = mail_access_local_handle_get (self,
@@ -568,8 +575,6 @@ mail_access_local_store (KolabMailAccess *self,
return FALSE;
}
- handle_skip:
-
do_store = kolab_mail_synchronizer_transaction_prepare (priv->synchronizer,
priv->state->opmode,
KOLAB_MAIL_SYNCHRONIZER_TRANSACTION_TYPE_STORE,
@@ -604,9 +609,6 @@ mail_access_local_store (KolabMailAccess *self,
return FALSE;
}
- if (kmailhandle == NULL)
- goto offline_skip;
-
/* offline store operation (also done in online mode, serves as a
* data loss failsafe guard in case online operation fails. If online
* operation completes successfully, this item is removed from side
@@ -630,7 +632,7 @@ mail_access_local_store (KolabMailAccess *self,
}
}
- offline_skip:
+ handle_skip:
/* online store operation */
if (do_store && (! offline_fail) && (priv->state->opmode == KOLAB_MAIL_ACCESS_OPMODE_ONLINE)) {
@@ -647,6 +649,12 @@ mail_access_local_store (KolabMailAccess *self,
sync_opmode = KOLAB_MAIL_ACCESS_OPMODE_ONLINE;
kolab_mail_handle_set_cache_location (local_handle,
KOLAB_OBJECT_CACHE_LOCATION_IMAP);
+ } else {
+ g_warning ("%s online mode failure: %s",
+ __func__, tmp_err->message);
+ g_error_free (tmp_err);
+ tmp_err = NULL;
+ online_fail = TRUE;
}
} else {
/* create folder (online operation required) */
@@ -655,16 +663,16 @@ mail_access_local_store (KolabMailAccess *self,
foldertype,
cancellable,
&tmp_err);
+
/* TODO check whether we need to update DBs and friends */
+
+ /* we skip the transaction handling again, which is for
+ * mail handles only and does not affect folders in the
+ * 'store' (i.e., folder creation) operation, at present
+ */
+ goto done;
}
- if (tmp_err != NULL) {
- g_warning ("%s online mode failure: %s",
- __func__, tmp_err->message);
- g_error_free (tmp_err);
- tmp_err = NULL;
- online_fail = TRUE;
- }
}
/* set handle incomplete */
@@ -698,7 +706,10 @@ mail_access_local_store (KolabMailAccess *self,
&tmp_err);
}
- kolab_mail_info_db_record_free (record);
+ done:
+
+ if (record != NULL)
+ kolab_mail_info_db_record_free (record);
if (! ok) {
g_propagate_error (err, tmp_err);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]