GNOME Bugzilla – Bug 145121
GtkFileChooser should accept file DND
Last modified: 2011-02-04 16:18:32 UTC
The GtkFileChooser dialog (or at least the files pane) should accept URI drops. The filechooser should select the dropped filename, switching the current directory if possible. This would allow to quickly change directories by dragging in a file from that folder.
s/if possible/if needed/
Yeah, this would be nice.
*** Bug 153753 has been marked as a duplicate of this bug. ***
I also think it is a good idea and the chooser should switch to the new directory immidiately
*** Bug 157994 has been marked as a duplicate of this bug. ***
*** Bug 163436 has been marked as a duplicate of this bug. ***
I'm attaching a patch (against Gtk+ 2.6.2) to add support for dragging and dropping files and directories onto a GtkFileChooser{Widget,Dialog}. It makes the file tree view the drag destination. Seems to me it makes most sense - making the whole widget the destination would be weird if it's used outside the dialog. I disabled the normal tree view drag effects to make it clearer you aren't dropping files into a directory that's visible in the tree view or something like that, but I'm not sure if it's clear enough. Other things: If you drag a directory, it opens that directory. If you drag a file, it opens the directory and selects the file. It removes any previous selection. I'm not sure if this is a good idea, though. It only handles one dragged item. Maybe it would make more sense to deal with multiple items, but I'm unsure what would be the best way to deal with that. Obviously it should at least in that case behave wrt. any dragged directories the same way it does with ordinary files.
Created attachment 37411 [details] [review] Patch to add support for dnd'ing stuff into a file chooser Er, see the previous comment.
*** Bug 172799 has been marked as a duplicate of this bug. ***
Federico: have you tried this patch ? Should we get this into 2.7.x ?
I'll take a look. I want to make sure that all the cases are right (OPEN/single, OPEN/multiple, SAVE/single, CREATE_FOLDER/single).
Created attachment 48744 [details] [review] patch redone against head Here is the patch redone against HEAD, and made to actually compile, to save the next person the trouble to repeat that. file_list_drag_data_received is the function that needs attention to get all cases right.
This looks fine; go ahead and put it in HEAD and gtk-2-6 :)
2005-07-07 Matthias Clasen <mclasen@redhat.com> Implement Drag-and-Drop to the file list. (#145121, Sven Neumann) * gtk/gtkfilechooserdefault.c (file_list_drag_data_received_cb) (file_list_drag_drop_cb, file_list_drag_motion_cb): New functions to handle drag-and-drop on the file list. (create_file_list): Set up drag-and-drop handlers on the file list.