From 1ea1b436aa576f324e295449b91c1c4dcf0fa3e3 Mon Sep 17 00:00:00 2001 From: Ettore Perazzoli Date: Tue, 2 Oct 2001 18:56:27 +0000 Subject: [Don't allow dragging from a folder to one of its descendants or onto itself, when the operation is GDK_DRAG_MOVE. This fixes bugs like #8737.] * e-storage-set-view.c (handle_evolution_path_drag_motion): Don't highlight if the user is attempting to move a folder to one of its descendants. svn path=/trunk/; revision=13307 --- shell/e-storage-set-view.c | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) (limited to 'shell/e-storage-set-view.c') diff --git a/shell/e-storage-set-view.c b/shell/e-storage-set-view.c index 96b705954a..5e2e2284a0 100644 --- a/shell/e-storage-set-view.c +++ b/shell/e-storage-set-view.c @@ -995,16 +995,40 @@ handle_evolution_path_drag_motion (EStorageSetView *storage_set_view, GdkDragContext *context, unsigned int time) { + EStorageSetViewPrivate *priv; GdkModifierType modifiers; GdkDragAction action; + priv = storage_set_view->priv; + gdk_window_get_pointer (NULL, NULL, NULL, &modifiers); - if ((modifiers & GDK_CONTROL_MASK) != 0) + if ((modifiers & GDK_CONTROL_MASK) != 0) { action = GDK_ACTION_COPY; - else + } else { + GtkWidget *source_widget; + action = GDK_ACTION_MOVE; + source_widget = gtk_drag_get_source_widget (context); + 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); + + if (source_path != NULL) { + int source_path_len; + const 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) + return FALSE; + } + } + } + e_tree_drag_highlight (E_TREE (storage_set_view), row, -1); gdk_drag_status (context, action, time); -- cgit v1.2.3