[Gnucash-changes] r13397 - gnucash/trunk/lib/libqof/qof - simplify
creation of new application events
Neil Williams
codehelp at cvs.gnucash.org
Sun Feb 26 14:03:37 EST 2006
Author: codehelp
Date: 2006-02-26 14:03:37 -0500 (Sun, 26 Feb 2006)
New Revision: 13397
Trac: http://svn.gnucash.org/trac/changeset/13397
Modified:
gnucash/trunk/lib/libqof/qof/qofevent.c
gnucash/trunk/lib/libqof/qof/qofevent.h
Log:
simplify creation of new application events
Modified: gnucash/trunk/lib/libqof/qof/qofevent.c
===================================================================
--- gnucash/trunk/lib/libqof/qof/qofevent.c 2006-02-26 18:59:38 UTC (rev 13396)
+++ gnucash/trunk/lib/libqof/qof/qofevent.c 2006-02-26 19:03:37 UTC (rev 13397)
@@ -205,7 +205,7 @@
g_return_if_fail(entity);
- if (event_id <= QOF_DEFAULT_EVENT_LIMIT)
+ if (event_id <= QOF_EVENT_BASE)
{
use_old_handlers = TRUE;
}
Modified: gnucash/trunk/lib/libqof/qof/qofevent.h
===================================================================
--- gnucash/trunk/lib/libqof/qof/qofevent.h 2006-02-26 18:59:38 UTC (rev 13396)
+++ gnucash/trunk/lib/libqof/qof/qofevent.h 2006-02-26 19:03:37 UTC (rev 13397)
@@ -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.
*
More information about the gnucash-changes
mailing list