aboutsummaryrefslogtreecommitdiffstats
path: root/mail/mail-local.c
diff options
context:
space:
mode:
authorNot Zed <NotZed@HelixCode.com>2001-01-03 09:18:21 +0800
committerMichael Zucci <zucchi@src.gnome.org>2001-01-03 09:18:21 +0800
commita16344fff4780b6b1c5d8c2d6531963e1fe07d52 (patch)
tree1f71c805d1f3d27131f68fd744113b2535a3d1ce /mail/mail-local.c
parentef48c6d6b0f84c1bbc5ce8ec666b0a581c9e3cc8 (diff)
downloadgsoc2013-evolution-a16344fff4780b6b1c5d8c2d6531963e1fe07d52.tar.gz
gsoc2013-evolution-a16344fff4780b6b1c5d8c2d6531963e1fe07d52.tar.zst
gsoc2013-evolution-a16344fff4780b6b1c5d8c2d6531963e1fe07d52.zip
Fix for mail_get_message change, use queue thread.
2001-01-02 Not Zed <NotZed@HelixCode.com> * mail-callbacks.c (view_msg): Fix for mail_get_message change, use queue thread. * folder-browser.c (done_message_selected): Fix mail_Get_message calls, use new thread. (do_message_selected): " * mail-ops.c (mail_get_message): Add a thread argument so callers can specify which queue it executes on. * mail-mt.c (mail_msg_free): Fix a free order problem. (mail_msg_destroy): Call mail_msg_free to do the work. (mail_msgport_replied): " (mail_msgport_replied): Check/display errors if we get them. (mail_msgport_received): If we have a describe function, say what we're doing, also set busy/unbusy. (mail_msgport_replied): Clear busy when we get a reply. (mail_get_password): Unset busy. (mail_msg_received): Set busy as we go. (mail_msg_destroy): Unset busy when done. (mail_status): Blah blah, new status interface, the other wans't workable with the way the shell api works. 2000-12-29 Not Zed <NotZed@HelixCode.com> * folder-browser.c (do_message_selected): If we are reconfiguring, just keep polling till we are done (yeah kinda shitty, but easy). (folder_browser_set_uri): Clear reconfigure flag here. ick. (got_folder): And here too. (on_right_click): Remove locking. (hide_sender): and here too. (hide_subject): And here. (on_right_click): If we are in reconfigure, then the whole menu is disabled. * mail-mt.c (status_busy_timeout): Clear the status_busy_timeout_id. * mail-local.c (local_storage_new_folder_cb): Made getting folders completely synchronous. The shell expects it, and it was only synchronous before by a sideeffect. (do_reconfigure_folder): Remove locking stuff. (do_reconfigure_folder): Use our own much simpler copying routine than that stupid move_folder_contents thing. (update_progress): Use mail_status_message() instead. (do_reconfigure_folder): Set the reconfigure flag during reconfigure & set busy flag. (cleanup_reconfigure_folder): clear busy flag. * mail-tools.c (mail_tool_uri_to_folder): Remove the tool_lock stuff. (mail_tool_uri_to_folder_noex): Clear exception on exit. (mail_tool_move_folder_contents): Get rid of this really stupid function that is only used in one place. * component-factory.c (owner_set_cb): Use direct calls to get the folders, as this code must run synchronous. Remove the event wait stuff. * mail-callbacks.c (edit_msg): Call mail_get_messages, and create the composers ourself. (do_edit_messages): get_messages callback, create the composers and connect to signals we need. (view_msg): Dont call do_view_messages, just call mail_get_messge for each to get them in parallel. (do_view_message): view a single message. * mail-ops.c (mail_edit_messages): Just use mail_get_messages for this operation. Removed the other async operation stuff. Changed my mind, just removed entirely. (mail_do_view_messages): Removed. (mail_do_setup_folder): Removed. (mail_do_scan_subfolders): Make this run synchronously, as every caller expects it to (even if they didn't realise). 2000-12-28 Not Zed <NotZed@HelixCode.com> * mail-callbacks.c (send_queued_mail): Dont expunge the folder here, but in send_queue, otherwise it might execute out of order. (expunge_folder): Remove the talbe prechange stuff, and infact references to the message_list folder, as we have our own folder. Also, dont allow expunge if we're already expunging. (expunged_folder): Clkear the expunging flag if we're finished. * folder-browser-factory.c (control_deactivate): Likewise here. Hrm, i thought this function required a callback, silly me. * mail-tools.c (mail_tool_make_message_attachment): Remov e locking. * folder-browser.c (on_message_selected): Use a timeout handler so we dont select immediately. (folder_browser_set_uri): Changed to use mail_get_folder. (got_folder): New callback called when get_folder is finished. (folder_browser_destroy): Use new sync interface. * mail-ops.c (mail_get_message): New function to asynchrounously get a message. : #define out mail_tool_camel_lock stuff entirely. (mail_get_folder): New function to asynchrounously get a folder. (mail_do_load_folder): Removed, replaced by more generic function above. (mail_do_display_message): Removed, replaced by the more generic funciton get_message. (mail_get_messages): New function to get a list of messages asynchronously. (mail_sync_folder): New interface to sync a folder async. (mail_expunge_folder): New interface for expunging folder, with callback. (do_send_queue): Remove lock stuff, and expunge if (and only if) successful, also sync the sent folder while we're at it. * session.c (mail_session_request_dialog): Changed to use new mail_get_password call. * mail-mt.[ch]: New threading/interthread messaging framework. * main.c (main): Init the message/thread system. svn path=/trunk/; revision=7223
Diffstat (limited to 'mail/mail-local.c')
-rw-r--r--mail/mail-local.c67
1 files changed, 49 insertions, 18 deletions
diff --git a/mail/mail-local.c b/mail/mail-local.c
index c86518e07a..bd322f505b 100644
--- a/mail/mail-local.c
+++ b/mail/mail-local.c
@@ -59,6 +59,7 @@
#include "mail-tools.h"
#include "mail-threads.h"
#include "folder-browser.h"
+#include "mail-mt.h"
#define d(x)
@@ -179,7 +180,7 @@ static void
update_progress(char *fmt, float percent)
{
if (fmt)
- mail_op_set_message ("%s", fmt);
+ mail_status(fmt);
/*mail_op_set_percentage (percent);*/
}
@@ -237,7 +238,8 @@ do_reconfigure_folder(gpointer in_data, gpointer op_data, CamelException *ex)
CamelStore *fromstore = NULL, *tostore = NULL;
char *fromurl = NULL, *tourl = NULL;
CamelFolder *fromfolder = NULL, *tofolder = NULL;
-
+ GPtrArray *uids;
+ int i;
char *metapath;
char *tmpname;
CamelURL *url = NULL;
@@ -246,6 +248,11 @@ do_reconfigure_folder(gpointer in_data, gpointer op_data, CamelException *ex)
d(printf("reconfiguring folder: %s to type %s\n", input->fb->uri, input->newtype));
+ mail_status_start(_("Reconfiguring folder"));
+
+ /* NOTE: This var is cleared by the folder_browser via the set_uri method */
+ input->fb->reconfigure = TRUE;
+
/* get the actual location of the mailbox */
url = camel_url_new(input->fb->uri, ex);
if (camel_exception_is_set(ex)) {
@@ -261,9 +268,7 @@ do_reconfigure_folder(gpointer in_data, gpointer op_data, CamelException *ex)
if (input->fb->folder != NULL) {
update_progress(_("Closing current folder"), 0.0);
- mail_tool_camel_lock_up ();
camel_folder_sync(input->fb->folder, FALSE, ex);
- mail_tool_camel_lock_down ();
camel_object_unref (CAMEL_OBJECT (input->fb->folder));
input->fb->folder = NULL;
}
@@ -275,16 +280,12 @@ do_reconfigure_folder(gpointer in_data, gpointer op_data, CamelException *ex)
d(printf("opening stores %s and %s\n", fromurl, tourl));
- mail_tool_camel_lock_up ();
fromstore = camel_session_get_store(session, fromurl, ex);
- mail_tool_camel_lock_down ();
if (camel_exception_is_set(ex))
goto cleanup;
- mail_tool_camel_lock_up ();
tostore = camel_session_get_store(session, tourl, ex);
- mail_tool_camel_lock_down ();
if (camel_exception_is_set(ex))
goto cleanup;
@@ -293,10 +294,8 @@ do_reconfigure_folder(gpointer in_data, gpointer op_data, CamelException *ex)
d(printf("renaming %s to %s, and opening it\n", meta->name, tmpname));
update_progress(_("Renaming old folder and opening"), 0.0);
- mail_tool_camel_lock_up ();
camel_store_rename_folder(fromstore, meta->name, tmpname, ex);
if (camel_exception_is_set(ex)) {
- mail_tool_camel_lock_down ();
goto cleanup;
}
@@ -306,7 +305,6 @@ do_reconfigure_folder(gpointer in_data, gpointer op_data, CamelException *ex)
/* try and recover ... */
camel_exception_clear (ex);
camel_store_rename_folder(fromstore, tmpname, meta->name, ex);
- mail_tool_camel_lock_down ();
goto cleanup;
}
@@ -323,16 +321,24 @@ do_reconfigure_folder(gpointer in_data, gpointer op_data, CamelException *ex)
/* try and recover ... */
camel_exception_clear (ex);
camel_store_rename_folder(fromstore, tmpname, meta->name, ex);
- mail_tool_camel_lock_down ();
goto cleanup;
}
update_progress(_("Copying messages"), 0.0);
- mail_tool_move_folder_contents (fromfolder, tofolder, FALSE, ex);
+ uids = camel_folder_get_uids(fromfolder);
+ for (i=0;i<uids->len;i++) {
+ mail_statusf("Copying message %d of %d", i, uids->len);
+ camel_folder_move_message_to(fromfolder, uids->pdata[i], tofolder, ex);
+ if (camel_exception_is_set(ex)) {
+ camel_folder_free_uids(fromfolder, uids);
+ goto cleanup;
+ }
+ }
+ camel_folder_free_uids(fromfolder, uids);
+ camel_folder_expunge(fromfolder, ex);
d(printf("delete old mbox ...\n"));
camel_store_delete_folder(fromstore, tmpname, ex);
- mail_tool_camel_lock_down ();
/* switch format */
g_free(meta->format);
@@ -380,6 +386,8 @@ cleanup_reconfigure_folder (gpointer in_data, gpointer op_data, CamelException
folder_browser_set_uri(input->fb, uri);
g_free(uri);
+ mail_status_end();
+
gtk_object_unref (GTK_OBJECT (input->fb));
g_free (input->newtype);
}
@@ -418,9 +426,6 @@ reconfigure_clicked(GnomeDialog *d, int button, reconfigure_folder_input_t *data
gnome_dialog_close(d);
}
-/* kills a very annoying warning */
-void local_reconfigure_folder(FolderBrowser *fb);
-
void
mail_local_reconfigure_folder(FolderBrowser *fb)
{
@@ -809,6 +814,7 @@ do_register_folder (gpointer in_data, gpointer op_data, CamelException *ex)
if (meta->indexed)
flags |= CAMEL_STORE_FOLDER_BODY_INDEX;
local_folder->folder = camel_store_get_folder (store, meta->name, flags, ex);
+ printf("got folder exception %s\n", camel_exception_get_description(ex));
local_folder->last_unread = camel_folder_get_unread_message_count(local_folder->folder);
camel_object_unref (CAMEL_OBJECT (store));
free_metainfo (meta);
@@ -868,7 +874,32 @@ local_storage_new_folder_cb (EvolutionStorageListener *storage_listener,
local_folder->path = g_strdup (path);
local_folder->local_store = local_store;
camel_object_ref((CamelObject *)local_store);
- mail_operation_queue (&op_register_folder, local_folder, FALSE);
+
+ /* Note: This needs to be synchronous, as that is what the shell
+ expects. Doesn't that suck. */
+ /* This used to be made 'synchronous' by having us wait for
+ outstanding requests, which was BAD */
+
+ /*mail_operation_queue (&op_register_folder, local_folder, FALSE);*/
+ {
+ CamelException *ex = camel_exception_new();
+
+ do_register_folder(local_folder, NULL, ex);
+ cleanup_register_folder(local_folder, NULL, ex);
+
+#if 0
+ /* yay, so we can't do this, because we've probably got the bloody
+ splash screen up */
+ if (camel_exception_is_set(ex)) {
+ char *msg = g_strdup_printf(_("Unable to register folder '%s':\n%s"),
+ path, camel_exception_get_description(ex));
+ GnomeDialog *gd = (GnomeDialog *)gnome_error_dialog(msg);
+ gnome_dialog_run_and_close(gd);
+ g_free(msg);
+ }
+#endif
+ camel_exception_free(ex);
+ }
}
static void