mirror of
https://github.com/Gnucash/gnucash.git
synced 2024-12-01 21:19:16 -06:00
change AccountGroup to use gncObject for initialization, dirty flag, teardown.
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@8561 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
ed48a82dd9
commit
a01a217180
@ -3146,6 +3146,7 @@ xaccAccountFindTransByDesc(Account *account, const char *description)
|
|||||||
return( trans );
|
return( trans );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* ================================================================ */
|
||||||
/* gncObject function implementation and registration */
|
/* gncObject function implementation and registration */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -38,6 +38,7 @@
|
|||||||
#include "gnc-engine-util.h"
|
#include "gnc-engine-util.h"
|
||||||
#include "gnc-event-p.h"
|
#include "gnc-event-p.h"
|
||||||
#include "gnc-numeric.h"
|
#include "gnc-numeric.h"
|
||||||
|
#include "gncObject.h"
|
||||||
|
|
||||||
static short module = MOD_ENGINE;
|
static short module = MOD_ENGINE;
|
||||||
|
|
||||||
@ -1275,4 +1276,66 @@ xaccGroupForEachAccount (AccountGroup *grp,
|
|||||||
return(NULL);
|
return(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* ============================================================== */
|
||||||
|
/* gncObject function implementation and registration */
|
||||||
|
|
||||||
|
static void
|
||||||
|
group_foreach (GNCBook *book, foreachObjectCB cb, gpointer ud)
|
||||||
|
{
|
||||||
|
// GNCEntityTable *et;
|
||||||
|
|
||||||
|
g_return_if_fail (book);
|
||||||
|
g_return_if_fail (cb);
|
||||||
|
|
||||||
|
printf ("duude calling group foreach \n");
|
||||||
|
/*
|
||||||
|
et = gnc_book_get_entity_table (book);
|
||||||
|
xaccForeachEntity (et, GNC_ID_GROUP, cb, ud);
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
group_book_begin (GNCBook *book)
|
||||||
|
{
|
||||||
|
printf ("duude call group book begin \n");
|
||||||
|
xaccSetAccountGroup (book, xaccMallocAccountGroup(book));
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
group_book_end (GNCBook *book)
|
||||||
|
{
|
||||||
|
xaccSetAccountGroup (book, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
group_is_dirty (GNCBook *book)
|
||||||
|
{
|
||||||
|
return xaccGroupNotSaved(xaccGetAccountGroup(book));
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
group_mark_clean(GNCBook *book)
|
||||||
|
{
|
||||||
|
xaccGroupMarkSaved(xaccGetAccountGroup(book));
|
||||||
|
}
|
||||||
|
|
||||||
|
static GncObject_t group_object_def =
|
||||||
|
{
|
||||||
|
interface_version: GNC_OBJECT_VERSION,
|
||||||
|
name: GNC_ID_GROUP,
|
||||||
|
type_label: "AccountGroup",
|
||||||
|
book_begin: group_book_begin,
|
||||||
|
book_end: group_book_end,
|
||||||
|
is_dirty: group_is_dirty,
|
||||||
|
mark_clean: group_mark_clean,
|
||||||
|
foreach: group_foreach,
|
||||||
|
printable: NULL,
|
||||||
|
};
|
||||||
|
|
||||||
|
gboolean
|
||||||
|
xaccGroupRegister (void)
|
||||||
|
{
|
||||||
|
return gncObjectRegister (&group_object_def);
|
||||||
|
}
|
||||||
|
|
||||||
/* ========================= END OF FILE ======================== */
|
/* ========================= END OF FILE ======================== */
|
||||||
|
@ -97,4 +97,6 @@ void xaccFreeAccountGroup (AccountGroup *account_group);
|
|||||||
/* Set the top-level group in the book */
|
/* Set the top-level group in the book */
|
||||||
void xaccSetAccountGroup (GNCBook *book, AccountGroup *grp);
|
void xaccSetAccountGroup (GNCBook *book, AccountGroup *grp);
|
||||||
|
|
||||||
|
gboolean xaccGroupRegister (void);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -118,7 +118,6 @@ gnc_book_mark_saved(GNCBook *book)
|
|||||||
|
|
||||||
book->dirty = FALSE;
|
book->dirty = FALSE;
|
||||||
|
|
||||||
xaccGroupMarkSaved(xaccGetAccountGroup(book));
|
|
||||||
gnc_pricedb_mark_clean(gnc_pricedb_get_db(book));
|
gnc_pricedb_mark_clean(gnc_pricedb_get_db(book));
|
||||||
|
|
||||||
xaccGroupMarkSaved(gnc_book_get_template_group(book));
|
xaccGroupMarkSaved(gnc_book_get_template_group(book));
|
||||||
@ -145,8 +144,6 @@ gnc_book_populate (GNCBook *book)
|
|||||||
}
|
}
|
||||||
gnc_commodity_table_set_table (book, ct);
|
gnc_commodity_table_set_table (book, ct);
|
||||||
|
|
||||||
xaccSetAccountGroup (book, xaccMallocAccountGroup(book));
|
|
||||||
|
|
||||||
gnc_pricedb_set_db (book, gnc_pricedb_create(book));
|
gnc_pricedb_set_db (book, gnc_pricedb_create(book));
|
||||||
|
|
||||||
gnc_book_set_schedxactions (book, NULL);
|
gnc_book_set_schedxactions (book, NULL);
|
||||||
@ -157,9 +154,6 @@ gnc_book_populate (GNCBook *book)
|
|||||||
static void
|
static void
|
||||||
gnc_book_depopulate (GNCBook *book)
|
gnc_book_depopulate (GNCBook *book)
|
||||||
{
|
{
|
||||||
/* unhook the top-level group */
|
|
||||||
xaccSetAccountGroup (book, NULL);
|
|
||||||
|
|
||||||
/* unhook the prices */
|
/* unhook the prices */
|
||||||
gnc_pricedb_set_db (book, NULL);
|
gnc_pricedb_set_db (book, NULL);
|
||||||
|
|
||||||
@ -178,8 +172,6 @@ gnc_book_not_saved(GNCBook *book)
|
|||||||
if (!book) return FALSE;
|
if (!book) return FALSE;
|
||||||
|
|
||||||
return(book->dirty
|
return(book->dirty
|
||||||
||
|
|
||||||
xaccGroupNotSaved(xaccGetAccountGroup(book))
|
|
||||||
||
|
||
|
||||||
gnc_pricedb_dirty(gnc_book_get_pricedb(book))
|
gnc_pricedb_dirty(gnc_book_get_pricedb(book))
|
||||||
||
|
||
|
||||||
|
@ -31,8 +31,9 @@
|
|||||||
#include "gnc-engine.h"
|
#include "gnc-engine.h"
|
||||||
#include "gnc-engine-util.h"
|
#include "gnc-engine-util.h"
|
||||||
|
|
||||||
#include "TransactionP.h"
|
|
||||||
#include "AccountP.h"
|
#include "AccountP.h"
|
||||||
|
#include "GroupP.h"
|
||||||
|
#include "TransactionP.h"
|
||||||
#include "gnc-book-p.h"
|
#include "gnc-book-p.h"
|
||||||
#include "gnc-lot-p.h"
|
#include "gnc-lot-p.h"
|
||||||
|
|
||||||
@ -83,6 +84,7 @@ gnc_engine_init(int argc, char ** argv)
|
|||||||
xaccSplitRegister ();
|
xaccSplitRegister ();
|
||||||
xaccTransRegister ();
|
xaccTransRegister ();
|
||||||
xaccAccountRegister ();
|
xaccAccountRegister ();
|
||||||
|
xaccGroupRegister ();
|
||||||
gnc_book_register ();
|
gnc_book_register ();
|
||||||
gnc_lot_register ();
|
gnc_lot_register ();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user