From e98f2565b3933b735c82753cd6d579d74de639df Mon Sep 17 00:00:00 2001 From: Jeffrey Stedfast Date: Mon, 11 Sep 2000 20:56:47 +0000 Subject: Don't freeze/thaw the default inbox here, let the caller freeze/thaw it. 2000-09-11 Jeffrey Stedfast * filter-driver.c (filter_driver_run): Don't freeze/thaw the default inbox here, let the caller freeze/thaw it. Don't destroy the folders hash table here, it's faster if we wait till the filter-driver is destroyed. (filter_driver_finalise): Destroy the folders hash table here (filter_driver_init): Initialize the folders hash table here svn path=/trunk/; revision=5346 --- filter/ChangeLog | 9 +++++++++ filter/filter-driver.c | 33 +++++++++++---------------------- 2 files changed, 20 insertions(+), 22 deletions(-) (limited to 'filter') diff --git a/filter/ChangeLog b/filter/ChangeLog index 37d6e02140..084b7833d4 100644 --- a/filter/ChangeLog +++ b/filter/ChangeLog @@ -1,3 +1,12 @@ +2000-09-11 Jeffrey Stedfast + + * filter-driver.c (filter_driver_run): Don't freeze/thaw the + default inbox here, let the caller freeze/thaw it. Don't destroy + the folders hash table here, it's faster if we wait till the + filter-driver is destroyed. + (filter_driver_finalise): Destroy the folders hash table here + (filter_driver_init): Initialize the folders hash table here + 2000-09-11 Jeffrey Stedfast * filtertypes.xml: Changed "Header" to be "Message header" so it's diff --git a/filter/filter-driver.c b/filter/filter-driver.c index e82c884f6e..257869081d 100644 --- a/filter/filter-driver.c +++ b/filter/filter-driver.c @@ -158,6 +158,8 @@ filter_driver_init (FilterDriver *obj) p->globals = g_hash_table_new (g_str_hash, g_str_equal); + p->folders = g_hash_table_new (g_str_hash, g_str_equal); + /* Will get set in filter_driver_run */ p->ex = NULL; } @@ -172,10 +174,14 @@ free_hash_strings (void *key, void *value, void *data) static void filter_driver_finalise (GtkObject *obj) { - FilterDriver *d = (FilterDriver *) obj; - struct _FilterDriverPrivate *p = _PRIVATE (d); + FilterDriver *driver = (FilterDriver *) obj; + struct _FilterDriverPrivate *p = _PRIVATE (driver); + + /* close all folders that were opened for appending */ + close_folders (driver); + g_hash_table_destroy (p->folders); - g_hash_table_foreach (p->globals, free_hash_strings, d); + g_hash_table_foreach (p->globals, free_hash_strings, driver); g_hash_table_destroy (p->globals); gtk_object_unref (GTK_OBJECT (p->eval)); @@ -358,8 +364,7 @@ open_folder (FilterDriver *driver, const char *folder_url) static void close_folder (void *key, void *value, void *data) -{ - +{ CamelFolder *folder = value; FilterDriver *driver = data; struct _FilterDriverPrivate *p = _PRIVATE (driver); @@ -368,8 +373,8 @@ close_folder (void *key, void *value, void *data) mail_tool_camel_lock_up (); camel_folder_sync (folder, FALSE, p->ex); camel_folder_thaw (folder); - mail_tool_camel_lock_down (); camel_object_unref (CAMEL_OBJECT (folder)); + mail_tool_camel_lock_down (); } /* flush/close all folders */ @@ -416,13 +421,6 @@ filter_driver_run (FilterDriver *driver, CamelMimeMessage *message, CamelMessage p->message = message; p->info = info; - /* setup runtime data */ - p->folders = g_hash_table_new (g_str_hash, g_str_equal); - - mail_tool_camel_lock_up (); - camel_folder_freeze (inbox); - mail_tool_camel_lock_down (); - fsearch = g_string_new (""); faction = g_string_new (""); @@ -477,15 +475,6 @@ filter_driver_run (FilterDriver *driver, CamelMimeMessage *message, CamelMessage filtered = TRUE; } - /* close all folders that were opened for appending */ - close_folders (driver); - g_hash_table_destroy (p->folders); - - /* thaw the inbox folder */ - mail_tool_camel_lock_up (); - camel_folder_thaw (inbox); - mail_tool_camel_lock_down (); - /* transfer the exception over to the parents exception */ if (camel_exception_is_set (p->ex)) camel_exception_xfer (ex, p->ex); -- cgit