[Gnucash-changes] r13352 - gnucash/trunk - Fix "default limit" QOF
eventing stuff; thanks Andi.
Joshua Sled
jsled at cvs.gnucash.org
Tue Feb 21 18:10:33 EST 2006
Author: jsled
Date: 2006-02-21 18:10:33 -0500 (Tue, 21 Feb 2006)
New Revision: 13352
Trac: http://svn.gnucash.org/trac/changeset/13352
Modified:
gnucash/trunk/ChangeLog
gnucash/trunk/lib/libqof/qof/qofevent.c
gnucash/trunk/lib/libqof/qof/qofevent.h
Log:
Fix "default limit" QOF eventing stuff; thanks Andi.
Modified: gnucash/trunk/ChangeLog
===================================================================
--- gnucash/trunk/ChangeLog 2006-02-21 21:46:07 UTC (rev 13351)
+++ gnucash/trunk/ChangeLog 2006-02-21 23:10:33 UTC (rev 13352)
@@ -1,5 +1,8 @@
2006-02-21 Joshua Sled <jsled at asynchronous.org>
+ * lib/libqof/qof/qofevent.[ch] (QOF_DEFAULT_EVENT_LIMIT): rename, set
+ to reasonable value (the last-defined event).
+
* src/register/ledger-core/split-register-load.c
(gnc_split_register_load): Ensure that a (unique) relevent split
from the currently-pending transaction is always in the split list
Modified: gnucash/trunk/lib/libqof/qof/qofevent.c
===================================================================
--- gnucash/trunk/lib/libqof/qof/qofevent.c 2006-02-21 21:46:07 UTC (rev 13351)
+++ gnucash/trunk/lib/libqof/qof/qofevent.c 2006-02-21 23:10:33 UTC (rev 13352)
@@ -205,24 +205,18 @@
g_return_if_fail(entity);
- if(event_id <= QOF_DEFAULT_LIMIT)
+ if (event_id <= QOF_DEFAULT_EVENT_LIMIT)
{
- use_old_handlers = TRUE;
+ use_old_handlers = TRUE;
}
switch (event_id)
{
- case QOF_EVENT_NONE: {
- /* if none, don't log, just return. */
- return;
- }
- case QOF_EVENT_CREATE :
- case QOF_EVENT_MODIFY :
- case QOF_EVENT_DESTROY :
- case QOF_EVENT_ADD :
- case QOF_EVENT_REMOVE :
- break;
+ case QOF_EVENT_NONE: {
+ /* if none, don't log, just return. */
+ return;
}
+ }
handler_run_level++;
for (node = handlers; node; node = next_node)
@@ -230,18 +224,18 @@
HandlerInfo *hi = node->data;
next_node = node->next;
- if ((hi->old_handler)&&(use_old_handlers))
- {
- PINFO (" deprecated: id=%d hi=%p han=%p", hi->handler_id, hi,
- hi->old_handler);
+ if ((hi->old_handler) && (use_old_handlers))
+ {
+ PINFO(" deprecated: id=%d hi=%p han=%p", hi->handler_id, hi,
+ hi->old_handler);
hi->old_handler ((GUID *)&entity->guid, entity->e_type,
- event_id, hi->user_data);
- }
+ event_id, hi->user_data);
+ }
if (hi->handler)
- {
- PINFO ("id=%d hi=%p han=%p", hi->handler_id, hi, hi->handler);
+ {
+ PINFO("id=%d hi=%p han=%p", hi->handler_id, hi, hi->handler);
hi->handler (entity, event_id, hi->user_data);
- }
+ }
}
handler_run_level--;
@@ -256,10 +250,10 @@
next_node = node->next;
if ((hi->handler == NULL)&&(hi->old_handler == NULL))
{
- /* remove this node from the list, then free this node */
- handlers = g_list_remove_link (handlers, node);
- g_list_free_1 (node);
- g_free (hi);
+ /* remove this node from the list, then free this node */
+ handlers = g_list_remove_link (handlers, node);
+ g_list_free_1 (node);
+ g_free (hi);
}
}
pending_deletes = 0;
Modified: gnucash/trunk/lib/libqof/qof/qofevent.h
===================================================================
--- gnucash/trunk/lib/libqof/qof/qofevent.h 2006-02-21 21:46:07 UTC (rev 13351)
+++ gnucash/trunk/lib/libqof/qof/qofevent.h 2006-02-21 23:10:33 UTC (rev 13352)
@@ -50,11 +50,12 @@
#define QOF_EVENT_DESTROY (1 << 2)
#define QOF_EVENT_ADD (1 << 3)
#define QOF_EVENT_REMOVE (1 << 4)
+#define QOF_EVENT__LAST QOF_EVENT_REMOVE
#define QOF_EVENT_ALL (0xff)
/** Allow scope for more defaults in future. Additional
event identifiers must be larger than this. */
-#define QOF_DEFAULT_LIMIT 10
+#define QOF_DEFAULT_EVENT_LIMIT QOF_EVENT__LAST
/** \brief Handler invoked when an engine event occurs.
*
More information about the gnucash-changes
mailing list