aboutsummaryrefslogtreecommitdiffstats
path: root/camel
diff options
context:
space:
mode:
authorNot Zed <NotZed@Ximian.com>2001-08-01 12:57:01 +0800
committerMichael Zucci <zucchi@src.gnome.org>2001-08-01 12:57:01 +0800
commit6f22eb642b794def699ce9341219f56d793a50fb (patch)
tree13397d532bcc83b891e7d4dfc8e46b72d37d819c /camel
parent96d24f1297eaa5a6333b9fcfdf35420d273703af (diff)
downloadgsoc2013-evolution-6f22eb642b794def699ce9341219f56d793a50fb.tar
gsoc2013-evolution-6f22eb642b794def699ce9341219f56d793a50fb.tar.gz
gsoc2013-evolution-6f22eb642b794def699ce9341219f56d793a50fb.tar.bz2
gsoc2013-evolution-6f22eb642b794def699ce9341219f56d793a50fb.tar.lz
gsoc2013-evolution-6f22eb642b794def699ce9341219f56d793a50fb.tar.xz
gsoc2013-evolution-6f22eb642b794def699ce9341219f56d793a50fb.tar.zst
gsoc2013-evolution-6f22eb642b794def699ce9341219f56d793a50fb.zip
Slightly re-arranged filter/change notification logic. If we;re filtering,
2001-08-01 Not Zed <NotZed@Ximian.com> * providers/imap/camel-imap-folder.c (camel_imap_folder_changed): Slightly re-arranged filter/change notification logic. If we;re filtering, freeze the folder till we're finished to smooth the ui for new mail. 2001-07-31 Not Zed <NotZed@Ximian.com> * camel-folder.c (camel_folder_init): Chagned mutexes to e_mutexes, folder lock recursive. This fixes the imap filtering bug, or at least some cases of it. (camel_folder_finalize): Free mutexes. * camel-private.h (CamelFolderPrivate): Changed mutexes to e_mutexes. 2001-07-25 Not Zed <NotZed@Ximian.com> * camel-folder.c (camel_folder_change_info_*): Change the return if fail's into asserts. (camel_folder_change_info_free): Don't let it accept a NULL argument. This isn't g_lib so we dont have to. svn path=/trunk/; revision=11537
Diffstat (limited to 'camel')
-rw-r--r--camel/ChangeLog24
-rw-r--r--camel/camel-folder.c41
-rw-r--r--camel/camel-private.h8
-rw-r--r--camel/providers/imap/camel-imap-folder.c42
4 files changed, 73 insertions, 42 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog
index f17ea3fea6..3adfa5ad7c 100644
--- a/camel/ChangeLog
+++ b/camel/ChangeLog
@@ -1,3 +1,27 @@
+2001-08-01 Not Zed <NotZed@Ximian.com>
+
+ * providers/imap/camel-imap-folder.c (camel_imap_folder_changed):
+ Slightly re-arranged filter/change notification logic. If we;re
+ filtering, freeze the folder till we're finished to smooth the ui
+ for new mail.
+
+2001-07-31 Not Zed <NotZed@Ximian.com>
+
+ * camel-folder.c (camel_folder_init): Chagned mutexes to
+ e_mutexes, folder lock recursive. This fixes the imap filtering
+ bug, or at least some cases of it.
+ (camel_folder_finalize): Free mutexes.
+
+ * camel-private.h (CamelFolderPrivate): Changed mutexes to
+ e_mutexes.
+
+2001-07-25 Not Zed <NotZed@Ximian.com>
+
+ * camel-folder.c (camel_folder_change_info_*): Change the
+ return if fail's into asserts.
+ (camel_folder_change_info_free): Don't let it accept a NULL
+ argument. This isn't g_lib so we dont have to.
+
2001-07-27 Jeffrey Stedfast <fejj@ximian.com>
* camel-mime-utils.c (header_decode_param): Fix the fix that fixes
diff --git a/camel/camel-folder.c b/camel/camel-folder.c
index ca40c8b0dc..ffd36cb730 100644
--- a/camel/camel-folder.c
+++ b/camel/camel-folder.c
@@ -173,8 +173,8 @@ camel_folder_init (gpointer object, gpointer klass)
folder->priv->frozen = 0;
folder->priv->changed_frozen = camel_folder_change_info_new();
#ifdef ENABLE_THREADS
- folder->priv->lock = g_mutex_new();
- folder->priv->change_lock = g_mutex_new();
+ folder->priv->lock = e_mutex_new(E_MUTEX_REC);
+ folder->priv->change_lock = e_mutex_new(E_MUTEX_SIMPLE);
#endif
}
@@ -194,8 +194,8 @@ camel_folder_finalize (CamelObject *object)
camel_folder_change_info_free(camel_folder->priv->changed_frozen);
#ifdef ENABLE_THREADS
- g_mutex_free(camel_folder->priv->lock);
- g_mutex_free(camel_folder->priv->change_lock);
+ e_mutex_destroy(camel_folder->priv->lock);
+ e_mutex_destroy(camel_folder->priv->change_lock);
#endif
g_free(camel_folder->priv);
}
@@ -1481,7 +1481,7 @@ camel_folder_change_info_add_source(CamelFolderChangeInfo *info, const char *uid
{
struct _CamelFolderChangeInfoPrivate *p;
- g_return_if_fail (info != NULL);
+ g_assert(info != NULL);
p = info->priv;
@@ -1505,8 +1505,8 @@ camel_folder_change_info_add_source_list(CamelFolderChangeInfo *info, const GPtr
struct _CamelFolderChangeInfoPrivate *p;
int i;
- g_return_if_fail (info != NULL);
- g_return_if_fail (list != NULL);
+ g_assert(info != NULL);
+ g_assert(list != NULL);
p = info->priv;
@@ -1535,7 +1535,7 @@ camel_folder_change_info_add_update(CamelFolderChangeInfo *info, const char *uid
char *key;
int value;
- g_return_if_fail (info != NULL);
+ g_assert(info != NULL);
p = info->priv;
@@ -1563,8 +1563,8 @@ camel_folder_change_info_add_update_list(CamelFolderChangeInfo *info, const GPtr
{
int i;
- g_return_if_fail (info != NULL);
- g_return_if_fail (list != NULL);
+ g_assert(info != NULL);
+ g_assert(list != NULL);
for (i=0;i<list->len;i++)
camel_folder_change_info_add_update(info, list->pdata[i]);
@@ -1604,7 +1604,7 @@ camel_folder_change_info_build_diff(CamelFolderChangeInfo *info)
{
struct _CamelFolderChangeInfoPrivate *p;
- g_return_if_fail (info != NULL);
+ g_assert(info != NULL);
p = info->priv;
@@ -1635,8 +1635,8 @@ change_info_cat(CamelFolderChangeInfo *info, GPtrArray *source, void (*add)(Came
void
camel_folder_change_info_cat(CamelFolderChangeInfo *info, CamelFolderChangeInfo *source)
{
- g_return_if_fail (info != NULL);
- g_return_if_fail (source != NULL);
+ g_assert(info != NULL);
+ g_assert(source != NULL);
change_info_cat(info, source->uid_added, camel_folder_change_info_add_uid);
change_info_cat(info, source->uid_removed, camel_folder_change_info_remove_uid);
@@ -1657,7 +1657,7 @@ camel_folder_change_info_add_uid(CamelFolderChangeInfo *info, const char *uid)
GPtrArray *olduids;
char *olduid;
- g_return_if_fail (info != NULL);
+ g_assert(info != NULL);
p = info->priv;
@@ -1691,7 +1691,7 @@ camel_folder_change_info_remove_uid(CamelFolderChangeInfo *info, const char *uid
GPtrArray *olduids;
char *olduid;
- g_return_if_fail (info != NULL);
+ g_assert(info != NULL);
p = info->priv;
@@ -1724,7 +1724,7 @@ camel_folder_change_info_change_uid(CamelFolderChangeInfo *info, const char *uid
GPtrArray *olduids;
char *olduid;
- g_return_if_fail (info != NULL);
+ g_assert(info != NULL);
p = info->priv;
@@ -1749,7 +1749,7 @@ camel_folder_change_info_change_uid(CamelFolderChangeInfo *info, const char *uid
gboolean
camel_folder_change_info_changed(CamelFolderChangeInfo *info)
{
- g_return_val_if_fail (info != NULL, FALSE);
+ g_assert(info != NULL);
return (info->uid_added->len || info->uid_removed->len || info->uid_changed->len);
}
@@ -1765,7 +1765,7 @@ camel_folder_change_info_clear(CamelFolderChangeInfo *info)
{
struct _CamelFolderChangeInfoPrivate *p;
- g_return_if_fail (info != NULL);
+ g_assert(info != NULL);
p = info->priv;
@@ -1791,9 +1791,8 @@ void
camel_folder_change_info_free(CamelFolderChangeInfo *info)
{
struct _CamelFolderChangeInfoPrivate *p;
-
- if (info == NULL)
- return;
+
+ g_assert(info != NULL);
p = info->priv;
diff --git a/camel/camel-private.h b/camel/camel-private.h
index f63a452a4c..4fb5bdb461 100644
--- a/camel/camel-private.h
+++ b/camel/camel-private.h
@@ -41,8 +41,8 @@ extern "C" {
struct _CamelFolderPrivate {
#ifdef ENABLE_THREADS
- GMutex *lock;
- GMutex *change_lock;
+ EMutex *lock;
+ EMutex *change_lock;
#endif
/* must require the 'change_lock' to access this */
@@ -51,8 +51,8 @@ struct _CamelFolderPrivate {
};
#ifdef ENABLE_THREADS
-#define CAMEL_FOLDER_LOCK(f, l) (g_mutex_lock(((CamelFolder *)f)->priv->l))
-#define CAMEL_FOLDER_UNLOCK(f, l) (g_mutex_unlock(((CamelFolder *)f)->priv->l))
+#define CAMEL_FOLDER_LOCK(f, l) (e_mutex_lock(((CamelFolder *)f)->priv->l))
+#define CAMEL_FOLDER_UNLOCK(f, l) (e_mutex_unlock(((CamelFolder *)f)->priv->l))
#else
#define CAMEL_FOLDER_LOCK(f, l)
#define CAMEL_FOLDER_UNLOCK(f, l)
diff --git a/camel/providers/imap/camel-imap-folder.c b/camel/providers/imap/camel-imap-folder.c
index 3984db4bd9..ba30ac7cc1 100644
--- a/camel/providers/imap/camel-imap-folder.c
+++ b/camel/providers/imap/camel-imap-folder.c
@@ -1846,27 +1846,35 @@ camel_imap_folder_changed (CamelFolder *folder, int exists,
imap_update_summary (folder, exists, changes, recents, ex);
}
- if (camel_folder_change_info_changed (changes)) {
- camel_object_trigger_event (CAMEL_OBJECT (folder),
- "folder_changed", changes);
+ /* if we have updates to make for filtering (probably), then we freeze the
+ folder so we dont show them till they're complete, this may cause unacceptable
+ delays for users, but the alternative isn't very nice either (show them and let
+ them change as processed) */
+ if (recents && !camel_exception_is_set(ex) && recents->len) {
+ CamelFilterDriver *driver;
+
+ camel_folder_freeze(folder);
+
+ if (camel_folder_change_info_changed(changes))
+ camel_object_trigger_event(CAMEL_OBJECT(folder), "folder_changed", changes);
+
+ driver = camel_session_get_filter_driver(CAMEL_SERVICE(folder->parent_store)->session, "incoming", ex);
+ if (driver) {
+ camel_filter_driver_filter_folder(driver, folder, NULL, recents, FALSE, ex);
+ camel_object_unref(CAMEL_OBJECT(driver));
+ }
+
+ camel_folder_thaw(folder);
+ } else {
+ if (camel_folder_change_info_changed(changes))
+ camel_object_trigger_event(CAMEL_OBJECT(folder), "folder_changed", changes);
}
+
camel_folder_change_info_free (changes);
- if (recents) {
- if (!camel_exception_is_set (ex) && recents->len) {
- CamelFilterDriver *driver;
-
- driver = camel_session_get_filter_driver (
- CAMEL_SERVICE (folder->parent_store)->session,
- "incoming", ex);
- if (driver) {
- camel_filter_driver_filter_folder (
- driver, folder, NULL, recents, FALSE, ex);
- camel_object_unref (CAMEL_OBJECT (driver));
- }
- }
+ if (recents)
g_ptr_array_free (recents, TRUE);
- }
+
camel_folder_summary_save (folder->summary);
}