[Vala] How to get drag'n drop picture from Firefox ?



Hello,


I'm trying to get an picutre and its URL from Firefox by 'drag & drop' into my vala application....

I only have the URL link "pointed by" the picture and I think I've missed something with targets list ... (I've got some hints from http://faq.pygtk.org/index.py?req=edit&file=faq23.018.htp)

text/x-moz-url
_NETSCAPE_URL
text/x-moz-url-data
text/x-moz-url-desc
application/x-moz-custom-clipdata
text/_moz_htmlcontext
text/_moz_htmlinfo
text/html
text/unicode
text/plain;charset=utf-8
text/plain
application/x-moz-nativeimage
application/x-moz-file-promise
application/x-moz-file-promise-url
application/x-moz-file-promise-dest-filename

I've took an example from Akshay Shekher (https://gist.github.com/voldyman/11396492) and add some lines :

(...)
        Gtk.TargetEntry plain_entry = { "text/plain",        0, 2 };

        target_list += string_entry;
        target_list += urilist_entry;
        target_list += plain_entry;
(...)

   void on_drag_data_received (Gtk.Widget widget, Gdk.DragContext ctx,
                            int x, int y,
                            Gtk.SelectionData selection_data,
                            uint target_type, uint time) {


(...)

        case 2:

            string data = (string) selection_data.get_data ();
            print ("%s\n", data);
            this.add (new Gtk.Label (data));
            break;
        }

(...)


Do you have some hints ? :)

Thanks

Regards

Raum




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