Free budgets when closing a book

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@18491 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Phil Longstaff 2009-12-13 00:42:12 +00:00
parent 66b64e45e8
commit 15491e23e7

View File

@ -602,6 +602,21 @@ gnc_budget_get_default (QofBook *book)
return bgt;
}
/* Book handling routines */
/**
* Delete all budgets
*
* @param book Book
*/
static void
budget_book_end(QofBook* book)
{
QofCollection *col;
col = qof_book_get_collection(book, GNC_ID_BUDGET);
qof_collection_foreach(col, (QofInstanceForeachCB)gnc_budget_destroy, NULL);
}
/* Define the QofObject. */
static QofObject budget_object_def =
{
@ -610,7 +625,7 @@ static QofObject budget_object_def =
.type_label = "Budget",
.create = (gpointer)gnc_budget_new,
.book_begin = NULL,
.book_end = NULL,
.book_end = budget_book_end,
.is_dirty = qof_collection_is_dirty,
.mark_clean = qof_collection_mark_clean,
.foreach = qof_collection_foreach,