[PATCH] iterate through drop container target list instead of drag context DND list



Should fix bug 337588 [1], proposed patch attached.

[1] http://bugzilla.gnome.org/show_bug.cgi?id=337588

-- 
Christian Neumair <chris gnome-de org>
Index: libnautilus-private/nautilus-icon-dnd.c
===================================================================
RCS file: /cvs/gnome/nautilus/libnautilus-private/nautilus-icon-dnd.c,v
retrieving revision 1.152
diff -u -p -r1.152 nautilus-icon-dnd.c
--- libnautilus-private/nautilus-icon-dnd.c	18 Mar 2006 07:13:49 -0000	1.152
+++ libnautilus-private/nautilus-icon-dnd.c	9 Apr 2006 12:55:12 -0000
@@ -371,8 +371,8 @@ nautilus_icon_container_dropped_icon_fee
 static void
 get_data_on_first_target_we_support (GtkWidget *widget, GdkDragContext *context, guint32 time)
 {
-	GList *target;
 	GtkTargetList *list;
+	GdkAtom target;
 	
 	if (drop_types_list == NULL) {
 		drop_types_list = gtk_target_list_new (drop_types,
@@ -390,30 +390,28 @@ get_data_on_first_target_we_support (Gtk
 	} else {
 		list = drop_types_list;
 	}
-	
-	for (target = context->targets; target != NULL; target = target->next) {
+
+	target = gtk_drag_dest_find_target (widget, context, list);
+	if (target != GDK_NONE) {
 		guint info;
-		GdkAtom target_atom = GDK_POINTER_TO_ATOM (target->data);
 		NautilusDragInfo *drag_info;
+		gboolean found;
 
 		drag_info = &(NAUTILUS_ICON_CONTAINER (widget)->details->dnd_info->drag_info);
 
-		if (gtk_target_list_find (list, 
-					  target_atom,
-					  &info)) {
-			/* Don't get_data for rootwindow drops unless it's the actual drop */
-			if (info == NAUTILUS_ICON_DND_ROOTWINDOW_DROP &&
-			    !drag_info->drop_occured) {
-				/* We can't call get_data here, because that would
-				   make the source execute the rootwin action */
-				drag_info->got_drop_data_type = TRUE;
-				drag_info->data_type = NAUTILUS_ICON_DND_ROOTWINDOW_DROP;
-			} else {
-				gtk_drag_get_data (GTK_WIDGET (widget), context,
-						   target_atom,
-						   time);
-			}
-			break;
+		found = gtk_target_list_find (list, target, &info);
+		g_assert (found);
+
+		/* Don't get_data for rootwindow drops unless it's the actual drop */
+		if (info == NAUTILUS_ICON_DND_ROOTWINDOW_DROP &&
+		    !drag_info->drop_occured) {
+			/* We can't call get_data here, because that would
+			   make the source execute the rootwin action */
+			drag_info->got_drop_data_type = TRUE;
+			drag_info->data_type = NAUTILUS_ICON_DND_ROOTWINDOW_DROP;
+		} else {
+			gtk_drag_get_data (GTK_WIDGET (widget), context,
+					   target, time);
 		}
 	}
 }


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