backend config

Neil Williams linux at codehelp.co.uk
Thu Aug 18 08:39:12 EDT 2005


On Thursday 18 August 2005 1:14 pm, Derek Atkins wrote:
> You might also want another API:
>
>   GHashTable* qof_backend_check_config(QofBackend*);

OK.

> This would return a (const) HashTable from the backend object

Why const? The options aren't (yet) stored in the backend in a hash table but 
as discrete variables. The hash table is just a convenient way of passing a 
selection of keys and their values - I had first thought of actually doing it 
via a KvpFrame, but a hash table is more or less equivalent for this job and 
there's no need for the backend to store / write out the options themselves - 
that's done in the frontend, if at all, using e.g. GConf.

> and list 
> all the current configuration options that the backend accepts.

I know what you mean, using g_hash_table_foreach to iterate / build a GList if 
necessary. The list of options would not change at runtime, it's like the 
list of parameters for an object. Some backends could use a similar static 
struct, others will simply init to one value and change that value if the 
config is loaded to do that.

> This 
> would allow the backend to even set defaults.

With you so far. In fact, for this to work, the backend already has to set 
defaults because there's no guarantee that the config will ever be loaded 
prior to the backend having to do something.

e.g. 
gboolean file_compression defaults to FALSE, 
int file_retention_days defaults to zero.

> Of course this means 
> you need some way to 'type' the configuration options.

Now you've lost me. I was expecting the option list for each backend to be 
documented (e.g. Doxygen / man page) and only changeable at compile time. In 
effect, it becomes part of the API for the backend library. The backend would 
only act on those hash table keys that it recognised and only if the values 
are acceptable for those options.

-- 

Neil Williams
=============
http://www.data-freedom.org/
http://www.nosoftwarepatents.com/
http://www.linux.codehelp.co.uk/

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.gnucash.org/pipermail/gnucash-devel/attachments/20050818/21ff28e2/attachment.bin


More information about the gnucash-devel mailing list