From bb662dceb3894008854314fed8625402c8af85dd Mon Sep 17 00:00:00 2001 From: Ettore Perazzoli Date: Wed, 22 Aug 2001 21:41:32 +0000 Subject: If the remove_source is %TRUE and destination is a descendant of the * e-storage.c (e_storage_async_xfer_folder): If the remove_source is %TRUE and destination is a descendant of the parent, pass an `E_STORAGE_CANTMOVETODESCENDANT' error code to the callback. * e-storage.h: New value `E_STORAGE_CANTMOVETODESCENDANT' in `EStorageResult'. svn path=/trunk/; revision=12397 --- shell/ChangeLog | 9 +++++++++ shell/e-storage.c | 12 ++++++++++++ shell/e-storage.h | 1 + 3 files changed, 22 insertions(+) (limited to 'shell') diff --git a/shell/ChangeLog b/shell/ChangeLog index 99a746a444..149d021697 100644 --- a/shell/ChangeLog +++ b/shell/ChangeLog @@ -1,3 +1,12 @@ +2001-08-22 Ettore Perazzoli + + * e-storage.c (e_storage_async_xfer_folder): If the remove_source + is %TRUE and destination is a descendant of the parent, pass an + `E_STORAGE_CANTMOVETODESCENDANT' error code to the callback. + + * e-storage.h: New value `E_STORAGE_CANTMOVETODESCENDANT' in + `EStorageResult'. + 2001-08-22 Ettore Perazzoli * e-shell-folder-commands.c diff --git a/shell/e-storage.c b/shell/e-storage.c index 3ef8041d8a..17c8d94f14 100644 --- a/shell/e-storage.c +++ b/shell/e-storage.c @@ -467,6 +467,16 @@ e_storage_async_xfer_folder (EStorage *storage, g_return_if_fail (destination_path != NULL); g_return_if_fail (g_path_is_absolute (destination_path)); + if (remove_source) { + int source_len; + + source_len = strlen (source_path); + if (strncmp (destination_path, source_path, source_len) == 0) { + (* callback) (storage, E_STORAGE_CANTMOVETODESCENDANT, data); + return; + } + } + (* ES_CLASS (storage)->async_xfer_folder) (storage, source_path, destination_path, remove_source, callback, data); } @@ -499,6 +509,8 @@ e_storage_result_to_string (EStorageResult result) return _("The specified type is not supported in this storage"); case E_STORAGE_CANTCHANGESTOCKFOLDER: return _("The specified folder cannot be modified or removed"); + case E_STORAGE_CANTMOVETODESCENDANT: + return _("Cannot make a folder a child of one of its descendants"); default: return _("Unknown error"); } diff --git a/shell/e-storage.h b/shell/e-storage.h index ea3ab52ea1..bc60e1ee5a 100644 --- a/shell/e-storage.h +++ b/shell/e-storage.h @@ -58,6 +58,7 @@ enum _EStorageResult { E_STORAGE_UNSUPPORTEDOPERATION, E_STORAGE_UNSUPPORTEDTYPE, E_STORAGE_CANTCHANGESTOCKFOLDER, + E_STORAGE_CANTMOVETODESCENDANT, E_STORAGE_INVALIDNAME }; typedef enum _EStorageResult EStorageResult; -- cgit v1.2.3