Re: color selection and tree view



Hi Ian,

 model = gtk_tree_view_get_model(GTK_TREE_VIEW(view));

 g_object_ref(model); /* Make sure the model stays with us after the tree view unrefs it */

 gtk_tree_view_set_model(GTK_TREE_VIEW(view), NULL); /* Detach model from view */

 ... insert a couple of thousand rows ...

 gtk_tree_view_set_model(GTK_TREE_VIEW(view), model); /* Re-attach model to view */

 g_object_unref(model);

is this equivelenat to the above?

 g_object_get( G_OBJECT( widget->widget ), "model", &model, NULL );
// Make sure the model stays with us after we remove it from the model widget
 g_object_ref( model );
 // Detach model from view
g_object_set( G_OBJECT( widget->widget ), "model", NULL, NULL ); // is this correct?

... insert a couple thousand rows ...

g_object_set( G_OBJECT( widget->widget ), "model", model, NULL );// Reattach the model
 g_object_unref( model );



 ...

tim> Secondly, you should make sure that sorting is disabled while you
tim> are doing your mass insertions, otherwise your store might be
tim> resorted after each and every single row insertion, which is going
tim> to be everything but fast.

This reads like excellent advice, and I already follow the first part.  But,
as for the second part, how do I temporarily disable sorting on a sorted
view?

did you try gtk_tree_sortable_set_sort_func <http://developer.gnome.org/doc/API/2.0/gtk/GtkTreeSortable.html#gtk-tree-sortable-set-sort-func>?

Merely setting the sort column to  GTK_DEFAULT_SORT_COLUMN_ID doesn't
do it, bacause I have already used gtk_tree_sortable_set_default_sort_func()
to basically remember the initial order.  Using the same function
with a NULL parameter leads to a segfault, which tells me that there is an
internal do-nothing function installed initially.  But I cannot retrieve
_that_ and use it because there is no gtk_tree_sortable_get_default_sort_func.

Really, I simply want (but cannot find) something like a "sortable" property
on the view that I can clear before the big operation and set again after.

sorry i don't have answers to your other questions.

-todd





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