Rename GNCBook into QofBook everywhere and remove separate header gnc-book.h.

The former was already #define'd on the latter, so its removal gets
rid of one level of indirection which makes function lookup easier.
Also, the macro (!) qof_book_get_slots was turned into a normal
function again because that's what functions are for (and otherwise
the additional declaration in engine.i would break).

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@18800 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Christian Stimming 2010-03-03 20:47:10 +00:00
parent 44b63315df
commit b7b34b87c9
43 changed files with 44 additions and 93 deletions

View File

@ -41,7 +41,6 @@
#include "Scrub.h"
#include "Split.h"
#include "Transaction.h"
#include "gnc-book.h"
#include "gnc-commodity.h"
#include "gnc-event.h"
#include "gnc-exp-parser.h"

View File

@ -39,7 +39,6 @@
#include <string.h>
#include "Account.h"
#include "gnc-book.h"
#include "gnc-component-manager.h"
#include "qof.h"
#include "gnc-engine.h"

View File

@ -27,7 +27,6 @@
#include <glib.h>
#include <libguile.h>
#include "gnc-book.h"
#include "qof.h"
#include "Account.h"

View File

@ -38,7 +38,6 @@
#include "gnc-slots-sql.h"
#include "gnc-engine.h"
#include "gnc-book.h"
#include "SX-book.h"
#include "SX-book-p.h"
@ -146,7 +145,7 @@ load_single_book( GncSqlBackend* be, GncSqlRow* row )
pBook = be->primary_book;
if( pBook == NULL ) {
pBook = gnc_book_new();
pBook = qof_book_new();
}
qof_book_begin_edit( pBook );

View File

@ -25,7 +25,6 @@
#ifndef GNC_BUSINESS_GNOME_UTILS_H_
#define GNC_BUSINESS_GNOME_UTILS_H_
#include "gnc-book.h"
#include "gncOwner.h"
#include "gncBillTerm.h"
#include "gncTaxTable.h"

View File

@ -26,7 +26,7 @@
typedef struct _billterms_window BillTermsWindow;
#include "gnc-book.h"
#include "qof.h"
/* Create a billterms window */
BillTermsWindow * gnc_ui_billterms_window_new (QofBook *book);

View File

@ -25,7 +25,6 @@
#define _DIALOG_DATE_CLOSE_H
#include "Account.h"
#include "gnc-book.h"
#include "qof.h"
#include "gncBillTerm.h"

View File

@ -26,7 +26,6 @@
typedef struct _payment_window PaymentWindow;
#include "gnc-book.h"
#include "gncOwner.h"
#include "gncInvoice.h"

View File

@ -27,7 +27,6 @@
#include "QueryNew.h"
#include "gncEntry.h"
#include "gncOrder.h"
#include "gnc-book.h"
#include "table-allgui.h"
typedef enum

View File

@ -374,7 +374,7 @@ void gnc_entry_ledger_load (GncEntryLedger *ledger, GList *entry_list)
/* Compute the proper taxtable */
odb = gnc_option_db_new_for_type (GNC_ID_BOOK);
gnc_option_db_load_from_kvp (odb, gnc_book_get_slots (ledger->book));
gnc_option_db_load_from_kvp (odb, qof_book_get_slots (ledger->book));
switch (gncOwnerGetType (owner))
{

View File

@ -25,7 +25,6 @@
#define GNC_ENTRY_LEDGERP_H
#include "qof.h"
#include "gnc-book.h"
#include "table-allgui.h"
#include "gncEntryLedger.h"

View File

@ -26,7 +26,6 @@
typedef struct _taxtable_window TaxTableWindow;
#include "gnc-book.h"
#include "gncTaxTable.h"
/* Create a new tax-table by name */

View File

@ -39,7 +39,6 @@ SET (libgncmod_engine_HEADERS
engine-helpers.h
glib-helpers.h
gnc-associate-account.h
gnc-book.h
gnc-budget.h
gnc-commodity.h
gnc-engine.h

View File

@ -76,7 +76,6 @@ gncinclude_HEADERS = \
engine-helpers.h \
glib-helpers.h \
gnc-associate-account.h \
gnc-book.h \
gnc-budget.h \
gnc-commodity.h \
gnc-engine.h \

View File

@ -30,7 +30,6 @@
#include "qof.h"
#include "Account.h"
#include "gnc-book.h"
#include "SX-book.h"
#include "SX-ttinfo.h"
#include "SchedXaction.h"

View File

@ -197,12 +197,6 @@ KvpValue * kvp_frame_get_slot_path_gslist (KvpFrame *frame, GSList *key_path);
%clear GSList *key_path;
%inline %{
static KvpFrame * gnc_book_get_slots(QofBook *book) {
return qof_instance_get_slots(QOF_INSTANCE(book));
}
%}
%init {
{

View File

@ -1,14 +0,0 @@
#include "qof.h"
#define GNCBook QofBook
#define gnc_book_new qof_book_new
#define gnc_book_destroy qof_book_destroy
#define gnc_book_get_guid qof_book_get_guid
#define gnc_book_get_slots qof_book_get_slots
#define gnc_book_not_saved qof_book_not_saved
#define gnc_book_set_data qof_book_set_data
#define gnc_book_get_data qof_book_get_data
#define gnc_book_get_backend qof_book_get_backend
#define gnc_book_get_entity_table qof_book_get_entity_table
#define gnc_book_get_counter qof_book_get_counter

View File

@ -205,7 +205,7 @@ typedef GList SplitList;
typedef GList TransList;
/** GList of GUIDs of a Account */
typedef GList AccountGUIDList;
/** GList of GUIDs of a GNCBook */
/** GList of GUIDs of a QofBook */
typedef GList BookGUIDList;
typedef void (*EngineCommitErrorCallback)( gpointer data, QofBackendError errcode );

View File

@ -15,7 +15,6 @@
#include <string.h>
#include <unistd.h>
#include "gnc-book.h"
#include "gnc-engine.h"
#include "io-gncxml.h"
@ -211,7 +210,7 @@ main (int argc, char *argv[])
{
int err, fake_argc =1;
char * fake_argv[] = {"hello", 0};
GNCBook *book;
QofBook *book;
Account *root;
char *request_bufp, *reply_bufp;
int rc, sz;
@ -221,7 +220,7 @@ main (int argc, char *argv[])
/* contact the database, which is a flat file for this demo */
/* this should really be an SQL server */
book = gnc_book_new ();
book = qof_book_new ();
rc = gnc_book_begin (book, "file:/tmp/demo.xac", FALSE);
if (!rc) goto bookerrexit;
@ -374,7 +373,7 @@ bookerrexit:
FCGI_Finish();
/* close the book */
gnc_book_destroy (book);
qof_book_destroy (book);
/* shut down the engine */
gnc_engine_shutdown ();

View File

@ -13,7 +13,6 @@
#include <stdlib.h>
#include <string.h>
#include "gnc-book.h"
#include "gnc-commodity.h"
#include "gnc-engine.h"
#include "io-gncxml-v2.h"
@ -24,7 +23,7 @@ main (int argc, char *argv[])
{
int fake_argc =1;
char * fake_argv[] = {"hello", 0};
GNCBook *book;
QofBook *book;
int rc;
/* intitialize the engine */
@ -38,7 +37,7 @@ main (int argc, char *argv[])
}
/* contact the database, which is a flat file for this demo */
book = gnc_book_new ();
book = qof_book_new ();
rc = gnc_book_begin (book, "file:/tmp/demo.gml", FALSE, FALSE);
if (!rc) {
@ -69,7 +68,7 @@ main (int argc, char *argv[])
bookerrexit:
/* close the book */
gnc_book_destroy (book);
qof_book_destroy (book);
/* shut down the engine */
gnc_engine_shutdown ();

View File

@ -10,7 +10,6 @@
#include <stdlib.h>
#include <string.h>
#include "gnc-book.h"
#include "gnc-engine.h"
#include "io-gncxml.h"
#include "Query.h"
@ -20,7 +19,7 @@ main (int argc, char *argv[])
{
int fake_argc =1;
char * fake_argv[] = {"hello2", 0};
GNCBook *book;
QofBook *book;
Account *root;
Query *q, *qq;
GList *split_list, *sl2, *node;
@ -33,7 +32,7 @@ main (int argc, char *argv[])
gnc_engine_init (fake_argc, fake_argv);
/* contact the database, which is a flat file for this demo */
book = gnc_book_new ();
book = qof_book_new ();
rc = gnc_book_begin (book, "file:/tmp/demo.xac", FALSE);
if (!rc) {
@ -107,7 +106,7 @@ main (int argc, char *argv[])
bookerrexit:
/* close the book */
gnc_book_destroy (book);
qof_book_destroy (book);
/* shut down the engine */
gnc_engine_shutdown ();

View File

@ -14,7 +14,6 @@
#include <string.h>
#include <unistd.h>
#include "gnc-book.h"
#include "gnc-engine.h"
#include "io-gncxml.h"
@ -26,7 +25,7 @@ main (int argc, char *argv[])
{
int err, fake_argc =1;
char * fake_argv[] = {"hello", 0};
GNCBook *book;
QofBook *book;
Account *root;
char *bufp;
int rc, sz;
@ -35,7 +34,7 @@ main (int argc, char *argv[])
gnc_engine_init (fake_argc, fake_argv);
/* contact the database, which is a flat file for this demo */
book = gnc_book_new ();
book = qof_book_new ();
rc = gnc_book_begin (book, "file:/tmp/demo.xac", FALSE);
if (!rc) goto bookerrexit;
@ -124,7 +123,7 @@ bookerrexit:
FCGI_Finish();
/* close the book */
gnc_book_destroy (book);
qof_book_destroy (book);
/* shut down the engine */
gnc_engine_shutdown ();

View File

@ -33,7 +33,6 @@
#define GNC_GENERAL_SEARCH_H
#include "dialog-search.h"
#include "gnc-book.h"
#define GNC_TYPE_GENERAL_SEARCH \
(gnc_general_search_get_type ())

View File

@ -26,7 +26,6 @@
#include "config.h"
#include <gtk/gtk.h>
#include "gnc-book.h"
#include "QueryNew.h"
#include "dialog-utils.h"
@ -72,9 +71,9 @@ dql_build_booklist (DialogQueryList *dql, Query *q)
for (node = gncQueryGetBooks(q); node; node = node->next)
{
GNCBook *book = node->data;
QofBook *book = node->data;
GUID *guid = xaccGUIDMalloc();
*guid = *(gnc_book_get_guid(book));
*guid = *(qof_book_get_guid(book));
dql->books = g_list_prepend(dql->books, guid);
}
}

View File

@ -31,7 +31,6 @@
#include "dialog-transfer.h"
#include "dialog-utils.h"
#include "gnc-amount-edit.h"
#include "gnc-book.h"
#include "gnc-component-manager.h"
#include "gnc-date-edit.h"
#include "gnc-engine.h"

View File

@ -38,14 +38,12 @@
#include <time.h>
#include "qof.h"
#include "gnc-book.h"
#include "Account.h"
#include "SchedXaction.h"
#include "SX-book.h"
#include "dialog-preferences.h"
#include "dialog-sx-editor.h"
#include "dialog-utils.h"
#include "gnc-book.h"
#include "gnc-component-manager.h"
#include "gnc-date.h"
#include "gnc-date-edit.h"

View File

@ -36,7 +36,6 @@
#include "SX-book.h"
#include "SX-ttinfo.h"
#include "druid-utils.h"
#include "gnc-book.h"
#include "gnc-amount-edit.h"
#include "gnc-account-sel.h"
#include "gnc-date.h"

View File

@ -32,7 +32,6 @@
#include "druid-stock-split.h"
#include "druid-utils.h"
#include "gnc-amount-edit.h"
#include "gnc-book.h"
#include "gnc-component-manager.h"
#include "gnc-currency-edit.h"
#include "gnc-date-edit.h"

View File

@ -51,7 +51,6 @@
#include "dialog-transfer.h"
#include "dialog-utils.h"
#include "druid-stock-split.h"
#include "gnc-book.h"
#include "gnc-gconf-utils.h"
#include "gnc-component-manager.h"
#include "gnc-date.h"

View File

@ -49,7 +49,6 @@
#include "Transaction.h"
#include "dialog-sx-editor.h"
#include "dialog-utils.h"
#include "gnc-book.h"
#include "gnc-commodity.h"
#include "gnc-component-manager.h"
#include "gnc-dense-cal.h"

View File

@ -31,7 +31,6 @@
#include "import-main-matcher.h"
#include "gnc-file.h"
#include "gnc-book.h"
#include "gnc-ui-util.h"
#include "gnc-glib-utils.h"
#include "gnc-gui-query.h"

View File

@ -1,6 +1,5 @@
#include "gnc-csv-model.h"
#include "gnc-book.h"
#include <glib/gi18n.h>

View File

@ -253,7 +253,7 @@ AB_TRANSACTION *gnc_hbci_trans_list_cb(AB_TRANSACTION *h_trans, void *user_data)
/* time_t tt1, tt2; */
/*struct tm tm1, tm2;*/
Account *gnc_acc;
GNCBook *book;
QofBook *book;
Transaction *gnc_trans;
const GWEN_TIME *valutaDate, *normalDate;
Split *split;

View File

@ -122,30 +122,30 @@ void gnc_hbci_set_account_trans_retrieval (Account *a, Timespec time)
/* GNCBook */
/* QofBook */
#define HBCI_CONFIGFILE "config-filename"
#define HBCI_TEMPLATES "template-list"
char *gnc_hbci_get_book_configfile (GNCBook *b)
char *gnc_hbci_get_book_configfile (QofBook *b)
{
kvp_frame *frame = gnc_hbci_get_book_kvp (b, FALSE);
kvp_value *value = kvp_frame_get_slot (frame, HBCI_CONFIGFILE);
return kvp_value_get_string (value);
}
void gnc_hbci_set_book_configfile (GNCBook *b, const char *filename)
void gnc_hbci_set_book_configfile (QofBook *b, const char *filename)
{
kvp_frame *frame = gnc_hbci_get_book_kvp (b, TRUE);
kvp_value *value = kvp_value_new_string (filename);
kvp_frame_set_slot_nc (frame, HBCI_CONFIGFILE, value);
qof_book_kvp_changed (b);
}
GList *gnc_hbci_get_book_template_list (GNCBook *b)
GList *gnc_hbci_get_book_template_list (QofBook *b)
{
kvp_frame *frame = gnc_hbci_get_book_kvp (b, FALSE);
kvp_value *value = kvp_frame_get_slot (frame, HBCI_TEMPLATES);
return kvp_value_get_glist (value);
}
void gnc_hbci_set_book_template_list (GNCBook *b, GList *template_list)
void gnc_hbci_set_book_template_list (QofBook *b, GList *template_list)
{
kvp_frame *frame = gnc_hbci_get_book_kvp (b, TRUE);
kvp_value *value = kvp_value_new_glist_nc (template_list);
@ -154,13 +154,13 @@ void gnc_hbci_set_book_template_list (GNCBook *b, GList *template_list)
}
#if 0
GList *gnc_hbci_get_book_account_list (GNCBook *b)
GList *gnc_hbci_get_book_account_list (QofBook *b)
{
kvp_frame *frame = gnc_hbci_get_book_kvp (b, FALSE);
kvp_value *value = kvp_frame_get_slot (frame, HBCI_ACCOUNTS);
return kvp_value_get_glist (value);
}
void gnc_hbci_set_book_account_list (GNCBook *b, GList *account_list)
void gnc_hbci_set_book_account_list (QofBook *b, GList *account_list)
{
kvp_frame *frame = gnc_hbci_get_book_kvp (b, TRUE);
kvp_value *value = kvp_value_new_glist_nc (account_list);
@ -172,7 +172,7 @@ void gnc_hbci_set_book_account_list (GNCBook *b, GList *account_list)
/* lowlevel */
/* getters for kvp frame in book */
kvp_frame *gnc_hbci_get_book_kvp (GNCBook *b, gboolean create)
kvp_frame *gnc_hbci_get_book_kvp (QofBook *b, gboolean create)
{
kvp_frame *toplevel = qof_book_get_slots (b);
kvp_frame *result = kvp_frame_get_frame (toplevel, HBCI_KEY);

View File

@ -26,7 +26,6 @@
#include <glib.h>
#include "qof.h"
#include "Account.h"
#include "gnc-book.h"
/* Account */
@ -67,35 +66,35 @@ Timespec gnc_hbci_get_account_trans_retrieval (Account *a);
void gnc_hbci_set_account_trans_retrieval (Account *a, Timespec time);
/* GNCBook */
/* QofBook */
/** Returns a non-copied pointer to the configfile string in the
* GNCBook b. The char* is still owned by the kvp_frame, so don't free
* QofBook b. The char* is still owned by the kvp_frame, so don't free
* it until you want to delete the whole kvp_frame. */
char *gnc_hbci_get_book_configfile (GNCBook *b);
/** Set the configfile string in the GNCBook b. A copy of the string
char *gnc_hbci_get_book_configfile (QofBook *b);
/** Set the configfile string in the QofBook b. A copy of the string
* will be stored. The Book will be marked as "dirty". */
void gnc_hbci_set_book_configfile (GNCBook *b, const char *filename);
void gnc_hbci_set_book_configfile (QofBook *b, const char *filename);
/** Returns a non-copied pointer to the GList of kvp_frames which
* eventually are the template transactions, stored in the given
* book. */
GList *gnc_hbci_get_book_template_list (GNCBook *b);
void gnc_hbci_set_book_template_list (GNCBook *b, GList *template_list);
GList *gnc_hbci_get_book_template_list (QofBook *b);
void gnc_hbci_set_book_template_list (QofBook *b, GList *template_list);
#if 0
/** Returns a non-copied pointer to the GList of kvp_frames which
* eventually are the available HBCI accounts, stored in the given
* book. */
GList *gnc_hbci_get_book_account_list (GNCBook *b);
void gnc_hbci_set_book_account_list (GNCBook *b, GList *account_list);
GList *gnc_hbci_get_book_account_list (QofBook *b);
void gnc_hbci_set_book_account_list (QofBook *b, GList *account_list);
#endif
/* lowlevel */
/* internal getter for kvp frame in book. The create argument says
* to create the frame if it doesn't already exist. */
kvp_frame *gnc_hbci_get_book_kvp (GNCBook *b, gboolean create);
kvp_frame *gnc_hbci_get_book_kvp (QofBook *b, gboolean create);
/* internal getter for kvp frame in Account. The create argument says
* to create the frame if it doesn't already exist. */

View File

@ -47,7 +47,6 @@
#include "gnc-ui.h"
#include "Account.h"
#include "Transaction.h"
#include "gnc-book.h"
#include "import-main-matcher.h"
#include "hbci-interaction.h"

View File

@ -90,7 +90,7 @@ GncImportMatchMap * gnc_imap_create_from_book (QofBook *book)
kvp_frame * frame;
if (!book) return NULL;
frame = gnc_book_get_slots (book);
frame = qof_book_get_slots (book);
g_return_val_if_fail (frame != NULL, NULL);
return gnc_imap_create_from_frame (frame, NULL, book);

View File

@ -32,7 +32,6 @@
typedef struct _GncImportMatchMap GncImportMatchMap;
#include "Account.h"
#include "gnc-book.h"
/** @{
Obtain an ImportMatchMap object from an Account or a Book */

View File

@ -41,7 +41,6 @@
#include "gnc-log-replay.h"
#include "gnc-file.h"
#include "qof.h"
#include "gnc-book.h"
#include "gnc-ui-util.h"
#include "gnc-gui-query.h"

View File

@ -45,7 +45,6 @@
#include "gnc-ofx-import.h"
#include "gnc-file.h"
#include "gnc-engine.h"
#include "gnc-book.h"
#include "gnc-ui-util.h"
#include "gnc-glib-utils.h"

View File

@ -269,6 +269,11 @@ void qof_book_kvp_changed (QofBook *book)
/* ====================================================================== */
KvpFrame *qof_book_get_slots(const QofBook *book)
{
return qof_instance_get_slots(QOF_INSTANCE(book));
}
/* Store arbitrary pointers in the QofBook for data storage extensibility */
/* XXX if data is NULL, we should remove the key from the hash table!
*/

View File

@ -192,7 +192,7 @@ void qof_book_foreach_collection (const QofBook *, QofCollectionForeachCB, gpoin
* between multiple users). To store application runtime data, use
* qof_book_set_data() instead.
*/
#define qof_book_get_slots(book) qof_instance_get_slots(QOF_INSTANCE(book))
KvpFrame *qof_book_get_slots(const QofBook *book);
/** The qof_book_set_data() allows arbitrary pointers to structs
* to be stored in QofBook. This is the "preferred" method for

View File

@ -32,7 +32,6 @@
#include "SX-book.h"
#include "Transaction.h"
#include "gnc-component-manager.h"
#include "gnc-book.h"
#include "gnc-date.h"
#include "gnc-engine.h"
#include "gnc-event.h"