Make this a no-op if the source and the destination path are the same.

* e-storage.c (e_storage_async_xfer_folder): Make this a no-op if
the source and the destination path are the same.

* e-local-storage.c (impl_async_xfer_folder): return after
returning `E_STORAGE_CANTCHANGESTOCKFOLDER' to the callback.

* e-storage-set-view.c (handle_evolution_path_drag_motion): Make
the check for dragging a folder over itself a little bit more
accurate.

svn path=/trunk/; revision=13550
This commit is contained in:
Ettore Perazzoli
2001-10-10 14:10:51 +00:00
parent 6b746897bf
commit acaea79e71
4 changed files with 36 additions and 8 deletions

View File

@ -1,3 +1,15 @@
2001-10-10 Ettore Perazzoli <ettore@ximian.com>
* e-storage.c (e_storage_async_xfer_folder): Make this a no-op if
the source and the destination path are the same.
* e-local-storage.c (impl_async_xfer_folder): return after
returning `E_STORAGE_CANTCHANGESTOCKFOLDER' to the callback.
* e-storage-set-view.c (handle_evolution_path_drag_motion): Make
the check for dragging a folder over itself a little bit more
accurate.
2001-10-05 Jon Trowbridge <trow@ximian.com>
* e-shell-view-menu.c (command_work_offline): This is a message,

View File

@ -839,8 +839,6 @@ async_xfer_folder_callback (EvolutionShellComponentClient *shell_component_clien
char *dest_physical_path;
char *new_physical_uri;
/* FIXME handle errors. */
xfer_data = (XferData *) callback_data;
item = (XferItem *) xfer_data->current_folder_item->data;
@ -892,8 +890,10 @@ impl_async_xfer_folder (EStorage *storage,
local_storage = E_LOCAL_STORAGE (storage);
priv = local_storage->priv;
if (remove_source && e_folder_get_is_stock (e_storage_get_folder (storage, source_path)))
if (remove_source && e_folder_get_is_stock (e_storage_get_folder (storage, source_path))) {
(* callback) (storage, E_STORAGE_CANTCHANGESTOCKFOLDER, callback_data);
return;
}
folder_items = NULL;
append_xfer_item_list (storage, g_strdup (source_path), g_strdup (destination_path), &folder_items);

View File

@ -1014,17 +1014,28 @@ handle_evolution_path_drag_motion (EStorageSetView *storage_set_view,
if (source_widget != NULL
&& E_IS_STORAGE_SET_VIEW (storage_set_view)) {
const char *source_path;
source_path = e_storage_set_view_get_current_folder (storage_set_view);
source_path = e_storage_set_view_get_current_folder (storage_set_view);
if (source_path != NULL) {
int source_path_len;
const char *destination_path;
const char *destination_path_base;
char *destination_path;
source_path_len = strlen (path);
destination_path = e_tree_memory_node_get_data (E_TREE_MEMORY (priv->etree_model), path);
if (strncmp (destination_path, source_path, source_path_len) == 0)
destination_path_base = e_tree_memory_node_get_data (E_TREE_MEMORY (priv->etree_model), path);
if (strcmp (destination_path_base, source_path) == 0)
return FALSE;
destination_path = g_strconcat (destination_path_base, "/", g_basename (source_path), NULL);
g_print ("source %s destination %s\n", source_path, destination_path);
if (strncmp (destination_path, source_path, source_path_len) == 0) {
g_free (destination_path);
return FALSE;
}
g_free (destination_path);
}
}
}

View File

@ -467,6 +467,11 @@ 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 (strcmp (source_path, destination_path) == 0) {
(* callback) (storage, E_STORAGE_OK, data);
return;
}
if (remove_source) {
int destination_len;
int source_len;