[Gtk-sharp-list] Draging text/uri from external app to widget

ub boo@youfuckingbitch.com
Sun, 19 Sep 2004 19:05:11 +0200


hi list!
i am trying to drag some link from firefox/konq into my gui, but i dont 
seem to get it to work.i am messing around with this stuff all day; ok 
so here's what i've tried:

textview1.DragDataReceived += new DragDataReceivedHandler (on_drop);

void on_drop(object o, DragDataReceivedArgs args){
    Console.WriteLine("stuff got dropped");
}

also tried that with DragDataDrop, DragEnd, kinda every Drag* handler, 
on almost every widget in the gui, but on_drop() never fired. i figured 
i'd need to add Drag.DestSet method.  i downloaded f-spot source 
(http://www.gnome.org/projects/f-spot/) where it seems to work (kinda), 
so i added

private static TargetEntry [] icon_source_target_table = new TargetEntry 
[] {
        new TargetEntry ("application/x-fspot-photos", 0, (uint) 
TargetType.PhotoList), 
        new TargetEntry ("text/uri-list", 0, (uint) 
TargetType.UriList),  //i really have no clue what this does
    };
// TargetTypeis an enum containing some lists, they dont get used before 
a handler is called, still tried to add/modify them - didnt help.
Gtk.Drag.DestSet (textview, DestDefaults.All, icon_dest_target_table,
                  DragAction.Copy | DragAction.Move); //copy/paste from 
MainWindow.cs - f-spot-0.0.2

again i tried almost every possible constelation of widget - drag*, but 
no luck. now im kinda fed up with bruteforcing (this is very frustrating 
by now) ;(
btw, yes - i read the tutorial at gtk.org and the mono documentation, 
but i still have no clue how to do a simple drop operation. would be 
nice if someone could explain how i get a widget to except drops from an 
external app (any help is appreciated).

Thanks,
Ulrich