aboutsummaryrefslogtreecommitdiffstats
path: root/mail
diff options
context:
space:
mode:
author0 <NotZed@Ximian.com>2001-10-10 13:46:34 +0800
committerMichael Zucci <zucchi@src.gnome.org>2001-10-10 13:46:34 +0800
commit7ce7e097622ccf0a2946abd35a4f02c5dbb9e42e (patch)
treef821b4354f59f995f33146286baa08d013543eae /mail
parent14124e1c1639ef555dd0829ea74799525caf4374 (diff)
downloadgsoc2013-evolution-7ce7e097622ccf0a2946abd35a4f02c5dbb9e42e.tar
gsoc2013-evolution-7ce7e097622ccf0a2946abd35a4f02c5dbb9e42e.tar.gz
gsoc2013-evolution-7ce7e097622ccf0a2946abd35a4f02c5dbb9e42e.tar.bz2
gsoc2013-evolution-7ce7e097622ccf0a2946abd35a4f02c5dbb9e42e.tar.lz
gsoc2013-evolution-7ce7e097622ccf0a2946abd35a4f02c5dbb9e42e.tar.xz
gsoc2013-evolution-7ce7e097622ccf0a2946abd35a4f02c5dbb9e42e.tar.zst
gsoc2013-evolution-7ce7e097622ccf0a2946abd35a4f02c5dbb9e42e.zip
IF the source and destination folders are the same, do nothing. Oh, and
2001-10-10 <NotZed@Ximian.com> * 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 <NotZed@Ximian.com> * 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
Diffstat (limited to 'mail')
-rw-r--r--mail/ChangeLog14
-rw-r--r--mail/component-factory.c109
-rw-r--r--mail/mail-ops.c18
3 files changed, 89 insertions, 52 deletions
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 <NotZed@Ximian.com>
+
+ * 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 <lewing@ximian.com>
* mail-display.c (save_part): ref the part.
@@ -9,6 +17,12 @@
2001-10-09 <NotZed@Ximian.com>
+ * 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;i<sizeof(shell_component_handlers)/sizeof(shell_component_handlers[0]);i++)
+ gtk_signal_disconnect((GtkObject *)shell_component, shell_component_handlers[i].hand);
+
+ 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);
+}
+
static BonoboObject *
create_component (void)
{
EvolutionShellComponentDndDestinationFolder *destination_interface;
MailOfflineHandler *offline_handler;
-
+ int i;
+
shell_component = evolution_shell_component_new (folder_types,
schema_types,
create_view,
@@ -834,19 +856,12 @@ create_component (void)
evolution_shell_component_add_user_creatable_item (shell_component, "message", _("New Mail Message"), _("New _Mail Message"), 'm');
- gtk_signal_connect (GTK_OBJECT (shell_component), "owner_set",
- GTK_SIGNAL_FUNC (owner_set_cb), NULL);
- gtk_signal_connect (GTK_OBJECT (shell_component), "owner_unset",
- GTK_SIGNAL_FUNC (owner_unset_cb), NULL);
- gtk_signal_connect (GTK_OBJECT (shell_component), "debug",
- GTK_SIGNAL_FUNC (debug_cb), NULL);
- gtk_signal_connect (GTK_OBJECT (shell_component), "destroy",
- GTK_SIGNAL_FUNC (owner_unset_cb), NULL);
- gtk_signal_connect (GTK_OBJECT (shell_component), "handle_external_uri",
- GTK_SIGNAL_FUNC (handle_external_uri_cb), NULL);
- gtk_signal_connect (GTK_OBJECT (shell_component), "user_create_new_item",
- GTK_SIGNAL_FUNC (user_create_new_item_cb), NULL);
-
+ for (i=0;i<sizeof(shell_component_handlers)/sizeof(shell_component_handlers[0]);i++) {
+ shell_component_handlers[i].hand = gtk_signal_connect(GTK_OBJECT(shell_component),
+ shell_component_handlers[i].sig,
+ shell_component_handlers[i].func, NULL);
+ }
+
offline_handler = mail_offline_handler_new ();
bonobo_object_add_interface (BONOBO_OBJECT (shell_component), BONOBO_OBJECT (offline_handler));
diff --git a/mail/mail-ops.c b/mail/mail-ops.c
index 009581b6d9..dd365b3fb5 100644
--- a/mail/mail-ops.c
+++ b/mail/mail-ops.c
@@ -866,7 +866,19 @@ transfer_messages_transfer (struct _mail_msg *mm)
void (*func) (CamelFolder *, GPtrArray *,
CamelFolder *,
CamelException *);
-
+
+ dest = mail_tool_uri_to_folder (m->dest_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);