After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 145121 - GtkFileChooser should accept file DND
GtkFileChooser should accept file DND
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Widget: GtkFileChooser
2.4.x
Other All
: Normal enhancement
: ---
Assigned To: Federico Mena Quintero
Federico Mena Quintero
: 153753 157994 163436 172799 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2004-06-29 09:00 UTC by Sven Neumann
Modified: 2011-02-04 16:18 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Patch to add support for dnd'ing stuff into a file chooser (5.20 KB, patch)
2005-02-12 16:35 UTC, Juri Pakaste
none Details | Review
patch redone against head (5.46 KB, patch)
2005-07-06 20:52 UTC, Matthias Clasen
accepted-commit_now Details | Review

Description Sven Neumann 2004-06-29 09:00:18 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.
Comment 1 Sven Neumann 2004-06-29 09:01:11 UTC
s/if possible/if needed/
Comment 2 Federico Mena Quintero 2004-07-09 01:11:45 UTC
Yeah, this would be nice.
Comment 3 Matthias Clasen 2004-09-26 04:25:50 UTC
*** Bug 153753 has been marked as a duplicate of this bug. ***
Comment 4 Lemmit Kaplinski 2004-09-26 17:50:47 UTC
I also think it is a good idea and the chooser should switch to the new
directory immidiately
Comment 5 Federico Mena Quintero 2004-12-15 01:02:32 UTC
*** Bug 157994 has been marked as a duplicate of this bug. ***
Comment 6 Matthias Clasen 2005-01-09 21:23:14 UTC
*** Bug 163436 has been marked as a duplicate of this bug. ***
Comment 7 Juri Pakaste 2005-02-12 16:34:25 UTC
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.
Comment 8 Juri Pakaste 2005-02-12 16:35:53 UTC
Created attachment 37411 [details] [review]
Patch to add support for dnd'ing stuff into a file chooser

Er, see the previous comment.
Comment 9 Federico Mena Quintero 2005-04-15 20:50:32 UTC
*** Bug 172799 has been marked as a duplicate of this bug. ***
Comment 10 Matthias Clasen 2005-06-16 05:50:13 UTC
Federico: have you tried this patch ? Should we get this into 2.7.x ?
Comment 11 Federico Mena Quintero 2005-06-16 15:47:40 UTC
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).
Comment 12 Matthias Clasen 2005-07-06 20:52:52 UTC
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.
Comment 13 Federico Mena Quintero 2005-07-07 01:33:51 UTC
This looks fine; go ahead and put it in HEAD and gtk-2-6 :)
Comment 14 Matthias Clasen 2005-07-07 17:14:55 UTC
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.