mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
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:
parent
61a12b2715
commit
45403651c5
@ -20,6 +20,13 @@
|
|||||||
* lib/libqof/qof/qofevent.[ch]:
|
* lib/libqof/qof/qofevent.[ch]:
|
||||||
Fix the definition of QOF_EVENT_BASE; use QOF_EVENT__LAST for tests.
|
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>
|
2006-03-08 Christian Stimming <stimming@tuhh.de>
|
||||||
|
|
||||||
* src/gnc-module/gnc-module.c, src/backend/file/sixtp-utils.c:
|
* src/gnc-module/gnc-module.c, src/backend/file/sixtp-utils.c:
|
||||||
|
@ -433,8 +433,8 @@ AC_ARG_ENABLE(qof,
|
|||||||
AC_ARG_WITH(qof, [ --with-qof=path prefix for Query Object Framework - QOF (auto)],
|
AC_ARG_WITH(qof, [ --with-qof=path prefix for Query Object Framework - QOF (auto)],
|
||||||
[gnc_with_qof=$withval], [gnc_with_qof=yes])
|
[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
|
# bug fixes in QOF mean gnucash runs best with 0.6.3
|
||||||
QOF_REQUIRED=0.6.2
|
QOF_REQUIRED=0.6.3
|
||||||
if test "$gnc_enable_qof" = true ; then
|
if test "$gnc_enable_qof" = true ; then
|
||||||
AC_MSG_CHECKING([for QOF, version >= $QOF_REQUIRED])
|
AC_MSG_CHECKING([for QOF, version >= $QOF_REQUIRED])
|
||||||
if test "$gnc_with_qof" != "yes"; then
|
if test "$gnc_with_qof" != "yes"; then
|
||||||
|
@ -46,6 +46,7 @@
|
|||||||
#include "gnc-engine.h"
|
#include "gnc-engine.h"
|
||||||
#include "gnc-lot-p.h"
|
#include "gnc-lot-p.h"
|
||||||
#include "gnc-lot.h"
|
#include "gnc-lot.h"
|
||||||
|
#include "gnc-event.h"
|
||||||
|
|
||||||
const char *void_former_amt_str = "void-former-amount";
|
const char *void_former_amt_str = "void-former-amount";
|
||||||
const char *void_former_val_str = "void-former-value";
|
const char *void_former_val_str = "void-former-value";
|
||||||
@ -517,6 +518,8 @@ xaccSplitCommitEdit(Split *s)
|
|||||||
xaccGroupMarkNotSaved (orig_acc->parent);
|
xaccGroupMarkNotSaved (orig_acc->parent);
|
||||||
//FIXME: find better event type
|
//FIXME: find better event type
|
||||||
qof_event_gen (&orig_acc->inst.entity, QOF_EVENT_MODIFY, NULL);
|
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.");
|
} else PERR("Account lost track of moved or deleted split.");
|
||||||
orig_acc->balance_dirty = TRUE;
|
orig_acc->balance_dirty = TRUE;
|
||||||
xaccAccountRecomputeBalance(orig_acc);
|
xaccAccountRecomputeBalance(orig_acc);
|
||||||
@ -541,6 +544,9 @@ xaccSplitCommitEdit(Split *s)
|
|||||||
xaccGroupMarkNotSaved (acc->parent); //FIXME: probably not needed.
|
xaccGroupMarkNotSaved (acc->parent); //FIXME: probably not needed.
|
||||||
//FIXME: find better event
|
//FIXME: find better event
|
||||||
qof_event_gen (&acc->inst.entity, QOF_EVENT_MODIFY, NULL);
|
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.");
|
} else PERR("Account grabbed split prematurely.");
|
||||||
acc->balance_dirty = TRUE;
|
acc->balance_dirty = TRUE;
|
||||||
xaccSplitSetAmount(s, xaccSplitGetAmount(s));
|
xaccSplitSetAmount(s, xaccSplitGetAmount(s));
|
||||||
|
@ -24,11 +24,17 @@
|
|||||||
#define GNC_EVENT_H
|
#define GNC_EVENT_H
|
||||||
|
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
|
#include <qof.h>
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
gpointer node;
|
gpointer node;
|
||||||
gint idx;
|
gint idx;
|
||||||
} GncEventData;
|
} 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
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user