Preference question, issue or not?

Geert Janssens geert.gnucash at kobaltwit.be
Fri Feb 16 06:08:01 EST 2018


Op vrijdag 16 februari 2018 11:54:41 CET schreef Robert Fewell:
> Hi,
> 
> While I was working out why setting 'don't use gnucash color themes' was
> being reset after every restart of Gnucash, I added a print statement to
> gnc_prefs_get_bool which resulted in loads of output related to the
> preference 'show-leaf-account-names'. Used the glib backtrace function to
> work out what is calling this preference with the following results from
> starting Gnucash for a short time and also moving a terminal window over a
> register page...
> 
> 376 calls to gnc_table_get_entry
> 248 calls to gnc_account_foreach_descendent
> 
> to
> 
> 502 calls to gnc_get_account_name_for_register
> to
> 502 calls to gnc_prefs_get_bool for show-leaf-account-names
> 
> My question is whether the register should hold the value and not keep
> asking the preference system for it which I assume to mean gsettings
> calling what ever back end is being used. It could be cached in some way or
> with the fast PC's nowadays it is of no issue. Just asking before I spend
> any more time on this.
> 
> Regards,
> 
>   Bob

Caching the value would probably be better, although a performance test before 
and after is the only sure way to test.

If you cache it, you should also add a watch function that triggers whenever 
the user changes the preference. When triggered it should cause the register 
to redraw.

Geert




More information about the gnucash-devel mailing list