[PATCH] Updated add/edit account window

Chris Shoemaker c.shoemaker at cox.net
Thu Jan 19 10:32:38 EST 2006


On Wed, Jan 18, 2006 at 02:10:28PM +0100, Eskil Bylund wrote:
> 2006/1/17, Chris Shoemaker <c.shoemaker at cox.net>:
> > If you want to continue with this, here's what I suggest:
> >
> >   1) move the filter function into gnc-tree-model-account-types.c.  I
> > think it can be private because...
> >   2) add a public convenience routine to
> > gnc-tree-model-account-types.[ch] that will return a filter model
> > already wrapped around the master account_types tree model.  This
> > function does the middle chunk of what your
> > gnc_account_type_combo_box_init() does.  Let this function take the
> > "valid_types" mask, and pass it as data to the filter function setter.
> >   3) change the filter function to take just the valid_types as data
> > -- no need for a struct.
> >
> 
> The attached patch implements this. How does it look?

Looks good.  I'm going to line wrap it at 80 columns and tweak it a
bit.  Also, I'm leaning towards forcing the functions to use the
static treemodel, instead of allowing one to be supplied.  It should
be sufficient and it will simplify usage.

So, I think the prototype will be:
GtkTreeModel * gnc_tree_model_account_types_valid(void);

and this will be a drop-in replacement for
gnc_tree_model_account_types_master(), which can now be private.

> The gnc_tree_model_account_types_filter_get_valid_types function
> should probably be put in the engine, but I'll leave that to you since
> I wouldn't know where.

Account.[ch], and it also should be slightly more restrictive than 
(-1 & ~(1 << CURRENCY)).  Probably:
 ((1 << NUM_ACCOUNT_TYPES) - 1) & ~(1 << CURRENCY)


Good work.  I'll commit soon and I look forward to seeing the patch
for the first user of these functions.

-chris


More information about the gnucash-devel mailing list