--- gtk+-2.6.2/gtk/gtkfilechooserdefault.c	2005-02-12 18:31:34.000000000 +0200
+++ gtk+-2.6.2-patch/gtk/gtkfilechooserdefault.c	2005-02-12 18:01:50.000000000 +0200
@@ -2906,12 +2906,6 @@
 		     num_shortcuts_dest_targets,
 		     GDK_ACTION_COPY | GDK_ACTION_MOVE);
 
-  gtk_drag_dest_set (impl->browse_files_tree_view,
-                     GTK_DEST_DEFAULT_ALL,
-                     file_list_dest_targets,
-                     num_file_list_dest_targets,
-                     GDK_ACTION_COPY | GDK_ACTION_MOVE);
-
   selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (impl->browse_shortcuts_tree_view));
   gtk_tree_selection_set_mode (selection, GTK_SELECTION_BROWSE);
   gtk_tree_selection_set_select_function (selection,
@@ -2943,9 +2937,6 @@
   g_signal_connect (impl->browse_shortcuts_tree_view, "drag-data-received",
 		    G_CALLBACK (shortcuts_drag_data_received_cb), impl);
 
-  g_signal_connect (impl->browse_files_tree_view, "drag-data-received",
-                    G_CALLBACK (file_list_drag_data_received_cb), impl);
-
   gtk_container_add (GTK_CONTAINER (swin), impl->browse_shortcuts_tree_view);
   gtk_widget_show (impl->browse_shortcuts_tree_view);
 
@@ -3126,41 +3117,83 @@
                                  gpointer               data)
 {
   GtkFileChooserDefault *impl;
+  GtkFileChooser *chooser;
   gchar **uris;
-  gint i;
 
   impl = GTK_FILE_CHOOSER_DEFAULT (data);
+  chooser = GTK_FILE_CHOOSER (data);
   
   /* Parse the text/uri-list string, navigate to the first one */
-  uris = g_uri_list_extract_uris (data);
+  uris = g_uri_list_extract_uris (selection_data->data);
   if (uris[0]) 
     {
       char *uri;
       GtkFilePath *path;
+      GError *error;
+      error = NULL;
       
       uri = uris[0];
       path = gtk_file_system_uri_to_path (impl->file_system, uri);
       
       if (path)
         {
-          gtk_file_chooser_set_filename(impl, path);
+          if (check_is_folder(impl->file_system, path, error))
+            {
+              change_folder_and_display_error(impl, path);
+            }
+          else
+            {
+              gtk_file_chooser_default_unselect_all (chooser);
+              gtk_file_chooser_default_select_path (chooser, path, &error);
+              browse_files_center_selected_row (chooser);
+              if (error)
+                {
+                  error_selecting_dragged_file_dialog (impl, path, error);
+                }
+            }
         }
       else
         {
-	  GError *error;
-
 	  g_set_error (&error,
 		       GTK_FILE_CHOOSER_ERROR,
 		       GTK_FILE_CHOOSER_ERROR_BAD_FILENAME,
 		       _("Could not select file '%s' "
 			 "because it is an invalid path name."),
 		       uri);
-	  error_adding_bookmark_dialog (impl, path, error);
+	  error_selecting_dragged_file_dialog (impl, path, error);
         }
     }
+  g_signal_stop_emission_by_name (widget, "drag-data-received");
   g_strfreev(uris);
 }
 
+/* Don't do anything with the drag_drop signal */
+static gboolean
+file_list_drag_drop_cb (GtkWidget             *widget,
+			GdkDragContext        *context,
+			gint                   x,
+			gint                   y,
+			guint                  time_,
+			GtkFileChooserDefault *impl)
+{
+  g_signal_stop_emission_by_name (widget, "drag-drop");
+  return TRUE;
+}
+
+/* Disable the normal tree drag motion handler, it makes it look like you're
+   dropping the dragged item onto a tree item */
+static gboolean
+file_list_drag_motion_cb (GtkWidget             *widget,
+                          GdkDragContext        *context,
+                          gint                   x,
+                          gint                   y,
+                          guint                  time_,
+                          GtkFileChooserDefault *impl)
+{
+  g_signal_stop_emission_by_name (widget, "drag-motion");
+  return TRUE;
+}
+
 
 /* Constructs the popup menu for the file list if needed */
 static void
@@ -3326,6 +3359,13 @@
 
   gtk_tree_view_set_rules_hint (GTK_TREE_VIEW (impl->browse_files_tree_view), TRUE);
   gtk_container_add (GTK_CONTAINER (swin), impl->browse_files_tree_view);
+
+  gtk_drag_dest_set (impl->browse_files_tree_view,
+                     GTK_DEST_DEFAULT_ALL,
+                     file_list_dest_targets,
+                     num_file_list_dest_targets,
+                     GDK_ACTION_COPY | GDK_ACTION_MOVE);
+
   g_signal_connect (impl->browse_files_tree_view, "row-activated",
 		    G_CALLBACK (list_row_activated), impl);
   g_signal_connect (impl->browse_files_tree_view, "key-press-event",
@@ -3334,6 +3374,12 @@
 		    G_CALLBACK (list_popup_menu_cb), impl);
   g_signal_connect (impl->browse_files_tree_view, "button-press-event",
 		    G_CALLBACK (list_button_press_event_cb), impl);
+  g_signal_connect (impl->browse_files_tree_view, "drag-data-received",
+                    G_CALLBACK (file_list_drag_data_received_cb), impl);
+  g_signal_connect (impl->browse_files_tree_view, "drag-drop",
+                    G_CALLBACK (file_list_drag_drop_cb), impl);
+  g_signal_connect (impl->browse_files_tree_view, "drag-motion",
+                    G_CALLBACK (file_list_drag_motion_cb), impl);
 
   selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (impl->browse_files_tree_view));
   gtk_tree_selection_set_select_function (selection,
