[PATCH] Updated add/edit account window

Eskil Bylund eskil.bylund at gmail.com
Thu Jan 19 13:21:49 EST 2006


2006/1/19, Chris Shoemaker <c.shoemaker at cox.net>:
> 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.
>
Yes, that seems good. Please remember to keep the _filter_using_mask()
function (maybe rename it to just _filter() ), since I would need this
in dialog-account.c when only specific types are to be allowed.

> > 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)
>
Yes, that would be better. I just couldn't figure that out :-)

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

While we're at GncTreeModelAccountTypes, there are some other changes
I would like to make.
1. Remove gnc_tree_model_account_types_get/set_selection, which
handles the selection of a GtkTreeView.
2. Rename gnc_tree_model_account_types_get/set_selected to
_get/set_visible and change GNC_TREE_MODEL_ACCOUNT_TYPES_COL_SELECTED
to GNC_TREE_MODEL_ACCOUNT_TYPES_COL_VISIBLE.

This is to change the Filter By dialog to use a checkbox for selection
of account types, instead of using the selection of the tree view.
(I.e. make it similar to the Visible columns in Nautilus).
To see why this is wanted, try and select some visible types in the
current filter dialog using only your keyboard or mouse. It's
difficult, not to say impossible.

I'll have a patch ready soon. It'll probably make more sense then my
attempt to explain above...

Anyone got any comments on this?



More information about the gnucash-devel mailing list