Neil Williams linux at codehelp.co.uk
Sat Jul 24 14:48:57 EDT 2004

I see that most qof_class_register calls set a NULL in place of the possible 
QofSetterFunc. I couldn't find a single (QofSetterFunc) with a grep of src/ 
but maybe that's just me.

I've got my own code to work when e.g. Account.c has a corresponding 
QofSetterFunc defined:
    { ACCOUNT_NAME_, QOF_TYPE_STRING, (QofAccessFunc)xaccAccountGetName, 
(QofSetterFunc) xaccAccountSetName },

I need a generic way of setting the updated and new data into the target book 
and this looks like a good candidate. (OK, new will need other code too).

Was it an oversight not to specify QofSetterFunc's? Or just that nobody had a 
use for them, yet?

I'm using:

	/* puts the list of object parameters into a suitable GSList* 
		- mergeData->mergeObjectParams */
	qof_class_param_foreach(rule->mergeType, gncBookMergeForeachParam, NULL);
	QofParam *holly; // test code, will be replaced later.
	char *lister;
	while(mergeData->mergeObjectParams != NULL) {
		holly = mergeData->mergeObjectParams->data;
		rule->mergeType = holly->param_type;
		void(*string_setter)(QofEntity*, QofType);
		if(safe_strcmp(rule->mergeType, QOF_TYPE_STRING) == 0)  { 
			lister = "testing again";
			string_setter = (void(*)(QofEntity*, QofType))holly->param_setfcn;
			if(string_setter != NULL) {
				string_setter(mergeData->importEnt, lister);
		mergeData->mergeObjectParams = g_slist_next(mergeData->mergeObjectParams);

(Yes, I know I'm changing the setting in the import book - it was only a 

Can I change each qof_class_register section to use appropriate Set functions, 
where they exist? (If they don't, I'll cross that bridge when I get to it!) 
(Can I have CVS commit access for the main tree too?)

Full source code and documentation, as usual:


Neil Williams

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

More information about the gnucash-devel mailing list