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;
|
QofBackend * be;
|
||||||
|
|
||||||
if (!inst) { return FALSE; }
|
if (!inst) return FALSE;
|
||||||
(inst->editlevel)++;
|
inst->editlevel++;
|
||||||
if (1 < inst->editlevel) { return FALSE; }
|
if (1 < inst->editlevel) return FALSE;
|
||||||
if (0 >= inst->editlevel) { inst->editlevel = 1; }
|
if (0 >= inst->editlevel)
|
||||||
|
inst->editlevel = 1;
|
||||||
|
|
||||||
be = qof_book_get_backend (inst->book);
|
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);
|
qof_backend_run_begin(be, inst);
|
||||||
} else { inst->dirty = TRUE; }
|
else
|
||||||
|
inst->dirty = TRUE;
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -246,18 +250,21 @@ gboolean qof_commit_edit(QofInstance *inst)
|
|||||||
{
|
{
|
||||||
QofBackend * be;
|
QofBackend * be;
|
||||||
|
|
||||||
if (!inst) { return FALSE; }
|
if (!inst) return FALSE;
|
||||||
(inst->editlevel)--;
|
inst->editlevel--;
|
||||||
if (0 < inst->editlevel) { return FALSE; }
|
if (0 < inst->editlevel) return FALSE;
|
||||||
|
|
||||||
if ((-1 == inst->editlevel) && inst->dirty)
|
if ((-1 == inst->editlevel) && inst->dirty)
|
||||||
{
|
{
|
||||||
be = qof_book_get_backend ((inst)->book);
|
be = qof_book_get_backend (inst->book);
|
||||||
if (be && qof_backend_begin_exists(be)) {
|
if (be && qof_backend_commit_exists(be)) {
|
||||||
qof_backend_run_begin(be, inst);
|
qof_backend_run_commit(be, inst);
|
||||||
}
|
}
|
||||||
inst->editlevel = 0;
|
|
||||||
}
|
}
|
||||||
if (0 > inst->editlevel) { inst->editlevel = 0; }
|
if (0 > inst->editlevel) {
|
||||||
|
PERR ("unbalanced call - resetting (was %d)", inst->editlevel);
|
||||||
|
inst->editlevel = 0;
|
||||||
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -354,12 +354,12 @@ gboolean qof_begin_edit(QofInstance *inst);
|
|||||||
/* The pricedb suffers from delayed update... */ \
|
/* The pricedb suffers from delayed update... */ \
|
||||||
/* This may be setting a bad precedent for other types, I fear. */ \
|
/* This may be setting a bad precedent for other types, I fear. */ \
|
||||||
/* Other types probably really should handle begin like this. */ \
|
/* Other types probably really should handle begin like this. */ \
|
||||||
if ((-1 == (inst)->editlevel) && (inst)->dirty) \
|
if ((-1 == (inst)->editlevel) && (inst)->dirty) \
|
||||||
{ \
|
{ \
|
||||||
QofBackend * be; \
|
QofBackend * be; \
|
||||||
be = qof_book_get_backend ((inst)->book); \
|
be = qof_book_get_backend ((inst)->book); \
|
||||||
if (be && qof_backend_begin_exists(be)) { \
|
if (be && qof_backend_commit_exists(be)) { \
|
||||||
qof_backend_run_begin(be, (inst)); \
|
qof_backend_run_commit(be, (inst)); \
|
||||||
} \
|
} \
|
||||||
(inst)->editlevel = 0; \
|
(inst)->editlevel = 0; \
|
||||||
} \
|
} \
|
||||||
|
Loading…
Reference in New Issue
Block a user