diff options
Diffstat (limited to 'shell')
-rw-r--r-- | shell/ChangeLog | 9 | ||||
-rw-r--r-- | shell/e-shell-folder-commands.c | 27 |
2 files changed, 36 insertions, 0 deletions
diff --git a/shell/ChangeLog b/shell/ChangeLog index cdb77f31b4..ec728b43a1 100644 --- a/shell/ChangeLog +++ b/shell/ChangeLog @@ -1,3 +1,12 @@ +2001-07-06 Ettore Perazzoli <ettore@ximian.com> + + [Fix #3959, copying a folder over itself crashes Evolution.] + + * e-shell-folder-commands.c + (folder_selection_dialog_folder_selected_callback): Sanity checks: + don't allow copying a folder over itself, or moving it under one + of its descendants. In such cases, pop up an error dialog. + 2001-07-05 Iain Holmes <iain@ximian.com> * e-shortcuts-view.c (icon_callback): Special case the evolution:/My 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, |