mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
add kvp_frame to books; fix misc session->book bugs
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@6020 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
2a1dd5b86c
commit
1ea3b0dbfa
@ -53,6 +53,8 @@ typedef enum
|
|||||||
GNC_ID_TRANS,
|
GNC_ID_TRANS,
|
||||||
GNC_ID_SPLIT,
|
GNC_ID_SPLIT,
|
||||||
GNC_ID_PRICE,
|
GNC_ID_PRICE,
|
||||||
|
GNC_ID_BOOK,
|
||||||
|
GNC_ID_SESSION,
|
||||||
GNC_ID_SCHEDXACTION,
|
GNC_ID_SCHEDXACTION,
|
||||||
GNC_ID_FREQSPEC,
|
GNC_ID_FREQSPEC,
|
||||||
LAST_GNC_ID = GNC_ID_FREQSPEC
|
LAST_GNC_ID = GNC_ID_FREQSPEC
|
||||||
|
@ -28,8 +28,10 @@
|
|||||||
|
|
||||||
#include "FreqSpec.h"
|
#include "FreqSpec.h"
|
||||||
#include "GNCId.h"
|
#include "GNCId.h"
|
||||||
|
#include "Group.h"
|
||||||
#include "SX-ttinfo.h"
|
#include "SX-ttinfo.h"
|
||||||
#include "SchedXactionP.h"
|
#include "SchedXactionP.h"
|
||||||
|
#include "Transaction.h"
|
||||||
#include "date.h"
|
#include "date.h"
|
||||||
#include "gnc-book-p.h"
|
#include "gnc-book-p.h"
|
||||||
#include "gnc-engine.h"
|
#include "gnc-engine.h"
|
||||||
|
@ -30,17 +30,16 @@
|
|||||||
#ifndef GNC_BOOK_P_H
|
#ifndef GNC_BOOK_P_H
|
||||||
#define GNC_BOOK_P_H
|
#define GNC_BOOK_P_H
|
||||||
|
|
||||||
#include "BackendP.h"
|
#include "Backend.h"
|
||||||
#include "GNCIdP.h"
|
#include "GNCIdP.h"
|
||||||
#include "DateUtils.h"
|
|
||||||
#include "TransLog.h"
|
|
||||||
#include "gnc-book.h"
|
#include "gnc-book.h"
|
||||||
#include "gnc-engine-util.h"
|
|
||||||
#include "gnc-engine.h"
|
#include "gnc-engine.h"
|
||||||
#include "gnc-pricedb-p.h"
|
#include "kvp_frame.h"
|
||||||
|
|
||||||
struct gnc_book_struct
|
struct gnc_book_struct
|
||||||
{
|
{
|
||||||
|
kvp_frame *kvp_data;
|
||||||
|
|
||||||
/* The entity table associates the GUIDs of all the objects
|
/* The entity table associates the GUIDs of all the objects
|
||||||
* created in the session with their respective objects
|
* created in the session with their respective objects
|
||||||
* (pointer addresses) */
|
* (pointer addresses) */
|
||||||
@ -63,9 +62,10 @@ struct gnc_book_struct
|
|||||||
Backend *backend;
|
Backend *backend;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
void gnc_book_set_group(GNCBook *book, AccountGroup *grp);
|
void gnc_book_set_group(GNCBook *book, AccountGroup *grp);
|
||||||
void gnc_book_set_pricedb(GNCBook *book, GNCPriceDB *db);
|
void gnc_book_set_pricedb(GNCBook *book, GNCPriceDB *db);
|
||||||
|
void gnc_book_set_schedxactions( GNCBook *book, GList *newList );
|
||||||
|
void gnc_book_set_template_group( GNCBook *book, AccountGroup *templateGroup );
|
||||||
|
|
||||||
void gnc_book_set_backend (GNCBook *book, Backend *be);
|
void gnc_book_set_backend (GNCBook *book, Backend *be);
|
||||||
|
|
||||||
|
@ -70,6 +70,7 @@ gnc_book_init (GNCBook *book)
|
|||||||
if (!book) return;
|
if (!book) return;
|
||||||
|
|
||||||
book->entity_table = xaccEntityTableNew ();
|
book->entity_table = xaccEntityTableNew ();
|
||||||
|
book->kvp_data = kvp_frame_new ();
|
||||||
book->topgroup = xaccMallocAccountGroup(book);
|
book->topgroup = xaccMallocAccountGroup(book);
|
||||||
book->pricedb = gnc_pricedb_create();
|
book->pricedb = gnc_pricedb_create();
|
||||||
|
|
||||||
@ -100,6 +101,13 @@ gnc_book_new (void)
|
|||||||
|
|
||||||
/* ---------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
kvp_frame *
|
||||||
|
gnc_book_get_slots (GNCBook *book)
|
||||||
|
{
|
||||||
|
if (!book) return NULL;
|
||||||
|
return book->kvp_data;
|
||||||
|
}
|
||||||
|
|
||||||
GNCEntityTable *
|
GNCEntityTable *
|
||||||
gnc_book_get_entity_table (GNCBook *book)
|
gnc_book_get_entity_table (GNCBook *book)
|
||||||
{
|
{
|
||||||
|
@ -38,28 +38,28 @@
|
|||||||
|
|
||||||
#include "gnc-engine.h"
|
#include "gnc-engine.h"
|
||||||
#include "gnc-pricedb.h"
|
#include "gnc-pricedb.h"
|
||||||
|
#include "kvp_frame.h"
|
||||||
|
|
||||||
/** PROTOTYPES ******************************************************/
|
/** PROTOTYPES ******************************************************/
|
||||||
|
|
||||||
GNCBook * gnc_book_new (void);
|
GNCBook * gnc_book_new (void);
|
||||||
void gnc_book_destroy (GNCBook *book);
|
void gnc_book_destroy (GNCBook *book);
|
||||||
|
|
||||||
|
/* The gnc_book_get_slots() method will return the kvp data
|
||||||
|
* for the book */
|
||||||
|
kvp_frame * gnc_book_get_slots (GNCBook *book);
|
||||||
|
|
||||||
|
/* Return the various top-level data structure pointers stored
|
||||||
|
* in the book. */
|
||||||
AccountGroup *gnc_book_get_group (GNCBook *book);
|
AccountGroup *gnc_book_get_group (GNCBook *book);
|
||||||
void gnc_book_set_group(GNCBook *book, AccountGroup *group);
|
|
||||||
GNCPriceDB *gnc_book_get_pricedb (GNCBook *book);
|
GNCPriceDB *gnc_book_get_pricedb (GNCBook *book);
|
||||||
|
|
||||||
guint gnc_book_count_transactions(GNCBook *book);
|
|
||||||
|
|
||||||
gnc_commodity_table* gnc_book_get_commodity_table(GNCBook *book);
|
gnc_commodity_table* gnc_book_get_commodity_table(GNCBook *book);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the list of scheduled transactions.
|
* Returns the list of scheduled transactions.
|
||||||
**/
|
**/
|
||||||
GList * gnc_book_get_schedxactions( GNCBook *book );
|
GList * gnc_book_get_schedxactions( GNCBook *book );
|
||||||
void gnc_book_set_schedxactions( GNCBook *book, GList *newList );
|
|
||||||
|
|
||||||
AccountGroup *gnc_book_get_template_group( GNCBook *book );
|
AccountGroup *gnc_book_get_template_group( GNCBook *book );
|
||||||
void gnc_book_set_template_group( GNCBook *book, AccountGroup *templateGroup );
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The gnc_book_not_saved() subroutine will return TRUE
|
* The gnc_book_not_saved() subroutine will return TRUE
|
||||||
@ -71,4 +71,8 @@ gboolean gnc_book_not_saved(GNCBook *book);
|
|||||||
* in the two given books is equal. */
|
* in the two given books is equal. */
|
||||||
gboolean gnc_book_equal (GNCBook *book_1, GNCBook *book_2);
|
gboolean gnc_book_equal (GNCBook *book_1, GNCBook *book_2);
|
||||||
|
|
||||||
|
/* XXX FIXME count_transactions is a utility function, needs
|
||||||
|
* to be moved to some utility/support file. */
|
||||||
|
guint gnc_book_count_transactions(GNCBook *book);
|
||||||
|
|
||||||
#endif /* GNC_BOOK_H */
|
#endif /* GNC_BOOK_H */
|
||||||
|
@ -315,6 +315,7 @@
|
|||||||
"#include <Backend.h>\n"
|
"#include <Backend.h>\n"
|
||||||
"#include <Group.h>\n"
|
"#include <Group.h>\n"
|
||||||
"#include <gnc-book.h>\n"
|
"#include <gnc-book.h>\n"
|
||||||
|
"#include <gnc-book-p.h>\n"
|
||||||
"#include <gnc-session.h>\n"
|
"#include <gnc-session.h>\n"
|
||||||
"#include <gnc-engine-util.h>\n"
|
"#include <gnc-engine-util.h>\n"
|
||||||
"#include <date.h>\n"
|
"#include <date.h>\n"
|
||||||
@ -1565,6 +1566,7 @@ when no longer needed.")
|
|||||||
'((<gnc:Book*> book))
|
'((<gnc:Book*> book))
|
||||||
"Get the book's account group.")
|
"Get the book's account group.")
|
||||||
|
|
||||||
|
;; XXX FIXME this is a private function, should not be exported publically.
|
||||||
(gw:wrap-function
|
(gw:wrap-function
|
||||||
mod
|
mod
|
||||||
'gnc:book-set-group
|
'gnc:book-set-group
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
|
|
||||||
#include "date.h"
|
#include "date.h"
|
||||||
#include "Group.h"
|
#include "Group.h"
|
||||||
|
#include "gnc-book-p.h"
|
||||||
#include "gnc-engine.h"
|
#include "gnc-engine.h"
|
||||||
#include "gnc-engine-util.h"
|
#include "gnc-engine-util.h"
|
||||||
#include "test-engine-stuff.h"
|
#include "test-engine-stuff.h"
|
||||||
@ -1442,6 +1443,9 @@ get_random_book (void)
|
|||||||
|
|
||||||
book = gnc_book_new ();
|
book = gnc_book_new ();
|
||||||
|
|
||||||
|
/* XXX fixme -- gnc_book_set_group is a private engine function,
|
||||||
|
* it should not be invoked in ordinary test cases. Its should
|
||||||
|
* be more like make_random_pricedb below... */
|
||||||
gnc_book_set_group (book, get_random_group (book));
|
gnc_book_set_group (book, get_random_group (book));
|
||||||
|
|
||||||
make_random_pricedb (book, gnc_book_get_pricedb (book));
|
make_random_pricedb (book, gnc_book_get_pricedb (book));
|
||||||
@ -1459,6 +1463,9 @@ get_random_session (void)
|
|||||||
|
|
||||||
book = gnc_session_get_book (session);
|
book = gnc_session_get_book (session);
|
||||||
|
|
||||||
|
/* XXX fixme -- gnc_book_set_group is a private engine function,
|
||||||
|
* it should not be invoked in ordinary test cases. Its should
|
||||||
|
* be more like make_random_pricedb below... */
|
||||||
gnc_book_set_group (book, get_random_group (book));
|
gnc_book_set_group (book, get_random_group (book));
|
||||||
|
|
||||||
make_random_pricedb (book, gnc_book_get_pricedb (book));
|
make_random_pricedb (book, gnc_book_get_pricedb (book));
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
#include "GNCIdP.h"
|
#include "GNCIdP.h"
|
||||||
#include "TransLog.h"
|
#include "TransLog.h"
|
||||||
#include "gnc-book.h"
|
#include "gnc-book.h"
|
||||||
|
#include "gnc-book-p.h"
|
||||||
#include "gnc-engine.h"
|
#include "gnc-engine.h"
|
||||||
#include "gnc-module.h"
|
#include "gnc-module.h"
|
||||||
#include "test-engine-stuff.h"
|
#include "test-engine-stuff.h"
|
||||||
@ -67,6 +68,9 @@ run_test (void)
|
|||||||
exit(get_rv());
|
exit(get_rv());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* ???????? this test seems to be testing routines that
|
||||||
|
* are private to the engine, not sure why. book_set_group
|
||||||
|
* should not be called publically. */
|
||||||
gnc_book_set_group (book, group1);
|
gnc_book_set_group (book, group1);
|
||||||
if (!group_has_book (group1, book))
|
if (!group_has_book (group1, book))
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user