[Gnucash-changes] r13505 - gnucash/trunk/src/engine - Move both old an new-style Account MODIFY events into the "on_done" case

Chris Shoemaker chris at cvs.gnucash.org
Mon Mar 6 19:27:39 EST 2006


Author: chris
Date: 2006-03-06 19:27:38 -0500 (Mon, 06 Mar 2006)
New Revision: 13505
Trac: http://svn.gnucash.org/trac/changeset/13505

Modified:
   gnucash/trunk/src/engine/Account.c
Log:
   Move both old an new-style Account MODIFY events into the "on_done" case
   of qof_commit_edit_part2().


Modified: gnucash/trunk/src/engine/Account.c
===================================================================
--- gnucash/trunk/src/engine/Account.c	2006-03-06 21:52:33 UTC (rev 13504)
+++ gnucash/trunk/src/engine/Account.c	2006-03-07 00:27:38 UTC (rev 13505)
@@ -314,8 +314,20 @@
 	qof_begin_edit(&acc->inst);
 }
 
-static inline void noop(QofInstance *inst) {}
+static inline void on_done(QofInstance *inst) 
+{
+    GncEventData ed;
 
+    /* old event style */
+    gnc_engine_gen_event (&inst->entity, GNC_EVENT_MODIFY);
+
+    /* new event style */
+    ed.node = inst;
+    ed.idx = 0;
+    qof_event_gen(&inst->entity, QOF_EVENT_MODIFY, &ed);
+
+}
+
 static inline void on_err (QofInstance *inst, QofBackendError errcode)
 {
   PERR("commit error: %d", errcode);
@@ -331,8 +343,6 @@
 void 
 xaccAccountCommitEdit (Account *acc) 
 {
-  GncEventData ed;
-
   if(!qof_commit_edit(&acc->inst)) { return;}
 
   /* If marked for deletion, get rid of subaccounts first,
@@ -378,12 +388,7 @@
     xaccGroupInsertAccount(acc->parent, acc); 
   }
 
-  ed.node = acc;
-  ed.idx = 0;
-  qof_event_gen(&acc->inst.entity, QOF_EVENT_MODIFY, &ed);
-
-  if (qof_commit_edit_part2(&acc->inst, on_err, noop, acc_free))
-      gnc_engine_gen_event (&acc->inst.entity, GNC_EVENT_MODIFY);
+  qof_commit_edit_part2(&acc->inst, on_err, on_done, acc_free);
 }
 
 void 



More information about the gnucash-changes mailing list