GncTreeView

Chris Shoemaker c.shoemaker at cox.net
Tue Jun 7 15:37:22 EDT 2005


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:

        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.

        Also, IIUC, add_numeric_column still requires that the model
column be G_TYPE_STRING, right?  Maybe it's possible to go a step
further with something like add_monetary_col().  It could take two
model columns, one for the commodity and one for the amount.  Then,
internally, you could use a cell_renderer_text, and set your own
cell_data_fun to turn commodity+gnc_numeric into a string.

        As for GtkCellEditable, I guess the way to use this would be
to call gtk_tree_view_column_get_renderers() on the viewcol returned
by the add_xxx_column to get the renderer, then set "editable"
property to true and connect to "edited" signal.  It's a little
difficult to do that without making making some reasonable assumptions
about how the add_xxx_column functions are packing the cellrenderers
into the viewcol.  Maybe you can just make that an explicit part of
the api by saying, "this function will add N CRs under these
conditions..."

        Nice work!

-chris


More information about the gnucash-devel mailing list