[PATCH] Updated add/edit account window

Chris Shoemaker c.shoemaker at cox.net
Wed Feb 15 14:32:41 EST 2006


On Wed, Feb 15, 2006 at 06:40:10PM +0100, Andreas Köhler wrote:
> Hi,
> 
> On Monday, 16 Jan 2006, 16:49 CET, Eskil Bylund wrote:
> > Here's a patch that updates the add/edit account window. Changes are:
> > 
> >  * src/gnome/glade/account.glade
> >  * src/gnome-utils/dialog-account.c: Clean up the Account dialog.
> > Replace the account type clist with a GtkComboBox. Update the title
> > when changing parent account.
> > 
> > By the way. The GnomeDateEdit in the opening balance notebook allows
> > one to set not only the date but also the time. Is this time ever
> > used? If not, the GnomeDateEdit should be set to only display the
> > date.
> 
> @Eskil:
> I am sorry, I did not follow/remember this thread, so my patch
> ([13259]) did not make use of your work. I rather saw a CList and
> thought that nobody has cared yet.

I share some blame here.  I asked Eskil to generalize parts of the
patch.  He did that and I committed them to
gnc-tree-model-account-types.[ch].  But, I never followed up with him
about rewriting the original patch to use the generalized functions.

> Here is a patch that tries to replace the list store with a filtered
> GncTreeModelAccountTypes. If you do not want to go this way (do not
> think so), there are still two open bugs in my own code ;)

Much of these changes apply equally to using a treeview or a
combobox. So, we can consider a later patch that would switch from
treeview to combobox, but at least this patch will use the global
filtered model.

> 
> What it does:
> 
> * uses a filtered GncTreeModelAccountTypes with eigher
>   aw->valid_types or xaccAccountTypesValid | 1<< aw->type

good.

> 
> * adds gnc_tree_model_account_types_get_iter_from_type to set an
>   iter to a specific type

You probably felt the need to add this because the existing
gnc_tree_model_account_types_set_selected() operated only on a view
that had attached the unfiltered model instead of the filtered model.
That was an oversight and should be fixed.  I think this change
removes the last use of the unfiltered model, so we can just remove
access to it from gnc_tree_model_account_types.h.

> 
> * some minor changes, including one to
>   gnc_tree_model_account_types_get_flags

good.

> What do you think?

I'll convert the existing gnc_tree_model_account_types_set_selected()
to use the filtered model.  That should simplify this patch just a bit
by hiding some of this stuff:

> +  if (gnc_tree_model_account_types_get_iter_from_type (
> +	GNC_TREE_MODEL_ACCOUNT_TYPES (model), &iter, aw->type)) {
> +    if ((path = gtk_tree_model_get_path (model, &iter)) != NULL) {
> +      if ((f_path = gtk_tree_model_filter_convert_child_path_to_path (
> +	     GTK_TREE_MODEL_FILTER (f_model), path)) != NULL) {
> +	gtk_tree_selection_select_path (selection, f_path);
> +	gtk_tree_view_scroll_to_cell (view, f_path, NULL, FALSE, 0.0, 0.0);
> +	gtk_tree_path_free (f_path);
> +      }
> +      gtk_tree_path_free (path);
> +    }


-chris


More information about the gnucash-devel mailing list