GncTreeView

Chris Shoemaker c.shoemaker at cox.net
Tue Jun 7 17:10:26 EDT 2005


On Tue, Jun 07, 2005 at 03:37:22PM -0400, Chris Shoemaker wrote:
> David,
>         I've had a pretty good look at gnc-tree-view.{ch} and I think
> it's fantastic.  This is exactly what all the other tree views were
> begging for.  And the integration with gconf is great.  I think it's
> going to make for nice behavior of treeviews and much cleaner code,
> too.
> 
>         Mind you, I haven't actually tried to use the api, just read
> through the code, but I have some ideas/suggestions:

I gave it a spin and I'm still impressed.  I coded up in about 10 min
what had previously taken me about 1 hr, and I estimate it would have
taken only about 30min if I'd started w/ GncTreeView, plus I got the
pretty alternating colors for free. :)

A few more comments:

   Something like gnc_tree_view_new() or
gnc_tree_view_new_with_model(), would be convenient.  It seems almost
conventional in gtk.

> 
>         All the viewcols are of the "attribute" type.  This is good
> for most cases, but maybe it would be good to allow adding a viewcol
> of the "cell_data_func" type.  I know you could always make your own
> viewcol and then call gnc_tree_view_append_column(), but that doesn't
> get you all the gconf/sorting/pango/selection menu goodness that the
> other viewcols get.

        I realize now, that I can add a col with the add_text_column
function, grab the col's renderers and change the type to
cell_data_func after-the-fact.  Apparently I can have my cake and eat
it, too.  But, it does hinge on getting the right renderer.  I feel a
bit icky just grabbing the first in the list returned by
gtk_tree_view_column_get_cell_renderers.  Maybe you could provide a
helper func to return the cell renderer I expect to be added when I
call add_xxx_col.  Or mark it with an object property?  I don't know.

        Does the second-to-last column have to be visible by default?

-chris


More information about the gnucash-devel mailing list