r21566 - gnucash/trunk/src/backend - Minor code cleanup: Rename field "primary_book" into "book" because there are no multiple books in gnucash at all.
Christian Stimming
cstim at code.gnucash.org
Sun Nov 13 16:33:29 EST 2011
Author: cstim
Date: 2011-11-13 16:33:29 -0500 (Sun, 13 Nov 2011)
New Revision: 21566
Trac: http://svn.gnucash.org/trac/changeset/21566
Modified:
gnucash/trunk/src/backend/dbi/gnc-backend-dbi.c
gnucash/trunk/src/backend/sql/gnc-account-sql.c
gnucash/trunk/src/backend/sql/gnc-address-sql.c
gnucash/trunk/src/backend/sql/gnc-backend-sql.c
gnucash/trunk/src/backend/sql/gnc-backend-sql.h
gnucash/trunk/src/backend/sql/gnc-bill-term-sql.c
gnucash/trunk/src/backend/sql/gnc-book-sql.c
gnucash/trunk/src/backend/sql/gnc-budget-sql.c
gnucash/trunk/src/backend/sql/gnc-commodity-sql.c
gnucash/trunk/src/backend/sql/gnc-customer-sql.c
gnucash/trunk/src/backend/sql/gnc-employee-sql.c
gnucash/trunk/src/backend/sql/gnc-entry-sql.c
gnucash/trunk/src/backend/sql/gnc-invoice-sql.c
gnucash/trunk/src/backend/sql/gnc-job-sql.c
gnucash/trunk/src/backend/sql/gnc-lots-sql.c
gnucash/trunk/src/backend/sql/gnc-order-sql.c
gnucash/trunk/src/backend/sql/gnc-owner-sql.c
gnucash/trunk/src/backend/sql/gnc-price-sql.c
gnucash/trunk/src/backend/sql/gnc-schedxaction-sql.c
gnucash/trunk/src/backend/sql/gnc-slots-sql.c
gnucash/trunk/src/backend/sql/gnc-tax-table-sql.c
gnucash/trunk/src/backend/sql/gnc-transaction-sql.c
gnucash/trunk/src/backend/sql/gnc-vendor-sql.c
gnucash/trunk/src/backend/xml/gnc-backend-xml.c
gnucash/trunk/src/backend/xml/gnc-backend-xml.h
Log:
Minor code cleanup: Rename field "primary_book" into "book" because there are no multiple books in gnucash at all.
Modified: gnucash/trunk/src/backend/dbi/gnc-backend-dbi.c
===================================================================
--- gnucash/trunk/src/backend/dbi/gnc-backend-dbi.c 2011-11-13 21:26:21 UTC (rev 21565)
+++ gnucash/trunk/src/backend/dbi/gnc-backend-dbi.c 2011-11-13 21:33:29 UTC (rev 21566)
@@ -1693,7 +1693,7 @@
gnc_sql_init( &dbi_be->sql_be );
dbi_be->sql_be.conn = NULL;
- dbi_be->sql_be.primary_book = NULL;
+ dbi_be->sql_be.book = NULL;
}
static QofBackend*
Modified: gnucash/trunk/src/backend/sql/gnc-account-sql.c
===================================================================
--- gnucash/trunk/src/backend/sql/gnc-account-sql.c 2011-11-13 21:26:21 UTC (rev 21565)
+++ gnucash/trunk/src/backend/sql/gnc-account-sql.c 2011-11-13 21:33:29 UTC (rev 21566)
@@ -169,11 +169,11 @@
guid = gnc_sql_load_guid( be, row );
if ( guid != NULL )
{
- pAccount = xaccAccountLookup( guid, be->primary_book );
+ pAccount = xaccAccountLookup( guid, be->book );
}
if ( pAccount == NULL )
{
- pAccount = xaccMallocAccount( be->primary_book );
+ pAccount = xaccMallocAccount( be->book );
}
xaccAccountBeginEdit( pAccount );
gnc_sql_load_object( be, row, GNC_ID_ACCOUNT, pAccount, col_table );
@@ -182,7 +182,7 @@
/* If we don't have a parent and this isn't the root account, it might be because the parent
account hasn't been loaded yet. Remember the account and its parent guid for later. */
if ( gnc_account_get_parent( pAccount ) == NULL
- && pAccount != gnc_book_get_root_account( be->primary_book ) )
+ && pAccount != gnc_book_get_root_account( be->book ) )
{
account_parent_guid_struct* s = g_malloc( (gsize)sizeof(account_parent_guid_struct) );
g_assert( s != NULL );
@@ -210,7 +210,7 @@
ENTER( "" );
- pBook = be->primary_book;
+ pBook = be->book;
pTable = gnc_commodity_table_get_table( pBook );
stmt = gnc_sql_create_select_statement( be, TABLE_NAME );
@@ -256,7 +256,7 @@
for ( elem = l_accounts_needing_parents; elem != NULL; )
{
account_parent_guid_struct* s = (account_parent_guid_struct*)elem->data;
- pParent = xaccAccountLookup( &s->guid, be->primary_book );
+ pParent = xaccAccountLookup( &s->guid, be->book );
if ( pParent != NULL )
{
GList* next_elem;
@@ -416,7 +416,7 @@
if ( val != NULL && G_VALUE_HOLDS_STRING( val ) && g_value_get_string( val ) != NULL )
{
(void)string_to_guid( g_value_get_string( val ), &guid );
- account = xaccAccountLookup( &guid, be->primary_book );
+ account = xaccAccountLookup( &guid, be->book );
if ( account != NULL )
{
if ( table_row->gobj_param_name != NULL )
Modified: gnucash/trunk/src/backend/sql/gnc-address-sql.c
===================================================================
--- gnucash/trunk/src/backend/sql/gnc-address-sql.c 2011-11-13 21:26:21 UTC (rev 21565)
+++ gnucash/trunk/src/backend/sql/gnc-address-sql.c 2011-11-13 21:33:29 UTC (rev 21566)
@@ -82,7 +82,7 @@
g_return_if_fail( pObject != NULL );
g_return_if_fail( table_row != NULL );
- addr = gncAddressCreate( be->primary_book, NULL );
+ addr = gncAddressCreate( be->book, NULL );
for ( subtable = col_table; subtable->col_name != NULL; subtable++ )
{
buf = g_strdup_printf( "%s_%s", table_row->col_name, subtable->col_name );
Modified: gnucash/trunk/src/backend/sql/gnc-backend-sql.c
===================================================================
--- gnucash/trunk/src/backend/sql/gnc-backend-sql.c 2011-11-13 21:26:21 UTC (rev 21565)
+++ gnucash/trunk/src/backend/sql/gnc-backend-sql.c 2011-11-13 21:33:29 UTC (rev 21566)
@@ -229,8 +229,8 @@
if ( loadType == LOAD_TYPE_INITIAL_LOAD )
{
- g_assert( be->primary_book == NULL );
- be->primary_book = book;
+ g_assert( be->book == NULL );
+ be->book = book;
/* Load any initial stuff. Some of this needs to happen in a certain order */
for ( i = 0; fixed_load_order[i] != NULL; i++ )
@@ -367,11 +367,11 @@
g_return_val_if_fail( be != NULL, FALSE );
update_progress( be );
- is_ok = write_account_tree( be, gnc_book_get_root_account( be->primary_book ) );
+ is_ok = write_account_tree( be, gnc_book_get_root_account( be->book ) );
if ( is_ok )
{
update_progress( be );
- is_ok = write_account_tree( be, gnc_book_get_template_root( be->primary_book ) );
+ is_ok = write_account_tree( be, gnc_book_get_template_root( be->book ) );
}
return is_ok;
@@ -408,7 +408,7 @@
data.be = be;
data.is_ok = TRUE;
(void)xaccAccountTreeForEachTransaction(
- gnc_book_get_root_account( be->primary_book ), write_tx, &data );
+ gnc_book_get_root_account( be->book ), write_tx, &data );
update_progress( be );
return data.is_ok;
}
@@ -423,7 +423,7 @@
data.is_ok = TRUE;
data.be = be;
- ra = gnc_book_get_template_root( be->primary_book );
+ ra = gnc_book_get_template_root( be->book );
if ( gnc_account_n_descendants( ra ) > 0 )
{
(void)xaccAccountTreeForEachTransaction( ra, write_tx, &data );
@@ -442,7 +442,7 @@
g_return_val_if_fail( be != NULL, FALSE );
- schedXactions = gnc_book_get_schedxactions( be->primary_book )->sx_list;
+ schedXactions = gnc_book_get_schedxactions( be->book )->sx_list;
for ( ; schedXactions != NULL && is_ok; schedXactions = schedXactions->next )
{
@@ -492,7 +492,7 @@
g_return_if_fail( be != NULL );
g_return_if_fail( book != NULL );
- ENTER( "book=%p, primary=%p", book, be->primary_book );
+ ENTER( "book=%p, be->book=%p", book, be->book );
update_progress( be );
(void)reset_version_info( be );
gnc_sql_set_table_version( be, "Gnucash", gnc_get_long_version() );
@@ -503,7 +503,7 @@
qof_object_foreach_backend( GNC_SQL_BACKEND, create_tables_cb, be );
/* Save all contents */
- be->primary_book = book;
+ be->book = book;
be->obj_total = 0;
be->obj_total += 1 + gnc_account_n_descendants( gnc_book_get_root_account( book ) );
be->obj_total += gnc_book_count_transactions( book );
@@ -614,7 +614,7 @@
g_return_if_fail( be != NULL );
g_return_if_fail( inst != NULL );
- if ( qof_book_is_readonly( be->primary_book ) )
+ if ( qof_book_is_readonly( be->book ) )
{
qof_backend_set_error( (QofBackend*)be, ERR_BACKEND_READONLY );
(void)gnc_sql_connection_rollback_transaction( be->conn );
@@ -632,7 +632,7 @@
if ( strcmp( inst->e_type, "PriceDB" ) == 0 )
{
qof_instance_mark_clean( inst );
- qof_book_mark_saved( be->primary_book );
+ qof_book_mark_saved( be->book );
return;
}
@@ -673,7 +673,7 @@
// Don't let unknown items still mark the book as being dirty
qof_instance_mark_clean(inst);
- qof_book_mark_saved( be->primary_book );
+ qof_book_mark_saved( be->book );
LEAVE( "Rolled back - unknown object type" );
return;
}
@@ -690,7 +690,7 @@
(void)gnc_sql_connection_commit_transaction( be->conn );
qof_instance_mark_clean(inst);
- qof_book_mark_saved( be->primary_book );
+ qof_book_mark_saved( be->book );
LEAVE( "" );
}
@@ -1070,7 +1070,7 @@
// }
// Mark the book as clean
- qof_instance_mark_clean( QOF_INSTANCE(be->primary_book) );
+ qof_instance_mark_clean( QOF_INSTANCE(be->book) );
// DEBUG( "%s\n", (gchar*)pQueryInfo->pCompiledQuery );
Modified: gnucash/trunk/src/backend/sql/gnc-backend-sql.h
===================================================================
--- gnucash/trunk/src/backend/sql/gnc-backend-sql.h 2011-11-13 21:26:21 UTC (rev 21565)
+++ gnucash/trunk/src/backend/sql/gnc-backend-sql.h 2011-11-13 21:33:29 UTC (rev 21566)
@@ -55,7 +55,7 @@
QofBackend be; /**< QOF backend */
GncSqlConnection* conn; /**< SQL connection */
/*@ dependent @*/
- QofBook *primary_book; /**< The primary, main open book */
+ QofBook *book; /**< The primary, main open book */
gboolean loading; /**< We are performing an initial load */
gboolean in_query; /**< We are processing a query */
gboolean is_pristine_db; /**< Are we saving to a new pristine db? */
Modified: gnucash/trunk/src/backend/sql/gnc-bill-term-sql.c
===================================================================
--- gnucash/trunk/src/backend/sql/gnc-bill-term-sql.c 2011-11-13 21:26:21 UTC (rev 21565)
+++ gnucash/trunk/src/backend/sql/gnc-bill-term-sql.c 2011-11-13 21:33:29 UTC (rev 21566)
@@ -187,10 +187,10 @@
g_return_val_if_fail( row != NULL, NULL );
guid = gnc_sql_load_guid( be, row );
- pBillTerm = gncBillTermLookup( be->primary_book, guid );
+ pBillTerm = gncBillTermLookup( be->book, guid );
if ( pBillTerm == NULL )
{
- pBillTerm = gncBillTermCreate( be->primary_book );
+ pBillTerm = gncBillTermCreate( be->book );
}
gnc_sql_load_object( be, row, GNC_ID_BILLTERM, pBillTerm, col_table );
@@ -229,7 +229,7 @@
g_return_if_fail( be != NULL );
- pBook = be->primary_book;
+ pBook = be->book;
stmt = gnc_sql_create_select_statement( be, TABLE_NAME );
result = gnc_sql_execute_select_statement( be, stmt );
@@ -312,7 +312,7 @@
data.be = be;
data.is_ok = TRUE;
- qof_object_foreach( GNC_ID_BILLTERM, be->primary_book, do_save_billterm, &data );
+ qof_object_foreach( GNC_ID_BILLTERM, be->book, do_save_billterm, &data );
return data.is_ok;
}
@@ -369,7 +369,7 @@
if ( val != NULL && G_VALUE_HOLDS_STRING( val ) && g_value_get_string( val ) != NULL )
{
string_to_guid( g_value_get_string( val ), &guid );
- term = gncBillTermLookup( be->primary_book, &guid );
+ term = gncBillTermLookup( be->book, &guid );
if ( term != NULL )
{
if ( table_row->gobj_param_name != NULL )
Modified: gnucash/trunk/src/backend/sql/gnc-book-sql.c
===================================================================
--- gnucash/trunk/src/backend/sql/gnc-book-sql.c 2011-11-13 21:26:21 UTC (rev 21565)
+++ gnucash/trunk/src/backend/sql/gnc-book-sql.c 2011-11-13 21:33:29 UTC (rev 21566)
@@ -148,7 +148,7 @@
guid = gnc_sql_load_guid( be, row );
- pBook = be->primary_book;
+ pBook = be->book;
if ( pBook == NULL )
{
pBook = qof_book_new();
@@ -182,7 +182,7 @@
// If there are no rows, try committing the book
if ( row == NULL )
{
- (void)gnc_sql_save_book( be, QOF_INSTANCE(be->primary_book) );
+ (void)gnc_sql_save_book( be, QOF_INSTANCE(be->book) );
}
else
{
Modified: gnucash/trunk/src/backend/sql/gnc-budget-sql.c
===================================================================
--- gnucash/trunk/src/backend/sql/gnc-budget-sql.c 2011-11-13 21:26:21 UTC (rev 21565)
+++ gnucash/trunk/src/backend/sql/gnc-budget-sql.c 2011-11-13 21:33:29 UTC (rev 21566)
@@ -275,7 +275,7 @@
info.budget = budget;
num_periods = gnc_budget_get_num_periods( budget );
- descendants = gnc_account_get_descendants( gnc_book_get_root_account( be->primary_book ) );
+ descendants = gnc_account_get_descendants( gnc_book_get_root_account( be->book ) );
for ( node = descendants; node != NULL && is_ok; node = g_list_next(node) )
{
guint i;
@@ -309,11 +309,11 @@
guid = gnc_sql_load_guid( be, row );
if ( guid != NULL )
{
- pBudget = gnc_budget_lookup( guid, be->primary_book );
+ pBudget = gnc_budget_lookup( guid, be->book );
}
if ( pBudget == NULL )
{
- pBudget = gnc_budget_new( be->primary_book );
+ pBudget = gnc_budget_new( be->book );
}
gnc_budget_begin_edit( pBudget );
@@ -472,7 +472,7 @@
data.be = be;
data.is_ok = TRUE;
- qof_collection_foreach( qof_book_get_collection( be->primary_book, GNC_ID_BUDGET ),
+ qof_collection_foreach( qof_book_get_collection( be->book, GNC_ID_BUDGET ),
(QofInstanceForeachCB)do_save_budget, &data );
return data.is_ok;
@@ -497,7 +497,7 @@
if ( val != NULL && G_VALUE_HOLDS_STRING( val ) && g_value_get_string( val ) != NULL )
{
(void)string_to_guid( g_value_get_string( val ), &guid );
- budget = gnc_budget_lookup( &guid, be->primary_book );
+ budget = gnc_budget_lookup( &guid, be->book );
if ( budget != NULL )
{
if ( table_row->gobj_param_name != NULL )
Modified: gnucash/trunk/src/backend/sql/gnc-commodity-sql.c
===================================================================
--- gnucash/trunk/src/backend/sql/gnc-commodity-sql.c 2011-11-13 21:26:21 UTC (rev 21565)
+++ gnucash/trunk/src/backend/sql/gnc-commodity-sql.c 2011-11-13 21:33:29 UTC (rev 21566)
@@ -115,7 +115,7 @@
static /*@ dependent @*/ gnc_commodity*
load_single_commodity( GncSqlBackend* be, GncSqlRow* row )
{
- QofBook* pBook = be->primary_book;
+ QofBook* pBook = be->book;
gnc_commodity* pCommodity;
pCommodity = gnc_commodity_new( pBook, NULL, NULL, NULL, NULL, 100 );
@@ -133,7 +133,7 @@
GncSqlResult* result;
gnc_commodity_table* pTable;
- pTable = gnc_commodity_table_get_table( be->primary_book );
+ pTable = gnc_commodity_table_get_table( be->book );
stmt = gnc_sql_create_select_statement( be, COMMODITIES_TABLE );
if ( stmt == NULL ) return;
result = gnc_sql_execute_select_statement( be, stmt );
@@ -278,7 +278,7 @@
if ( val != NULL && G_VALUE_HOLDS_STRING( val ) && g_value_get_string( val ) != NULL )
{
(void)string_to_guid( g_value_get_string( val ), &guid );
- commodity = gnc_commodity_find_commodity_by_guid( &guid, be->primary_book );
+ commodity = gnc_commodity_find_commodity_by_guid( &guid, be->book );
if ( commodity != NULL )
{
if ( table_row->gobj_param_name != NULL )
Modified: gnucash/trunk/src/backend/sql/gnc-customer-sql.c
===================================================================
--- gnucash/trunk/src/backend/sql/gnc-customer-sql.c 2011-11-13 21:26:21 UTC (rev 21565)
+++ gnucash/trunk/src/backend/sql/gnc-customer-sql.c 2011-11-13 21:33:29 UTC (rev 21566)
@@ -94,10 +94,10 @@
g_return_val_if_fail( row != NULL, NULL );
guid = gnc_sql_load_guid( be, row );
- pCustomer = gncCustomerLookup( be->primary_book, guid );
+ pCustomer = gncCustomerLookup( be->book, guid );
if ( pCustomer == NULL )
{
- pCustomer = gncCustomerCreate( be->primary_book );
+ pCustomer = gncCustomerCreate( be->book );
}
gnc_sql_load_object( be, row, GNC_ID_CUSTOMER, pCustomer, col_table );
qof_instance_mark_clean( QOF_INSTANCE(pCustomer) );
@@ -114,7 +114,7 @@
g_return_if_fail( be != NULL );
- pBook = be->primary_book;
+ pBook = be->book;
stmt = gnc_sql_create_select_statement( be, TABLE_NAME );
result = gnc_sql_execute_select_statement( be, stmt );
@@ -226,7 +226,7 @@
data.be = be;
data.is_ok = TRUE;
- qof_object_foreach( GNC_ID_CUSTOMER, be->primary_book, write_single_customer, (gpointer)&data );
+ qof_object_foreach( GNC_ID_CUSTOMER, be->book, write_single_customer, (gpointer)&data );
return data.is_ok;
}
Modified: gnucash/trunk/src/backend/sql/gnc-employee-sql.c
===================================================================
--- gnucash/trunk/src/backend/sql/gnc-employee-sql.c 2011-11-13 21:26:21 UTC (rev 21565)
+++ gnucash/trunk/src/backend/sql/gnc-employee-sql.c 2011-11-13 21:33:29 UTC (rev 21566)
@@ -85,10 +85,10 @@
g_return_val_if_fail( row != NULL, NULL );
guid = gnc_sql_load_guid( be, row );
- pEmployee = gncEmployeeLookup( be->primary_book, guid );
+ pEmployee = gncEmployeeLookup( be->book, guid );
if ( pEmployee == NULL )
{
- pEmployee = gncEmployeeCreate( be->primary_book );
+ pEmployee = gncEmployeeCreate( be->book );
}
gnc_sql_load_object( be, row, GNC_ID_EMPLOYEE, pEmployee, col_table );
qof_instance_mark_clean( QOF_INSTANCE(pEmployee) );
@@ -106,7 +106,7 @@
g_return_if_fail( be != NULL );
- pBook = be->primary_book;
+ pBook = be->book;
pTable = gnc_commodity_table_get_table( pBook );
stmt = gnc_sql_create_select_statement( be, TABLE_NAME );
@@ -259,7 +259,7 @@
data.be = be;
data.is_ok = TRUE;
- qof_object_foreach( GNC_ID_EMPLOYEE, be->primary_book, write_single_employee, &data );
+ qof_object_foreach( GNC_ID_EMPLOYEE, be->book, write_single_employee, &data );
return data.is_ok;
}
Modified: gnucash/trunk/src/backend/sql/gnc-entry-sql.c
===================================================================
--- gnucash/trunk/src/backend/sql/gnc-entry-sql.c 2011-11-13 21:26:21 UTC (rev 21565)
+++ gnucash/trunk/src/backend/sql/gnc-entry-sql.c 2011-11-13 21:33:29 UTC (rev 21566)
@@ -159,10 +159,10 @@
g_return_val_if_fail( row != NULL, NULL );
guid = gnc_sql_load_guid( be, row );
- pEntry = gncEntryLookup( be->primary_book, guid );
+ pEntry = gncEntryLookup( be->book, guid );
if ( pEntry == NULL )
{
- pEntry = gncEntryCreate( be->primary_book );
+ pEntry = gncEntryCreate( be->book );
}
gnc_sql_load_object( be, row, GNC_ID_ENTRY, pEntry, col_table );
qof_instance_mark_clean( QOF_INSTANCE(pEntry) );
@@ -179,7 +179,7 @@
g_return_if_fail( be != NULL );
- pBook = be->primary_book;
+ pBook = be->book;
stmt = gnc_sql_create_select_statement( be, TABLE_NAME );
result = gnc_sql_execute_select_statement( be, stmt );
@@ -274,7 +274,7 @@
data.be = be;
data.is_ok = TRUE;
- qof_object_foreach( GNC_ID_ENTRY, be->primary_book, write_single_entry, &data );
+ qof_object_foreach( GNC_ID_ENTRY, be->book, write_single_entry, &data );
return data.is_ok;
}
Modified: gnucash/trunk/src/backend/sql/gnc-invoice-sql.c
===================================================================
--- gnucash/trunk/src/backend/sql/gnc-invoice-sql.c 2011-11-13 21:26:21 UTC (rev 21565)
+++ gnucash/trunk/src/backend/sql/gnc-invoice-sql.c 2011-11-13 21:33:29 UTC (rev 21566)
@@ -102,10 +102,10 @@
g_return_val_if_fail( row != NULL, NULL );
guid = gnc_sql_load_guid( be, row );
- pInvoice = gncInvoiceLookup( be->primary_book, guid );
+ pInvoice = gncInvoiceLookup( be->book, guid );
if ( pInvoice == NULL )
{
- pInvoice = gncInvoiceCreate( be->primary_book );
+ pInvoice = gncInvoiceCreate( be->book );
}
gnc_sql_load_object( be, row, GNC_ID_INVOICE, pInvoice, col_table );
qof_instance_mark_clean( QOF_INSTANCE(pInvoice) );
@@ -122,7 +122,7 @@
g_return_if_fail( be != NULL );
- pBook = be->primary_book;
+ pBook = be->book;
stmt = gnc_sql_create_select_statement( be, TABLE_NAME );
result = gnc_sql_execute_select_statement( be, stmt );
@@ -277,7 +277,7 @@
data.be = be;
data.is_ok = TRUE;
- qof_object_foreach( GNC_ID_INVOICE, be->primary_book, write_single_invoice, &data );
+ qof_object_foreach( GNC_ID_INVOICE, be->book, write_single_invoice, &data );
return data.is_ok;
}
@@ -301,7 +301,7 @@
if ( val != NULL && G_VALUE_HOLDS_STRING( val ) && g_value_get_string( val ) != NULL )
{
string_to_guid( g_value_get_string( val ), &guid );
- invoice = gncInvoiceLookup( be->primary_book, &guid );
+ invoice = gncInvoiceLookup( be->book, &guid );
if ( invoice != NULL )
{
if ( table_row->gobj_param_name != NULL )
Modified: gnucash/trunk/src/backend/sql/gnc-job-sql.c
===================================================================
--- gnucash/trunk/src/backend/sql/gnc-job-sql.c 2011-11-13 21:26:21 UTC (rev 21565)
+++ gnucash/trunk/src/backend/sql/gnc-job-sql.c 2011-11-13 21:33:29 UTC (rev 21566)
@@ -79,10 +79,10 @@
g_return_val_if_fail( row != NULL, NULL );
guid = gnc_sql_load_guid( be, row );
- pJob = gncJobLookup( be->primary_book, guid );
+ pJob = gncJobLookup( be->book, guid );
if ( pJob == NULL )
{
- pJob = gncJobCreate( be->primary_book );
+ pJob = gncJobCreate( be->book );
}
gnc_sql_load_object( be, row, GNC_ID_JOB, pJob, col_table );
qof_instance_mark_clean( QOF_INSTANCE(pJob) );
@@ -99,7 +99,7 @@
g_return_if_fail( be != NULL );
- pBook = be->primary_book;
+ pBook = be->book;
stmt = gnc_sql_create_select_statement( be, TABLE_NAME );
result = gnc_sql_execute_select_statement( be, stmt );
@@ -197,7 +197,7 @@
data.be = be;
data.is_ok = TRUE;
- qof_object_foreach( GNC_ID_JOB, be->primary_book, write_single_job, &data );
+ qof_object_foreach( GNC_ID_JOB, be->book, write_single_job, &data );
return data.is_ok;
}
Modified: gnucash/trunk/src/backend/sql/gnc-lots-sql.c
===================================================================
--- gnucash/trunk/src/backend/sql/gnc-lots-sql.c 2011-11-13 21:26:21 UTC (rev 21565)
+++ gnucash/trunk/src/backend/sql/gnc-lots-sql.c 2011-11-13 21:33:29 UTC (rev 21566)
@@ -104,7 +104,7 @@
g_return_val_if_fail( be != NULL, NULL );
g_return_val_if_fail( row != NULL, NULL );
- lot = gnc_lot_new( be->primary_book );
+ lot = gnc_lot_new( be->book );
gnc_lot_begin_edit( lot );
gnc_sql_load_object( be, row, GNC_ID_LOT, lot, col_table );
@@ -207,7 +207,7 @@
data.be = be;
data.is_ok = TRUE;
- qof_collection_foreach( qof_book_get_collection( be->primary_book, GNC_ID_LOT ),
+ qof_collection_foreach( qof_book_get_collection( be->book, GNC_ID_LOT ),
(QofInstanceForeachCB)do_save_lot, &data );
return data.is_ok;
}
@@ -231,7 +231,7 @@
if ( val != NULL && G_VALUE_HOLDS_STRING( val ) && g_value_get_string( val ) != NULL )
{
(void)string_to_guid( g_value_get_string( val ), &guid );
- lot = gnc_lot_lookup( &guid, be->primary_book );
+ lot = gnc_lot_lookup( &guid, be->book );
if ( lot != NULL )
{
if ( table_row->gobj_param_name != NULL )
Modified: gnucash/trunk/src/backend/sql/gnc-order-sql.c
===================================================================
--- gnucash/trunk/src/backend/sql/gnc-order-sql.c 2011-11-13 21:26:21 UTC (rev 21565)
+++ gnucash/trunk/src/backend/sql/gnc-order-sql.c 2011-11-13 21:33:29 UTC (rev 21566)
@@ -76,10 +76,10 @@
g_return_val_if_fail( row != NULL, NULL );
guid = gnc_sql_load_guid( be, row );
- pOrder = gncOrderLookup( be->primary_book, guid );
+ pOrder = gncOrderLookup( be->book, guid );
if ( pOrder == NULL )
{
- pOrder = gncOrderCreate( be->primary_book );
+ pOrder = gncOrderCreate( be->book );
}
gnc_sql_load_object( be, row, GNC_ID_ORDER, pOrder, col_table );
qof_instance_mark_clean( QOF_INSTANCE(pOrder) );
@@ -96,7 +96,7 @@
g_return_if_fail( be != NULL );
- pBook = be->primary_book;
+ pBook = be->book;
stmt = gnc_sql_create_select_statement( be, TABLE_NAME );
result = gnc_sql_execute_select_statement( be, stmt );
@@ -194,7 +194,7 @@
data.be = be;
data.is_ok = TRUE;
- qof_object_foreach( GNC_ID_ORDER, be->primary_book, write_single_order, &data );
+ qof_object_foreach( GNC_ID_ORDER, be->book, write_single_order, &data );
return data.is_ok;
}
@@ -218,7 +218,7 @@
if ( val != NULL && G_VALUE_HOLDS_STRING( val ) && g_value_get_string( val ) != NULL )
{
string_to_guid( g_value_get_string( val ), &guid );
- order = gncOrderLookup( be->primary_book, &guid );
+ order = gncOrderLookup( be->book, &guid );
if ( order != NULL )
{
if ( table_row->gobj_param_name != NULL )
Modified: gnucash/trunk/src/backend/sql/gnc-owner-sql.c
===================================================================
--- gnucash/trunk/src/backend/sql/gnc-owner-sql.c 2011-11-13 21:26:21 UTC (rev 21565)
+++ gnucash/trunk/src/backend/sql/gnc-owner-sql.c 2011-11-13 21:33:29 UTC (rev 21566)
@@ -65,7 +65,7 @@
g_return_if_fail( pObject != NULL );
g_return_if_fail( table_row != NULL );
- book = be->primary_book;
+ book = be->book;
buf = g_strdup_printf( "%s_type", table_row->col_name );
val = gnc_sql_row_get_value_at_col_name( row, buf );
type = (GncOwnerType)gnc_sql_get_integer_value( val );
Modified: gnucash/trunk/src/backend/sql/gnc-price-sql.c
===================================================================
--- gnucash/trunk/src/backend/sql/gnc-price-sql.c 2011-11-13 21:26:21 UTC (rev 21565)
+++ gnucash/trunk/src/backend/sql/gnc-price-sql.c 2011-11-13 21:33:29 UTC (rev 21566)
@@ -75,7 +75,7 @@
g_return_val_if_fail( be != NULL, NULL );
g_return_val_if_fail( row != NULL, NULL );
- pPrice = gnc_price_create( be->primary_book );
+ pPrice = gnc_price_create( be->book );
gnc_price_begin_edit( pPrice );
gnc_sql_load_object( be, row, GNC_ID_PRICE, pPrice, col_table );
@@ -94,7 +94,7 @@
g_return_if_fail( be != NULL );
- pBook = be->primary_book;
+ pBook = be->book;
pPriceDB = gnc_pricedb_get_db( pBook );
stmt = gnc_sql_create_select_statement( be, TABLE_NAME );
if ( stmt != NULL )
@@ -219,7 +219,7 @@
g_return_val_if_fail( be != NULL, FALSE );
- priceDB = gnc_pricedb_get_db( be->primary_book );
+ priceDB = gnc_pricedb_get_db( be->book );
data.be = be;
data.is_ok = TRUE;
Modified: gnucash/trunk/src/backend/sql/gnc-schedxaction-sql.c
===================================================================
--- gnucash/trunk/src/backend/sql/gnc-schedxaction-sql.c 2011-11-13 21:26:21 UTC (rev 21565)
+++ gnucash/trunk/src/backend/sql/gnc-schedxaction-sql.c 2011-11-13 21:33:29 UTC (rev 21566)
@@ -90,7 +90,7 @@
guid = gnc_sql_load_guid( be, row );
g_assert( guid != NULL );
- pSx = xaccSchedXactionMalloc( be->primary_book );
+ pSx = xaccSchedXactionMalloc( be->book );
gnc_sx_begin_edit( pSx );
gnc_sql_load_object( be, row, GNC_SX_ID, pSx, col_table );
@@ -121,7 +121,7 @@
GncSqlRow* row;
SchedXactions *sxes;
GList* list = NULL;
- sxes = gnc_book_get_schedxactions( be->primary_book );
+ sxes = gnc_book_get_schedxactions( be->book );
row = gnc_sql_result_get_first_row( result );
while ( row != NULL )
Modified: gnucash/trunk/src/backend/sql/gnc-slots-sql.c
===================================================================
--- gnucash/trunk/src/backend/sql/gnc-slots-sql.c 2011-11-13 21:26:21 UTC (rev 21565)
+++ gnucash/trunk/src/backend/sql/gnc-slots-sql.c 2011-11-13 21:33:29 UTC (rev 21566)
@@ -979,7 +979,7 @@
guid = load_obj_guid( be, row );
g_return_if_fail( guid != NULL );
- inst = lookup_fn( guid, be->primary_book );
+ inst = lookup_fn( guid, be->book );
g_return_if_fail( inst != NULL );
slot_info.be = be;
Modified: gnucash/trunk/src/backend/sql/gnc-tax-table-sql.c
===================================================================
--- gnucash/trunk/src/backend/sql/gnc-tax-table-sql.c 2011-11-13 21:26:21 UTC (rev 21565)
+++ gnucash/trunk/src/backend/sql/gnc-tax-table-sql.c 2011-11-13 21:33:29 UTC (rev 21566)
@@ -292,10 +292,10 @@
g_return_if_fail( row != NULL );
guid = gnc_sql_load_guid( be, row );
- tt = gncTaxTableLookup( be->primary_book, guid );
+ tt = gncTaxTableLookup( be->book, guid );
if ( tt == NULL )
{
- tt = gncTaxTableCreate( be->primary_book );
+ tt = gncTaxTableCreate( be->book );
}
gnc_sql_load_object( be, row, GNC_ID_TAXTABLE, tt, tt_col_table );
gnc_sql_slots_load( be, QOF_INSTANCE(tt) );
@@ -528,7 +528,7 @@
data.be = be;
data.is_ok = TRUE;
- qof_object_foreach( GNC_ID_TAXTABLE, be->primary_book, save_next_taxtable, &data );
+ qof_object_foreach( GNC_ID_TAXTABLE, be->book, save_next_taxtable, &data );
return data.is_ok;
}
@@ -552,7 +552,7 @@
if ( val != NULL && G_VALUE_HOLDS_STRING( val ) && g_value_get_string( val ) != NULL )
{
string_to_guid( g_value_get_string( val ), &guid );
- taxtable = gncTaxTableLookup( be->primary_book, &guid );
+ taxtable = gncTaxTableLookup( be->book, &guid );
if ( taxtable != NULL )
{
if ( table_row->gobj_param_name != NULL )
Modified: gnucash/trunk/src/backend/sql/gnc-transaction-sql.c
===================================================================
--- gnucash/trunk/src/backend/sql/gnc-transaction-sql.c 2011-11-13 21:26:21 UTC (rev 21565)
+++ gnucash/trunk/src/backend/sql/gnc-transaction-sql.c 2011-11-13 21:33:29 UTC (rev 21566)
@@ -210,10 +210,10 @@
if ( guid == NULL ) return NULL;
split_guid = *guid;
- pSplit = xaccSplitLookup( &split_guid, be->primary_book );
+ pSplit = xaccSplitLookup( &split_guid, be->book );
if ( pSplit == NULL )
{
- pSplit = xaccMallocSplit( be->primary_book );
+ pSplit = xaccMallocSplit( be->book );
}
/* If the split is dirty, don't overwrite it */
@@ -222,7 +222,7 @@
gnc_sql_load_object( be, row, GNC_ID_SPLIT, pSplit, split_col_table );
}
- /*# -ifempty */g_assert( pSplit == xaccSplitLookup( &split_guid, be->primary_book ) );
+ /*# -ifempty */g_assert( pSplit == xaccSplitLookup( &split_guid, be->book ) );
return pSplit;
}
@@ -287,17 +287,17 @@
tx_guid = *guid;
// Don't overwrite the transaction if it's already been loaded (and possibly modified).
- pTx = xaccTransLookup( &tx_guid, be->primary_book );
+ pTx = xaccTransLookup( &tx_guid, be->book );
if ( pTx != NULL )
{
return NULL;
}
- pTx = xaccMallocTransaction( be->primary_book );
+ pTx = xaccMallocTransaction( be->book );
xaccTransBeginEdit( pTx );
gnc_sql_load_object( be, row, GNC_ID_TRANS, pTx, tx_col_table );
- g_assert( pTx == xaccTransLookup( &tx_guid, be->primary_book ) );
+ g_assert( pTx == xaccTransLookup( &tx_guid, be->book ) );
return pTx;
}
@@ -389,7 +389,7 @@
Transaction* tx;
GSList* bal_list = NULL;
GSList* nextbal;
- Account* root = gnc_book_get_root_account( be->primary_book );
+ Account* root = gnc_book_get_root_account( be->book );
#if LOAD_TRANSACTIONS_AS_NEEDED
qof_event_suspend();
@@ -1335,7 +1335,7 @@
g_return_if_fail( pObject != NULL );
g_return_if_fail( pValue != NULL );
- bal->acct = xaccAccountLookup( guid, bal->be->primary_book );
+ bal->acct = xaccAccountLookup( guid, bal->be->book );
}
static void
@@ -1498,7 +1498,7 @@
if ( guid_str != NULL )
{
(void)string_to_guid( guid_str, &guid );
- tx = xaccTransLookup( &guid, be->primary_book );
+ tx = xaccTransLookup( &guid, be->book );
// If the transaction is not found, try loading it
if ( tx == NULL )
@@ -1511,7 +1511,7 @@
stmt = gnc_sql_create_statement_from_sql( (GncSqlBackend*)be, buf );
g_free( buf );
query_transactions( (GncSqlBackend*)be, stmt );
- tx = xaccTransLookup( &guid, be->primary_book );
+ tx = xaccTransLookup( &guid, be->book );
}
if ( tx != NULL )
Modified: gnucash/trunk/src/backend/sql/gnc-vendor-sql.c
===================================================================
--- gnucash/trunk/src/backend/sql/gnc-vendor-sql.c 2011-11-13 21:26:21 UTC (rev 21565)
+++ gnucash/trunk/src/backend/sql/gnc-vendor-sql.c 2011-11-13 21:33:29 UTC (rev 21566)
@@ -93,10 +93,10 @@
g_return_val_if_fail( row != NULL, NULL );
guid = gnc_sql_load_guid( be, row );
- pVendor = gncVendorLookup( be->primary_book, guid );
+ pVendor = gncVendorLookup( be->book, guid );
if ( pVendor == NULL )
{
- pVendor = gncVendorCreate( be->primary_book );
+ pVendor = gncVendorCreate( be->book );
}
gnc_sql_load_object( be, row, GNC_ID_VENDOR, pVendor, col_table );
qof_instance_mark_clean( QOF_INSTANCE(pVendor) );
@@ -113,7 +113,7 @@
g_return_if_fail( be != NULL );
- pBook = be->primary_book;
+ pBook = be->book;
stmt = gnc_sql_create_select_statement( be, TABLE_NAME );
result = gnc_sql_execute_select_statement( be, stmt );
@@ -256,7 +256,7 @@
data.be = be;
data.is_ok = TRUE;
- qof_object_foreach( GNC_ID_VENDOR, be->primary_book, write_single_vendor, &data );
+ qof_object_foreach( GNC_ID_VENDOR, be->book, write_single_vendor, &data );
return data.is_ok;
}
Modified: gnucash/trunk/src/backend/xml/gnc-backend-xml.c
===================================================================
--- gnucash/trunk/src/backend/xml/gnc-backend-xml.c 2011-11-13 21:26:21 UTC (rev 21565)
+++ gnucash/trunk/src/backend/xml/gnc-backend-xml.c 2011-11-13 21:33:29 UTC (rev 21566)
@@ -378,7 +378,7 @@
FileBackend *be = (FileBackend*)be_start;
ENTER (" ");
- if ( be->primary_book && qof_book_is_readonly( be->primary_book ) )
+ if ( be->book && qof_book_is_readonly( be->book ) )
{
qof_backend_set_error( (QofBackend*)be, ERR_BACKEND_READONLY );
return;
@@ -959,20 +959,18 @@
xml_sync_all(QofBackend* be, QofBook *book)
{
FileBackend *fbe = (FileBackend *) be;
- ENTER ("book=%p, primary=%p", book, fbe->primary_book);
+ ENTER ("book=%p, fbe->book=%p", book, fbe->book);
/* We make an important assumption here, that we might want to change
* in the future: when the user says 'save', we really save the one,
- * the only, the current open book, and nothing else. We do this
- * because we assume that any other books that we are dealing with
- * are 'read-only', non-editable, because they are closed books.
- * If we ever want to have more than one book open read-write,
- * this will have to change.
+ * the only, the current open book, and nothing else. In any case the plans
+ * for multiple books have been removed in the meantime and there is just one
+ * book, no more.
*/
- if (NULL == fbe->primary_book) fbe->primary_book = book;
- if (book != fbe->primary_book) return;
+ if (NULL == fbe->book) fbe->book = book;
+ if (book != fbe->book) return;
- if (qof_book_is_readonly( fbe->primary_book ) )
+ if (qof_book_is_readonly( fbe->book ) )
{
/* Are we read-only? Don't continue in this case. */
qof_backend_set_error( (QofBackend*)be, ERR_BACKEND_READONLY );
@@ -1102,7 +1100,7 @@
if (loadType != LOAD_TYPE_INITIAL_LOAD) return;
error = ERR_BACKEND_NO_ERR;
- be->primary_book = book;
+ be->book = book;
switch (gnc_xml_be_determine_file_type(be->fullpath))
{
@@ -1282,7 +1280,7 @@
gnc_be->linkfile = NULL;
gnc_be->lockfd = -1;
- gnc_be->primary_book = NULL;
+ gnc_be->book = NULL;
gnc_be->file_retention_days = (int)gnc_gconf_get_float(GCONF_GENERAL, KEY_RETAIN_DAYS, NULL);
gnc_be->file_compression = gnc_gconf_get_bool(GCONF_GENERAL, KEY_FILE_COMPRESSION, NULL);
Modified: gnucash/trunk/src/backend/xml/gnc-backend-xml.h
===================================================================
--- gnucash/trunk/src/backend/xml/gnc-backend-xml.h 2011-11-13 21:26:21 UTC (rev 21565)
+++ gnucash/trunk/src/backend/xml/gnc-backend-xml.h 2011-11-13 21:33:29 UTC (rev 21566)
@@ -53,7 +53,7 @@
char *linkfile;
int lockfd;
- QofBook *primary_book; /* The primary, main open book */
+ QofBook *book; /* The primary, main open book */
XMLFileRetentionType file_retention_type;
int file_retention_days;
More information about the gnucash-changes
mailing list