Patch that fixes an issue in folder removal
- From: Sergio Villar Senin <svillar igalia com>
- To: tinymail devel list <tinymail-devel-list gnome org>
- Subject: Patch that fixes an issue in folder removal
- Date: Wed, 06 Jun 2007 18:09:40 +0300
Hi,
this patch enables tinymail to remove a folder that is just under an
account.
Looking forward for your comments
Br
Index: tny-camel-folder.c
===================================================================
--- tny-camel-folder.c (revision 2081)
+++ tny-camel-folder.c (working copy)
@@ -2771,8 +2771,8 @@
}
-static void
-tny_camel_folder_remove_folder_actual (TnyFolderStore *self, TnyFolder *folder, GError **err)
+void
+_tny_camel_folder_remove_folder_actual (TnyFolderStore *self, TnyFolder *folder, GError **err)
{
TnyCamelFolderPriv *priv = TNY_CAMEL_FOLDER_GET_PRIVATE (self);
CamelStore *store = priv->store;
@@ -2896,7 +2896,7 @@
tny_debug ("tny_folder_store_remove: actual removal of %s\n",
tny_folder_get_name (folder));
- tny_camel_folder_remove_folder_actual (from, folder, &nerr);
+ _tny_camel_folder_remove_folder_actual (from, folder, &nerr);
exception:
Index: tny-camel-account-priv.h
===================================================================
--- tny-camel-account-priv.h (revision 2081)
+++ tny-camel-account-priv.h (working copy)
@@ -28,7 +28,7 @@
{
TnySessionCamel *session;
- GStaticRecMutex *service_lock;
+ GStaticRecMutex *service_lock, *account_lock;
/* Set in tny_camel_store_account_prepare(). */
CamelService *service;
Index: tny-camel-store-account.c
===================================================================
--- tny-camel-store-account.c (revision 2081)
+++ tny-camel-store-account.c (working copy)
@@ -515,10 +515,17 @@
static void
recurse_remove (TnyFolderStore *from, TnyFolder *folder, GError **err)
{
- TnyCamelFolderPriv *fpriv = TNY_CAMEL_FOLDER_GET_PRIVATE (from);
+ GStaticRecMutex *lock;
GError *nerr = NULL;
- g_static_rec_mutex_lock (fpriv->folder_lock);
+ if (TNY_IS_FOLDER (from)) {
+ TnyCamelFolderPriv *fpriv = TNY_CAMEL_FOLDER_GET_PRIVATE (from);
+ lock = fpriv->folder_lock;
+ } else {
+ TnyCamelAccountPriv *apriv = TNY_CAMEL_ACCOUNT_GET_PRIVATE (from);
+ lock = apriv->account_lock;
+ }
+ g_static_rec_mutex_lock (lock);
if (TNY_IS_FOLDER_STORE (folder))
{
@@ -559,15 +566,17 @@
tny_debug ("tny_folder_store_remove: actual removal of %s\n",
tny_folder_get_name (folder));
- tny_camel_store_account_remove_folder_actual (from, folder, &nerr);
+ if (TNY_IS_ACCOUNT (from))
+ tny_camel_store_account_remove_folder_actual (from, folder, &nerr);
+ else if (TNY_IS_FOLDER (from))
+ _tny_camel_folder_remove_folder_actual (from, folder, &nerr);
-
exception:
if (nerr != NULL)
g_propagate_error (err, nerr);
- g_static_rec_mutex_unlock (fpriv->folder_lock);
+ g_static_rec_mutex_unlock (lock);
return;
}
Index: tny-camel-account.c
===================================================================
--- tny-camel-account.c (revision 2081)
+++ tny-camel-account.c (working copy)
@@ -845,6 +845,9 @@
priv->service_lock = g_new (GStaticRecMutex, 1);
g_static_rec_mutex_init (priv->service_lock);
+ priv->account_lock = g_new (GStaticRecMutex, 1);
+ g_static_rec_mutex_init (priv->account_lock);
+
return;
}
@@ -1001,6 +1004,7 @@
camel_exception_free (priv->ex);
g_static_rec_mutex_free (priv->service_lock);
+ g_static_rec_mutex_free (priv->account_lock);
(*parent_class->finalize) (object);
Index: tny-camel-folder-priv.h
===================================================================
--- tny-camel-folder-priv.h (revision 2081)
+++ tny-camel-folder-priv.h (working copy)
@@ -72,6 +72,9 @@
void _tny_camel_folder_unreason (TnyCamelFolderPriv *priv);
void _tny_camel_folder_reason (TnyCamelFolderPriv *priv);
+void _tny_camel_folder_remove_folder_actual (TnyFolderStore *self, TnyFolder *folder, GError **err);
+
+
#define TNY_CAMEL_FOLDER_GET_PRIVATE(o) \
(G_TYPE_INSTANCE_GET_PRIVATE ((o), TNY_TYPE_CAMEL_FOLDER, TnyCamelFolderPriv))
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]