Define and emit two new events when splits are added/removed from accounts.

* src/engine/gnc-event.h:
	  Add GNC_EVENT_ITEM_ADDED and GNC_EVENT_ITEM_REMOVED event definitions
	* src/engine/Split.c:
	  Emit GNC_EVENT_ITEM_ADDED and GNC_EVENT_ITEM_REMOVED events
	  when a split is added or removed from an account.
	* configure.in: depend on QOF 0.6.3 for proper event handling.



git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@13548 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Derek Atkins 2006-03-09 03:58:00 +00:00
parent 61a12b2715
commit 45403651c5
4 changed files with 21 additions and 2 deletions

View File

@ -20,6 +20,13 @@
* lib/libqof/qof/qofevent.[ch]:
Fix the definition of QOF_EVENT_BASE; use QOF_EVENT__LAST for tests.
* src/engine/gnc-event.h:
Add GNC_EVENT_ITEM_ADDED and GNC_EVENT_ITEM_REMOVED event definitions
* src/engine/Split.c:
Emit GNC_EVENT_ITEM_ADDED and GNC_EVENT_ITEM_REMOVED events
when a split is added or removed from an account.
* configure.in: depend on QOF 0.6.3 for proper event handling.
2006-03-08 Christian Stimming <stimming@tuhh.de>
* src/gnc-module/gnc-module.c, src/backend/file/sixtp-utils.c:

View File

@ -433,8 +433,8 @@ AC_ARG_ENABLE(qof,
AC_ARG_WITH(qof, [ --with-qof=path prefix for Query Object Framework - QOF (auto)],
[gnc_with_qof=$withval], [gnc_with_qof=yes])
# bug fixes between 0.6.1 and 0.6.2 mean gnucash runs best with 0.6.2
QOF_REQUIRED=0.6.2
# bug fixes in QOF mean gnucash runs best with 0.6.3
QOF_REQUIRED=0.6.3
if test "$gnc_enable_qof" = true ; then
AC_MSG_CHECKING([for QOF, version >= $QOF_REQUIRED])
if test "$gnc_with_qof" != "yes"; then

View File

@ -46,6 +46,7 @@
#include "gnc-engine.h"
#include "gnc-lot-p.h"
#include "gnc-lot.h"
#include "gnc-event.h"
const char *void_former_amt_str = "void-former-amount";
const char *void_former_val_str = "void-former-value";
@ -517,6 +518,8 @@ xaccSplitCommitEdit(Split *s)
xaccGroupMarkNotSaved (orig_acc->parent);
//FIXME: find better event type
qof_event_gen (&orig_acc->inst.entity, QOF_EVENT_MODIFY, NULL);
// And send the account-based event, too
qof_event_gen(&orig_acc->inst.entity, GNC_EVENT_ITEM_REMOVED, s);
} else PERR("Account lost track of moved or deleted split.");
orig_acc->balance_dirty = TRUE;
xaccAccountRecomputeBalance(orig_acc);
@ -541,6 +544,9 @@ xaccSplitCommitEdit(Split *s)
xaccGroupMarkNotSaved (acc->parent); //FIXME: probably not needed.
//FIXME: find better event
qof_event_gen (&acc->inst.entity, QOF_EVENT_MODIFY, NULL);
/* Also send an event based on the account */
qof_event_gen(&acc->inst.entity, GNC_EVENT_ITEM_ADDED, s);
} else PERR("Account grabbed split prematurely.");
acc->balance_dirty = TRUE;
xaccSplitSetAmount(s, xaccSplitGetAmount(s));

View File

@ -24,11 +24,17 @@
#define GNC_EVENT_H
#include <glib.h>
#include <qof.h>
typedef struct {
gpointer node;
gint idx;
} GncEventData;
/* 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)
#endif