Remove separate object initialization in engine/gncBusiness.c and move this into one common initialization function cashobjects_register in <engine/cashobjects.h>.

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@19360 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Christian Stimming 2010-07-12 20:12:22 +00:00
parent f8007880fd
commit 4bd4d41c05
9 changed files with 41 additions and 68 deletions

View File

@ -67,7 +67,7 @@ libgncmod_business_core_gnc_module_init(int refcount)
if (refcount == 0)
{
gnc_module_init_business_core_init();
/* Object initialization already finished in the engine. */
}
scm_init_sw_business_core_module();

View File

@ -160,7 +160,6 @@ int main (int argc, char ** argv)
qof_init();
cashobjects_register();
gnc_module_init_business_core_init();
qof_load_backend_library ("../../../../backend/dbi/.libs/", GNC_LIB_NAME);
init_business_sql();

View File

@ -138,7 +138,6 @@ SET (libgncmod_engine_SOURCES
gncAddress.c
gncBillTerm.c
gncBusGuile.c
gncBusiness.c
gncCustomer.c
gncEmployee.c
gncEntry.c

View File

@ -47,7 +47,6 @@ libgncmod_engine_la_SOURCES = \
gncBusGuile.c \
gncAddress.c \
gncBillTerm.c \
gncBusiness.c \
gncCustomer.c \
gncEmployee.c \
gncEntry.c \

View File

@ -2,8 +2,11 @@
* cashobjects.c
*
* Mon Aug 22 09:49:52 2005
* Copyright 2005 Neil Williams
* linux@codehelp.co.uk
* Copyright 2005 Neil Williams linux@codehelp.co.uk
*
* Copyright (C) 2002 Derek Atkins
* Copyright (C) 2010 Christian Stimming
*
****************************************************************************/
/*
@ -34,6 +37,35 @@
#include "gnc-lot-p.h"
#include "gnc-budget.h"
#include "gncAddressP.h"
#include "gncBillTermP.h"
#include "gncCustomerP.h"
#include "gncEmployeeP.h"
#include "gncEntryP.h"
#include "gncInvoiceP.h"
#include "gncJobP.h"
#include "gncOrderP.h"
#include "gncOwnerP.h"
#include "gncTaxTableP.h"
#include "gncVendorP.h"
static void
business_core_init(void)
{
/* initialize known types */
gncInvoiceRegister ();
gncJobRegister ();
gncBillTermRegister ();
gncCustomerRegister ();
gncAddressRegister ();
gncEmployeeRegister ();
gncEntryRegister ();
gncOrderRegister ();
gncOwnerRegister ();
gncTaxTableRegister ();
gncVendorRegister ();
}
gboolean
cashobjects_register(void)
{
@ -46,6 +78,10 @@ cashobjects_register(void)
g_return_val_if_fail(gnc_pricedb_register(), FALSE);
g_return_val_if_fail (gnc_budget_register(), FALSE);
g_return_val_if_fail ( gnc_lot_register (), FALSE);
/* And the business objects */
business_core_init();
return TRUE;
}

View File

@ -1,57 +0,0 @@
/*
* gncBusiness.c -- Business helper functions
* Copyright (C) 2002 Derek Atkins
* Author: Derek Atkins <warlord@MIT.EDU>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, contact:
*
* Free Software Foundation Voice: +1-617-542-5942
* 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652
* Boston, MA 02110-1301, USA gnu@gnu.org
*/
#include "config.h"
#include "gncBusiness.h"
#include <glib.h>
#include "gncAddressP.h"
#include "gncBillTermP.h"
#include "gncCustomerP.h"
#include "gncEmployeeP.h"
#include "gncEntryP.h"
#include "gncInvoiceP.h"
#include "gncJobP.h"
#include "gncOrderP.h"
#include "gncOwnerP.h"
#include "gncTaxTableP.h"
#include "gncVendorP.h"
void
gnc_module_init_business_core_init(void)
{
/* initialize known types */
gncInvoiceRegister ();
gncJobRegister ();
gncBillTermRegister ();
gncCustomerRegister ();
gncAddressRegister ();
gncEmployeeRegister ();
gncEntryRegister ();
gncOrderRegister ();
gncOwnerRegister ();
gncTaxTableRegister ();
gncVendorRegister ();
}

View File

@ -47,8 +47,8 @@
#define GNC_TAXTABLE_MODULE_NAME GNC_ID_TAXTABLE
#define GNC_VENDOR_MODULE_NAME GNC_ID_VENDOR
void
gnc_module_init_business_core_init(void);
/* The initialization of the business objects is done in
* cashobjects_register() of <engine/cashobjects.h>. */
#ifndef DI
# ifdef _MSC_VER

View File

@ -48,7 +48,6 @@ extern "C"
#include "swig-runtime.h"
#include "backend/xml/gnc-backend-xml.h"
#include "engine/gncBusiness.h"
#include "business/business-core/xml/gncmod-business-backend-xml.h"
#ifdef WITH_SQL
# include "backend/dbi/gnc-backend-dbi.h"
@ -180,7 +179,6 @@ main(int argc, char ** argv)
#ifdef WITH_SQL
gnc_module_init_backend_dbi();
#endif
gnc_module_init_business_core_init();
gnc_module_init_business_core_xml_init();
gnc_ui_util_init();
gnc_exp_parser_init();

View File

@ -187,7 +187,6 @@ gnc_engine_init_static(0, no_args);
gnc_module_init_backend_xml();
gnc_module_init_backend_dbi();
gnc_module_init_business_core_init();
gnc_module_init_business_core_xml_init();
gnc_module_init_business_core_sql_init();
%}