SX event handler behaviour (was SX Projection Report/SX enable/disable)

Peter McAlpine peter at aoeu.ca
Fri Feb 2 22:54:45 EST 2007


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

We discussed some things via IRC but a couple questions remain...

On 31-Jan-07, at 10:39 PM, Josh Sled wrote:
> <snip>
> '_gnc_sx_instance_event_handler' should be modified to ignore
> non-enabled SXes that it receives updates about; I've added a fixme in
> the code about it.

Am I correct in that this handler exists to update an open SLR when  
SX's are edited/added/removed? If this is the case then is merely  
ignoring non-enabled SXes what we want to do?

How about this behaviour:
MODIFY event:
If instances for the SX are not found in the model and the SX is  
enabled then generate the instances and add them to the model.
If instances for the SX are found in the model and the SX is now non- 
enabled then remove the instances from the model.
Otherwise the usual behaviour

REMOVED event:
No change here, if the instances aren't found in the model, then  
don't remove them, otherwise the SX was enabled and deal with the  
event as per usual.

You've got a fixme at this event but I'm not sure why. Perhaps you  
were assuming that if we ever removed an SX but no instance exists  
then it'd be an error? Now that it's possible for a SX to not put any  
instances into the model we can treat this as a potentially valid event?

ADDED event:
If the SX is non-enabled then it should not generate any new instances.

> <snip>

Hmmm, I went to look at whether I'd be able to see the 'printf("err 
\n")' you put in the REMOVE event by trying to remove a SX with it's  
frequency set to "None" but I was unable to even do this. The SX  
editor popped up a dialog to confirm I wanted to set an SX that would  
never run (to which I replied "Yes") but the change to the SX was not  
saved. Strangely enough, when I went to edit it again I set the  
Recurrence Frequency to "Weekly" and was incorrectly prompted to  
confirm that I wanted to create a SX that would never run. I'm  
assuming this should not have happened this way...?

Another issue I've noticed is that the calendar should not show  
instances for non-enabled SX's or SX's that will never run (if I can  
ever create such a SX), do you agree?

Thanks for all your feedback!

- -Peter
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (Darwin)

iD8DBQFFxAeFeeKWVnwTIPIRAsBcAKDIsOtduwhAj35si/E9uYX5e5NC/QCgu12E
xheeti3FTcTktTFFx6hp0OU=
=e74x
-----END PGP SIGNATURE-----


More information about the gnucash-devel mailing list