mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Remove some unnecessary Begin/Commit blocks around code that is already
transactional. Convert some Split function calls to the xaccSplit... form. git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@13833 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
8600495bb8
commit
78f8adc645
@ -276,13 +276,9 @@ gnc_split_register_move_cursor (VirtualLocation *p_new_virt_loc,
|
|||||||
(old_split != new_split) &&
|
(old_split != new_split) &&
|
||||||
gnc_split_register_old_split_empty_p(reg, old_split))
|
gnc_split_register_old_split_empty_p(reg, old_split))
|
||||||
{
|
{
|
||||||
Transaction *t;
|
|
||||||
int current_row;
|
int current_row;
|
||||||
|
|
||||||
t = xaccSplitGetParent(old_split);
|
|
||||||
xaccTransBeginEdit (t);
|
|
||||||
xaccSplitDestroy(old_split);
|
xaccSplitDestroy(old_split);
|
||||||
xaccTransCommitEdit (t);
|
|
||||||
old_split = NULL;
|
old_split = NULL;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -101,7 +101,7 @@ struct sr_info
|
|||||||
/* flag indicating a template register */
|
/* flag indicating a template register */
|
||||||
gboolean template;
|
gboolean template;
|
||||||
|
|
||||||
/* The template account which template transaction should below to */
|
/* The template account which template transaction should belong to */
|
||||||
GUID template_account;
|
GUID template_account;
|
||||||
|
|
||||||
/* configured strings for debit/credit headers */
|
/* configured strings for debit/credit headers */
|
||||||
|
@ -436,7 +436,7 @@ gnc_split_register_duplicate_current (SplitRegister *reg)
|
|||||||
new_split = xaccMallocSplit (gnc_get_current_book ());
|
new_split = xaccMallocSplit (gnc_get_current_book ());
|
||||||
|
|
||||||
xaccTransBeginEdit (trans);
|
xaccTransBeginEdit (trans);
|
||||||
xaccTransAppendSplit (trans, new_split);
|
xaccSplitSetParent (new_split, trans);
|
||||||
gnc_copy_split_onto_split (split, new_split, FALSE);
|
gnc_copy_split_onto_split (split, new_split, FALSE);
|
||||||
xaccTransCommitEdit (trans);
|
xaccTransCommitEdit (trans);
|
||||||
|
|
||||||
@ -716,16 +716,14 @@ gnc_split_register_paste_current (SplitRegister *reg)
|
|||||||
|
|
||||||
gnc_suspend_gui_refresh ();
|
gnc_suspend_gui_refresh ();
|
||||||
|
|
||||||
xaccTransBeginEdit(trans);
|
|
||||||
if (split == NULL)
|
if (split == NULL)
|
||||||
{ /* We are on a null split in an expanded transaction. */
|
{ /* We are on a null split in an expanded transaction. */
|
||||||
split = xaccMallocSplit(gnc_get_current_book ());
|
split = xaccMallocSplit(gnc_get_current_book ());
|
||||||
xaccTransAppendSplit(trans, split);
|
xaccSplitSetParent(split, trans);
|
||||||
}
|
}
|
||||||
|
|
||||||
gnc_copy_split_scm_onto_split(copied_item, split,
|
gnc_copy_split_scm_onto_split(copied_item, split,
|
||||||
gnc_get_current_book ());
|
gnc_get_current_book ());
|
||||||
xaccTransCommitEdit(trans);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -834,9 +832,7 @@ gnc_split_register_delete_current_split (SplitRegister *reg)
|
|||||||
|
|
||||||
account = xaccSplitGetAccount (split);
|
account = xaccSplitGetAccount (split);
|
||||||
|
|
||||||
xaccTransBeginEdit (trans);
|
|
||||||
xaccSplitDestroy (split);
|
xaccSplitDestroy (split);
|
||||||
xaccTransCommitEdit (trans);
|
|
||||||
|
|
||||||
/* Check pending transaction */
|
/* Check pending transaction */
|
||||||
if (trans == pending_trans)
|
if (trans == pending_trans)
|
||||||
@ -887,9 +883,7 @@ gnc_split_register_delete_current_trans (SplitRegister *reg)
|
|||||||
|
|
||||||
gnc_suspend_gui_refresh ();
|
gnc_suspend_gui_refresh ();
|
||||||
|
|
||||||
xaccTransBeginEdit (trans);
|
|
||||||
xaccTransDestroy (trans);
|
xaccTransDestroy (trans);
|
||||||
xaccTransCommitEdit (trans);
|
|
||||||
|
|
||||||
info->blank_split_guid = *guid_null();
|
info->blank_split_guid = *guid_null();
|
||||||
blank_split = NULL;
|
blank_split = NULL;
|
||||||
@ -908,9 +902,7 @@ gnc_split_register_delete_current_trans (SplitRegister *reg)
|
|||||||
* their register windows after the deletion. */
|
* their register windows after the deletion. */
|
||||||
trans = xaccSplitGetParent(split);
|
trans = xaccSplitGetParent(split);
|
||||||
|
|
||||||
xaccTransBeginEdit(trans);
|
|
||||||
xaccTransDestroy(trans);
|
xaccTransDestroy(trans);
|
||||||
xaccTransCommitEdit(trans);
|
|
||||||
|
|
||||||
/* Check pending transaction */
|
/* Check pending transaction */
|
||||||
if (trans == pending_trans)
|
if (trans == pending_trans)
|
||||||
@ -956,10 +948,7 @@ gnc_split_register_void_current_trans (SplitRegister *reg, const char *reason)
|
|||||||
gnc_suspend_gui_refresh ();
|
gnc_suspend_gui_refresh ();
|
||||||
|
|
||||||
trans = xaccSplitGetParent(split);
|
trans = xaccSplitGetParent(split);
|
||||||
|
|
||||||
xaccTransBeginEdit(trans);
|
|
||||||
xaccTransVoid(trans, reason);
|
xaccTransVoid(trans, reason);
|
||||||
xaccTransCommitEdit(trans);
|
|
||||||
|
|
||||||
/* Check pending transaction */
|
/* Check pending transaction */
|
||||||
if (trans == pending_trans)
|
if (trans == pending_trans)
|
||||||
@ -1006,9 +995,7 @@ gnc_split_register_unvoid_current_trans (SplitRegister *reg)
|
|||||||
|
|
||||||
trans = xaccSplitGetParent(split);
|
trans = xaccSplitGetParent(split);
|
||||||
|
|
||||||
xaccTransBeginEdit(trans);
|
|
||||||
xaccTransUnvoid(trans);
|
xaccTransUnvoid(trans);
|
||||||
xaccTransCommitEdit(trans);
|
|
||||||
|
|
||||||
/* Check pending transaction */
|
/* Check pending transaction */
|
||||||
if (trans == pending_trans)
|
if (trans == pending_trans)
|
||||||
@ -1335,7 +1322,7 @@ gnc_split_register_save (SplitRegister *reg, gboolean do_commit)
|
|||||||
|
|
||||||
/* use the changed flag to avoid heavy-weight updates
|
/* use the changed flag to avoid heavy-weight updates
|
||||||
* of the split & transaction fields. This will help
|
* of the split & transaction fields. This will help
|
||||||
* cut down on uneccessary register redraws. */
|
* cut down on unnecessary register redraws. */
|
||||||
if (!gnc_table_current_cursor_changed (reg->table, FALSE))
|
if (!gnc_table_current_cursor_changed (reg->table, FALSE))
|
||||||
{
|
{
|
||||||
if (!do_commit)
|
if (!do_commit)
|
||||||
@ -1397,8 +1384,8 @@ gnc_split_register_save (SplitRegister *reg, gboolean do_commit)
|
|||||||
/* If we are committing the blank split, add it to the account now */
|
/* If we are committing the blank split, add it to the account now */
|
||||||
if (trans == blank_trans)
|
if (trans == blank_trans)
|
||||||
{
|
{
|
||||||
xaccAccountInsertSplit (gnc_split_register_get_default_account (reg),
|
xaccSplitSetAccount(blank_split,
|
||||||
blank_split);
|
gnc_split_register_get_default_account (reg));
|
||||||
xaccTransSetDateEnteredSecs(trans, time(NULL));
|
xaccTransSetDateEnteredSecs(trans, time(NULL));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1927,15 +1914,15 @@ gnc_split_register_changed (SplitRegister *reg)
|
|||||||
SRInfo *info = gnc_split_register_get_info (reg);
|
SRInfo *info = gnc_split_register_get_info (reg);
|
||||||
Transaction *pending_trans;
|
Transaction *pending_trans;
|
||||||
|
|
||||||
pending_trans = xaccTransLookup (&info->pending_trans_guid,
|
|
||||||
gnc_get_current_book ());
|
|
||||||
|
|
||||||
if (reg == NULL)
|
if (reg == NULL)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
if (gnc_table_current_cursor_changed (reg->table, FALSE))
|
if (gnc_table_current_cursor_changed (reg->table, FALSE))
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
|
pending_trans = xaccTransLookup (&info->pending_trans_guid,
|
||||||
|
gnc_get_current_book ());
|
||||||
|
|
||||||
return xaccTransIsOpen (pending_trans);
|
return xaccTransIsOpen (pending_trans);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2373,9 +2360,7 @@ gnc_split_register_cleanup (SplitRegister *reg)
|
|||||||
pending_trans = NULL;
|
pending_trans = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
xaccTransBeginEdit (trans);
|
|
||||||
xaccTransDestroy (trans);
|
xaccTransDestroy (trans);
|
||||||
xaccTransCommitEdit (trans);
|
|
||||||
|
|
||||||
info->blank_split_guid = *guid_null ();
|
info->blank_split_guid = *guid_null ();
|
||||||
blank_split = NULL;
|
blank_split = NULL;
|
||||||
|
Loading…
Reference in New Issue
Block a user