From 7ce7e097622ccf0a2946abd35a4f02c5dbb9e42e Mon Sep 17 00:00:00 2001 From: 0 Date: Wed, 10 Oct 2001 05:46:34 +0000 Subject: IF the source and destination folders are the same, do nothing. Oh, and 2001-10-10 * mail-ops.c (transfer_messages_transfer): IF the source and destination folders are the same, do nothing. Oh, and return an error, otherwise the shell goes and removes it anyway. Fixes a rather serious bug with dnd of folders onto their current location. 2001-10-09 * component-factory.c (owner_unset_cb): Disconnect from all the signals we were listening to, so we dont try and do shit twice on exit (one on unset_cb, one on destroy). (create_component): Setup the signal handlers using a table, so they're easier to disconnect on finish. svn path=/trunk/; revision=13545 --- mail/ChangeLog | 14 ++++++ mail/component-factory.c | 109 +++++++++++++++++++++++++++-------------------- mail/mail-ops.c | 18 +++++--- 3 files changed, 89 insertions(+), 52 deletions(-) (limited to 'mail') diff --git a/mail/ChangeLog b/mail/ChangeLog index b7dbaab68e..88df7a3caa 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,3 +1,11 @@ +2001-10-10 + + * mail-ops.c (transfer_messages_transfer): IF the source and + destination folders are the same, do nothing. Oh, and return an + error, otherwise the shell goes and removes it anyway. Fixes a + rather serious bug with dnd of folders onto their current + location. + 2001-10-09 Larry Ewing * mail-display.c (save_part): ref the part. @@ -9,6 +17,12 @@ 2001-10-09 + * component-factory.c (owner_unset_cb): Disconnect from all the + signals we were listening to, so we dont try and do shit twice on + exit (one on unset_cb, one on destroy). + (create_component): Setup the signal handlers using a table, so + they're easier to disconnect on finish. + * mail-folder-cache.c (folder_changed): Ref folder so it hangs around till we're done with it. (real_folder_changed): Unref folder when we are done with it. diff --git a/mail/component-factory.c b/mail/component-factory.c index f3f1d0d81c..e193fec3c6 100644 --- a/mail/component-factory.c +++ b/mail/component-factory.c @@ -734,39 +734,6 @@ free_storage (gpointer service, gpointer storage, gpointer data) bonobo_object_unref (BONOBO_OBJECT (storage)); } -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); - - gtk_main_quit (); - - return FALSE; -} - -static void -owner_unset_cb (EvolutionShellComponent *shell_component, gpointer user_data) -{ - global_shell_client = NULL; - - if (mail_config_get_empty_trash_on_exit ()) - empty_trash (NULL, NULL, NULL); - - mail_msg_wait_all(); - - unref_standard_folders (); - mail_importer_uninit (); - - mail_session_enable_interaction (FALSE); - g_idle_add_full (G_PRIORITY_LOW, idle_quit, NULL, NULL); -} - static void debug_cb (EvolutionShellComponent *shell_component, gpointer user_data) { @@ -807,12 +774,67 @@ user_create_new_item_cb (EvolutionShellComponent *shell_component, g_warning ("Don't know how to create item of type \"%s\"", id); } +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); + + gtk_main_quit (); + + return FALSE; +} + +static void owner_unset_cb (EvolutionShellComponent *shell_component, gpointer user_data); + +/* Table for signal handler setup/cleanup */ +static struct { + char *sig; + GtkSignalFunc func; + int hand; +} shell_component_handlers[] = { + { "owner_set", owner_set_cb, }, + { "owner_unset", owner_unset_cb, }, + { "debug", debug_cb, }, + { "destroy", owner_unset_cb, }, + { "handle_external_uri", handle_external_uri_cb, }, + { "user_create_new_item", user_create_new_item_cb } +}; + +static void +owner_unset_cb (EvolutionShellComponent *shell_component, gpointer user_data) +{ + int i; + + for (i=0;idest_uri, m->dest_flags, &mm->ex); + if (camel_exception_is_set (&mm->ex)) + return; + + if (dest == m->source) { + camel_object_unref((CamelObject *)dest); + camel_exception_setv(&mm->ex, CAMEL_EXCEPTION_FOLDER_INVALID, + _("Cannot copy a folder `%s' to itself"), + m->dest_uri); + return; + } + if (m->delete) { func = camel_folder_move_messages_to; desc = _("Moving"); @@ -875,10 +887,6 @@ transfer_messages_transfer (struct _mail_msg *mm) desc = _("Copying"); } - dest = mail_tool_uri_to_folder (m->dest_uri, m->dest_flags, &mm->ex); - if (camel_exception_is_set (&mm->ex)) - return; - camel_folder_freeze (m->source); camel_folder_freeze (dest); -- cgit v1.2.3