diff src/bar_keywords.c @ 1395:e86d8facbdae

dnd fixes
author nadvornik
date Sun, 08 Mar 2009 11:32:12 +0000
parents bec57fa486f4
children 58f0b4586c8c
line wrap: on
line diff
--- a/src/bar_keywords.c	Sun Mar 08 10:38:51 2009 +0000
+++ b/src/bar_keywords.c	Sun Mar 08 11:32:12 2009 +0000
@@ -572,6 +572,11 @@
 		gtk_tree_path_free(tpath);
 		gtk_tree_model_filter_convert_iter_to_child_iter(GTK_TREE_MODEL_FILTER(model), &dest_kw_iter, &dest_iter);
 
+		if (src_valid && gtk_tree_store_is_ancestor(GTK_TREE_STORE(keyword_tree), &src_kw_iter, &dest_kw_iter))
+			{
+			/* can't move to it's own child */
+			return;
+			}
 
 		if ((pos == GTK_TREE_VIEW_DROP_INTO_OR_BEFORE || pos == GTK_TREE_VIEW_DROP_INTO_OR_AFTER) &&
 		    !gtk_tree_model_iter_has_child(keyword_tree, &dest_kw_iter))
@@ -640,7 +645,12 @@
 
 	gtk_tree_view_set_drag_dest_row(GTK_TREE_VIEW(tree_view), tpath, pos);
 	gtk_tree_path_free(tpath);
-	gdk_drag_status(context, GDK_ACTION_COPY, time);
+	
+	if (tree_view == gtk_drag_get_source_widget(context))
+		gdk_drag_status(context, GDK_ACTION_MOVE, time);
+	else
+		gdk_drag_status(context, GDK_ACTION_COPY, time);
+	
 	return TRUE;
 }