drag-data-received signal not being emitted



Hi all,

I am trying to write a GTK/GNOME application. It has a main window with
GtkTreeView control on to which you can drag and drop files from
Nautilus.

The code I have used to set up the widgets is:

enum
{
   TARGET_URI_LIST,
};

static GtkTargetEntry target_list [] = {{ "text/uri-list", 0,
TARGET_URI_LIST }};

static guint n_targets = G_N_ELEMENTS (target_list);
....
....
....
int main(int argc, char **argv)
{
   GtkListStore *list_store;
   ..... 
   ....
   tree_view = GTK_WIDGET(glade_xml_get_widget(xml, "tree_view"));
    
   /* Set the tree view to receive drag/drops. */
   list_store = gtk_list_store_new(2, G_TYPE_STRING, G_TYPE_STRING);
   gtk_tree_view_set_model(GTK_TREE_VIEW(tree_view),
GTK_TREE_MODEL(list_store));
   gtk_drag_dest_set(tree_view, GTK_DEST_DEFAULT_MOTION |
GTK_DEST_DEFAULT_HIGHLIGHT, target_list, n_targets, GDK_ACTION_COPY);
    
   /* Set up, and connect the events for, the main window. */
   g_signal_connect(G_OBJECT(tree_view), "drag-drop",
G_CALLBACK(drag_drop), NULL);
   g_signal_connect(G_OBJECT(tree_view), "drag-data-received",
G_CALLBACK(drag_data_received), NULL);
......
}

The definition of my drag_drop function is:

gboolean drag_drop(GtkWidget *widget, GdkDragContext *drag_context, gint
x, gint y, guint time, gpointer user_data)
{
   GdkAtom target_type;
        
   /* If the source offers a target */
   if (drag_context->targets)
   {
      target_type = GDK_POINTER_TO_ATOM(g_list_nth_data
(drag_context->targets, TARGET_URI_LIST));
                
      /* Request the data from the source. */
      gtk_drag_get_data(widget, drag_context, target_type, time);
        
      return TRUE;
    }
    
    return FALSE;
}

However, although the drag_drop signal is being received OK the
drag_data_received signal is not being emitted at all. I have scoured
the GTK documentation and Google but can find nothing on this.

Any pointers would be appreciated.

Regards,


Chris





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