Xarchiver: help with Drag and Drop

David Keogh davekeogh at shaw.ca
Wed Jun 28 18:46:39 CEST 2006


On 6/28/06, Colossus <colossus73 at gmail.com> wrote:
>
> Hi,
>
> I'm currently stuck in developing DnD with XDS protocol. The problem
> is that I don't know how to handle multiple selected rows, dragged
> from Xarchiver window and dropped in another application (Thunar, ROX,
> etc), in the DnD handler. I tried to look up at xfburn and Thunar code
> but the first doesn't use the signal drag-begins, and so I don't know
> how to pass the thunar current path to the 'drag_data_received'
> handler; the latter's  code is too complicated for being adapted to
> Xarchiver.
>
> Any volunteer wants to help me please ? Apart DnD I just have to fix
> the bugs and then I can finally release out a beta test.


Hi,

I've been playing around with XDS lately as a bit of a learning experience,
so I may be able to give you a bit of insight. Although, I have been using
Python, so I won't be able to give you any code you can use directly.

In the callback for the "drag-begin" signal set your window's XDS property.
For example, in Python:

def treeview_drag_begin(self, widget, context):
    win = context.source_window
    win.property_change('XdndDirectSave0', 'text/plain', 8,
gtk.gdk.PROP_MODE_REPLACE, selected_file_no1)

Then, in the callback for "drag-data-get", read the XDS property to find out
the URI provided by Thunar or Rox:

def treeview_drag_data_get(self, widget, context, selection, info,
timestamp):
    win = context.source_window
    retval = win.property_get('XdndDirectSave0', 'text/plain', False)
    uri = retval[2]

>
The XDS protocal was designed for only saving a single file, but once you
have the URI for the first selected file, you can easily extract the rest to
the same path.

I figured most of this out by looking at the source of rox-lib vecause I
found that the XDS docs are fairly non-existant. It may not be 100% correct,
but it certainly works for me with Thunar, I don't actually have Rox on my
PC to test with.

I hope this message can be of some use to you. Xarchiver is becoming quite a
nice piece of software, and once XDS and the command-line switches are
working I'll be able to banish file-roller from my system.

Cheers,
David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.xfce.org/pipermail/xfce4-dev/attachments/20060628/b09e69c9/attachment.html>


More information about the Xfce4-dev mailing list