Re: Implementing XDS at GTK+ level?



On Fri, 04 Nov 2005 16:34:03 -0500, Matthias Clasen wrote:

> On Fri, 2005-11-04 at 12:26 +0100, Christian Neumair wrote:
>> I wonder whether implementing the XDS dnd protocol [1] at GTK+ level is
>> viable. The drag source implementation is in GIMP, the drag target
>> implementation (rather the rarely tested beginning of it) in bugzilla
>> [2,3,4]. I'm asking because it would be handy for Nautilus/panel
>> interaction (launcher copying), where both would be drag source and
>> destination, and I'm sure that many applications want this as well.
>> 
>> [1] http://www.newplanetsoftware.com/xds/
>> [2] http://bugzilla.gnome.org/show_bug.cgi?id=171655
>> [3] http://bugzilla.gnome.org/attachment.cgi?id=49362&action=view
>> [4] http://bugzilla.gnome.org/attachment.cgi?id=49363&action=view
>> 
> Do you have an API proposal ?

Here's the one that ROX-Lib provides:

http://rox.sourceforge.net/rox_lib_docs/rox.loading.html

When the text/uri-list arrives, the application is offered the list
(xds_load_uris()).

If it doesn't handle this, ROX-Lib checks whether all the URIs refer to
local files. If so, it calls xds_load_from_file() on each one. If not, and
there is one remote file, ROX-Lib fetches it via the X server and passes
it to the application with xds_load_from_stream().

So, if an application just wants data, it only overrides load_from_stream,
whereas if it wants files it overrides load_from_file. Of course, you
might implement this with signals rather than by sub-classing in a GTK
version.

Probably the most useful function is having GTK extract the local file
names from the uri-list, as this is rather error-prone (some apps don't
cope well with hostnames currently, for example). Likewise, we could do
with a GTK function to create a text/uri-list from a list of local files
(many apps get the line endings wrong).


-- 
Dr Thomas Leonard		http://rox.sourceforge.net
GPG: 9242 9807 C985 3C07 44A6  8B9A AE07 8280 59A5 3CC1





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