Tree view multiple row selection



Can anyone offer some advice on multiple row selection using a button_press_event connected to a TreeView 
column list?

I have the following code:

{
   //connecting the signal:
   .......
   g_signal_connect ((gpointer) vars_clist, "button_press_event",
                                G_CALLBACK (clist_button_discriminator),
                                NULL);
   ........
}

//the callback
gint
clist_button_discriminator (GtkWidget *treeview, GdkEventButton *event, gpointer userdata)
{
   ..........
        selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(treeview));
         gtk_tree_view_get_path_at_pos(GTK_TREE_VIEW(treeview),
                                                             event->x, event->y,
                                                            &path, &column, NULL, NULL);
        row = gtk_tree_path_get_indices (path)[0];
        col = GPOINTER_TO_INT(g_object_get_data( G_OBJECT( column ), "column"));
//        printf("%d, %d\n", row, col);
//        gtk_tree_selection_unselect_all(selection);
        gtk_tree_selection_select_path(selection, path);
        gtk_tree_path_free(path);
        HANDLE_TREEVIEW_MOUSE_EVENTS(col, event->button, event);
        return TRUE;
}

with "gtk_tree_selection_unselect_all(selection)"  this code works fine when the selection mode is _SINGLE, 
but when I change the selection mode to _MULTIPLE "gtk_tree_selection_unselect_all(selection)" basically 
cancels my action and is the reason why it's commented out above. The problem now is that the rows can't be 
unselected.....

Thanks for any help
-M



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