mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Make qof_commit_edit() (and macro version) call qof_backend_run_commit()
instead of qof_backend_run_begin(). Minor cleanups of qof_commit_edit() and qof_begin_edit(). git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@13955 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
681577f889
commit
57636f50e4
@ -231,14 +231,18 @@ qof_begin_edit(QofInstance *inst)
|
||||
{
|
||||
QofBackend * be;
|
||||
|
||||
if (!inst) { return FALSE; }
|
||||
(inst->editlevel)++;
|
||||
if (1 < inst->editlevel) { return FALSE; }
|
||||
if (0 >= inst->editlevel) { inst->editlevel = 1; }
|
||||
if (!inst) return FALSE;
|
||||
inst->editlevel++;
|
||||
if (1 < inst->editlevel) return FALSE;
|
||||
if (0 >= inst->editlevel)
|
||||
inst->editlevel = 1;
|
||||
|
||||
be = qof_book_get_backend (inst->book);
|
||||
if (be && qof_backend_begin_exists(be)) {
|
||||
if (be && qof_backend_begin_exists(be))
|
||||
qof_backend_run_begin(be, inst);
|
||||
} else { inst->dirty = TRUE; }
|
||||
else
|
||||
inst->dirty = TRUE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -246,18 +250,21 @@ gboolean qof_commit_edit(QofInstance *inst)
|
||||
{
|
||||
QofBackend * be;
|
||||
|
||||
if (!inst) { return FALSE; }
|
||||
(inst->editlevel)--;
|
||||
if (0 < inst->editlevel) { return FALSE; }
|
||||
if (!inst) return FALSE;
|
||||
inst->editlevel--;
|
||||
if (0 < inst->editlevel) return FALSE;
|
||||
|
||||
if ((-1 == inst->editlevel) && inst->dirty)
|
||||
{
|
||||
be = qof_book_get_backend ((inst)->book);
|
||||
if (be && qof_backend_begin_exists(be)) {
|
||||
qof_backend_run_begin(be, inst);
|
||||
be = qof_book_get_backend (inst->book);
|
||||
if (be && qof_backend_commit_exists(be)) {
|
||||
qof_backend_run_commit(be, inst);
|
||||
}
|
||||
}
|
||||
if (0 > inst->editlevel) {
|
||||
PERR ("unbalanced call - resetting (was %d)", inst->editlevel);
|
||||
inst->editlevel = 0;
|
||||
}
|
||||
if (0 > inst->editlevel) { inst->editlevel = 0; }
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -358,8 +358,8 @@ gboolean qof_begin_edit(QofInstance *inst);
|
||||
{ \
|
||||
QofBackend * be; \
|
||||
be = qof_book_get_backend ((inst)->book); \
|
||||
if (be && qof_backend_begin_exists(be)) { \
|
||||
qof_backend_run_begin(be, (inst)); \
|
||||
if (be && qof_backend_commit_exists(be)) { \
|
||||
qof_backend_run_commit(be, (inst)); \
|
||||
} \
|
||||
(inst)->editlevel = 0; \
|
||||
} \
|
||||
|
Loading…
Reference in New Issue
Block a user