Add debug helper function qofeventid_to_string.

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@19957 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Christian Stimming 2010-12-17 21:31:11 +00:00
parent 7c76425cbf
commit 6accd9a09a
4 changed files with 46 additions and 1 deletions

View File

@ -120,6 +120,7 @@ SET (libgncmod_engine_SOURCES
gnc-budget.c
gnc-commodity.c
gnc-engine.c
gnc-event.c
gnc-hooks.c
gnc-lot.c
gnc-pricedb.c

View File

@ -32,6 +32,7 @@ libgncmod_engine_la_SOURCES = \
gnc-budget.c \
gnc-commodity.c \
gnc-engine.c \
gnc-event.c \
gnc-hooks.c \
gnc-lot.c \
gnc-pricedb.c \

31
src/engine/gnc-event.c Normal file
View File

@ -0,0 +1,31 @@
#include "config.h"
#include "gnc-event.h"
const char* qofeventid_to_string(QofEventId id)
{
switch (id)
{
case 0:
return "NONE";
case QOF_EVENT_CREATE:
return "CREATE";
case QOF_EVENT_MODIFY:
return "MODIFY";
case QOF_EVENT_DESTROY:
return "DESTROY";
case QOF_EVENT_ADD:
return "ADD";
case QOF_EVENT_REMOVE:
return "REMOVE";
case GNC_EVENT_ITEM_ADDED:
return "ITEM_ADDED";
case GNC_EVENT_ITEM_REMOVED:
return "ITEM_REMOVED";
case GNC_EVENT_ITEM_CHANGED:
return "ITEM_CHANGED";
default:
return "<unknown, maybe multiple>";
}
}

View File

@ -20,6 +20,13 @@
* *
********************************************************************/
/** @addtogroup Event
@{
*/
/** @file
@brief Additional event handling code
*/
#ifndef GNC_EVENT_H
#define GNC_EVENT_H
@ -32,11 +39,16 @@ typedef struct
gint idx;
} GncEventData;
/* These events are used when a split is added to an account.
/** These events are used when a split is added to an account.
* The event subject is the Account, the Object is the Split.
*/
#define GNC_EVENT_ITEM_ADDED QOF_MAKE_EVENT(QOF_EVENT_BASE+0)
#define GNC_EVENT_ITEM_REMOVED QOF_MAKE_EVENT(QOF_EVENT_BASE+1)
#define GNC_EVENT_ITEM_CHANGED QOF_MAKE_EVENT(QOF_EVENT_BASE+2)
/** Convert the given QofEventId (an integer number) to a string that
* is usable in debugging output. */
const char* qofeventid_to_string(QofEventId id);
#endif
/** @} */