From 343f36cffe95db2943ba897b83bbb88a6c25c366 Mon Sep 17 00:00:00 2001 From: 3 Date: Tue, 23 Oct 2001 06:28:27 +0000 Subject: Completely re-done. We now hae a completely async dialogue when requested 2001-10-23 * mail-session.c (get_password): Completely re-done. We now hae a completely async dialogue when requested from antoehr thread, and dont use gtk_main() if we can avoid it (which is normally the case). This stuff is only partially finished, and will mena the removal of the same from mail-mt.c, and the mail_user_message() code will be moved here and changed to work in a similar way. * mail-callbacks.c (empty_trash): Dont try and connect to remote stores just to get the trash. Also, always run empty trash async, and make sure we unref the trash. (empty_trash): Hmm, dont unref the trash, causes a problem on exit, i suspect something else is doing funky unrefs on it. * mail-tools.c (mail_tool_get_trash): Pass a 'connect' arg, tell it whether it should tryand connect or not to the parent service, if it isn't already connected. * component-factory.c (owner_unset_cb): Dont try wait_all here, could potentially deadlock. (idle_quit): Keep returning TRUE if we have outstanding processing. Note that this may busy-wait during exit processign with busy tasks :( (idle_quit): Keep calling ourselves till we no longer get called (i.e. gtk_main really quits). * mail-mt.c (mail_msg_active): New function, returns TRUE if events are still active/outstanding. (do_op_status): @$@$#@@!#@!! didn't unlock the mail_msg_lock if data->activity was NULL and we had no global_shell_client anymore! Also shortcut processing if this is going to be the case. (mail_msg_init): Setup a temporary other gui_port for redoing with new semantics password, user message and progress reporting. (mail_get_password): #ifdef'd out all this code temporarily, till it gets fully moved to mail-session.c 2001-10-22 * component-factory.c (owner_set_cb): Dont call enable_interaction here. (interactive_cb): But here instead, let the shell tell us when its ok to go interactive. svn path=/trunk/; revision=13933 --- mail/component-factory.c | 46 +++++++++++++++++++++++++++++++--------------- 1 file changed, 31 insertions(+), 15 deletions(-) (limited to 'mail/component-factory.c') diff --git a/mail/component-factory.c b/mail/component-factory.c index d6603cb9cc..c4be75f94d 100644 --- a/mail/component-factory.c +++ b/mail/component-factory.c @@ -718,8 +718,6 @@ owner_set_cb (EvolutionShellComponent *shell_component, got_folder, standard_folders[i].folder, mail_thread_new)); } - mail_session_enable_interaction (TRUE); - mail_autoreceive_setup (); if (mail_config_is_corrupt ()) { @@ -753,6 +751,12 @@ debug_cb (EvolutionShellComponent *shell_component, gpointer user_data) camel_verbose_debug = 1; } +static void +interactive_cb (EvolutionShellComponent *shell_component, gboolean on, gpointer user_data) +{ + mail_session_enable_interaction(on); +} + static void handle_external_uri_cb (EvolutionShellComponent *shell_component, const char *uri, @@ -788,19 +792,32 @@ user_create_new_item_cb (EvolutionShellComponent *shell_component, static gboolean idle_quit (gpointer user_data) { - mail_msg_wait_all(); - - if (e_list_length (folder_browser_factory_get_control_list ())) - return TRUE; - - g_hash_table_foreach (storages_hash, free_storage, NULL); - g_hash_table_destroy (storages_hash); - - mail_vfolder_shutdown (); + static int shutdown_vfolder = FALSE; + static int shutdown_shutdown = FALSE; + if (!shutdown_shutdown) { + if (e_list_length (folder_browser_factory_get_control_list ())) + return TRUE; + + if (mail_msg_active(-1)) { + /* short sleep? */ + return TRUE; + } + + if (!shutdown_vfolder) { + shutdown_vfolder = TRUE; + mail_vfolder_shutdown(); + return TRUE; + } + + shutdown_shutdown = TRUE; + g_hash_table_foreach (storages_hash, free_storage, NULL); + g_hash_table_destroy (storages_hash); + } + gtk_main_quit (); - return FALSE; + return TRUE; } static void owner_unset_cb (EvolutionShellComponent *shell_component, gpointer user_data); @@ -814,6 +831,7 @@ static struct { { "owner_set", owner_set_cb, }, { "owner_unset", owner_unset_cb, }, { "debug", debug_cb, }, + { "interactive", interactive_cb }, { "destroy", owner_unset_cb, }, { "handle_external_uri", handle_external_uri_cb, }, { "user_create_new_item", user_create_new_item_cb } @@ -830,14 +848,12 @@ owner_unset_cb (EvolutionShellComponent *shell_component, gpointer user_data) if (mail_config_get_empty_trash_on_exit ()) empty_trash (NULL, NULL, NULL); - mail_msg_wait_all(); - unref_standard_folders (); mail_importer_uninit (); global_shell_client = NULL; - mail_session_enable_interaction (FALSE); + g_idle_add_full (G_PRIORITY_LOW, idle_quit, NULL, NULL); } -- cgit