[GNC-dev] Comments in the state file

Robert Fewell 14ubobit at gmail.com
Fri Dec 20 08:50:30 EST 2019


Hi,
Need some advise on this problem I found when trying to fix a budget state
file issue...
Currently the register full name is being added as a comment to the
register sections of the state file based on the group, so we have...

#Register state for "Assets:Current Assets:Savings Account"
[Register 5ca76dbe6668a75daeffd33b1229fa0e]
date_width=111
...
Unfortunately, when the state file is loaded it strips out all the comments
and it is only the registers that have been open in the current session
that get there comments added back on save.
There is a key file flag that can be set, G_KEY_FILE_KEEP_COMMENTS but this
has the disadvantage of ending up with the comment being added on every
close so you end up with multiple comments like ...

#Register state for "Assets:Current Assets:Savings Account"

#Register state for "Assets:Current Assets:Savings Account"
[Register 5ca76dbe6668a75daeffd33b1229fa0e]
date_width=111
...
This does not happen if the comment is for a key, so if the date_width was
used you get...

[Register 5ca76dbe6668a75daeffd33b1229fa0e]
#Register state for "Assets:Current Assets:Savings Account"
date_width=111
...
So my first idea was to make the changes for above on maint and then in
master make the key file flag change but this would not work, if some one
from a version less than 3.8 upgraded to 4.0, there key file would still
have group comments and they would start multiplying on each save. I did
try removing the group comment but that does not work with the new key file
flag,

The only other thing I can think of is add a dummy key and put the register
full name in that which what I had done originally. The reason for asking
is I want to add a similar comment for the budget as it is only
identifiable by the guid and was looking at the lack of saving of the
invoice sheet layout hoping to get that sorted on master.

Regards,
Bob


More information about the gnucash-devel mailing list