diff options
author | Ettore Perazzoli <ettore@src.gnome.org> | 2001-07-06 16:35:27 +0800 |
---|---|---|
committer | Ettore Perazzoli <ettore@src.gnome.org> | 2001-07-06 16:35:27 +0800 |
commit | 8053d484f9fca3efd5ad78204d50f2b63988e42a (patch) | |
tree | aae1196b3be6df903871a47314f009c4fe676ca2 /shell/e-shell-folder-commands.c | |
parent | 60a7567a4171729f8753f0ece27888916c3137cb (diff) | |
download | gsoc2013-evolution-8053d484f9fca3efd5ad78204d50f2b63988e42a.tar.gz gsoc2013-evolution-8053d484f9fca3efd5ad78204d50f2b63988e42a.tar.zst gsoc2013-evolution-8053d484f9fca3efd5ad78204d50f2b63988e42a.zip |
Added error dialogs for when the user tries to copy/move a folder over
itself, or move it under one of its descendants. [Fixes #3959,
copying a folder over itself crashes Evolution.]
svn path=/trunk/; revision=10841
Diffstat (limited to 'shell/e-shell-folder-commands.c')
-rw-r--r-- | shell/e-shell-folder-commands.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/shell/e-shell-folder-commands.c b/shell/e-shell-folder-commands.c index d4670b7c29..e3276d609b 100644 --- a/shell/e-shell-folder-commands.c +++ b/shell/e-shell-folder-commands.c @@ -27,6 +27,8 @@ #include "e-shell-folder-commands.h" +#include <gal/widgets/e-gui-utils.h> + #include <libgnome/gnome-i18n.h> #include <libgnome/gnome-util.h> #include <libgnomeui/gnome-dialog.h> @@ -149,6 +151,31 @@ folder_selection_dialog_folder_selected_callback (EShellFolderSelectionDialog *f return; } + if (strcmp (folder_command_data->destination_path, + folder_command_data->source_path) == 0) { + const char *msg; + + if (remove_source) + msg = _("Cannot move a folder over itself."); + else + msg = _("Cannot copy a folder over itself."); + + e_notice (GTK_WINDOW (folder_selection_dialog), GNOME_MESSAGE_BOX_ERROR, msg); + return; + } + + if (remove_source) { + int source_len; + + source_len = strlen (folder_command_data->source_path); + if (strncmp (folder_command_data->destination_path, + folder_command_data->source_path, + source_len) == 0) { + e_notice (GTK_WINDOW (folder_selection_dialog), GNOME_MESSAGE_BOX_ERROR, + _("Cannot move a folder into one of its descendants.")); + } + } + storage_set = e_shell_get_storage_set (folder_command_data->shell); e_storage_set_async_xfer_folder (storage_set, |