[QOF-devel] Outline of new qofevent support

Neil Williams linux at codehelp.co.uk
Sat Feb 25 17:54:02 EST 2006


On Saturday 25 February 2006 10:15 pm, Derek Atkins wrote:
> > typedef void (*QofEventHandlerWithArg)(QofEntity*, QofEventId,
> > gpointer handler_data, gpointer event_data);
>
> Sorry, yes, this is what I meant.
>
> > Currently, the gpointer is set when the handler is registered, not when
> > it is used after an event is generated. Do you need both? Is the current
> > gpointer used?
>
> Yes, I need both.

Bearing in mind your earlier comment that gnucash uses so many events, this is 
actually getting quite complex with THREE types of handlers now supported - 
two to remain supported into libqof2.

What about if existing calls to gnc_engine_event_gen are mapped (via a define) 
to qof_event_gen(entity, event_id, NULL) and calls directly to qof_event_gen 
can choose to use or not to use an argument?

Redefine qof_event_gen(entity, event_id, event_data)
where event_data is a gpointer and can be NULL.

Then we'd have just one typedef, one handler in libqof2 and I can pass an 
event argument in all cases - it'll just be NULL sometimes.

Existing code would use old style handlers that do not support event data, new 
handlers would use the new code and have a choice about whether to use event 
data or not.

As 0.6.2 is not released yet, the qof_event_* syntax is not yet part of the 
API so it can be changed, leaving gnc_engine_event_* as the deprecated old 
style.

-- 

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/20060225/01de6441/attachment.bin


More information about the gnucash-devel mailing list