diff --git a/src/engine/Makefile.am b/src/engine/Makefile.am index 4932efb8e1..1f851b7c8a 100644 --- a/src/engine/Makefile.am +++ b/src/engine/Makefile.am @@ -75,6 +75,7 @@ gncinclude_HEADERS = \ gnc-budget.h \ gnc-commodity.h \ gnc-engine.h \ + gnc-event.h \ gnc-filepath-utils.h \ gnc-hooks.h \ gnc-pricedb.h \ diff --git a/src/engine/Transaction.c b/src/engine/Transaction.c index a7e2744d37..6ad76f816d 100644 --- a/src/engine/Transaction.c +++ b/src/engine/Transaction.c @@ -46,6 +46,7 @@ #include "gnc-engine.h" #include "gnc-lot-p.h" #include "gnc-lot.h" +#include "gnc-event.h" /* Notes about xaccTransBeginEdit(), xaccTransCommitEdit(), and @@ -954,15 +955,18 @@ static void trans_cleanup_commit(Transaction *trans) if ((s->parent != trans) || s->inst.do_free) { /* Existing split either moved to another transaction or 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); - //gnc_engine_gen_event(&trans->inst, QOF_EVENT_REMOVE); + qof_event_gen(&s->inst.entity, QOF_EVENT_REMOVE, &ed); } if (s->parent == trans) { /* Split was either destroyed or just changed */ - //if (s->inst.do_free) - // gnc_engine_gen_event(&trans->inst, QOF_EVENT_REMOVE); - //else gnc_engine_gen_event(&trans->inst, QOF_EVENT_MODIFY); + if (s->inst.do_free) + qof_event_gen(&s->inst.entity, QOF_EVENT_DESTROY, NULL); + else qof_event_gen(&s->inst.entity, QOF_EVENT_MODIFY, NULL); xaccSplitCommitEdit(s); } } diff --git a/src/engine/gnc-event.h b/src/engine/gnc-event.h new file mode 100644 index 0000000000..09f3d80df5 --- /dev/null +++ b/src/engine/gnc-event.h @@ -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 + +typedef struct { + gpointer parent; + gint idx; +} GncEventData; + + +#endif