On Mon, 2005-11-28 at 19:42 +0100, DaveMDS wrote:
> Hi , (no replay on my last post...retry...)
> 
> I have a problem using the IconView auto-dnd 
> (gtk_icon_view_enable_model_drag_source) and the item-activated signal.
> 
> On item-activate I show a dialog to the user, when the dialog is closed 
> the IconView start a drag operation incorrectly.
> 
> This is the complete code (is this a bug? or I made something Wrong?)
> -----------------------------------------------------------------------------------------------------------
> #include <gtk/gtk.h>
> 
> enum
> {
>  COL_TEXT,
>  COL_PIXBUF,
>  NUM_COLS
> };
> static GtkTargetEntry targets[] =
>    {
>      { "text/uri-list", 0, 0 },
>    };
> 
> GtkWidget         *window = NULL;
> GtkWidget         *icon_view;
> GtkListStore     *store;
> 
> static void
> fill_store (GtkListStore *store)
> {
>  GtkTreeIter iter;
>  GdkPixbuf *pixbuf = gdk_pixbuf_new_from_file ("test.png", NULL);
> 
>  /* First clear the store */
>  gtk_list_store_clear (store);
>   
>  gtk_list_store_append (store, &iter);
>  gtk_list_store_set (store, &iter, COL_TEXT, "test",COL_PIXBUF,pixbuf, -1);
> }
> 
> static void        
> on_item_activated            (GtkIconView *iconview,GtkTreePath 
> *arg1,gpointer user_data){
>    GtkWidget *dialog;
>    g_print("ACTIVATed\n");
>    dialog = gtk_dialog_new_with_buttons("TEST",
>                                        GTK_WINDOW(window),
>                                        GTK_DIALOG_MODAL | 
> GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_NO_SEPARATOR,
>                                        GTK_STOCK_CLOSE,GTK_RESPONSE_YES,
>                                        NULL);
>    gtk_dialog_run(GTK_DIALOG(dialog));
>    gtk_widget_destroy (dialog);
> }
> 
> int main(int   argc,char *argv[]){
> 
>    gtk_init (&argc, &argv);
>   
>    //window   
>    window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
>    gtk_window_set_default_size (GTK_WINDOW (window), 650, 400);
>    gtk_window_set_title (GTK_WINDOW (window), "GtkIconView demo");
>    g_signal_connect (window, "destroy",G_CALLBACK 
> (gtk_widget_destroyed), &window);
>   
>    //store
>    store = gtk_list_store_new (NUM_COLS, G_TYPE_STRING, GDK_TYPE_PIXBUF);
>    fill_store (store);
>  
>    //icon_view
>    icon_view = gtk_icon_view_new_with_model (GTK_TREE_MODEL (store));
>    gtk_icon_view_set_text_column (GTK_ICON_VIEW (icon_view), COL_TEXT);
>    gtk_icon_view_set_pixbuf_column (GTK_ICON_VIEW (icon_view), COL_PIXBUF);
>    /* enable icon view auto D'n'D */
>    
> gtk_icon_view_enable_model_drag_source(GTK_ICON_VIEW(icon_view),GDK_BUTTON1_MASK,targets,1,GDK_ACTION_COPY);
>    
> gtk_icon_view_enable_model_drag_dest(GTK_ICON_VIEW(icon_view),targets,1, 
> GDK_ACTION_COPY);
>    gtk_signal_connect (GTK_OBJECT (icon_view), "item-activated", 
> GTK_SIGNAL_FUNC (on_item_activated),NULL);
> 
>    gtk_container_add (GTK_CONTAINER (window), icon_view);
>     
>    gtk_widget_show_all (window);
>    gtk_main();
>    return 0;
> }
> ----------------------

Please file a bug in bugzilla with your testcase. 


Thanks, Matthias

_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Reply via email to