[Vala] How to get drag'n drop picture from Firefox ?
- From: raum no-log org
- To: vala-list gnome org
- Subject: [Vala] How to get drag'n drop picture from Firefox ?
- Date: Tue, 16 Aug 2016 09:27:10 +0200
Hello all,
I've tried to send yesterday a mail but I didnt received a notification,
so please excuse me if you have this message on double... ^_^
I'm trying to get an picture 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 to retrieve picture and URL pointed by this picture ?
(example on youtube, if I search "usain bolt", I've got a picture
https://i.ytimg.com/vi/V9sxs9ekWC0/hqdefault.jpg?custom=true&w=196&h=110&stc=true&jpg444=true&jpgq=90&sp=68&sigh=8NoJzcuPtRovVOesoOjRT4iuZGU
and the link to the video https://www.youtube.com/watch?v=V9sxs9ekWC0)
Thanks
Regards
Raum
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]