GncTreeView
David Hampton
hampton-gnucash at rainbolthampton.net
Tue Jun 7 18:59:28 EDT 2005
On Tue, 2005-06-07 at 15:37 -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.
Thanks.
> Mind you, I haven't actually tried to use the api, just read
> through the code, but I have some ideas/suggestions:
I did look at your budgeting code while working on the changes, and
tried to make the GncTreeView flexible enough to meet what you were
doing.
> 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.
You can't get sorting without using the GtkTreeModel, because the
sorting happens in a GtkTreeModelSort that is layered between the data
model and the view. The gconf/slection menu code should work correctly
for append_column() as long as you provide a pref_name. Not quite sure
what you mean by the pango reference. IIRC the only use of pango was
sizing the column title.
> 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.
It requires that the model return a string to the view. Says nothing
about what the model uses to create this string. That's internal to the
model. You can finda ll the available types at
http://developer.gnome.org/doc/API/2.0/gobject/gobject-Type-
Information.html#G-TYPE-INVALID:CAPS, but the only easily usable ones
are boolean, int, double, string, and pointer.
> 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..."
Does gnc_tree_view_account_add_custom_column() provide what you're
looking for?
David
More information about the gnucash-devel
mailing list