Register-rewrite update

Chris Shoemaker c.shoemaker at cox.net
Wed Jul 18 14:26:09 EDT 2007


On Wed, Jul 18, 2007 at 12:06:57AM -0500, Jeff Green wrote:
> I have been focusing on the crashes that were caused by adding
> autocompletion, since I realized that I couldn't adequately test any other
> functionality if I could only add one new transaction without crashing the
> program or closing and reopening the account. I spent some quality time with
> gdb and narrowed down the crashes to being caused by setting up the
> autocompletion using the real model associated with the transaction register
> treeview. So I tried making a copy of the data for the column that needs
> autocompletion (just the Description column for now) and using that for the
> autocompletion. This solved all the crashes.
> 
> Unfortunately on the first implementation, autocompletion only worked for
> the first new transaction. This was an issue with TreeViewIters and creating
> a copy of the treeview model on each "editing-started" signal. So I made a
> new function to make a copy of the completion data when the cellrenderers
> are initialized (in cdf) and then use that copy for all completions. With
> this change autocompletion worked for all new transactions, the only problem
> being that the descriptions of the new transactions were not added to the
> copy of the completion data. This can be solved by adding the new text
> entered into the cell to the copy when the "edited" signal is received. This
> is where I'm at currently.

Oh, what a pain!  I was so pleased when I saw that the first
autocomplete implementation re-used the transaction-model.  That's
just very simple, and automatically has many properties that are nice
for autocompletion, like 1) it only uses the descriptions already in
that register, and 2) it sees the newly added descriptions.

It would be such a shame if we had to do something like copy
model+insert new.  But honestly, it would probably still be simpler
than the old custom autocomplete code.

If you try again with the single model, and get stumped, don't
hesitate to send the backtrace here.

-chris

> I also noticed when looking into creating a callback or using an existing
> one for the "edited" signal (the existing callback is "gtvt_edited_cb") that
> I had unnecessarily created the "editing_started_cb" callback for the
> "editing-started" signal ("get_editable_start_editing_cb" was already being
> connected to that signal), so now I am working on integrating my code with
> the existing callbacks. Once the callbacks are integrated there should be no
> problems with autocompletion for the description field. It might also turn
> out that there is no need for the copy of the data from the treeview model,
> but that will have to wait until tomorrow. I'm running on very little sleep
> and I need to get to bed before my keyboard becomes my pillow.
> 
> Jeff


More information about the gnucash-devel mailing list