Re: [gtkmm] Custom tree model



Aaron Isotton wrote:
> a nice way to communicate the change to the tree views.  What I'm using
> right now is an ugly hack, and I have not yet found a clean way to do
> what I want with the row_inserted and row_deleted functions.  My tree
> model should be quite efficient up to about 20,000 rows, and I just
> don't like to make 40,000 function calls for what should be done in
> simply one.

It's difficult to answer that without knowing your code, but I guess you're
currently trying to implement an "automated" way to update the TreeView every
time there's a change in the model. Why not just give the model a public
"refresh" function and leave it to the application developer when to call it?
(I.e. fill in your 20,000 rows without updating once, _then_ manually call the
refresh.)

> - The GtkTreeIter structure is okay for C programs, but in my case I
> have a custom iterator class which can not be converted to three void*
> pointers in a nice way.  What I'd like to do is to allocate a iterator
> for every GtkTreeIter and put a pointer to it into user_data.  The
> problem is that I don't know when to free the allocated object, to avoid
> memory leaks.  Any ideas?

Could you give more details about the problem here? Especially when is your
custom iterator created, and why doesn't it just work to symmetrically
reverse this way? (I.e. "allocate when inserting a GtkTreeIter" -- "free
when removing the GtkTreeIter")

Attachment: pgpeWZeZeawAh.pgp
Description: PGP signature



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