mirror of
https://github.com/Gnucash/gnucash.git
synced 2026-09-03 20:53:02 -05:00
simplify creation of new application events
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@13397 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
@@ -205,7 +205,7 @@ qof_event_generate_internal (QofEntity *entity, QofEventId event_id,
|
||||
|
||||
g_return_if_fail(entity);
|
||||
|
||||
if (event_id <= QOF_DEFAULT_EVENT_LIMIT)
|
||||
if (event_id <= QOF_EVENT_BASE)
|
||||
{
|
||||
use_old_handlers = TRUE;
|
||||
}
|
||||
|
||||
@@ -40,23 +40,36 @@
|
||||
/** Define the type of events allowed. */
|
||||
typedef gint QofEventId;
|
||||
|
||||
/** \brief Allow application-specific events to be created.
|
||||
|
||||
Used together with QOF_EVENT_BASE to simplify creation
|
||||
of application events without interfering with any new
|
||||
events added within QOF.
|
||||
|
||||
/verbatim
|
||||
#define APP_EVENT_A QOF_MAKE_EVENT(QOF_EVENT_BASE+0)
|
||||
#define APP_EVENT_B QOF_MAKE_EVENT(QOF_EVENT_BASE+1)
|
||||
/endverbatim
|
||||
*/
|
||||
#define QOF_MAKE_EVENT(x) (1<<x)
|
||||
|
||||
/** \brief Default events for backwards compatibility.
|
||||
|
||||
These defaults merely replicate previous behaviour,
|
||||
any process can define their own events.
|
||||
*/
|
||||
#define QOF_EVENT_NONE (0)
|
||||
#define QOF_EVENT_CREATE (1 << 0)
|
||||
#define QOF_EVENT_MODIFY (1 << 1)
|
||||
#define QOF_EVENT_DESTROY (1 << 2)
|
||||
#define QOF_EVENT_ADD (1 << 3)
|
||||
#define QOF_EVENT_REMOVE (1 << 4)
|
||||
#define QOF_EVENT_CREATE QOF_MAKE_EVENT(0)
|
||||
#define QOF_EVENT_MODIFY QOF_MAKE_EVENT(1)
|
||||
#define QOF_EVENT_DESTROY QOF_MAKE_EVENT(2)
|
||||
#define QOF_EVENT_ADD QOF_MAKE_EVENT(3)
|
||||
#define QOF_EVENT_REMOVE QOF_MAKE_EVENT(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_EVENT_LIMIT QOF_EVENT__LAST
|
||||
#define QOF_EVENT_BASE QOF_EVENT__LAST
|
||||
|
||||
/** \brief Handler invoked when an event is generated.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user