r18491 - gnucash/trunk/src/engine - Free budgets when closing a book
Phil Longstaff
plongstaff at code.gnucash.org
Sat Dec 12 19:42:14 EST 2009
Author: plongstaff
Date: 2009-12-12 19:42:12 -0500 (Sat, 12 Dec 2009)
New Revision: 18491
Trac: http://svn.gnucash.org/trac/changeset/18491
Modified:
gnucash/trunk/src/engine/gnc-budget.c
Log:
Free budgets when closing a book
Modified: gnucash/trunk/src/engine/gnc-budget.c
===================================================================
--- gnucash/trunk/src/engine/gnc-budget.c 2009-12-12 20:05:44 UTC (rev 18490)
+++ gnucash/trunk/src/engine/gnc-budget.c 2009-12-13 00:42:12 UTC (rev 18491)
@@ -602,6 +602,21 @@
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 @@
.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,
More information about the gnucash-changes
mailing list