aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
author0 <NotZed@Ximian.com>2001-09-11 08:26:29 +0800
committerMichael Zucci <zucchi@src.gnome.org>2001-09-11 08:26:29 +0800
commitec9803b91dc499b6864c1d1a6a8cf615760d7649 (patch)
tree60a113d97c8db6e43902e8feb808e64192ba670b
parent2e238a7ebc19c49d607f8e17322540291ed67ad7 (diff)
downloadgsoc2013-evolution-ec9803b91dc499b6864c1d1a6a8cf615760d7649.tar
gsoc2013-evolution-ec9803b91dc499b6864c1d1a6a8cf615760d7649.tar.gz
gsoc2013-evolution-ec9803b91dc499b6864c1d1a6a8cf615760d7649.tar.bz2
gsoc2013-evolution-ec9803b91dc499b6864c1d1a6a8cf615760d7649.tar.lz
gsoc2013-evolution-ec9803b91dc499b6864c1d1a6a8cf615760d7649.tar.xz
gsoc2013-evolution-ec9803b91dc499b6864c1d1a6a8cf615760d7649.tar.zst
gsoc2013-evolution-ec9803b91dc499b6864c1d1a6a8cf615760d7649.zip
Progress reporting while moving messages.
2001-09-10 <NotZed@Ximian.com> * camel-folder.c (move_messages_to): Progress reporting while moving messages. * camel-store.c (camel_store_delete_folder): Make sure we remove the folder from our vtrash, if we have it in our opened set, and also remove it from our hashtable. (camel_store_rename_folder): Remove the old folder name from the folder cahce, if it is there. svn path=/trunk/; revision=12758
-rw-r--r--camel/ChangeLog11
-rw-r--r--camel/camel-folder.c13
-rw-r--r--camel/camel-store.c31
-rw-r--r--camel/providers/local/camel-mbox-summary.c8
4 files changed, 56 insertions, 7 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog
index 2bbe20bc55..2047c2d5ec 100644
--- a/camel/ChangeLog
+++ b/camel/ChangeLog
@@ -1,3 +1,14 @@
+2001-09-10 <NotZed@Ximian.com>
+
+ * camel-folder.c (move_messages_to): Progress reporting while
+ moving messages.
+
+ * camel-store.c (camel_store_delete_folder): Make sure we remove
+ the folder from our vtrash, if we have it in our opened set, and
+ also remove it from our hashtable.
+ (camel_store_rename_folder): Remove the old folder name from the
+ folder cahce, if it is there.
+
2001-09-10 Jeffrey Stedfast <fejj@ximian.com>
* camel-charset-map.c (camel_charset_to_iconv): Get rid of the
diff --git a/camel/camel-folder.c b/camel/camel-folder.c
index ffd36cb730..dc93443c7c 100644
--- a/camel/camel-folder.c
+++ b/camel/camel-folder.c
@@ -28,12 +28,13 @@
#endif
#include <string.h>
-#include <camel/camel-folder.h>
-#include <camel/camel-exception.h>
+#include "camel-folder.h"
+#include "camel-exception.h"
#include "camel-store.h"
#include "camel-mime-message.h"
#include "string-utils.h"
#include "e-util/e-memory.h"
+#include "camel-operation.h"
#include "camel-private.h"
@@ -1203,9 +1204,15 @@ static void
move_messages_to (CamelFolder *source, GPtrArray *uids, CamelFolder *dest, CamelException *ex)
{
int i;
+
+ camel_operation_start(NULL, _("Moving messages"));
- for (i = 0; i < uids->len && !camel_exception_is_set (ex); i++)
+ for (i = 0; i < uids->len && !camel_exception_is_set (ex); i++) {
move_message_to (source, uids->pdata[i], dest, ex);
+ camel_operation_progress(NULL, i * 100 / uids->len);
+ }
+
+ camel_operation_end(NULL);
}
/**
diff --git a/camel/camel-store.c b/camel/camel-store.c
index 0a0132e543..470ada7baf 100644
--- a/camel/camel-store.c
+++ b/camel/camel-store.c
@@ -293,7 +293,26 @@ delete_folder (CamelStore *store, const char *folder_name, CamelException *ex)
void
camel_store_delete_folder (CamelStore *store, const char *folder_name, CamelException *ex)
{
+
CAMEL_STORE_LOCK(store, folder_lock);
+
+ /* if we deleted a folder, force it out of the cache, and also out of the vtrash if setup */
+ if (store->folders) {
+ CamelFolder *folder;
+ char *key;
+
+ CAMEL_STORE_LOCK(store, cache_lock);
+ if (g_hash_table_lookup_extended(store->folders, folder_name, &key, (void **)&folder)) {
+ g_hash_table_remove(store->folders, key);
+ g_free(key);
+ CAMEL_STORE_UNLOCK(store, cache_lock);
+ if (store->vtrash)
+ camel_vee_folder_remove_folder((CamelVeeFolder *)store->vtrash, folder);
+ } else {
+ CAMEL_STORE_UNLOCK(store, cache_lock);
+ }
+ }
+
CS_CLASS (store)->delete_folder (store, folder_name, ex);
CAMEL_STORE_UNLOCK(store, folder_lock);
}
@@ -319,7 +338,19 @@ rename_folder (CamelStore *store, const char *old_name,
void
camel_store_rename_folder (CamelStore *store, const char *old_name, const char *new_name, CamelException *ex)
{
+ char *key;
+ CamelFolder *folder;
+
CAMEL_STORE_LOCK(store, folder_lock);
+
+ /* remove the old name from the cache if it is there */
+ CAMEL_STORE_LOCK(store, cache_lock);
+ if (g_hash_table_lookup_extended(store->folders, old_name, &key, (void **)&folder)) {
+ g_hash_table_remove(store->folders, key);
+ g_free(key);
+ }
+ CAMEL_STORE_UNLOCK(store, cache_lock);
+
CS_CLASS (store)->rename_folder (store, old_name, new_name, ex);
CAMEL_STORE_UNLOCK(store, folder_lock);
}
diff --git a/camel/providers/local/camel-mbox-summary.c b/camel/providers/local/camel-mbox-summary.c
index a1b563dc69..d1c9c311e5 100644
--- a/camel/providers/local/camel-mbox-summary.c
+++ b/camel/providers/local/camel-mbox-summary.c
@@ -246,13 +246,13 @@ summary_rebuild(CamelMboxSummary *mbs, off_t offset, CamelException *ex)
/* FIXME: If there is a failure, it shouldn't clear the summary and restart,
it should try and merge the summary info's. This is a bit tricky. */
- camel_operation_start(NULL, _("Summarizing folder"));
+ camel_operation_start(NULL, _("Storing folder"));
fd = open(cls->folder_path, O_RDONLY);
if (fd == -1) {
printf("%s failed to open: %s\n", cls->folder_path, strerror(errno));
- camel_exception_setv(ex, 1, _("Could not open folder: %s: summarizing from position %ld: %s"),
- cls->folder_path, offset, strerror(errno));
+ camel_exception_setv(ex, 1, _("Could not open folder: %s: %s"),
+ cls->folder_path, strerror(errno));
camel_operation_end(NULL);
return -1;
}
@@ -368,7 +368,7 @@ mbox_summary_check(CamelLocalSummary *cls, CamelFolderChangeInfo *changes, Camel
/* check if the summary is up-to-date */
if (stat(cls->folder_path, &st) == -1) {
camel_folder_summary_clear(s);
- camel_exception_setv(ex, 1, _("Cannot summarize folder: %s: %s"), cls->folder_path, strerror(errno));
+ camel_exception_setv(ex, 1, _("Cannot check folder: %s: %s"), cls->folder_path, strerror(errno));
return -1;
}