aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEttore Perazzoli <ettore@src.gnome.org>2001-07-06 16:35:27 +0800
committerEttore Perazzoli <ettore@src.gnome.org>2001-07-06 16:35:27 +0800
commit8053d484f9fca3efd5ad78204d50f2b63988e42a (patch)
treeaae1196b3be6df903871a47314f009c4fe676ca2
parent60a7567a4171729f8753f0ece27888916c3137cb (diff)
downloadgsoc2013-evolution-8053d484f9fca3efd5ad78204d50f2b63988e42a.tar
gsoc2013-evolution-8053d484f9fca3efd5ad78204d50f2b63988e42a.tar.gz
gsoc2013-evolution-8053d484f9fca3efd5ad78204d50f2b63988e42a.tar.bz2
gsoc2013-evolution-8053d484f9fca3efd5ad78204d50f2b63988e42a.tar.lz
gsoc2013-evolution-8053d484f9fca3efd5ad78204d50f2b63988e42a.tar.xz
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
-rw-r--r--shell/ChangeLog9
-rw-r--r--shell/e-shell-folder-commands.c27
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,