mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Generate REMOVE events when a Split is removed from a Transaction.
Pass the *old* parent transaction (since the Split may be moving into a new transaction) and the old index of the Split in the old Transaction's list of Splits. git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@13468 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
22ee7eb47f
commit
d0f3042d8f
@ -75,6 +75,7 @@ gncinclude_HEADERS = \
|
|||||||
gnc-budget.h \
|
gnc-budget.h \
|
||||||
gnc-commodity.h \
|
gnc-commodity.h \
|
||||||
gnc-engine.h \
|
gnc-engine.h \
|
||||||
|
gnc-event.h \
|
||||||
gnc-filepath-utils.h \
|
gnc-filepath-utils.h \
|
||||||
gnc-hooks.h \
|
gnc-hooks.h \
|
||||||
gnc-pricedb.h \
|
gnc-pricedb.h \
|
||||||
|
@ -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"
|
||||||
|
|
||||||
|
|
||||||
/* Notes about xaccTransBeginEdit(), xaccTransCommitEdit(), and
|
/* Notes about xaccTransBeginEdit(), xaccTransCommitEdit(), and
|
||||||
@ -954,15 +955,18 @@ static void trans_cleanup_commit(Transaction *trans)
|
|||||||
if ((s->parent != trans) || s->inst.do_free) {
|
if ((s->parent != trans) || s->inst.do_free) {
|
||||||
/* Existing split either moved to another transaction or
|
/* Existing split either moved to another transaction or
|
||||||
was destroyed, drop from list */
|
was destroyed, drop from list */
|
||||||
|
GncEventData ed;
|
||||||
|
ed.parent = trans;
|
||||||
|
ed.idx = g_list_index(trans->splits, s);
|
||||||
trans->splits = g_list_remove(trans->splits, s);
|
trans->splits = g_list_remove(trans->splits, s);
|
||||||
//gnc_engine_gen_event(&trans->inst, QOF_EVENT_REMOVE);
|
qof_event_gen(&s->inst.entity, QOF_EVENT_REMOVE, &ed);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (s->parent == trans) {
|
if (s->parent == trans) {
|
||||||
/* Split was either destroyed or just changed */
|
/* Split was either destroyed or just changed */
|
||||||
//if (s->inst.do_free)
|
if (s->inst.do_free)
|
||||||
// gnc_engine_gen_event(&trans->inst, QOF_EVENT_REMOVE);
|
qof_event_gen(&s->inst.entity, QOF_EVENT_DESTROY, NULL);
|
||||||
//else gnc_engine_gen_event(&trans->inst, QOF_EVENT_MODIFY);
|
else qof_event_gen(&s->inst.entity, QOF_EVENT_MODIFY, NULL);
|
||||||
xaccSplitCommitEdit(s);
|
xaccSplitCommitEdit(s);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
34
src/engine/gnc-event.h
Normal file
34
src/engine/gnc-event.h
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
/********************************************************************
|
||||||
|
* gnc-event.h -- engine-level events for Gnucash *
|
||||||
|
* *
|
||||||
|
* This program is free software; you can redistribute it and/or *
|
||||||
|
* modify it under the terms of the GNU General Public License as *
|
||||||
|
* published by the Free Software Foundation; either version 2 of *
|
||||||
|
* the License, or (at your option) any later version. *
|
||||||
|
* *
|
||||||
|
* This program is distributed in the hope that it will be useful, *
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||||
|
* GNU General Public License for more details. *
|
||||||
|
* *
|
||||||
|
* You should have received a copy of the GNU General Public License*
|
||||||
|
* along with this program; if not, contact: *
|
||||||
|
* *
|
||||||
|
* Free Software Foundation Voice: +1-617-542-5942 *
|
||||||
|
* 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652 *
|
||||||
|
* Boston, MA 02110-1301, USA gnu@gnu.org *
|
||||||
|
* *
|
||||||
|
********************************************************************/
|
||||||
|
|
||||||
|
#ifndef GNC_EVENT_H
|
||||||
|
#define GNC_EVENT_H
|
||||||
|
|
||||||
|
#include <glib.h>
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
gpointer parent;
|
||||||
|
gint idx;
|
||||||
|
} GncEventData;
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
Loading…
Reference in New Issue
Block a user