xaccSchedXactionFree
Josh Sled
jsled@asynchronous.org
Wed, 25 Jul 2001 19:09:17 -0700
On Wed, Jul 25, 2001 at 05:04:01PM +1000, Robert Graham Merkel wrote:
| OK, then. I've seen the FIXME with respect to cleaning up the
| template account, and I'm attempting to do so.
Excellent. :)
| Now, as you don't have a pointer to the template account in
| the gncp_SchedXaction struct, the only way I can see to get
| access to the account is by looking it up by name from the
| AccountGroup it belongs to.
True, and this is what happens in the UI code... :(
| Now, the only way to get that AccountGroup (you don't store
| that either) is from the GNCBook that the whole world belongs
| to. However, that's not directly available either, AFAICT!
It's directly available, except to the engine
[src/FileDialog.{h,c}:gncGetCurrentGroup() -- though this doesn't seem
like the right place for this function].
| a) add another argument to xaccSchedXactionFree (pass in the
| appropriate GNCBook)
This doesn't make me that happy, for some reason.
| b) add another member to the gncp_SchedXaction struct to store
| the information needed about the template account to be able
| to delete it.
Yes, this is right.
To recap from my perspective...
Right now, the template transactions for a particular scheduled transaction
are in an Account in the template AccountGroup. This Account's name is
the guid_to_string() form of the SX's GUID.
Cleaning up the template account for the SX would then involve:
. getting this Account
. destroying all Transactions/Splits in it
. removing that Account from the template AccountGroup
. freeing the Account
In order to do that, you one of the two things, as you say.
I like the latter option ["b)"] for a couple of reasons:
. This wackiness with the GUID-to-string being the name of the account
to be looked up can go away [though I think these template account
names should be something like "Transaction for SX <guid_to_string(...)>"]
. The parent/template AccountGroup can be navigated to [through
xaccAccountGetParent()], so we can remove the Account near the end.
| Am I missing something here?
Nope... you got it.
...jsled