Re: Tricky treemodel question



Hi,

On Wed, 2002-07-17 at 23:58, Ben Martin wrote:
> I am creating a custom tree model and when a row is expanded there is
> sometimes considerable work to be done. I can break that work up to some
> level and am emitting libsigc++ signals that the main window class is
> attached to and the main window then sets a progress bar so that I can
> give some indication of progress.
> 
> The problem comes in where I have to do something like
>         while( gtk_events_pending() )
>             gtk_main_iteration_do(false);
> after setting the progress bar so that GTK repaints the new bar
> position. However I am getting the following error which I think is
> caused by GTK trying to repaint the gtktreeview again. 

If you can divide the work to do in small chunks (or you can
suspend/resume execution of it arbitrarialy) I think it would be better
to set up an idle handler and do the work incrementally from there. 
E.g. as the nautilus tree sidebar works (take a look at
nautilus/components/tree/nautilus-tree-model.c).  That way you won't
have this kind of reentrancy problem and your interface will still be
responsive.

Hope this helps,
Gustavo





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