Re: [gtk-list] Drag and drop



On Sat, 3 Jan 1998, Robert Roebling wrote:

> if I want to drag and drop files the way, it's done
> by a filemanager, which dnd-types do I have to use.
> It would of course be possible to use the mime-type
> "text/plain" and to list the files in the data section
> as a string list, but is that the way that was planned
> to be used for that purpose?

Nope. text/plain means a text document, any type of text document.

> I found the (re)definitions of Offix types in gdk/gdktypes.h,
> but they are not used anywhere. When using the original
> offix protocol I used the DND_FILES type. I don't know
> how to express that dnd-type with mime-type strings. Can
> that be done or how can I implement a filemanager?

The OffiX stuff is a hangover from when there was OffiX support in Gtk.

First of all, the way to drag multiple files is to use
gtk_widget_dnd_drag_add() inside a drag_begin_request signal handler., not
by passing a list of files.

For each of those widgets that you add, it should be set up with
gtk_widget_dnd_drag_set(), and the type_accept_list should include the 
type specific to each file. For example, if someone was dragging a .jpg
image from your file manager, you would specify type_accept_list to be
"url:image/jpeg", "image/jpeg" to specify that your file manager can offer
the drag target either the URL to or the content of the .jpg image.

You cannot assume that the person will always be dragging things from your
file manager to your file manager. For example, they may well be wanting
to drag this image to the GIMP to edit it, which is why you have to be
ready to offer the content as well as the filename/URL. (The
"url:typename" is just a convention I plan on using to allow
distinguishing between URL's and file contents - some programs can operate
only on one or the other).

Read header files and source code, it's good for you ;-) It's probably the
most helpful place at this point, along with asking on the list.
-- Elliot					http://www.redhat.com/
"They don't let my code go into shipping products," Gates said. "They
 haven't done that for eight years." (at the 1997 PDC)



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