aboutsummaryrefslogtreecommitdiffstats
path: root/shell/e-storage-set-view.c
diff options
context:
space:
mode:
authorEttore Perazzoli <ettore@src.gnome.org>2001-10-03 02:56:27 +0800
committerEttore Perazzoli <ettore@src.gnome.org>2001-10-03 02:56:27 +0800
commit1ea1b436aa576f324e295449b91c1c4dcf0fa3e3 (patch)
tree2047d2220c2f0147f5efeaa43a293b4cf9f1358f /shell/e-storage-set-view.c
parent11c665c9250652c340c4f9636390f7cdbe1e7565 (diff)
downloadgsoc2013-evolution-1ea1b436aa576f324e295449b91c1c4dcf0fa3e3.tar.gz
gsoc2013-evolution-1ea1b436aa576f324e295449b91c1c4dcf0fa3e3.tar.zst
gsoc2013-evolution-1ea1b436aa576f324e295449b91c1c4dcf0fa3e3.zip
[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
Diffstat (limited to 'shell/e-storage-set-view.c')
-rw-r--r--shell/e-storage-set-view.c28
1 files changed, 26 insertions, 2 deletions
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);