[Gnucash-changes] r13132 - gnucash/trunk/src/engine - Keep QOF aware of the dirty-state of Transactions.

Derek Atkins warlord at MIT.EDU
Mon Feb 6 13:47:12 EST 2006


Quoting Chris Shoemaker <c.shoemaker at cox.net>:

> mark_trans() is horribly named.  It's a fundamentally different
> operation than qof_instance_set_dirty().  _Most_ of the places we call
> qof_instance_dirty (11 of them) we don't really want to dirty the
> splits.

I admit I haven't looked at the code recently..  Part of the issue is that
in XML the Splits aren't listed on their own -- they only exist within
a Transaction -- so you kinda need to mark the transaction as dirty when
you change a split.

I'm not sure in what cases you ever want to or need to mark a split
dirty just because the transaction changed.

>> On a separate (but related) note, I want to separate extend the events
>> in order to differentiate between "Account data modified" and "account
>> contents modified" -- where the former is emitted by the new/edit account
>> dialog, and the latter is emitted by the register...
>
> Absolutely, and this is _very_ related, because the same case applies
> to Transactions.  The mark_trans() cases should correlate with
> emitting the "child_changed" signal (or whatever), while the
> qof_instance_set_dirty() cases should correlate with emitting just the
> "changed" signal (or whatever).  And in two places, we should emit both.

We need to come up with a good set of signals here.  "MODIFIED" isn't
sufficiently robust.  :)   Unfortunately "INSERTED" and "REMOVED" are
already used, and used IMHO in weird ways.  :(

> This is a very useful distinction for both Accounts and Transactions.

... and Invoices.

Indeed, another question is who owns the link.  For example, I think
the Split<->Account mapping is backwards.. Right now you need to Begin/Commit
on the Account, but it's really the Split that contains the mapping.
The XML (and SQL) data for an account does not keep track of the splits.
The split keep track of the account.  So, shouldn't it be 
xaccSplitSetAccount()
instead of xaccAccountInsertSplit(), and shouldn't that be wrapped around
a Split/Trans Begin/Commit edit?

(I'll note that we still need the xaccAccountInsertSplit(), but I think that
only should be called "interally" by xaccSplitSetAccount(), and it doesn't
necessarily need a begin/commit edit because it's only structural data,
not real data).

-derek

-- 
       Derek Atkins, SB '93 MIT EE, SM '95 MIT Media Laboratory
       Member, MIT Student Information Processing Board  (SIPB)
       URL: http://web.mit.edu/warlord/    PP-ASEL-IA     N1NWH
       warlord at MIT.EDU                        PGP key available



More information about the gnucash-devel mailing list