Skip to content

Commit

Permalink
add tracing printfs
Browse files Browse the repository at this point in the history
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@9038 57a11ea4-9604-0410-9ed3-97b8803252fd
  • Loading branch information
linas committed Aug 10, 2003
1 parent 4b6ef39 commit 0b6d1b5
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions src/engine/gnc-event.c
Expand Up @@ -57,6 +57,7 @@ gnc_engine_register_event_handler (GNCEngineEventHandler handler,
gint handler_id;
GList *node;

ENTER ("(handler=%p, data=%p)", handler, user_data);
/* sanity check */
if (!handler)
{
Expand All @@ -82,7 +83,7 @@ gnc_engine_register_event_handler (GNCEngineEventHandler handler,
node = node->next;
}

/* found one, add the handler */
/* Found one, add the handler */
hi = g_new0 (HandlerInfo, 1);

hi->handler = handler;
Expand All @@ -91,9 +92,10 @@ gnc_engine_register_event_handler (GNCEngineEventHandler handler,

handlers = g_list_prepend (handlers, hi);

/* update id for next registration */
/* Update id for next registration */
next_handler_id = handler_id + 1;

LEAVE ("(handler=%p, data=%p) handler_id=%d", handler, user_data, handler_id);
return handler_id;
}

Expand All @@ -102,18 +104,18 @@ gnc_engine_unregister_event_handler (gint handler_id)
{
GList *node;

ENTER ("(handler_id=%d)", handler_id);
for (node = handlers; node; node = node->next)
{
HandlerInfo *hi = node->data;

if (hi->handler_id != handler_id)
continue;

/* found it */

/* take out of list */
/* Found it, take out of list */
handlers = g_list_remove_link (handlers, node);

LEAVE ("(handler_id=%d) handler=%p data=%p", handler_id, hi->handler, hi->user_data);
/* safety */
hi->handler = NULL;

Expand Down Expand Up @@ -176,6 +178,7 @@ gnc_engine_generate_event_internal (const GUID *entity, QofIdType type,
{
HandlerInfo *hi = node->data;

PINFO ("id=%d node=%p hi=%p han=%p\n", hi->handler_id, node, hi, hi->handler);
if (hi->handler)
hi->handler ((GUID *)entity, type, event_type, hi->user_data);
}
Expand Down Expand Up @@ -203,3 +206,5 @@ gnc_engine_generate_event (const GUID *entity, QofIdType type,

gnc_engine_generate_event_internal (entity, type, event_type);
}

/* =========================== END OF FILE ======================= */

0 comments on commit 0b6d1b5

Please sign in to comment.