[nautilus] Improve list view dropping for crowded folders



commit 4daa5ef02fdbaa43b5ecdb445bf16ffba6699230
Author: Christian Neumair <cneumair gnome org>
Date:   Sat Sep 15 07:33:50 2012 -0400

    Improve list view dropping for crowded folders
    
    "If ... you have opened a big directory with many directories you are
    not able any more to drag for example a file from the desktop into this
    directory ... ."
    
    Make Nautilus only accept the drop path if you're directly above it with the mouse.
    
    http://bugzilla.gnome.org/show_bug.cgi?id=310819

 libnautilus-private/nautilus-tree-view-drag-dest.c |   15 ++++++++++++---
 1 files changed, 12 insertions(+), 3 deletions(-)
---
diff --git a/libnautilus-private/nautilus-tree-view-drag-dest.c b/libnautilus-private/nautilus-tree-view-drag-dest.c
index dba9243..a338924 100644
--- a/libnautilus-private/nautilus-tree-view-drag-dest.c
+++ b/libnautilus-private/nautilus-tree-view-drag-dest.c
@@ -422,7 +422,11 @@ drag_motion_callback (GtkWidget *widget,
 
 	gtk_tree_view_get_dest_row_at_pos (GTK_TREE_VIEW (widget),
 					   x, y, &path, &pos);
-	
+	if (pos == GTK_TREE_VIEW_DROP_BEFORE ||
+	    pos == GTK_TREE_VIEW_DROP_AFTER) {
+		gtk_tree_path_free (path);
+		path = NULL;
+	}
 
 	if (!dest->details->have_drag_data) {
 		res = get_drag_data (dest, context, time);
@@ -498,13 +502,18 @@ drag_leave_callback (GtkWidget *widget,
 static char *
 get_drop_target_uri_at_pos (NautilusTreeViewDragDest *dest, int x, int y)
 {
-	char *drop_target;
+	char *drop_target = NULL;
 	GtkTreePath *path;
 	GtkTreePath *drop_path;
 	GtkTreeViewDropPosition pos;
 
-	gtk_tree_view_get_dest_row_at_pos (dest->details->tree_view, x, y, 
+	gtk_tree_view_get_dest_row_at_pos (dest->details->tree_view, x, y,
 					   &path, &pos);
+	if (pos == GTK_TREE_VIEW_DROP_BEFORE ||
+	    pos == GTK_TREE_VIEW_DROP_AFTER) {
+		gtk_tree_path_free (path);
+		path = NULL;
+	}
 
 	drop_path = get_drop_path (dest, path);
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]