[Gnucash-changes] r13347 - gnucash/trunk/src/engine - Avoid
qof-dirtying Accounts when Splits or Lots are inserted or removed.
Chris Shoemaker
chris at cvs.gnucash.org
Tue Feb 21 15:27:41 EST 2006
Author: chris
Date: 2006-02-21 15:27:40 -0500 (Tue, 21 Feb 2006)
New Revision: 13347
Trac: http://svn.gnucash.org/trac/changeset/13347
Modified:
gnucash/trunk/src/engine/Account.c
Log:
Avoid qof-dirtying Accounts when Splits or Lots are inserted or removed.
Modified: gnucash/trunk/src/engine/Account.c
===================================================================
--- gnucash/trunk/src/engine/Account.c 2006-02-21 19:48:19 UTC (rev 13346)
+++ gnucash/trunk/src/engine/Account.c 2006-02-21 20:27:40 UTC (rev 13347)
@@ -738,10 +738,7 @@
if (!acc || !lot || !acc->lots) return;
ENTER ("(acc=%p, lot=%p)", acc, lot);
- xaccAccountBeginEdit (acc);
acc->lots = g_list_remove (acc->lots, lot);
- mark_account(acc);
- xaccAccountCommitEdit (acc);
LEAVE ("(acc=%p, lot=%p)", acc, lot);
}
@@ -758,15 +755,10 @@
/* pull it out of the old account */
if (lot->account) {
old_acc = lot->account;
- xaccAccountBeginEdit (old_acc);
old_acc->lots = g_list_remove (old_acc->lots, lot);
- mark_account(old_acc);
}
- xaccAccountBeginEdit(acc);
-
acc->lots = g_list_prepend (acc->lots, lot);
- mark_account(acc);
lot->account = acc;
/* Move all splits over to the new account. At worst,
@@ -776,10 +768,6 @@
if (s->acc != acc)
xaccAccountInsertSplit (acc, s);
}
- xaccAccountCommitEdit(acc);
-
- if (old_acc)
- xaccAccountCommitEdit(old_acc);
LEAVE ("(acc=%p, lot=%p)", acc, lot);
}
@@ -798,7 +786,6 @@
trans = xaccSplitGetParent (split);
ENTER ("(acc=%p, trans=%p, split=%p)", acc, trans, split);
- xaccAccountBeginEdit(acc);
if (trans)
xaccTransBeginEdit(trans);
@@ -815,8 +802,7 @@
xaccAccountInsertLot (acc, split->lot);
if (!g_list_find(acc->splits, split)) {
- /* BUG? condition sort based on editlevel==1? What about editlevel==2? */
- if (acc->inst.editlevel == 1)
+ if (acc->inst.editlevel == 0)
{
acc->splits = g_list_insert_sorted(acc->splits, split,
split_sort_func);
@@ -838,7 +824,6 @@
if (trans)
xaccTransCommitEdit(trans);
- xaccAccountCommitEdit(acc);
LEAVE ("(acc=%p, trans=%p, split=%p)", acc, trans, split);
}
@@ -858,7 +843,6 @@
if (node) {
Transaction *trans = xaccSplitGetParent (split);
- xaccAccountBeginEdit(acc);
acc->splits = g_list_delete_link (acc->splits, node);
acc->balance_dirty = TRUE;
@@ -879,7 +863,6 @@
gen_event can be removed. */
if (split->parent)
gnc_engine_gen_event (&split->parent->inst.entity, GNC_EVENT_MODIFY);
- xaccAccountCommitEdit(acc);
} else PERR ("split is not in account, but it thinks it is!");
@@ -923,10 +906,6 @@
/* Begin editing both accounts and all transactions in accfrom. */
g_list_foreach(accfrom->splits, (GFunc)xaccPreSplitMove, NULL);
- xaccAccountBeginEdit(accfrom);
- xaccAccountBeginEdit(accto);
- mark_account (accfrom);
- mark_account (accto);
/* Concatenate accfrom's lists of splits and lots to accto's lists. */
accto->splits = g_list_concat(accto->splits, accfrom->splits);
@@ -953,15 +932,12 @@
* DNJ - I don't really understand why this is necessary,
* but xaccAccountInsertSplit does it.
*/
- if (accto->inst.editlevel == 1)
+ if (accto->inst.editlevel == 0)
{
accto->splits = g_list_sort(accto->splits, split_sort_func);
accto->sort_dirty = FALSE;
}
- /* Commit to editing both accounts. */
- xaccAccountCommitEdit(accfrom);
- xaccAccountCommitEdit(accto);
LEAVE ("(accfrom=%p, accto=%p)", accfrom, accto);
}
More information about the gnucash-changes
mailing list