GtkTextView drag and drop problems
- From: "Miroslav Rajcic" <rajcic sokrates hr>
- To: <gtk-app-devel-list gnome org>
- Subject: GtkTextView drag and drop problems
- Date: Tue, 7 Apr 2009 14:25:35 +0200
I am trying to allow GtkTextView widget accepting drop from Firefox, both
dropping the URL from address bar, and selected text from some page.
I am stuck, so I could use some tips.
I've initialized my text view as a drop target with:
gtk_drag_dest_add_text_targets(GTK_WIDGET(textview1));
gtk_drag_dest_add_uri_targets(GTK_WIDGET(textview1));
I've connected the DnD handlers:
g_signal_connect (G_OBJECT (textview1), "drag-drop", G_CALLBACK
(textview_on_drop), NULL);
g_signal_connect (G_OBJECT (textview1), "drag-data-received", G_CALLBACK
(drag_data_received_handl), NULL);
Unfortunately, I get no signal whatsoever. Draging from Firefox does not get
any of the
handlers being called!
Next I've tried initializing the drop target with explicit list:
static const GtkTargetEntry targets[] = {
{ "text/uri-list", GTK_TARGET_OTHER_APP|GTK_TARGET_OTHER_WIDGET, 0 },
{ "text/plain", GTK_TARGET_OTHER_APP|GTK_TARGET_OTHER_WIDGET, 1 },
{ "STRING", GTK_TARGET_OTHER_APP|GTK_TARGET_OTHER_WIDGET, 2 },
{ "text/html", GTK_TARGET_OTHER_APP|GTK_TARGET_OTHER_WIDGET, 1 },
};
gtk_drag_dest_set(GTK_WIDGET(textview1), GTK_DEST_DEFAULT_ALL, targets,
G_N_ELEMENTS (targets), GdkDragAction(GDK_ACTION_COPY|GDK_ACTION_MOVE));
This does not work either.
When dragging over the widget, cursor indicates that the drp is not
possible, but any of my handlers was not called. I am using gtk for Windows
from gtk.org (not the latest one, but not too old one) and VS2005. I've run
some tests and it appears that the same problem exists on Linux too.
When dragging the Firefox contents over "Clipboard Spy" tool, I notice that
data formats include "CF_TEXT" and "text/html".
Why does not seem to be any format match then (I've registered target for
text formats) ?
TIA,
Miroslav Rajcic
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]