DND in gtk+-1.2.0



Hi,

I'm experimenting with the drag and drop features of GTK+-1.2.0. I'm
using a modified code snippet of the gtk/testdnd.c program of the GTK+
distribution. The init_dnd function is called for a clist
widget. After dragging a hyperlink from netscape to the clist, I get
the following output:

Gtk-WARNING **: gtk_signal_disconnect_by_func(): could not find handler (0x40094BF0) containing data (0x0)

Gtk-WARNING **: gtk_signal_disconnect_by_func(): could not find handler (0x40098410) containing data (0x0)
Received "http://wm.themes.org/theme-download.cgi?name=Firebird-Lightning" in label

The 'Received ..' message is ok, however, how do I avoid the Warning
messages?
Any help is appreciated. BTW: Is there documentation about gtk+ DND
available somewhere? I didn't find any info in the tutorial or manual.

Thanks,

Ullrich

Here's the program snippet:

enum {
  TARGET_STRING,
  TARGET_ROOTWIN
};

static GtkTargetEntry target_table[] = {
  { "STRING",     0, TARGET_STRING },
  { "text/plain", 0, TARGET_STRING },
  { "application/x-rootwin-drop", 0, TARGET_ROOTWIN }
};

static guint n_targets = sizeof(target_table) / sizeof(target_table[0]);

static void
init_dnd (GtkWidget *widget)
{
   gtk_drag_dest_set (widget,
		      GTK_DEST_DEFAULT_ALL,
		      target_table, n_targets - 1, /* no rootwin */
		      GDK_ACTION_COPY | GDK_ACTION_MOVE);
   gtk_signal_connect (GTK_OBJECT (widget), "drag_data_received",
		       GTK_SIGNAL_FUNC (drag_data_received), NULL);
}

static void  
drag_data_received (GtkWidget *widget, GdkDragContext *context, gint x, gint y,
		    GtkSelectionData *data, guint info, guint time)
{
   if (data->length >= 0 && data->format == 8)
   {
      g_print ("Received \"%s\" in label\n", (gchar *) data->data);
      gtk_drag_finish (context, TRUE, FALSE, time);
      return;
   }
   gtk_drag_finish (context, FALSE, FALSE, time);
}
-- 
Ullrich Hafner <hafner@bigfoot.de>, http://www.bigfoot.com/~uhafner



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