r15878 - gnucash/branches/gda-dev - Merge in trunk up to 15877

Phil Longstaff plongstaff at cvs.gnucash.org
Fri Apr 13 20:36:08 EDT 2007


Author: plongstaff
Date: 2007-04-13 20:35:53 -0400 (Fri, 13 Apr 2007)
New Revision: 15878
Trac: http://svn.gnucash.org/trac/changeset/15878

Removed:
   gnucash/branches/gda-dev/src/network-utils/
Modified:
   gnucash/branches/gda-dev/configure.in
   gnucash/branches/gda-dev/lib/libqof/backend/file/qof-backend-qsf.h
   gnucash/branches/gda-dev/lib/libqof/backend/file/qsf-backend.c
   gnucash/branches/gda-dev/lib/libqof/backend/file/qsf-xml.c
   gnucash/branches/gda-dev/lib/libqof/backend/file/qsf-xml.h
   gnucash/branches/gda-dev/lib/libqof/qof/deprecated.c
   gnucash/branches/gda-dev/lib/libqof/qof/deprecated.h
   gnucash/branches/gda-dev/lib/libqof/qof/gnc-date.c
   gnucash/branches/gda-dev/lib/libqof/qof/gnc-date.h
   gnucash/branches/gda-dev/lib/libqof/qof/qofbook-p.h
   gnucash/branches/gda-dev/lib/libqof/qof/qofbook.c
   gnucash/branches/gda-dev/lib/libqof/qof/qofbook.h
   gnucash/branches/gda-dev/lib/libqof/qof/qofbookmerge.c
   gnucash/branches/gda-dev/lib/libqof/qof/qofbookmerge.h
   gnucash/branches/gda-dev/lib/libqof/qof/qofclass.h
   gnucash/branches/gda-dev/lib/libqof/qof/qofevent-p.h
   gnucash/branches/gda-dev/lib/libqof/qof/qofevent.c
   gnucash/branches/gda-dev/lib/libqof/qof/qofevent.h
   gnucash/branches/gda-dev/lib/libqof/qof/qofgobj.c
   gnucash/branches/gda-dev/lib/libqof/qof/qofid-p.h
   gnucash/branches/gda-dev/lib/libqof/qof/qofid.c
   gnucash/branches/gda-dev/lib/libqof/qof/qofid.h
   gnucash/branches/gda-dev/lib/libqof/qof/qofinstance-p.h
   gnucash/branches/gda-dev/lib/libqof/qof/qofinstance.c
   gnucash/branches/gda-dev/lib/libqof/qof/qofinstance.h
   gnucash/branches/gda-dev/lib/libqof/qof/qofobject.c
   gnucash/branches/gda-dev/lib/libqof/qof/qofobject.h
   gnucash/branches/gda-dev/lib/libqof/qof/qofquery.c
   gnucash/branches/gda-dev/lib/libqof/qof/qofquerycore.c
   gnucash/branches/gda-dev/lib/libqof/qof/qofreference.c
   gnucash/branches/gda-dev/lib/libqof/qof/qofreference.h
   gnucash/branches/gda-dev/lib/libqof/qof/qofsession-p.h
   gnucash/branches/gda-dev/lib/libqof/qof/qofsession.c
   gnucash/branches/gda-dev/lib/libqof/qof/qofsession.h
   gnucash/branches/gda-dev/lib/libqof/qof/qofsql.c
   gnucash/branches/gda-dev/lib/libqof/qof/qofsql.h
   gnucash/branches/gda-dev/lib/libqof/qof/qofutil.c
   gnucash/branches/gda-dev/lib/libqof/qof/qofutil.h
   gnucash/branches/gda-dev/packaging/win32/README
   gnucash/branches/gda-dev/src/app-utils/gnc-component-manager.c
   gnucash/branches/gda-dev/src/app-utils/gnc-sx-instance-model.c
   gnucash/branches/gda-dev/src/app-utils/gnc-sx-instance-model.h
   gnucash/branches/gda-dev/src/app-utils/gnc-ui-util.c
   gnucash/branches/gda-dev/src/app-utils/options.scm
   gnucash/branches/gda-dev/src/app-utils/test/test-sx.c
   gnucash/branches/gda-dev/src/backend/dwi/qofmap.c
   gnucash/branches/gda-dev/src/backend/file/gnc-backend-file.c
   gnucash/branches/gda-dev/src/backend/file/gnc-book-xml-v2.c
   gnucash/branches/gda-dev/src/backend/file/gnc-budget-xml-v2.c
   gnucash/branches/gda-dev/src/backend/file/gnc-pricedb-xml-v2.c
   gnucash/branches/gda-dev/src/backend/file/io-gncxml-v1.c
   gnucash/branches/gda-dev/src/backend/file/io-gncxml-v2.c
   gnucash/branches/gda-dev/src/backend/gda/gnc-account-gda.c
   gnucash/branches/gda-dev/src/backend/gda/gnc-backend-gda.c
   gnucash/branches/gda-dev/src/backend/gda/gnc-book-gda.c
   gnucash/branches/gda-dev/src/backend/gda/gnc-budget-gda.c
   gnucash/branches/gda-dev/src/backend/gda/gnc-commodity-gda.c
   gnucash/branches/gda-dev/src/backend/gda/gnc-lots-gda.c
   gnucash/branches/gda-dev/src/backend/gda/gnc-price-gda.c
   gnucash/branches/gda-dev/src/backend/gda/gnc-schedxaction-gda.c
   gnucash/branches/gda-dev/src/backend/gda/gnc-transaction-gda.c
   gnucash/branches/gda-dev/src/backend/postgres/PostgresBackend.c
   gnucash/branches/gda-dev/src/backend/postgres/book.c
   gnucash/branches/gda-dev/src/backend/postgres/events.c
   gnucash/branches/gda-dev/src/backend/postgres/price.c
   gnucash/branches/gda-dev/src/backend/postgres/putil.h
   gnucash/branches/gda-dev/src/backend/postgres/table.m4
   gnucash/branches/gda-dev/src/backend/postgres/txn.c
   gnucash/branches/gda-dev/src/business/business-core/file/gnc-bill-term-xml-v2.c
   gnucash/branches/gda-dev/src/business/business-core/file/gnc-customer-xml-v2.c
   gnucash/branches/gda-dev/src/business/business-core/file/gnc-employee-xml-v2.c
   gnucash/branches/gda-dev/src/business/business-core/file/gnc-entry-xml-v2.c
   gnucash/branches/gda-dev/src/business/business-core/file/gnc-invoice-xml-v2.c
   gnucash/branches/gda-dev/src/business/business-core/file/gnc-job-xml-v2.c
   gnucash/branches/gda-dev/src/business/business-core/file/gnc-order-xml-v2.c
   gnucash/branches/gda-dev/src/business/business-core/file/gnc-tax-table-xml-v2.c
   gnucash/branches/gda-dev/src/business/business-core/file/gnc-vendor-xml-v2.c
   gnucash/branches/gda-dev/src/business/business-core/gncAddress.c
   gnucash/branches/gda-dev/src/business/business-core/gncAddress.h
   gnucash/branches/gda-dev/src/business/business-core/gncAddressP.h
   gnucash/branches/gda-dev/src/business/business-core/gncBillTerm.c
   gnucash/branches/gda-dev/src/business/business-core/gncBillTerm.h
   gnucash/branches/gda-dev/src/business/business-core/gncBillTermP.h
   gnucash/branches/gda-dev/src/business/business-core/gncCustomer.c
   gnucash/branches/gda-dev/src/business/business-core/gncCustomer.h
   gnucash/branches/gda-dev/src/business/business-core/gncCustomerP.h
   gnucash/branches/gda-dev/src/business/business-core/gncEmployee.c
   gnucash/branches/gda-dev/src/business/business-core/gncEmployee.h
   gnucash/branches/gda-dev/src/business/business-core/gncEmployeeP.h
   gnucash/branches/gda-dev/src/business/business-core/gncEntry.c
   gnucash/branches/gda-dev/src/business/business-core/gncEntry.h
   gnucash/branches/gda-dev/src/business/business-core/gncEntryP.h
   gnucash/branches/gda-dev/src/business/business-core/gncInvoice.c
   gnucash/branches/gda-dev/src/business/business-core/gncInvoice.h
   gnucash/branches/gda-dev/src/business/business-core/gncInvoiceP.h
   gnucash/branches/gda-dev/src/business/business-core/gncJob.c
   gnucash/branches/gda-dev/src/business/business-core/gncJob.h
   gnucash/branches/gda-dev/src/business/business-core/gncJobP.h
   gnucash/branches/gda-dev/src/business/business-core/gncOrder.c
   gnucash/branches/gda-dev/src/business/business-core/gncOrder.h
   gnucash/branches/gda-dev/src/business/business-core/gncOrderP.h
   gnucash/branches/gda-dev/src/business/business-core/gncOwner.c
   gnucash/branches/gda-dev/src/business/business-core/gncOwner.h
   gnucash/branches/gda-dev/src/business/business-core/gncTaxTable.c
   gnucash/branches/gda-dev/src/business/business-core/gncTaxTable.h
   gnucash/branches/gda-dev/src/business/business-core/gncTaxTableP.h
   gnucash/branches/gda-dev/src/business/business-core/gncVendor.c
   gnucash/branches/gda-dev/src/business/business-core/gncVendor.h
   gnucash/branches/gda-dev/src/business/business-core/gncVendorP.h
   gnucash/branches/gda-dev/src/business/business-core/test/test-address.c
   gnucash/branches/gda-dev/src/business/business-core/test/test-customer.c
   gnucash/branches/gda-dev/src/business/business-core/test/test-employee.c
   gnucash/branches/gda-dev/src/business/business-core/test/test-job.c
   gnucash/branches/gda-dev/src/business/business-core/test/test-vendor.c
   gnucash/branches/gda-dev/src/business/business-gnome/business-urls.c
   gnucash/branches/gda-dev/src/business/business-gnome/gnc-plugin-business.c
   gnucash/branches/gda-dev/src/core-utils/gnc-gdate-utils.c
   gnucash/branches/gda-dev/src/core-utils/gnc-gdate-utils.h
   gnucash/branches/gda-dev/src/doc/backend-api.txt
   gnucash/branches/gda-dev/src/doc/sx.rst
   gnucash/branches/gda-dev/src/engine/Account.c
   gnucash/branches/gda-dev/src/engine/Account.h
   gnucash/branches/gda-dev/src/engine/AccountP.h
   gnucash/branches/gda-dev/src/engine/FreqSpec.c
   gnucash/branches/gda-dev/src/engine/FreqSpec.h
   gnucash/branches/gda-dev/src/engine/FreqSpecP.h
   gnucash/branches/gda-dev/src/engine/GNCId.h
   gnucash/branches/gda-dev/src/engine/Period.c
   gnucash/branches/gda-dev/src/engine/Recurrence.c
   gnucash/branches/gda-dev/src/engine/SX-book.c
   gnucash/branches/gda-dev/src/engine/SX-book.h
   gnucash/branches/gda-dev/src/engine/SchedXaction.c
   gnucash/branches/gda-dev/src/engine/SchedXaction.h
   gnucash/branches/gda-dev/src/engine/Scrub.c
   gnucash/branches/gda-dev/src/engine/Scrub2.c
   gnucash/branches/gda-dev/src/engine/Split.c
   gnucash/branches/gda-dev/src/engine/Split.h
   gnucash/branches/gda-dev/src/engine/SplitP.h
   gnucash/branches/gda-dev/src/engine/Transaction.c
   gnucash/branches/gda-dev/src/engine/Transaction.h
   gnucash/branches/gda-dev/src/engine/TransactionP.h
   gnucash/branches/gda-dev/src/engine/cap-gains.c
   gnucash/branches/gda-dev/src/engine/gnc-book.h
   gnucash/branches/gda-dev/src/engine/gnc-budget.c
   gnucash/branches/gda-dev/src/engine/gnc-budget.h
   gnucash/branches/gda-dev/src/engine/gnc-commodity.c
   gnucash/branches/gda-dev/src/engine/gnc-commodity.h
   gnucash/branches/gda-dev/src/engine/gnc-engine.h
   gnucash/branches/gda-dev/src/engine/gnc-filepath-utils.c
   gnucash/branches/gda-dev/src/engine/gnc-lot-p.h
   gnucash/branches/gda-dev/src/engine/gnc-lot.c
   gnucash/branches/gda-dev/src/engine/gnc-lot.h
   gnucash/branches/gda-dev/src/engine/gnc-pricedb-p.h
   gnucash/branches/gda-dev/src/engine/gnc-pricedb.c
   gnucash/branches/gda-dev/src/engine/gnc-pricedb.h
   gnucash/branches/gda-dev/src/engine/test-core/test-engine-stuff.c
   gnucash/branches/gda-dev/src/engine/test/test-book-merge.c
   gnucash/branches/gda-dev/src/engine/test/test-guid.c
   gnucash/branches/gda-dev/src/engine/test/test-object.c
   gnucash/branches/gda-dev/src/engine/test/test-recursive.c
   gnucash/branches/gda-dev/src/engine/xlate.pl
   gnucash/branches/gda-dev/src/gnome-utils/account-quickfill.c
   gnucash/branches/gda-dev/src/gnome-utils/dialog-options.c
   gnucash/branches/gda-dev/src/gnome-utils/dialog-preferences.c
   gnucash/branches/gda-dev/src/gnome-utils/dialog-transfer.c
   gnucash/branches/gda-dev/src/gnome-utils/dialog-utils.c
   gnucash/branches/gda-dev/src/gnome-utils/gnc-account-sel.c
   gnucash/branches/gda-dev/src/gnome-utils/gnc-date-edit.c
   gnucash/branches/gda-dev/src/gnome-utils/gnc-dense-cal-model.h
   gnucash/branches/gda-dev/src/gnome-utils/gnc-dense-cal-store.c
   gnucash/branches/gda-dev/src/gnome-utils/gnc-dense-cal.c
   gnucash/branches/gda-dev/src/gnome-utils/gnc-dense-cal.h
   gnucash/branches/gda-dev/src/gnome-utils/gnc-file.c
   gnucash/branches/gda-dev/src/gnome-utils/gnc-html.c
   gnucash/branches/gda-dev/src/gnome-utils/gnc-icons.c
   gnucash/branches/gda-dev/src/gnome-utils/gnc-main-window.c
   gnucash/branches/gda-dev/src/gnome-utils/gnc-plugin-file-history.c
   gnucash/branches/gda-dev/src/gnome-utils/gnc-sx-instance-dense-cal-adapter.c
   gnucash/branches/gda-dev/src/gnome-utils/gnc-tree-model-account.c
   gnucash/branches/gda-dev/src/gnome-utils/gnc-tree-model-budget.c
   gnucash/branches/gda-dev/src/gnome-utils/gnc-tree-model-commodity.c
   gnucash/branches/gda-dev/src/gnome-utils/gnc-tree-model-price.c
   gnucash/branches/gda-dev/src/gnome-utils/gnc-tree-view-account.c
   gnucash/branches/gda-dev/src/gnome-utils/gnc-tree-view-price.c
   gnucash/branches/gda-dev/src/gnome-utils/gnc-tree-view.c
   gnucash/branches/gda-dev/src/gnome/dialog-chart-export.c
   gnucash/branches/gda-dev/src/gnome/dialog-chart-export.h
   gnucash/branches/gda-dev/src/gnome/dialog-price-editor.c
   gnucash/branches/gda-dev/src/gnome/dialog-print-check.c
   gnucash/branches/gda-dev/src/gnome/dialog-sx-editor.c
   gnucash/branches/gda-dev/src/gnome/dialog-sx-from-trans.c
   gnucash/branches/gda-dev/src/gnome/dialog-sx-since-last-run.c
   gnucash/branches/gda-dev/src/gnome/druid-hierarchy.c
   gnucash/branches/gda-dev/src/gnome/druid-loan.c
   gnucash/branches/gda-dev/src/gnome/druid-merge.c
   gnucash/branches/gda-dev/src/gnome/druid-merge.h
   gnucash/branches/gda-dev/src/gnome/druid-stock-split.c
   gnucash/branches/gda-dev/src/gnome/glade/sched-xact.glade
   gnucash/branches/gda-dev/src/gnome/gnc-plugin-page-register.c
   gnucash/branches/gda-dev/src/gnome/gnc-plugin-page-sx-list.c
   gnucash/branches/gda-dev/src/gnome/top-level.c
   gnucash/branches/gda-dev/src/import-export/hbci/gnc-hbci-gettrans.c
   gnucash/branches/gda-dev/src/register/ledger-core/split-register.c
   gnucash/branches/gda-dev/src/register/register-gnome/combocell-gnome.c
   gnucash/branches/gda-dev/src/register/register-gnome/datecell-gnome.c
   gnucash/branches/gda-dev/src/register/register-gnome/gnucash-sheet.c
   gnucash/branches/gda-dev/src/scm/price-quotes.scm
Log:
Merge in trunk up to 15877


Modified: gnucash/branches/gda-dev/configure.in
===================================================================
--- gnucash/branches/gda-dev/configure.in	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/configure.in	2007-04-14 00:35:53 UTC (rev 15878)
@@ -286,8 +286,8 @@
 fi
 AM_CONDITIONAL(HAVE_GLIB_2_8, test "x$HAVE_GLIB_2_8" = "xyes")
 
-AC_MSG_CHECKING([for untested GLIB versions (glib >= 2.11.0)])
-if $PKG_CONFIG 'glib-2.0 >= 2.11.0'
+AC_MSG_CHECKING([for untested GLIB versions (glib >= 2.13.0)])
+if $PKG_CONFIG 'glib-2.0 >= 2.13.0'
 then
   AC_MSG_RESULT(yes)
   HAVE_UNTESTED_GLIB=yes
@@ -1076,7 +1076,6 @@
     AS_SCRUB_INCLUDE(GTK_CFLAGS)
     AC_SUBST(GTK_CFLAGS)
     AC_SUBST(GTK_LIBS)
-    HAVE_UNTESTED_GDK=yes
     HAVE_UNTESTED_GTK=yes
 
     AC_MSG_CHECKING(for GTK - version >= 2.10.0)
@@ -1090,13 +1089,20 @@
     fi
     AM_CONDITIONAL(HAVE_GTK_2_10, test "x$HAVE_GTK_2_10" = "xyes" )
 
+    AC_MSG_CHECKING([for untested GDK versions (gdk > 2.11.0)])
+    if $PKG_CONFIG 'gtk+-2.0 > 2.11.0'
+    then
+      AC_MSG_RESULT(yes)
+      HAVE_UNTESTED_GDK=yes
+    fi
+
     PKG_CHECK_MODULES(GNOME, libgnomeui-2.0 >= 2.4)
     AS_SCRUB_INCLUDE(GNOME_CFLAGS)
     AC_SUBST(GNOME_CFLAGS)
     AC_SUBST(GNOME_LIBS)
 
-    AC_MSG_CHECKING([for untested GNOME versions (libgnome >= 2.15.0)])
-    if $PKG_CONFIG 'libgnome-2.0 >= 2.15.0'
+    AC_MSG_CHECKING([for untested GNOME versions (libgnome >= 2.19.0)])
+    if $PKG_CONFIG 'libgnome-2.0 >= 2.19.0'
     then
       AC_MSG_RESULT(yes)
       HAVE_UNTESTED_GNOME=yes

Modified: gnucash/branches/gda-dev/lib/libqof/backend/file/qof-backend-qsf.h
===================================================================
--- gnucash/branches/gda-dev/lib/libqof/backend/file/qof-backend-qsf.h	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/lib/libqof/backend/file/qof-backend-qsf.h	2007-04-14 00:35:53 UTC (rev 15878)
@@ -80,7 +80,7 @@
 written out, the reference can be included. When the file is imported back in, a
 little extra code then rebuilds those references during the merge.
 
-Copying entites from an existing QofBook using the qof_entity_copy routines will 
+Copying entites from an existing QofBook using the qof_instance_copy routines will 
 automatically create the reference table. If your QOF objects use references to other
 entities, books that are created manually also need to create a reference table.
 

Modified: gnucash/branches/gda-dev/lib/libqof/backend/file/qsf-backend.c
===================================================================
--- gnucash/branches/gda-dev/lib/libqof/backend/file/qsf-backend.c	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/lib/libqof/backend/file/qsf-backend.c	2007-04-14 00:35:53 UTC (rev 15878)
@@ -295,12 +295,12 @@
 }
 
 static void
-ent_ref_cb (QofEntity* ent, gpointer user_data)
+ent_ref_cb (QofInstance* ent, gpointer user_data)
 {
 	qsf_param *params;
-	QofEntityReference *ref;
-	void (*reference_setter) (QofEntity*, QofEntity*);
-	QofEntity *reference;
+	QofInstanceReference *ref;
+	void (*reference_setter) (QofInstance*, QofInstance*);
+	QofInstance *reference;
 	QofCollection *coll;
 	QofIdType type;
 
@@ -308,12 +308,12 @@
 	g_return_if_fail(params);
 	while(params->referenceList)
 	{
-		ref = (QofEntityReference*)params->referenceList->data;
+		ref = (QofInstanceReference*)params->referenceList->data;
 		if(qof_object_is_choice(ent->e_type)) { type = ref->choice_type; }
 		else { type = ref->type; }
 		coll = qof_book_get_collection(params->book, type);
 		reference = qof_collection_lookup_entity(coll, ref->ref_guid);
-		reference_setter = (void(*)(QofEntity*, QofEntity*))ref->param->param_setfcn;
+		reference_setter = (void(*)(QofInstance*, QofInstance*))ref->param->param_setfcn;
 		if(reference_setter != NULL)
 		{
 			qof_begin_edit((QofInstance*)ent);
@@ -337,7 +337,7 @@
 }
 
 /*================================================
-	Load QofEntity into QofBook from XML in memory
+	Load QofInstance into QofBook from XML in memory
 ==================================================*/
 
 static gboolean
@@ -370,7 +370,7 @@
 		if(!qof_class_is_registered(params->object_set->object_type)) { continue; }
 		inst = (QofInstance*)qof_object_new_instance(params->object_set->object_type, book);
 		g_return_val_if_fail(inst != NULL, FALSE);
-		params->qsf_ent = &inst->entity;
+		params->qsf_ent = inst;
 		qof_begin_edit(inst);
 		g_hash_table_foreach(params->qsf_parameter_hash, qsf_object_commitCB, params);
 		qof_commit_edit(inst);
@@ -644,7 +644,7 @@
 }
 
 static void
-qsf_from_coll_cb (QofEntity *ent, gpointer user_data)
+qsf_from_coll_cb (QofInstance *ent, gpointer user_data)
 {
 	qsf_param *params;
 	QofParam *qof_param;
@@ -654,7 +654,7 @@
 	params = (qsf_param*)user_data;
 	if(!ent || !params) { return; }
 	qof_param = params->qof_param;
-	guid_to_string_buff(qof_entity_get_guid(ent), qsf_guid);
+	guid_to_string_buff(qof_instance_get_guid(ent), qsf_guid);
 	node = xmlAddChild(params->output_node, xmlNewNode(params->qsf_ns,
 		BAD_CAST qof_param->param_type));
 	xmlNodeAddContent(node, BAD_CAST qsf_guid);
@@ -666,11 +666,11 @@
 static gint
 qof_reference_list_cb(gconstpointer a, gconstpointer b)
 {
-	const QofEntityReference *aa;
-	const QofEntityReference *bb;
+	const QofInstanceReference *aa;
+	const QofInstanceReference *bb;
 
-	aa = (QofEntityReference*) a;
-	bb = (QofEntityReference*) b;
+	aa = (QofInstanceReference*) a;
+	bb = (QofInstanceReference*) b;
 	if(aa == NULL) { return 1; }
 	g_return_val_if_fail((bb != NULL), 1);
 	g_return_val_if_fail((aa->type != NULL), 1);
@@ -683,11 +683,11 @@
 	return 1;
 }
 
-static QofEntityReference*
-qof_reference_lookup(GList *referenceList, QofEntityReference *find)
+static QofInstanceReference*
+qof_reference_lookup(GList *referenceList, QofInstanceReference *find)
 {
 	GList *single_ref;
-	QofEntityReference *ent_ref;
+	QofInstanceReference *ent_ref;
 
 	if(referenceList == NULL) { return NULL; }
 	g_return_val_if_fail(find != NULL, NULL);
@@ -695,7 +695,7 @@
 	ent_ref = NULL;
 	single_ref = g_list_find_custom(referenceList, find, qof_reference_list_cb);
 	if(single_ref == NULL) { return ent_ref; }
-	ent_ref = (QofEntityReference*)single_ref->data;
+	ent_ref = (QofInstanceReference*)single_ref->data;
 	g_list_free(single_ref);
 	return ent_ref;
 }
@@ -703,9 +703,9 @@
 static void
 reference_list_lookup(gpointer data, gpointer user_data)
 {
-	QofEntity *ent;
+	QofInstance *ent;
 	QofParam *ref_param;
-	QofEntityReference *reference, *starter;
+	QofInstanceReference *reference, *starter;
 	qsf_param  *params;
 	const GUID *guid;
 	xmlNodePtr node, object_node;
@@ -718,8 +718,8 @@
 	object_node = params->output_node;
 	ent = params->qsf_ent;
 	ns = params->qsf_ns;
-	starter = g_new(QofEntityReference, 1);
-	starter->ent_guid = qof_entity_get_guid(ent);
+	starter = g_new(QofInstanceReference, 1);
+	starter->ent_guid = qof_instance_get_guid(ent);
 	starter->type = g_strdup(ent->e_type);
 	starter->param = ref_param;
 	starter->ref_guid = NULL;
@@ -739,13 +739,13 @@
 		g_free(ref_name);
 	}
 	else {
-		ent = (QofEntity*)ref_param->param_getfcn(ent, ref_param);
+		ent = QOF_INSTANCE(ref_param->param_getfcn(ent, ref_param));
 		if(!ent) { return; }
 		if((0 == safe_strcmp(ref_param->param_type, QOF_TYPE_COLLECT)) ||
 			(0 == safe_strcmp(ref_param->param_type, QOF_TYPE_CHOICE)))
 		{ return; }
 		node = xmlAddChild(object_node, xmlNewNode(ns, BAD_CAST QOF_TYPE_GUID));
-		guid = qof_entity_get_guid(ent);
+		guid = qof_instance_get_guid(ent);
 		guid_to_string_buff(guid, qsf_guid);
 		xmlNodeAddContent(node, BAD_CAST qsf_guid);
 		xmlNewProp(node, BAD_CAST QSF_OBJECT_TYPE, BAD_CAST ref_param->param_name);
@@ -753,11 +753,11 @@
 }
 
 /*=====================================
-	Convert QofEntity to QSF XML node
+	Convert QofInstance to QSF XML node
 qof_param holds the parameter sequence.
 =======================================*/
 static void
-qsf_entity_foreach(QofEntity *ent, gpointer data)
+qsf_entity_foreach(QofInstance *ent, gpointer data)
 {
 	qsf_param  *params;
 	GSList     *param_list, *supported;
@@ -766,7 +766,7 @@
 	xmlNsPtr   ns;
 	gchar      *string_buffer;
 	QofParam   *qof_param;
-	QofEntity  *choice_ent;
+	QofInstance  *choice_ent;
 	KvpFrame   *qsf_kvp;
 	QofCollection *qsf_coll;
 	gint        param_count;
@@ -795,7 +795,7 @@
 		{
 			if(!own_guid)
 			{
-				cm_guid = qof_entity_get_guid(ent);
+				cm_guid = qof_instance_get_guid(ent);
 				node = xmlAddChild(object_node, xmlNewNode(ns, BAD_CAST QOF_TYPE_GUID));
 				guid_to_string_buff(cm_guid, cm_sa);
 				string_buffer = g_strdup(cm_sa);
@@ -827,13 +827,13 @@
 		if(0 == safe_strcmp(qof_param->param_type, QOF_TYPE_CHOICE))
 		{
 			/** \todo use the reference list here. */
-			choice_ent = (QofEntity*)qof_param->param_getfcn(ent, qof_param);
+			choice_ent = QOF_INSTANCE(qof_param->param_getfcn(ent, qof_param));
 			if(!choice_ent) {
 				param_list = g_slist_next(param_list);
 				continue;
 			}
 			node = xmlAddChild(object_node, xmlNewNode(ns, BAD_CAST qof_param->param_type));
-			cm_guid = qof_entity_get_guid(choice_ent);
+			cm_guid = qof_instance_get_guid(choice_ent);
 			guid_to_string_buff(cm_guid, cm_sa);
 			string_buffer = g_strdup(cm_sa);
 			xmlNodeAddContent(node, BAD_CAST string_buffer);
@@ -1047,7 +1047,7 @@
 }
 
 /* ======================================================
-	Commit XML data from file to QofEntity in a QofBook
+	Commit XML data from file to QofInstance in a QofBook
 ========================================================= */
 void
 qsf_object_commitCB(gpointer key, gpointer value, gpointer data)
@@ -1055,8 +1055,8 @@
 	qsf_param          *params;
 	qsf_objects        *object_set;
 	xmlNodePtr         node;
-	QofEntityReference *reference;
-	QofEntity          *qsf_ent;
+	QofInstanceReference *reference;
+	QofInstance          *qsf_ent;
 	QofBook            *targetBook;
 	const char         *qof_type, *parameter_name, *timechk;
 	QofIdType          obj_type, reference_type;
@@ -1077,14 +1077,14 @@
 	KvpValueType   cm_type;
 	QofSetterFunc  cm_setter;
 	const QofParam *cm_param;
-	void (*string_setter)    (QofEntity*, const gchar*);
-	void (*date_setter)      (QofEntity*, Timespec);
-	void (*numeric_setter)   (QofEntity*, gnc_numeric);
-	void (*double_setter)    (QofEntity*, double);
-	void (*boolean_setter)   (QofEntity*, gboolean);
-	void (*i32_setter)       (QofEntity*, gint32);
-	void (*i64_setter)       (QofEntity*, gint64);
-	void (*char_setter)      (QofEntity*, gchar);
+	void (*string_setter)    (QofInstance*, const gchar*);
+	void (*date_setter)      (QofInstance*, Timespec);
+	void (*numeric_setter)   (QofInstance*, gnc_numeric);
+	void (*double_setter)    (QofInstance*, double);
+	void (*boolean_setter)   (QofInstance*, gboolean);
+	void (*i32_setter)       (QofInstance*, gint32);
+	void (*i64_setter)       (QofInstance*, gint64);
+	void (*char_setter)      (QofInstance*, gchar);
 
 	g_return_if_fail(data && value && key);
 	params = (qsf_param*)data;
@@ -1102,11 +1102,11 @@
 	cm_param = qof_class_get_parameter(obj_type, parameter_name);
 	object_set = params->object_set;
 	if(safe_strcmp(qof_type, QOF_TYPE_STRING) == 0)  {
-		string_setter = (void(*)(QofEntity*, const gchar*))cm_setter;
+		string_setter = (void(*)(QofInstance*, const gchar*))cm_setter;
 		if(string_setter != NULL) { string_setter(qsf_ent, (gchar*)xmlNodeGetContent(node)); }
 	}
 	if(safe_strcmp(qof_type, QOF_TYPE_DATE) == 0) {
-		date_setter = (void(*)(QofEntity*, Timespec))cm_setter;
+		date_setter = (void(*)(QofInstance*, Timespec))cm_setter;
 		timechk = NULL;
 		timechk = strptime((char*)xmlNodeGetContent(node), QSF_XSD_TIME, &qsf_time);
 		g_return_if_fail(timechk != NULL);
@@ -1119,7 +1119,7 @@
 	}
 	if((safe_strcmp(qof_type, QOF_TYPE_NUMERIC) == 0)  ||
 	(safe_strcmp(qof_type, QOF_TYPE_DEBCRED) == 0)) {
-		numeric_setter = (void(*)(QofEntity*, gnc_numeric))cm_setter;
+		numeric_setter = (void(*)(QofInstance*, gnc_numeric))cm_setter;
 		string_to_gnc_numeric((char*)xmlNodeGetContent(node), &cm_numeric);
 		if(numeric_setter != NULL) { numeric_setter(qsf_ent, cm_numeric); }
 	}
@@ -1135,10 +1135,10 @@
 		reference_type = (char*)xmlGetProp(node, BAD_CAST QSF_OBJECT_TYPE);
 		if(0 == safe_strcmp(QOF_PARAM_GUID, reference_type))
 		{
-			qof_entity_set_guid(qsf_ent, cm_guid);
+			qof_instance_set_guid(qsf_ent, cm_guid);
 		}
 		else {
-			reference = qof_entity_get_reference_from(qsf_ent, cm_param);
+			reference = qof_instance_get_reference_from(qsf_ent, cm_param);
 			if(reference) {
 				params->referenceList = g_list_append(params->referenceList, reference);
 			}
@@ -1148,7 +1148,7 @@
 		errno = 0;
 		cm_i32 = (gint32)strtol ((char*)xmlNodeGetContent(node), &tail, 0);
 		if(errno == 0) {
-			i32_setter = (void(*)(QofEntity*, gint32))cm_setter;
+			i32_setter = (void(*)(QofInstance*, gint32))cm_setter;
 			if(i32_setter != NULL) { i32_setter(qsf_ent, cm_i32); }
 		}
 		else { qof_backend_set_error(params->be, ERR_QSF_OVERFLOW); }
@@ -1157,7 +1157,7 @@
 		errno = 0;
 		cm_i64 = strtoll((gchar*)xmlNodeGetContent(node), &tail, 0);
 		if(errno == 0) {
-			i64_setter = (void(*)(QofEntity*, gint64))cm_setter;
+			i64_setter = (void(*)(QofInstance*, gint64))cm_setter;
 			if(i64_setter != NULL) { i64_setter(qsf_ent, cm_i64); }
 		}
 		else { qof_backend_set_error(params->be, ERR_QSF_OVERFLOW); }
@@ -1166,7 +1166,7 @@
 		errno = 0;
 		cm_double = strtod((gchar*)xmlNodeGetContent(node), &tail);
 		if(errno == 0) {
-			double_setter = (void(*)(QofEntity*, double))cm_setter;
+			double_setter = (void(*)(QofInstance*, double))cm_setter;
 			if(double_setter != NULL) { double_setter(qsf_ent, cm_double); }
 		}
 	}
@@ -1176,7 +1176,7 @@
 			cm_boolean = TRUE;
 		}
 		else { cm_boolean = FALSE; }
-		boolean_setter = (void(*)(QofEntity*, gboolean))cm_setter;
+		boolean_setter = (void(*)(QofInstance*, gboolean))cm_setter;
 		if(boolean_setter != NULL) { boolean_setter(qsf_ent, cm_boolean); }
 	}
 	if(safe_strcmp(qof_type, QOF_TYPE_KVP) == 0) {
@@ -1190,7 +1190,7 @@
 	if(safe_strcmp(qof_type, QOF_TYPE_COLLECT) == 0) {
 		QofCollection *qsf_coll;
 		QofIdType type;
-		QofEntityReference *reference;
+		QofInstanceReference *reference;
 		QofParam *copy_param;
 		/* retrieve the *type* of the collection, ignore any contents. */
 		qsf_coll = cm_param->param_getfcn(qsf_ent, cm_param);
@@ -1202,11 +1202,11 @@
 			PINFO (" string to guid collect failed for %s", xmlNodeGetContent(node));
 			return;
 		}
-		/* create a QofEntityReference with this type and GUID.
+		/* create a QofInstanceReference with this type and GUID.
 		 there is only one entity each time.
 		 cm_guid contains the GUID of the reference.
 		 type is the type of the reference. */
-		reference = g_new0(QofEntityReference, 1);
+		reference = g_new0(QofInstanceReference, 1);
 		reference->type = g_strdup(qsf_ent->e_type);
 		reference->ref_guid = cm_guid;
 		reference->ent_guid = &qsf_ent->guid;
@@ -1219,7 +1219,7 @@
 	if(safe_strcmp(qof_type, QOF_TYPE_CHAR) == 0) {
 		char_getter = (gchar (*)(xmlNodePtr))xmlNodeGetContent;
 		cm_char = char_getter(node);
-		char_setter = (void(*)(QofEntity*, gchar))cm_setter;
+		char_setter = (void(*)(QofInstance*, gchar))cm_setter;
 		if(char_setter != NULL) { char_setter(qsf_ent, cm_char); }
 	}
 }

Modified: gnucash/branches/gda-dev/lib/libqof/backend/file/qsf-xml.c
===================================================================
--- gnucash/branches/gda-dev/lib/libqof/backend/file/qsf-xml.c	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/lib/libqof/backend/file/qsf-xml.c	2007-04-14 00:35:53 UTC (rev 15878)
@@ -355,7 +355,7 @@
 			DEBUG (" trying to set book GUID");
 			buffer = g_strdup((gchar*)xmlNodeGetContent(child_node));
 			g_return_if_fail(TRUE == string_to_guid(buffer, &book_guid));
-			qof_entity_set_guid((QofEntity*)params->book, &book_guid);
+			qof_instance_set_guid(QOF_INSTANCE(params->book), &book_guid);
 			xmlNewChild(params->output_node, params->qsf_ns, 
 			BAD_CAST QSF_BOOK_GUID, BAD_CAST buffer);
 			g_free(buffer);

Modified: gnucash/branches/gda-dev/lib/libqof/backend/file/qsf-xml.h
===================================================================
--- gnucash/branches/gda-dev/lib/libqof/backend/file/qsf-xml.h	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/lib/libqof/backend/file/qsf-xml.h	2007-04-14 00:35:53 UTC (rev 15878)
@@ -344,7 +344,7 @@
 	gint count;                  /**< sequential counter for each object in the book */
 	GList *qsf_object_list;      /**< list of qsf_objects */
 	GSList *qsf_sequence;        /**< Parameter list sorted into QSF order */
-	GList *referenceList;        /**< Table of references, ::QofEntityReference. */
+	GList *referenceList;        /**< Table of references, ::QofInstanceReference. */
 	GHashTable *qsf_parameter_hash; /**< Hashtable of parameters for each object */
 	GHashTable *qsf_calculate_hash, *qsf_default_hash, *qsf_define_hash;
 	GSList *supported_types;     /**< The list of QOF types currently supported, in QSF order. */
@@ -362,7 +362,7 @@
 	QofIdType qof_obj_type;	     /**< current QofObject type (e_type) for the parameters. */
 	QofIdType qof_foreach;       /**< How to iterate over hierarchical entities. */
 	gint foreach_limit;          /**< How many iterations are found in the QSF */
-	QofEntity *qsf_ent;          /**< Current entity in the book. */
+	QofInstance *qsf_ent;          /**< Current entity in the book. */
 	QofBackend *be;              /**< the current QofBackend for this operation. */
 	gboolean knowntype;          /**< detect references by comparing with known QOF types. */
 	QofParam *qof_param;         /**< used by kvp to handle the frame hash table */

Modified: gnucash/branches/gda-dev/lib/libqof/qof/deprecated.c
===================================================================
--- gnucash/branches/gda-dev/lib/libqof/qof/deprecated.c	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/lib/libqof/qof/deprecated.c	2007-04-14 00:35:53 UTC (rev 15878)
@@ -57,7 +57,7 @@
 {
 	qof_event_resume();
 }
-void gnc_engine_gen_event (QofEntity *entity, GNCEngineEventType event_type)
+void gnc_engine_gen_event (QofInstance *entity, GNCEngineEventType event_type)
 {
 	qof_event_gen(entity, event_type, NULL);
 }

Modified: gnucash/branches/gda-dev/lib/libqof/qof/deprecated.h
===================================================================
--- gnucash/branches/gda-dev/lib/libqof/qof/deprecated.h	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/lib/libqof/qof/deprecated.h	2007-04-14 00:35:53 UTC (rev 15878)
@@ -104,7 +104,7 @@
 /** \deprecated use qof_event_unregister_handler instead. */
 void gnc_engine_unregister_event_handler (gint handler_id);
 /** \deprecated use qof_event_gen instead. */
-void gnc_engine_gen_event (QofEntity *entity, GNCEngineEventType event_type);
+void gnc_engine_gen_event (QofInstance *entity, GNCEngineEventType event_type);
 /** \deprecated use qof_event_suspend instead. */
 void gnc_engine_suspend_events (void);
 /** \deprecated use qof_event_resume instead. */

Modified: gnucash/branches/gda-dev/lib/libqof/qof/gnc-date.c
===================================================================
--- gnucash/branches/gda-dev/lib/libqof/qof/gnc-date.c	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/lib/libqof/qof/gnc-date.c	2007-04-14 00:35:53 UTC (rev 15878)
@@ -505,81 +505,6 @@
 /* ============================================================== */
 
 size_t
-qof_print_hours_elapsed_buff (char * buff, size_t len, int secs, gboolean show_secs)
-{
-	size_t flen;
-	if (0 <= secs)
-	{
-		if (show_secs)
-		{
-			flen = g_snprintf(buff, len,
-			   "%02d:%02d:%02d", (int)(secs / 3600),
-			   (int)((secs % 3600) / 60), (int)(secs % 60));
-		}
-		else
-		{
-			flen = g_snprintf(buff, len, 
-			   "%02d:%02d", (int)(secs / 3600),
-			   (int)((secs % 3600) / 60));
-		}
-	} 
-	else 
-	{
-		if (show_secs)
-		{
-			flen = g_snprintf(buff, len,
-			   "-%02d:%02d:%02d", (int)(-secs / 3600),
-			   (int)((-secs % 3600) / 60), (int)(-secs % 60));
-		}
-		else
-		{
-			flen = g_snprintf(buff, len,
-			   "-%02d:%02d", (int)(-secs / 3600),
-			   (int)((-secs % 3600) / 60));
-		}
-	}
-	return flen;
-}
-
-/* ============================================================== */
-
-size_t
-qof_print_minutes_elapsed_buff (char * buff, size_t len, int secs, gboolean show_secs)
-{
-	size_t flen;
-	if (0 <= secs)
-	{
-		if (show_secs)
-		{
-			flen = g_snprintf(buff, len,
-			   "%02d:%02d", 
-				(int)(secs / 60), (int)(secs % 60));
-		}
-		else
-		{
-			flen = g_snprintf(buff, len, 
-			   "%02d", (int)(secs / 60));
-		}
-	} 
-	else 
-	{
-		if (show_secs)
-		{
-			flen = g_snprintf(buff, len,
-			   "-%02d:%02d", (int)(-secs / 60), (int)(-secs % 60));
-		}
-		else
-		{
-			flen = g_snprintf(buff, len,
-			   "-%02d", (int)(-secs / 60));
-		}
-	}
-	return flen;
-}
-
-/* ============================================================== */
-
-size_t
 qof_print_date_time_buff (char * buff, size_t len, time_t secs)
 {
   int flen;
@@ -656,21 +581,6 @@
 
 /* ============================================================== */
 
-int
-qof_is_same_day (time_t ta, time_t tb)
-{
-  struct tm lta, ltb;
-  lta = *localtime (&ta);
-  ltb = *localtime (&tb);
-  if (lta.tm_year == ltb.tm_year)
-  {
-    return (ltb.tm_yday - lta.tm_yday);
-  }
-  return (ltb.tm_year - lta.tm_year)*365;  /* very approximate */
-}
-
-/* ============================================================== */
-
 /* Convert a string into  day, month and year integers
 
     Convert a string into  day / month / year integers according to
@@ -1448,40 +1358,6 @@
 }
 
 
-#ifndef GNUCASH_MAJOR_VERSION
-time_t
-gnc_timet_get_day_start_gdate (GDate *date)
-{
-  struct tm stm;
-  time_t secs;
-
-  stm.tm_year = g_date_get_year (date) - 1900;
-  stm.tm_mon = g_date_get_month (date) - 1;
-  stm.tm_mday = g_date_get_day (date);
-  gnc_tm_set_day_start(&stm);
-
-  /* Compute number of seconds */
-  secs = mktime (&stm);
-  return secs;
-}
-
-time_t
-gnc_timet_get_day_end_gdate (GDate *date)
-{
-  struct tm stm;
-  time_t secs;
-
-  stm.tm_year = g_date_get_year (date) - 1900;
-  stm.tm_mon = g_date_get_month (date) - 1;
-  stm.tm_mday = g_date_get_day (date);
-  gnc_tm_set_day_end(&stm);
-
-  /* Compute number of seconds */
-  secs = mktime (&stm);
-  return secs;
-}
-#endif /* GNUCASH_MAJOR_VERSION */
-
 /* ======================================================== */
 
 void
@@ -1514,5 +1390,15 @@
   return mktime(&tm);
 }
 
-/********************** END OF FILE *********************************\
-\********************************************************************/
+void
+gnc_dow_abbrev(gchar *buf, int buf_len, int dow)
+{
+    struct tm my_tm;
+    int i;
+    
+    memset(buf, 0, buf_len);
+    memset(&my_tm, 0, sizeof(struct tm));
+    my_tm.tm_wday = dow;
+    i = qof_strftime(buf, buf_len - 1, "%a", &my_tm);
+    buf[i] = 0;
+}

Modified: gnucash/branches/gda-dev/lib/libqof/qof/gnc-date.h
===================================================================
--- gnucash/branches/gda-dev/lib/libqof/qof/gnc-date.h	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/lib/libqof/qof/gnc-date.h	2007-04-14 00:35:53 UTC (rev 15878)
@@ -396,14 +396,6 @@
 /* ------------------------------------------------------------------ */
 /* time printing utilities */
 
-/** The qof_print_hours_elapsed_buff() routine will print the 'secs' argument
- *    as HH:MM, and will print the seconds if show_secs is true.  
- *    Thus, for example, secs=3599 will print as 0:59
- *    Returns the number of bytes copied.
- */
-size_t qof_print_hours_elapsed_buff (char * buff, size_t len, int secs, gboolean show_secs);
-size_t qof_print_minutes_elapsed_buff (char * buff, size_t len, int secs, gboolean show_secs);
-
 /** The qof_print_time_buff() routine prints only the hour-part of the date.
  *    Thus, if secs is  ...
  *    Returns the number of bytes printed.
@@ -412,12 +404,6 @@
 size_t qof_print_time_buff (char * buff, size_t len, time_t secs);
 size_t qof_print_date_time_buff (char * buff, size_t len, time_t secs);
 
-/** The qof_is_same_day() routine returns 0 if both times are in the 
- * same day.
- */
-
-gboolean qof_is_same_day (time_t, time_t);
-
 /* ------------------------------------------------------------------ */
 /** The xaccDateUtilGetStamp() routine will take the given time in
  *  seconds and return a buffer containing a textual for the date.
@@ -510,22 +496,6 @@
  *  seconds and adjust it to the last second of that day. */
 time_t gnc_timet_get_day_end(time_t time_val);
 
-#ifndef GNUCASH_MAJOR_VERSION
-/** The gnc_timet_get_day_start() routine will take the given time in
- *  GLib GDate format and adjust it to the last second of that day.
- *
- *  @deprecated
- */
-time_t gnc_timet_get_day_start_gdate (GDate *date);
-
-/** The gnc_timet_get_day_end() routine will take the given time in
- *  GLib GDate format and adjust it to the last second of that day.
- *
- *  @deprecated
- */
-time_t gnc_timet_get_day_end_gdate (GDate *date);
-#endif /* GNUCASH_MAJOR_VERSION */
-
 /** Get the numerical last date of the month. (28, 29, 30, 31) */
 int date_get_last_mday(struct tm *tm);
 
@@ -564,6 +534,14 @@
  *  @note The caller owns this buffer and must free it when done. */
 char * xaccDateUtilGetStampNow (void);
 
+#define MIN_BUF_LEN 10
+/**
+ * Localized DOW abbreviation.
+ * @param buf_len at least MIN_BUF_LEN
+ * @param dow struct tm semantics: 0=sunday .. 6=saturday
+ **/
+void gnc_dow_abbrev(gchar *buf, int buf_len, int dow);
+
 //@}
 //@}
 #endif /* GNC_DATE_H */

Modified: gnucash/branches/gda-dev/lib/libqof/qof/qofbook-p.h
===================================================================
--- gnucash/branches/gda-dev/lib/libqof/qof/qofbook-p.h	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/lib/libqof/qof/qofbook-p.h	2007-04-14 00:35:53 UTC (rev 15878)
@@ -43,65 +43,6 @@
 #include "qofid-p.h"
 #include "qofinstance-p.h"
 
-/* Book structure */
-struct _QofBook
-{
-  QofInstance   inst;     /* Unique guid for this book. */
-
-  /* The time when the book was first dirtied.  This is a secondary
-   * indicator. It should only be used when inst.dirty is TRUE. */
-  time_t dirty_time;
-
-  /* This callback function is called any time the book dirty flag
-   * changes state. Both clean->dirty and dirty->clean transitions
-   * trigger a callback. */
-  QofBookDirtyCB dirty_cb;
-
-  /* This is the user supplied data that is returned in the dirty
-   * callback function.*/
-  gpointer dirty_data;
-
-  /* The entity table associates the GUIDs of all the objects
-   * belonging to this book, with their pointers to the respective
-   * objects.  This allows a lookup of objects based on thier guid.
-   */
-  GHashTable * hash_of_collections;
-
-  /* In order to store arbitrary data, for extensibility, add a table
-   * that will be used to hold arbitrary pointers.
-   */
-  GHashTable *data_tables;
-
-  /* Hash table of destroy callbacks for the data table. */
-  GHashTable *data_table_finalizers;
-
-  /* state flag: 'y' means 'open for editing',
-   * 'n' means 'book is closed'
-   * xxxxx shouldn't this be replaced by the instance editlevel ???
-   */
-  char book_open;
-
-  /* a flag denoting whether the book is closing down, used to
-   * help the QOF objects shut down cleanly without maintaining
-   * internal consistency.
-   * XXX shouldn't this be replaced by instance->do_free ???
-   */
-  gboolean shutting_down;
-
-  /* version number, used for tracking multiuser updates */
-  gint32  version;
-
-  /* To be technically correct, backends belong to sessions and
-   * not books.  So the pointer below "really shouldn't be here",
-   * except that it provides a nice convenience, avoiding a lookup
-   * from the session.  Better solutions welcome ... */
-  QofBackend *backend;
-
-  /* -------------------------------------------------------------- */
-  /* Backend private expansion data */
-  guint32  idata;     /* used by the sql backend for kvp management */
-};
-
 /*
  *    qof_book_set_backend() is used by backends to
  *    initialize the pointers in the book structure to
@@ -115,10 +56,10 @@
 /* Register books with the engine */
 gboolean qof_book_register (void);
 
-/** @deprecated use qof_entity_set_guid instead but only in
+/** @deprecated use qof_instance_set_guid instead but only in
 backends (when reading the GUID from the data source). */
 #define qof_book_set_guid(book,guid)    \
-         qof_entity_set_guid(QOF_ENTITY(book), guid)
+         qof_instance_set_guid(QOF_INSTANCE(book), guid)
 
 /* @} */
 /* @} */

Modified: gnucash/branches/gda-dev/lib/libqof/qof/qofbook.c
===================================================================
--- gnucash/branches/gda-dev/lib/libqof/qof/qofbook.c	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/lib/libqof/qof/qofbook.c	2007-04-14 00:35:53 UTC (rev 15878)
@@ -48,6 +48,8 @@
 
 static QofLogModule log_module = QOF_MOD_ENGINE;
 
+QOF_GOBJECT_IMPL(qof_book, QofBook, QOF_TYPE_INSTANCE);
+
 /* ====================================================================== */
 /* constructor / destructor */
 
@@ -66,7 +68,7 @@
       (GDestroyNotify)qof_util_string_cache_remove,  /* key_destroy_func   */
       coll_destroy);                            /* value_destroy_func */
 
-  qof_instance_init (&book->inst, QOF_ID_BOOK, book);
+  qof_instance_init_data (&book->inst, QOF_ID_BOOK, book);
 
   book->data_tables = g_hash_table_new (g_str_hash, g_str_equal);
   book->data_table_finalizers = g_hash_table_new (g_str_hash, g_str_equal);
@@ -82,11 +84,10 @@
   QofBook *book;
 
   ENTER (" ");
-  book = g_new0(QofBook, 1);
-  qof_book_init(book);
+  book = g_object_new(QOF_TYPE_BOOK, NULL);
   qof_object_book_begin (book);
 
-  qof_event_gen (&book->inst.entity, QOF_EVENT_CREATE, NULL);
+  qof_event_gen (&book->inst, QOF_EVENT_CREATE, NULL);
   LEAVE ("book=%p", book);
   return book;
 }
@@ -101,14 +102,26 @@
   (*cb) (book, key, user_data);
 }
 
+static void
+qof_book_dispose_real (GObject *bookp)
+{
+}
+
+static void
+qof_book_finalize_real (GObject *bookp)
+{
+}
+
 void
 qof_book_destroy (QofBook *book) 
 {
+  GHashTable* cols;
+
   if (!book) return;
   ENTER ("book=%p", book);
 
   book->shutting_down = TRUE;
-  qof_event_force (&book->inst.entity, QOF_EVENT_DESTROY, NULL);
+  qof_event_force (&book->inst, QOF_EVENT_DESTROY, NULL);
 
   /* Call the list of finalizers, let them do their thing. 
    * Do this before tearing into the rest of the book.
@@ -122,12 +135,18 @@
   g_hash_table_destroy (book->data_tables);
   book->data_tables = NULL;
 
-  qof_instance_release (&book->inst);
+  /* qof_instance_release (&book->inst); */
 
-  g_hash_table_destroy (book->hash_of_collections);
+  /* Note: we need to save this hashtable until after we remove ourself
+   * from it, otherwise we'll crash in our dispose() function when we
+   * DO remove ourself from the collection but the collection had already
+   * been destroyed.
+   */
+  cols = book->hash_of_collections;
+  g_object_unref (book);
+  g_hash_table_destroy (cols);
   book->hash_of_collections = NULL;
 
-  g_free (book);
   LEAVE ("book=%p", book);
 }
 
@@ -411,7 +430,7 @@
 gboolean qof_book_register (void)
 {
   static QofParam params[] = {
-    { QOF_PARAM_GUID, QOF_TYPE_GUID, (QofAccessFunc)qof_entity_get_guid, NULL },
+    { QOF_PARAM_GUID, QOF_TYPE_GUID, (QofAccessFunc)qof_instance_get_guid, NULL },
     { QOF_PARAM_KVP,  QOF_TYPE_KVP,  (QofAccessFunc)qof_instance_get_slots, NULL },
     { NULL },
   };

Modified: gnucash/branches/gda-dev/lib/libqof/qof/qofbook.h
===================================================================
--- gnucash/branches/gda-dev/lib/libqof/qof/qofbook.h	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/lib/libqof/qof/qofbook.h	2007-04-14 00:35:53 UTC (rev 15878)
@@ -40,9 +40,93 @@
 #ifndef QOF_BOOK_H
 #define QOF_BOOK_H
 
+typedef struct _QofBookClass  QofBookClass;
+
 #include "qofid.h"
 #include "kvp_frame.h"
+#include "qofinstance.h"
 
+/* --- type macros --- */
+#define QOF_TYPE_BOOK            (qof_book_get_type ())
+#define QOF_BOOK(o)              \
+     (G_TYPE_CHECK_INSTANCE_CAST ((o), QOF_TYPE_BOOK, QofBook))
+#define QOF_BOOK_CLASS(k)        \
+     (G_TYPE_CHECK_CLASS_CAST((k), QOF_TYPE_BOOK, QofBookClass))
+#define QOF_IS_BOOK(o)           \
+     (G_TYPE_CHECK_INSTANCE_TYPE ((o), QOF_TYPE_BOOK))
+#define QOF_IS_BOOK_CLASS(k)     \
+     (G_TYPE_CHECK_CLASS_TYPE ((k), QOF_TYPE_BOOK))
+#define QOF_BOOK_GET_CLASS(o)    \
+     (G_TYPE_INSTANCE_GET_CLASS ((o), QOF_TYPE_BOOK, QofBookClass))
+
+typedef void (*QofBookDirtyCB) (QofBook *, gboolean dirty, gpointer user_data);
+
+/* Book structure */
+struct _QofBook
+{
+  QofInstance   inst;     /* Unique guid for this book. */
+
+  /* The time when the book was first dirtied.  This is a secondary
+   * indicator. It should only be used when inst.dirty is TRUE. */
+  time_t dirty_time;
+
+  /* This callback function is called any time the book dirty flag
+   * changes state. Both clean->dirty and dirty->clean transitions
+   * trigger a callback. */
+  QofBookDirtyCB dirty_cb;
+
+  /* This is the user supplied data that is returned in the dirty
+   * callback function.*/
+  gpointer dirty_data;
+
+  /* The entity table associates the GUIDs of all the objects
+   * belonging to this book, with their pointers to the respective
+   * objects.  This allows a lookup of objects based on thier guid.
+   */
+  GHashTable * hash_of_collections;
+
+  /* In order to store arbitrary data, for extensibility, add a table
+   * that will be used to hold arbitrary pointers.
+   */
+  GHashTable *data_tables;
+
+  /* Hash table of destroy callbacks for the data table. */
+  GHashTable *data_table_finalizers;
+
+  /* state flag: 'y' means 'open for editing',
+   * 'n' means 'book is closed'
+   * xxxxx shouldn't this be replaced by the instance editlevel ???
+   */
+  char book_open;
+
+  /* a flag denoting whether the book is closing down, used to
+   * help the QOF objects shut down cleanly without maintaining
+   * internal consistency.
+   * XXX shouldn't this be replaced by instance->do_free ???
+   */
+  gboolean shutting_down;
+
+  /* version number, used for tracking multiuser updates */
+  gint32  version;
+
+  /* To be technically correct, backends belong to sessions and
+   * not books.  So the pointer below "really shouldn't be here",
+   * except that it provides a nice convenience, avoiding a lookup
+   * from the session.  Better solutions welcome ... */
+  QofBackend *backend;
+
+  /* -------------------------------------------------------------- */
+  /* Backend private expansion data */
+  guint32  idata;     /* used by the sql backend for kvp management */
+};
+
+struct _QofBookClass
+{
+   QofInstanceClass parent_class;
+};
+
+GType qof_book_get_type(void);
+
 /** @brief Encapsulates all the information about a dataset
  * manipulated by QOF.  This is the top-most structure
  * used for anchoring data.
@@ -50,7 +134,7 @@
 
 /** Lookup an entity by guid, returning pointer to the entity */
 #define QOF_BOOK_LOOKUP_ENTITY(book,guid,e_type,c_type) ({  \
-  QofEntity *val = NULL;                                    \
+  QofInstance *val = NULL;                                    \
   if (guid && book) {                                       \
     QofCollection *col;                                     \
     col = qof_book_get_collection (book, e_type);           \
@@ -59,14 +143,10 @@
   (c_type *) val;                                           \
 })
 
-/** \brief QofBook reference */
-typedef struct _QofBook       QofBook;
-
 /** GList of QofBook */
 typedef GList                 QofBookList;
 
 typedef void (*QofBookFinalCB) (QofBook *, gpointer key, gpointer user_data);
-typedef void (*QofBookDirtyCB) (QofBook *, gboolean dirty, gpointer user_data);
 
 /** Register the book object with the QOF object system. */
 gboolean qof_book_register (void);
@@ -191,7 +271,7 @@
 gint64 qof_book_get_counter (QofBook *book, const char *counter_name);
 
 /** deprecated */
-#define qof_book_get_guid(X) qof_entity_get_guid (QOF_ENTITY(X))
+#define qof_book_get_guid(X) qof_instance_get_guid (QOF_INSTANCE(X))
 
 #endif /* QOF_BOOK_H */
 /** @} */

Modified: gnucash/branches/gda-dev/lib/libqof/qof/qofbookmerge.c
===================================================================
--- gnucash/branches/gda-dev/lib/libqof/qof/qofbookmerge.c	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/lib/libqof/qof/qofbookmerge.c	2007-04-14 00:35:53 UTC (rev 15878)
@@ -74,7 +74,7 @@
 };
 
 static void
-collect_reference_cb (QofEntity *ent, gpointer user_data)
+collect_reference_cb (QofInstance *ent, gpointer user_data)
 {
 	struct collect_list_s *s;
 
@@ -89,7 +89,7 @@
 	QofBookMergeRule *currentRule;
 	QofCollection *mergeColl, *targetColl;
 	gchar      *stringImport, *stringTarget;
-	QofEntity  *mergeEnt, *targetEnt, *referenceEnt;
+	QofInstance  *mergeEnt, *targetEnt, *referenceEnt;
 	const GUID *guidImport, *guidTarget;
 	QofParam   *qtparam;
 	KvpFrame   *kvpImport, *kvpTarget;
@@ -97,13 +97,13 @@
 	QofType    mergeType;
 	GSList    *paramList;
 	gboolean  absolute, mergeError, knowntype, mergeMatch, booleanImport, booleanTarget,
-                                                 (*boolean_getter) (QofEntity*, QofParam*);
-	Timespec      tsImport, tsTarget,            (*date_getter)    (QofEntity*, QofParam*);
-	gnc_numeric   numericImport, numericTarget,  (*numeric_getter) (QofEntity*, QofParam*);
-	double        doubleImport, doubleTarget,    (*double_getter)  (QofEntity*, QofParam*);
-	gint32        i32Import, i32Target,          (*int32_getter)   (QofEntity*, QofParam*);
-	gint64        i64Import, i64Target,          (*int64_getter)   (QofEntity*, QofParam*);
-	gchar         charImport, charTarget,        (*char_getter)    (QofEntity*, QofParam*);
+                                                 (*boolean_getter) (QofInstance*, QofParam*);
+	Timespec      tsImport, tsTarget,            (*date_getter)    (QofInstance*, QofParam*);
+	gnc_numeric   numericImport, numericTarget,  (*numeric_getter) (QofInstance*, QofParam*);
+	double        doubleImport, doubleTarget,    (*double_getter)  (QofInstance*, QofParam*);
+	gint32        i32Import, i32Target,          (*int32_getter)   (QofInstance*, QofParam*);
+	gint64        i64Import, i64Target,          (*int64_getter)   (QofInstance*, QofParam*);
+	gchar         charImport, charTarget,        (*char_getter)    (QofInstance*, QofParam*);
 
 	g_return_val_if_fail((mergeData != NULL), -1);
 	currentRule = mergeData->currentRule;
@@ -140,7 +140,7 @@
 			knowntype= TRUE;
 		}
 		if(safe_strcmp(mergeType, QOF_TYPE_DATE) == 0) {
-			date_getter = (Timespec (*)(QofEntity*, QofParam*))qtparam->param_getfcn;
+			date_getter = (Timespec (*)(QofInstance*, QofParam*))qtparam->param_getfcn;
 			tsImport = date_getter(mergeEnt, qtparam);
 			tsTarget = date_getter(targetEnt, qtparam);
 			if(timespec_cmp(&tsImport, &tsTarget) == 0) { mergeMatch = TRUE; }
@@ -150,7 +150,7 @@
 		}
 		if((safe_strcmp(mergeType, QOF_TYPE_NUMERIC) == 0)  ||
 		(safe_strcmp(mergeType, QOF_TYPE_DEBCRED) == 0)) { 
-			numeric_getter = (gnc_numeric (*)(QofEntity*, QofParam*)) qtparam->param_getfcn;
+			numeric_getter = (gnc_numeric (*)(QofInstance*, QofParam*)) qtparam->param_getfcn;
 			numericImport = numeric_getter(mergeEnt,qtparam);
 			numericTarget = numeric_getter(targetEnt,qtparam);
 			if(gnc_numeric_compare (numericImport, numericTarget) == 0) { mergeMatch = TRUE; }
@@ -167,7 +167,7 @@
 			knowntype= TRUE;
 		}
 		if(safe_strcmp(mergeType, QOF_TYPE_INT32) == 0) { 
-			int32_getter = (gint32 (*)(QofEntity*, QofParam*)) qtparam->param_getfcn;
+			int32_getter = (gint32 (*)(QofInstance*, QofParam*)) qtparam->param_getfcn;
 			i32Import = int32_getter(mergeEnt, qtparam);
 			i32Target = int32_getter(targetEnt, qtparam);
 			if(i32Target == i32Import) { mergeMatch = TRUE; }
@@ -176,7 +176,7 @@
 			knowntype= TRUE;
 		}
 		if(safe_strcmp(mergeType, QOF_TYPE_INT64) == 0) { 
-			int64_getter = (gint64 (*)(QofEntity*, QofParam*)) qtparam->param_getfcn;
+			int64_getter = (gint64 (*)(QofInstance*, QofParam*)) qtparam->param_getfcn;
 			i64Import = int64_getter(mergeEnt, qtparam);
 			i64Target = int64_getter(targetEnt, qtparam);
 			if(i64Target == i64Import) { mergeMatch = TRUE; }
@@ -185,7 +185,7 @@
 			knowntype= TRUE;
 		}
 		if(safe_strcmp(mergeType, QOF_TYPE_DOUBLE) == 0) { 
-			double_getter = (double (*)(QofEntity*, QofParam*)) qtparam->param_getfcn;
+			double_getter = (double (*)(QofInstance*, QofParam*)) qtparam->param_getfcn;
 			doubleImport = double_getter(mergeEnt, qtparam);
 			doubleTarget = double_getter(mergeEnt, qtparam);
 			if(doubleImport == doubleTarget) { mergeMatch = TRUE; }
@@ -194,7 +194,7 @@
 			knowntype= TRUE;
 		}
 		if(safe_strcmp(mergeType, QOF_TYPE_BOOLEAN) == 0){ 
-			boolean_getter = (gboolean (*)(QofEntity*, QofParam*)) qtparam->param_getfcn;
+			boolean_getter = (gboolean (*)(QofInstance*, QofParam*)) qtparam->param_getfcn;
 			booleanImport = boolean_getter(mergeEnt, qtparam);
 			booleanTarget = boolean_getter(targetEnt, qtparam);
 			if(booleanImport != FALSE && booleanImport != TRUE) { booleanImport = FALSE; }
@@ -213,7 +213,7 @@
 			knowntype= TRUE;
 		}
 		if(safe_strcmp(mergeType, QOF_TYPE_CHAR) == 0) { 
-			char_getter = (gchar (*)(QofEntity*, QofParam*)) qtparam->param_getfcn;
+			char_getter = (gchar (*)(QofInstance*, QofParam*)) qtparam->param_getfcn;
 			charImport = char_getter(mergeEnt, qtparam);
 			charTarget = char_getter(targetEnt, qtparam);
 			if(charImport == charTarget) { mergeMatch = TRUE; }
@@ -325,7 +325,7 @@
 is designed to solve the issues that result from this conflict. The previous match
 must be re-assigned because if two mergeEnt's are matched with only one targetEnt,
 data loss \b WILL follow. Equally, the current mergeEnt must replace the previous
-one as it is a better match. qof_entity_rating holds the details required to identify
+one as it is a better match. qof_instance_rating holds the details required to identify
 the correct mergeEnt to be re-assigned and these mergeEnt entities are therefore
 orphaned - to be re-matched later.
 
@@ -372,7 +372,7 @@
 {
 	GSList *orphans, *targets;
 	QofBookMergeRule *rule, *currentRule;
-	QofEntity *best_matchEnt;
+	QofInstance *best_matchEnt;
 	double difference;
 
 	g_return_if_fail(mergeData != NULL);
@@ -409,7 +409,7 @@
 }
 
 static void 
-qof_book_merge_foreach_target (QofEntity* targetEnt, gpointer user_data)
+qof_book_merge_foreach_target (QofInstance* targetEnt, gpointer user_data)
 {
 	QofBookMergeData *mergeData;
 
@@ -437,11 +437,11 @@
 }
 
 static void 
-qof_book_merge_foreach ( QofEntity* mergeEnt, gpointer user_data) 
+qof_book_merge_foreach ( QofInstance* mergeEnt, gpointer user_data) 
 {
 	QofBookMergeRule *mergeRule, *currentRule;
 	QofBookMergeData *mergeData;
-	QofEntity *targetEnt, *best_matchEnt;
+	QofInstance *targetEnt, *best_matchEnt;
 	GUID *g;
 	double difference;
 	GSList *c;
@@ -592,7 +592,7 @@
 { 
 	QofInstance *inst;
 	gboolean    registered_type;
-	QofEntity   *referenceEnt;
+	QofInstance   *referenceEnt;
 	/* cm_ prefix used for variables that hold the data to commit */
 	QofCollection *cm_coll;
 	QofParam    *cm_param;
@@ -600,26 +600,26 @@
 	const GUID  *cm_guid;
 	KvpFrame    *cm_kvp;
 	/* function pointers and variables for parameter getters that don't use pointers normally */
-	gnc_numeric  cm_numeric, (*numeric_getter)  (QofEntity*, QofParam*);
-	double       cm_double,  (*double_getter)   (QofEntity*, QofParam*);
-	gboolean     cm_boolean, (*boolean_getter)  (QofEntity*, QofParam*);
-	gint32       cm_i32,     (*int32_getter)    (QofEntity*, QofParam*);
-	gint64       cm_i64,     (*int64_getter)    (QofEntity*, QofParam*);
-	Timespec     cm_date,    (*date_getter)     (QofEntity*, QofParam*);
-	gchar        cm_char,    (*char_getter)     (QofEntity*, QofParam*);
+	gnc_numeric  cm_numeric, (*numeric_getter)  (QofInstance*, QofParam*);
+	double       cm_double,  (*double_getter)   (QofInstance*, QofParam*);
+	gboolean     cm_boolean, (*boolean_getter)  (QofInstance*, QofParam*);
+	gint32       cm_i32,     (*int32_getter)    (QofInstance*, QofParam*);
+	gint64       cm_i64,     (*int64_getter)    (QofInstance*, QofParam*);
+	Timespec     cm_date,    (*date_getter)     (QofInstance*, QofParam*);
+	gchar        cm_char,    (*char_getter)     (QofInstance*, QofParam*);
 	/* function pointers to the parameter setters */
-	void (*string_setter)    (QofEntity*, const gchar*);
-	void (*date_setter)      (QofEntity*, Timespec);
-	void (*numeric_setter)   (QofEntity*, gnc_numeric);
-	void (*guid_setter)      (QofEntity*, const GUID*);
-	void (*double_setter)    (QofEntity*, double);
-	void (*boolean_setter)   (QofEntity*, gboolean);
-	void (*i32_setter)       (QofEntity*, gint32);
-	void (*i64_setter)       (QofEntity*, gint64);
-	void (*char_setter)      (QofEntity*, gchar);
-	void (*kvp_frame_setter) (QofEntity*, KvpFrame*);
-	void (*reference_setter) (QofEntity*, QofEntity*);
-	void (*collection_setter)(QofEntity*, QofCollection*);
+	void (*string_setter)    (QofInstance*, const gchar*);
+	void (*date_setter)      (QofInstance*, Timespec);
+	void (*numeric_setter)   (QofInstance*, gnc_numeric);
+	void (*guid_setter)      (QofInstance*, const GUID*);
+	void (*double_setter)    (QofInstance*, double);
+	void (*boolean_setter)   (QofInstance*, gboolean);
+	void (*i32_setter)       (QofInstance*, gint32);
+	void (*i64_setter)       (QofInstance*, gint64);
+	void (*char_setter)      (QofInstance*, gchar);
+	void (*kvp_frame_setter) (QofInstance*, KvpFrame*);
+	void (*reference_setter) (QofInstance*, QofInstance*);
+	void (*collection_setter)(QofInstance*, QofCollection*);
 
 	g_return_if_fail(rule != NULL);
 	g_return_if_fail(mergeData != NULL);
@@ -630,8 +630,8 @@
 	if(rule->mergeResult == MERGE_NEW) {
 		inst = (QofInstance*)qof_object_new_instance(rule->importEnt->e_type, mergeData->targetBook);
 		g_return_if_fail(inst != NULL);
-		rule->targetEnt = &inst->entity;
-		qof_entity_set_guid(rule->targetEnt, qof_entity_get_guid(rule->importEnt));
+		rule->targetEnt = inst;
+		qof_instance_set_guid(rule->targetEnt, qof_instance_get_guid(rule->importEnt));
 	}
 	/* currentRule->targetEnt is now set,
 		1. by an absolute GUID match or
@@ -645,81 +645,81 @@
 		rule->mergeType = cm_param->param_type;
 		if(safe_strcmp(rule->mergeType, QOF_TYPE_STRING) == 0)  { 
 			cm_string = cm_param->param_getfcn(rule->importEnt, cm_param);
-			string_setter = (void(*)(QofEntity*, const gchar*))cm_param->param_setfcn;
+			string_setter = (void(*)(QofInstance*, const gchar*))cm_param->param_setfcn;
 			if(string_setter != NULL) { string_setter(rule->targetEnt, cm_string); }
 			registered_type = TRUE;
 		}
 		if(safe_strcmp(rule->mergeType, QOF_TYPE_DATE) == 0) { 
-			date_getter = (Timespec (*)(QofEntity*, QofParam*))cm_param->param_getfcn;
+			date_getter = (Timespec (*)(QofInstance*, QofParam*))cm_param->param_getfcn;
 			cm_date = date_getter(rule->importEnt, cm_param);
-			date_setter = (void(*)(QofEntity*, Timespec))cm_param->param_setfcn;
+			date_setter = (void(*)(QofInstance*, Timespec))cm_param->param_setfcn;
 			if(date_setter != NULL) { date_setter(rule->targetEnt, cm_date); }
 			registered_type = TRUE;
 		}
 		if((safe_strcmp(rule->mergeType, QOF_TYPE_NUMERIC) == 0)  ||
 		(safe_strcmp(rule->mergeType, QOF_TYPE_DEBCRED) == 0)) { 
-			numeric_getter = (gnc_numeric (*)(QofEntity*, QofParam*))cm_param->param_getfcn;
+			numeric_getter = (gnc_numeric (*)(QofInstance*, QofParam*))cm_param->param_getfcn;
 			cm_numeric = numeric_getter(rule->importEnt, cm_param);
-			numeric_setter = (void(*)(QofEntity*, gnc_numeric))cm_param->param_setfcn;
+			numeric_setter = (void(*)(QofInstance*, gnc_numeric))cm_param->param_setfcn;
 			if(numeric_setter != NULL) { numeric_setter(rule->targetEnt, cm_numeric); }
 			registered_type = TRUE;
 		}
 		if(safe_strcmp(rule->mergeType, QOF_TYPE_GUID) == 0) { 
 			cm_guid = cm_param->param_getfcn(rule->importEnt, cm_param);
-			guid_setter = (void(*)(QofEntity*, const GUID*))cm_param->param_setfcn;
+			guid_setter = (void(*)(QofInstance*, const GUID*))cm_param->param_setfcn;
 			if(guid_setter != NULL) { guid_setter(rule->targetEnt, cm_guid); }
 			registered_type = TRUE;
 		}
 		if(safe_strcmp(rule->mergeType, QOF_TYPE_INT32) == 0) { 
-			int32_getter = (gint32 (*)(QofEntity*, QofParam*)) cm_param->param_getfcn;
+			int32_getter = (gint32 (*)(QofInstance*, QofParam*)) cm_param->param_getfcn;
 			cm_i32 = int32_getter(rule->importEnt, cm_param);
-			i32_setter = (void(*)(QofEntity*, gint32))cm_param->param_setfcn;
+			i32_setter = (void(*)(QofInstance*, gint32))cm_param->param_setfcn;
 			if(i32_setter != NULL) { i32_setter(rule->targetEnt, cm_i32); }
 			registered_type = TRUE;
 		}
 		if(safe_strcmp(rule->mergeType, QOF_TYPE_INT64) == 0) { 
-			int64_getter = (gint64 (*)(QofEntity*, QofParam*)) cm_param->param_getfcn;
+			int64_getter = (gint64 (*)(QofInstance*, QofParam*)) cm_param->param_getfcn;
 			cm_i64 = int64_getter(rule->importEnt, cm_param);
-			i64_setter = (void(*)(QofEntity*, gint64))cm_param->param_setfcn;
+			i64_setter = (void(*)(QofInstance*, gint64))cm_param->param_setfcn;
 			if(i64_setter != NULL) { i64_setter(rule->targetEnt, cm_i64); }
 			registered_type = TRUE;
 		}
 		if(safe_strcmp(rule->mergeType, QOF_TYPE_DOUBLE) == 0) { 
-			double_getter = (double (*)(QofEntity*, QofParam*)) cm_param->param_getfcn;
+			double_getter = (double (*)(QofInstance*, QofParam*)) cm_param->param_getfcn;
 			cm_double = double_getter(rule->importEnt, cm_param);
-			double_setter = (void(*)(QofEntity*, double))cm_param->param_setfcn;
+			double_setter = (void(*)(QofInstance*, double))cm_param->param_setfcn;
 			if(double_setter != NULL) { double_setter(rule->targetEnt, cm_double); }
 			registered_type = TRUE;
 		}
 		if(safe_strcmp(rule->mergeType, QOF_TYPE_BOOLEAN) == 0){ 
-			boolean_getter = (gboolean (*)(QofEntity*, QofParam*)) cm_param->param_getfcn;
+			boolean_getter = (gboolean (*)(QofInstance*, QofParam*)) cm_param->param_getfcn;
 			cm_boolean = boolean_getter(rule->importEnt, cm_param);
-			boolean_setter = (void(*)(QofEntity*, gboolean))cm_param->param_setfcn;
+			boolean_setter = (void(*)(QofInstance*, gboolean))cm_param->param_setfcn;
 			if(boolean_setter != NULL) { boolean_setter(rule->targetEnt, cm_boolean); }
 			registered_type = TRUE;
 		}
 		if(safe_strcmp(rule->mergeType, QOF_TYPE_KVP) == 0) { 
 			cm_kvp = kvp_frame_copy(cm_param->param_getfcn(rule->importEnt,cm_param));
-			kvp_frame_setter = (void(*)(QofEntity*, KvpFrame*))cm_param->param_setfcn;
+			kvp_frame_setter = (void(*)(QofInstance*, KvpFrame*))cm_param->param_setfcn;
 			if(kvp_frame_setter != NULL) { kvp_frame_setter(rule->targetEnt, cm_kvp); }
 			registered_type = TRUE;
 		}
 		if(safe_strcmp(rule->mergeType, QOF_TYPE_CHAR) == 0) { 
-			char_getter = (gchar (*)(QofEntity*, QofParam*)) cm_param->param_getfcn;
+			char_getter = (gchar (*)(QofInstance*, QofParam*)) cm_param->param_getfcn;
 			cm_char = char_getter(rule->importEnt,cm_param);
-			char_setter = (void(*)(QofEntity*, gchar))cm_param->param_setfcn;
+			char_setter = (void(*)(QofInstance*, gchar))cm_param->param_setfcn;
 			if(char_setter != NULL) { char_setter(rule->targetEnt, cm_char); }
 			registered_type = TRUE;
 		}
 		if(safe_strcmp(rule->mergeType, QOF_TYPE_COLLECT) == 0) {
 			cm_coll = cm_param->param_getfcn(rule->importEnt, cm_param);
-			collection_setter = (void(*)(QofEntity*, QofCollection*))cm_param->param_setfcn;
+			collection_setter = (void(*)(QofInstance*, QofCollection*))cm_param->param_setfcn;
 			if(collection_setter != NULL) { collection_setter(rule->targetEnt, cm_coll); }
 			registered_type = TRUE;
 		}
 		if(safe_strcmp(rule->mergeType, QOF_TYPE_CHOICE) == 0) {
 			referenceEnt = cm_param->param_getfcn(rule->importEnt, cm_param);
-			reference_setter = (void(*)(QofEntity*, QofEntity*))cm_param->param_setfcn;
+			reference_setter = (void(*)(QofInstance*, QofInstance*))cm_param->param_setfcn;
 			if(reference_setter != NULL) 
 			{ 
 				reference_setter(rule->targetEnt, referenceEnt); 
@@ -729,7 +729,7 @@
 		if(registered_type == FALSE) {
 			referenceEnt = cm_param->param_getfcn(rule->importEnt, cm_param);
 			if(referenceEnt) {
-				reference_setter = (void(*)(QofEntity*, QofEntity*))cm_param->param_setfcn;
+				reference_setter = (void(*)(QofInstance*, QofInstance*))cm_param->param_setfcn;
 				if(reference_setter != NULL) 
 				{ 
 					reference_setter(rule->targetEnt, referenceEnt); 
@@ -819,20 +819,20 @@
 gchar* qof_class_get_param_as_string(QofIdTypeConst, QofInstance*); ?
 */
 gchar*
-qof_book_merge_param_as_string(QofParam *qtparam, QofEntity *qtEnt)
+qof_book_merge_param_as_string(QofParam *qtparam, QofInstance *qtEnt)
 {
 	gchar       *param_string, param_date[QOF_DATE_STRING_LENGTH];
 	gchar       param_sa[GUID_ENCODING_LENGTH + 1];
 	QofType     paramType;
 	const GUID *param_guid;
 	time_t      param_t;
-	gnc_numeric param_numeric,  (*numeric_getter) (QofEntity*, QofParam*);
-	Timespec    param_ts,       (*date_getter)    (QofEntity*, QofParam*);
-	double      param_double,   (*double_getter)  (QofEntity*, QofParam*);
-	gboolean    param_boolean,  (*boolean_getter) (QofEntity*, QofParam*);
-	gint32      param_i32,      (*int32_getter)   (QofEntity*, QofParam*);
-	gint64      param_i64,      (*int64_getter)   (QofEntity*, QofParam*);
-	gchar       param_char,     (*char_getter)    (QofEntity*, QofParam*);
+	gnc_numeric param_numeric,  (*numeric_getter) (QofInstance*, QofParam*);
+	Timespec    param_ts,       (*date_getter)    (QofInstance*, QofParam*);
+	double      param_double,   (*double_getter)  (QofInstance*, QofParam*);
+	gboolean    param_boolean,  (*boolean_getter) (QofInstance*, QofParam*);
+	gint32      param_i32,      (*int32_getter)   (QofInstance*, QofParam*);
+	gint64      param_i64,      (*int64_getter)   (QofInstance*, QofParam*);
+	gchar       param_char,     (*char_getter)    (QofInstance*, QofParam*);
 
 	param_string = NULL;
 	paramType = qtparam->param_type;
@@ -842,7 +842,7 @@
 			return param_string;
 		}
 		if(safe_strcmp(paramType, QOF_TYPE_DATE) == 0) { 
-			date_getter = (Timespec (*)(QofEntity*, QofParam*))qtparam->param_getfcn;
+			date_getter = (Timespec (*)(QofInstance*, QofParam*))qtparam->param_getfcn;
 			param_ts = date_getter(qtEnt, qtparam);
 			param_t = timespecToTime_t(param_ts);
 			qof_strftime(param_date, QOF_DATE_STRING_LENGTH, QOF_UTC_DATE_FORMAT, gmtime(&param_t));
@@ -851,7 +851,7 @@
 		}
 		if((safe_strcmp(paramType, QOF_TYPE_NUMERIC) == 0)  ||
 		(safe_strcmp(paramType, QOF_TYPE_DEBCRED) == 0)) { 
-			numeric_getter = (gnc_numeric (*)(QofEntity*, QofParam*)) qtparam->param_getfcn;
+			numeric_getter = (gnc_numeric (*)(QofInstance*, QofParam*)) qtparam->param_getfcn;
 			param_numeric = numeric_getter(qtEnt,qtparam);
 			param_string = g_strdup(gnc_numeric_to_string(param_numeric));
 			return param_string;
@@ -863,25 +863,25 @@
 			return param_string;
 		}
 		if(safe_strcmp(paramType, QOF_TYPE_INT32) == 0) { 
-			int32_getter = (gint32 (*)(QofEntity*, QofParam*)) qtparam->param_getfcn;
+			int32_getter = (gint32 (*)(QofInstance*, QofParam*)) qtparam->param_getfcn;
 			param_i32 = int32_getter(qtEnt, qtparam);
 			param_string = g_strdup_printf("%d", param_i32);
 			return param_string;
 		}
 		if(safe_strcmp(paramType, QOF_TYPE_INT64) == 0) { 
-			int64_getter = (gint64 (*)(QofEntity*, QofParam*)) qtparam->param_getfcn;
+			int64_getter = (gint64 (*)(QofInstance*, QofParam*)) qtparam->param_getfcn;
 			param_i64 = int64_getter(qtEnt, qtparam);
 			param_string = g_strdup_printf("%" G_GINT64_FORMAT, param_i64);
 			return param_string;
 		}
 		if(safe_strcmp(paramType, QOF_TYPE_DOUBLE) == 0) { 
-			double_getter = (double (*)(QofEntity*, QofParam*)) qtparam->param_getfcn;
+			double_getter = (double (*)(QofInstance*, QofParam*)) qtparam->param_getfcn;
 			param_double = double_getter(qtEnt, qtparam);
 			param_string = g_strdup_printf("%f", param_double);
 			return param_string;
 		}
 		if(safe_strcmp(paramType, QOF_TYPE_BOOLEAN) == 0){ 
-			boolean_getter = (gboolean (*)(QofEntity*, QofParam*)) qtparam->param_getfcn;
+			boolean_getter = (gboolean (*)(QofInstance*, QofParam*)) qtparam->param_getfcn;
 			param_boolean = boolean_getter(qtEnt, qtparam);
 			/* Boolean values need to be lowercase for QSF validation. */
 			if(param_boolean == TRUE) { param_string = g_strdup("true"); }
@@ -891,7 +891,7 @@
 		/* "kvp" contains repeating values, cannot be a single string for the frame. */
 		if(safe_strcmp(paramType, QOF_TYPE_KVP) == 0) { return param_string; }
 		if(safe_strcmp(paramType, QOF_TYPE_CHAR) == 0) { 
-			char_getter = (gchar (*)(QofEntity*, QofParam*)) qtparam->param_getfcn;
+			char_getter = (gchar (*)(QofInstance*, QofParam*)) qtparam->param_getfcn;
 			param_char = char_getter(qtEnt, qtparam);
 			param_string = g_strdup_printf("%c", param_char);
 			return param_string;

Modified: gnucash/branches/gda-dev/lib/libqof/qof/qofbookmerge.h
===================================================================
--- gnucash/branches/gda-dev/lib/libqof/qof/qofbookmerge.h	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/lib/libqof/qof/qofbookmerge.h	2007-04-14 00:35:53 UTC (rev 15878)
@@ -175,7 +175,7 @@
 	GSList *mergeParam;      /**< list of usable parameters for the object type */
 	GSList *linkedEntList;   /**< list of complex data types included in this object. 
 
-	linkedEntList contains an ::QofEntity reference to any parameter that is not
+	linkedEntList contains an ::QofInstance reference to any parameter that is not
 	one of the core QOF_TYPE data types. This entity must be already
     registered with QOF and the results of the comparison for the linked entity
     will modulate the mergeResult of this object. e.g. if an invoice is the
@@ -183,8 +183,8 @@
     MERGE_REPORT and the customer as MERGE_NEW.
 	*/
 	QofBookMergeResult mergeResult; /**< result of comparison with main ::QofBook */
-	QofEntity *importEnt;    /**< pointer to the current entity in the import book. */
-	QofEntity *targetEnt;    /**< pointer to the corresponding entity in the
+	QofInstance *importEnt;    /**< pointer to the current entity in the import book. */
+	QofInstance *targetEnt;    /**< pointer to the corresponding entity in the
                                 target book, if any. */
 }QofBookMergeRule;
 
@@ -194,7 +194,7 @@
 Used to dictate what to merge, how to merge it, where to get the new data and
 where to put the amended data. 
 
-Combines lists of \a ::QofParam, \a ::QofEntity and \a ::QofBookMergeRule
+Combines lists of \a ::QofParam, \a ::QofInstance and \a ::QofBookMergeRule
 into one struct that can be easily passed between callbacks. Also holds the
 pointers to the import and target ::QofBook structures.
 	
@@ -209,7 +209,7 @@
                                     parameter in the current object. */
 	GList 	*mergeList;          /**< GList of all ::qof_book_mergeRule rules
                                     for the merge operation. */
-	GSList 	*targetList;         /**< GSList of ::QofEntity * for each object
+	GSList 	*targetList;         /**< GSList of ::QofInstance * for each object
                                     of this type in the target book */
 	QofBook *mergeBook;          /**< pointer to the import book for this
                                     merge operation. */
@@ -218,16 +218,16 @@
 	gboolean abort;	             /**< set to TRUE if MERGE_INVALID is set. */
 	QofBookMergeRule *currentRule; /**< placeholder for the rule currently
                                     being tested or applied. */
-	GSList *orphan_list;         /**< List of QofEntity's that need to be rematched.
+	GSList *orphan_list;         /**< List of QofInstance's that need to be rematched.
 
-	When one QofEntity has a lower difference to the targetEnt than the
+	When one QofInstance has a lower difference to the targetEnt than the
     previous best_match, the new match takes precedence. This list holds those
     orphaned entities that are not a good enough match so that these can be
-    rematched later. The ranking is handled using the private QofEntityRating
+    rematched later. The ranking is handled using the private QofInstanceRating
     struct and the GHashTable ::QofBookMergeData::target_table.
 	*/
 	GHashTable *target_table;    /**< The GHashTable to hold the
-                                    QofEntityRating values.  */
+                                    QofInstanceRating values.  */
 
 }QofBookMergeData;
 
@@ -335,7 +335,7 @@
 routines for the target entity. The import entity is available for display.
 
 Uses ::qof_book_get_collection with the QofBookMergeRule::mergeType object
-type to return a collection of ::QofEntity entities from either the
+type to return a collection of ::QofInstance entities from either the
 QofBookMergeData::mergeBook or QofBookMergeData::targetBook. Then
 uses ::qof_collection_lookup_entity to lookup the QofBookMergeRule::importEnt
 and again the qof_book_mergeRule::targetEnt to return the two specific entities.
@@ -359,7 +359,7 @@
 parameter data.
 
 */
-gchar* qof_book_merge_param_as_string(QofParam *qtparam, QofEntity *qtEnt);
+gchar* qof_book_merge_param_as_string(QofParam *qtparam, QofInstance *qtEnt);
 
 /** \brief called by dialogue callback to set the result of user intervention
 

Modified: gnucash/branches/gda-dev/lib/libqof/qof/qofclass.h
===================================================================
--- gnucash/branches/gda-dev/lib/libqof/qof/qofclass.h	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/lib/libqof/qof/qofclass.h	2007-04-14 00:35:53 UTC (rev 15878)
@@ -267,7 +267,7 @@
 
 Simple check to return a GList of all parameters
 of this object type that are not known QOF data types.
-Used for partial QofBook support, see ::QofEntityReference
+Used for partial QofBook support, see ::QofInstanceReference
 */
 GList* qof_class_get_referenceList(QofIdTypeConst type);
 

Modified: gnucash/branches/gda-dev/lib/libqof/qof/qofevent-p.h
===================================================================
--- gnucash/branches/gda-dev/lib/libqof/qof/qofevent-p.h	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/lib/libqof/qof/qofevent-p.h	2007-04-14 00:35:53 UTC (rev 15878)
@@ -48,6 +48,6 @@
 					QofEventId event_id);
 
 /* generates an event even when events are suspended! */
-void qof_event_force (QofEntity *entity, QofEventId event_id, gpointer event_data);
+void qof_event_force (QofInstance *entity, QofEventId event_id, gpointer event_data);
 
 #endif

Modified: gnucash/branches/gda-dev/lib/libqof/qof/qofevent.c
===================================================================
--- gnucash/branches/gda-dev/lib/libqof/qof/qofevent.c	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/lib/libqof/qof/qofevent.c	2007-04-14 00:35:53 UTC (rev 15878)
@@ -203,7 +203,7 @@
 }
 
 static void
-qof_event_generate_internal (QofEntity *entity, QofEventId event_id, 
+qof_event_generate_internal (QofInstance *entity, QofEventId event_id, 
                             gpointer event_data)
 {
   GList *node;
@@ -275,7 +275,7 @@
 }
 
 void
-qof_event_force (QofEntity *entity, QofEventId event_id, gpointer event_data)
+qof_event_force (QofInstance *entity, QofEventId event_id, gpointer event_data)
 {
   if (!entity)
     return;
@@ -284,7 +284,7 @@
 }
 
 void
-qof_event_gen (QofEntity *entity, QofEventId event_id, gpointer event_data)
+qof_event_gen (QofInstance *entity, QofEventId event_id, gpointer event_data)
 {
   if (!entity)
     return;
@@ -300,7 +300,7 @@
 qof_event_generate (const GUID *guid, QofIdType e_type, 
 					QofEventId event_id)
 {
-  QofEntity ent;
+  QofInstance ent;
   ent.guid = *guid;
   ent.e_type = e_type;
   if (suspend_counter) return;

Modified: gnucash/branches/gda-dev/lib/libqof/qof/qofevent.h
===================================================================
--- gnucash/branches/gda-dev/lib/libqof/qof/qofevent.h	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/lib/libqof/qof/qofevent.h	2007-04-14 00:35:53 UTC (rev 15878)
@@ -81,7 +81,7 @@
  * @param handler_data:   data supplied when handler was registered.
  * @param event_data:   data to be supplied when handler is invoked.
  */
-typedef void (*QofEventHandler) (QofEntity *ent,  QofEventId event_type,
+typedef void (*QofEventHandler) (QofInstance *ent,  QofEventId event_type,
                                gpointer handler_data, gpointer event_data);
 
 /** \brief Register a handler for events.
@@ -113,14 +113,14 @@
    Any other events are entirely the concern of the application.
 
  \note QofEventHandler routines do \b NOT support generating
- events from a GUID and QofIdType - you must specify a genuine QofEntity.
+ events from a GUID and QofIdType - you must specify a genuine QofInstance.
 
  @param entity:     the entity generating the event
  @param event_type: the name of the event.
  @param event_data: Data to be passed to the event handler just for
  this one event. Can be NULL.
 */
-void qof_event_gen (QofEntity *entity, QofEventId event_type, 
+void qof_event_gen (QofInstance *entity, QofEventId event_type, 
                     gpointer event_data);
 
 /** \brief  Suspend all engine events.

Modified: gnucash/branches/gda-dev/lib/libqof/qof/qofgobj.c
===================================================================
--- gnucash/branches/gda-dev/lib/libqof/qof/qofgobj.c	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/lib/libqof/qof/qofgobj.c	2007-04-14 00:35:53 UTC (rev 15878)
@@ -202,7 +202,7 @@
  * of instances that we have on hand.
  */
 static void
-qof_gobject_foreach (QofCollection *coll, QofEntityForeachCB cb, gpointer ud)
+qof_gobject_foreach (QofCollection *coll, QofInstanceForeachCB cb, gpointer ud)
 {
   GSList *n;
   n = qof_collection_get_data (coll);

Modified: gnucash/branches/gda-dev/lib/libqof/qof/qofid-p.h
===================================================================
--- gnucash/branches/gda-dev/lib/libqof/qof/qofid-p.h	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/lib/libqof/qof/qofid-p.h	2007-04-14 00:35:53 UTC (rev 15878)
@@ -38,13 +38,13 @@
 /** Set the ID of the entity, over-riding the previous ID. 
  *  Very dangerous, use only for file i/o work. 
  */
-void qof_entity_set_guid (QofEntity *ent, const GUID *guid);
+void qof_instance_set_guid (QofInstance *ent, const GUID *guid);
 
 /** Take entity, remove it from whatever collection its currently
  *  in, and place it in a new collection.  To be used only for
  *  moving entity from one book to another.
  */
-void qof_collection_insert_entity (QofCollection *, QofEntity *);
+void qof_collection_insert_entity (QofCollection *, QofInstance *);
 
 /** reset value of dirty flag */
 void qof_collection_mark_clean (QofCollection *);

Modified: gnucash/branches/gda-dev/lib/libqof/qof/qofid.c
===================================================================
--- gnucash/branches/gda-dev/lib/libqof/qof/qofid.c	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/lib/libqof/qof/qofid.c	2007-04-14 00:35:53 UTC (rev 15878)
@@ -58,10 +58,8 @@
 
 /* =============================================================== */
 
-static void qof_collection_remove_entity (QofEntity *ent);
-
 void
-qof_entity_init (QofEntity *ent, QofIdType type, QofCollection * tab)
+qof_entity_init (QofInstance *ent, QofIdType type, QofCollection * tab)
 {
   g_return_if_fail (NULL != tab);
   
@@ -75,7 +73,7 @@
   ent->e_type = CACHE_INSERT (type);
 
   do
-  {
+   {
     guid_new(&ent->guid);
 
     if (NULL == qof_collection_lookup_entity (tab, &ent->guid)) break;
@@ -89,7 +87,7 @@
 }
 
 void
-qof_entity_release (QofEntity *ent)
+qof_entity_release (QofInstance *ent)
 {
   if (!ent->collection) return;
   qof_collection_remove_entity (ent);
@@ -101,7 +99,7 @@
 /* This is a restricted function, should be used only during 
  * read from file */
 void
-qof_entity_set_guid (QofEntity *ent, const GUID *guid)
+qof_instance_set_guid (QofInstance *ent, const GUID *guid)
 {
   QofCollection *col;
   if (guid_equal (guid, &ent->guid)) return;
@@ -112,13 +110,6 @@
   qof_collection_insert_entity (col, ent);
 }
 
-const GUID *
-qof_entity_get_guid (const QofEntity *ent)
-{
-  if (!ent) return guid_null();
-  return &ent->guid;
-}
-
 /* =============================================================== */
 
 static guint
@@ -189,8 +180,8 @@
 
 /* =============================================================== */
 
-static void
-qof_collection_remove_entity (QofEntity *ent)
+void
+qof_collection_remove_entity (QofInstance *ent)
 {
   QofCollection *col;
   if (!ent) return;
@@ -203,7 +194,7 @@
 }
 
 void
-qof_collection_insert_entity (QofCollection *col, QofEntity *ent)
+qof_collection_insert_entity (QofCollection *col, QofInstance *ent)
 {
   if (!col || !ent) return;
   if (guid_equal(&ent->guid, guid_null())) return;
@@ -216,9 +207,9 @@
 }
 
 gboolean
-qof_collection_add_entity (QofCollection *coll, QofEntity *ent)
+qof_collection_add_entity (QofCollection *coll, QofInstance *ent)
 {
-	QofEntity *e;
+	QofInstance *e;
 
 	e = NULL;
 	if (!coll || !ent) { return FALSE; }
@@ -233,7 +224,7 @@
 }
 
 static void
-collection_merge_cb (QofEntity *ent, gpointer data)
+collection_merge_cb (QofInstance *ent, gpointer data)
 {
 	QofCollection *target;
 
@@ -251,10 +242,10 @@
 }
 
 static void
-collection_compare_cb (QofEntity *ent, gpointer user_data)
+collection_compare_cb (QofInstance *ent, gpointer user_data)
 {
 	QofCollection *target;
-	QofEntity *e;
+	QofInstance *e;
 	gint value;
 
 	e = NULL;
@@ -302,10 +293,10 @@
 	return value;
 }
 
-QofEntity *
+QofInstance *
 qof_collection_lookup_entity (const QofCollection *col, const GUID * guid)
 {
-  QofEntity *ent;
+  QofInstance *ent;
   g_return_val_if_fail (col, NULL);
   if (guid == NULL) return NULL;
   ent = g_hash_table_lookup (col->hash_of_entities, guid);
@@ -316,13 +307,13 @@
 qof_collection_from_glist (QofIdType type, GList *glist)
 {
 	QofCollection *coll;
-	QofEntity *ent;
+	QofInstance *ent;
 	GList *list;
 
 	coll = qof_collection_new(type);
 	for(list = glist; list != NULL; list = list->next)
 	{
-		ent = (QofEntity*)list->data;
+		ent = QOF_INSTANCE(list->data);
 		if(FALSE == qof_collection_add_entity(coll, ent))
 		{
 			return NULL;
@@ -365,7 +356,7 @@
 {
   if (col->is_dirty)
     printf("%s collection is dirty.\n", col->e_type);
-  qof_collection_foreach(col, (QofEntityForeachCB)qof_instance_print_dirty, NULL);
+  qof_collection_foreach(col, (QofInstanceForeachCB)qof_instance_print_dirty, NULL);
 }
 
 /* =============================================================== */
@@ -385,20 +376,20 @@
 /* =============================================================== */
 
 struct _iterate {
-  QofEntityForeachCB      fcn;
+  QofInstanceForeachCB      fcn;
   gpointer                data;
 };
 
 static void foreach_cb (gpointer key, gpointer item, gpointer arg)
 {
   struct _iterate *iter = arg;
-  QofEntity *ent = item;
+  QofInstance *ent = item;
 
   iter->fcn (ent, iter->data);
 }
 
 void
-qof_collection_foreach (const QofCollection *col, QofEntityForeachCB cb_func, 
+qof_collection_foreach (const QofCollection *col, QofInstanceForeachCB cb_func, 
                         gpointer user_data)
 {
   struct _iterate iter;

Modified: gnucash/branches/gda-dev/lib/libqof/qof/qofid.h
===================================================================
--- gnucash/branches/gda-dev/lib/libqof/qof/qofid.h	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/lib/libqof/qof/qofid.h	2007-04-14 00:35:53 UTC (rev 15878)
@@ -83,15 +83,16 @@
 /** QofLogModule declaration */
 typedef const gchar* QofLogModule;
 
+typedef struct QofCollection_s QofCollection;
+
+#include "qofinstance.h"
+
 #define QOF_ID_NONE           NULL
 #define QOF_ID_NULL           "null"
 
 #define QOF_ID_BOOK           "Book"
 #define QOF_ID_SESSION        "Session"
 
-/** simple,cheesy cast but holds water for now */
-#define QOF_ENTITY(object) ((QofEntity *)(object))
-
 /** Inline string comparision; compiler will optimize away most of this */
 #define QSTRCMP(da,db) ({                \
   gint val = 0;                          \
@@ -111,7 +112,7 @@
 
 /** return TRUE if object is of the given type */
 #define QOF_CHECK_TYPE(obj,type) (((obj) != NULL) && \
-  (0 == QSTRCMP((type),(((QofEntity *)(obj))->e_type))))
+  (0 == QSTRCMP((type),(((QofInstance *)(obj))->e_type))))
 
 /** cast object to the indicated type,
 print error message if its bad  */
@@ -120,12 +121,11 @@
   (c_type *) (obj) :                                          \
   (c_type *) ({                                               \
      g_log (G_LOG_DOMAIN, G_LOG_LEVEL_CRITICAL,               \
-       "Error: Bad QofEntity at %s:%d", __FILE__, __LINE__);  \
+       "Error: Bad QofInstance at %s:%d", __FILE__, __LINE__);  \
      (obj);                                                   \
   }))
 
-/** QofEntity declaration */
-typedef struct QofEntity_s QofEntity;
+
 /** QofCollection declaration 
 
 @param e_type QofIdType
@@ -134,32 +134,10 @@
 @param data gpointer, place where object class can hang arbitrary data
 
 */
-typedef struct QofCollection_s QofCollection;
+void qof_entity_init (QofInstance *ent, QofIdType type, QofCollection * tab);
+void qof_entity_release (QofInstance *ent);
+void qof_instance_set_guid (QofInstance *ent, const GUID *guid);
 
-/** QofEntity structure
-
- at param e_type 	Entity type
- at param guid		GUID for the entity
- at param collection	Entity collection
-*/
-
-struct QofEntity_s
-{
-	QofIdType        e_type;
-	GUID             guid;
-	QofCollection  * collection;
-};
-
-/** @name QOF Entity Initialization & Shutdown 
- @{ */
-/** Initialise the memory associated with an entity */
-void qof_entity_init (QofEntity *, QofIdType, QofCollection *);
-                                                                                
-/** Release the data associated with this entity. Dont actually free
- * the memory associated with the instance. */
-void qof_entity_release (QofEntity *);
-/** @} */
-
 /** Is QOF operating in "alternate" dirty mode.  In normal mode,
  *  whenever an instance is dirtied, the collection (and therefore the
  *  book) is immediately marked as dirty.  In alternate mode, the
@@ -178,7 +156,7 @@
 void qof_set_alt_dirty_mode (gboolean enabled);
 
 /** Return the GUID of this entity */
-const GUID * qof_entity_get_guid (const QofEntity *);
+const GUID * qof_instance_get_guid (const QofInstance *);
 
 /** @name Collections of Entities 
  @{ */
@@ -196,13 +174,13 @@
 QofIdType qof_collection_get_type (const QofCollection *);
 
 /** Find the entity going only from its guid */
-QofEntity * qof_collection_lookup_entity (const QofCollection *, const GUID *);
+QofInstance * qof_collection_lookup_entity (const QofCollection *, const GUID *);
 
-/** Callback type for qof_entity_foreach */
-typedef void (*QofEntityForeachCB) (QofEntity *, gpointer user_data);
+/** Callback type for qof_collection_foreach */
+typedef void (*QofInstanceForeachCB) (QofInstance *, gpointer user_data);
 
 /** Call the callback for each entity in the collection. */
-void qof_collection_foreach (const QofCollection *, QofEntityForeachCB, 
+void qof_collection_foreach (const QofCollection *, QofInstanceForeachCB, 
                              gpointer user_data);
 
 /** Store and retreive arbitrary object-defined data 
@@ -234,20 +212,22 @@
 Entities can be
 freely added and merged across these secondary collections, they
 will not be removed from the original collection as they would
-by using ::qof_entity_insert_entity or ::qof_entity_remove_entity. 
+by using ::qof_instance_insert_entity or ::qof_instance_remove_entity. 
 
 */
 gboolean
-qof_collection_add_entity (QofCollection *coll, QofEntity *ent);
+qof_collection_add_entity (QofCollection *coll, QofInstance *ent);
 
+void qof_collection_remove_entity (QofInstance *ent);
+
 /** \brief Merge two QOF_TYPE_COLLECT of the same type.
 
 \note \b NOT the same as the main collections in the book.
 
 QOF_TYPE_COLLECT uses a secondary collection, independent of
 those in the book. Entities will not be removed from the
-original collection as when using ::qof_entity_insert_entity
-or ::qof_entity_remove_entity.
+original collection as when using ::qof_instance_insert_entity
+or ::qof_instance_remove_entity.
 
 */
 gboolean
@@ -255,7 +235,7 @@
 
 /** \brief Compare two secondary collections.
 
-Performs a deep comparision of the collections. Each QofEntity in
+Performs a deep comparision of the collections. Each QofInstance in
 each collection is looked up in the other collection, via the GUID.
 
 \return 0 if the collections are identical or both are NULL

Modified: gnucash/branches/gda-dev/lib/libqof/qof/qofinstance-p.h
===================================================================
--- gnucash/branches/gda-dev/lib/libqof/qof/qofinstance-p.h	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/lib/libqof/qof/qofinstance-p.h	2007-04-14 00:35:53 UTC (rev 15878)
@@ -31,49 +31,6 @@
 
 #include "qofinstance.h"
 
-/*
- * UNDER CONSTRUCTION!
- * This is mostly scaffolding for now,
- * eventually, it may hold more fields, such as refrence counting...
- *
- */
-struct QofInstance_s
-{
-   /* Globally unique id identifying this instance */
-   QofEntity entity;
-
-   /* The entity_table in which this instance is stored */
-   QofBook * book;
-
-  /* kvp_data is a key-value pair database for storing arbirtary
-   * information associated with this instance.  
-   * See src/engine/kvp_doc.txt for a list and description of the 
-   * important keys. */
-   KvpFrame *kvp_data;
-
-   /*  Timestamp used to track the last modification to this 
-    *  instance.  Typically used to compare two versions of the
-    *  same object, to see which is newer.  When used with the 
-    *  SQL backend, this field is reserved for SQL use, to compare
-    *  the version in local memory to the remote, server version.
-    */
-   Timespec last_update;
-
-   /*  Keep track of nesting level of begin/end edit calls */
-   int    editlevel;
-
-   /*  In process of being destroyed */
-   gboolean  do_free;
-
-   /*  dirty/clean flag. If dirty, then this instance has been modified,
-    *  but has not yet been written out to storage (file/database)
-    */
-   gboolean  dirty;
-
-   /* True iff this instance has never been committed. */
-   gboolean infant;
-};
-
 void qof_instance_set_slots (QofInstance *, KvpFrame *);
 
 /*  Set the last_update time. Reserved for use by the SQL backend;

Modified: gnucash/branches/gda-dev/lib/libqof/qof/qofinstance.c
===================================================================
--- gnucash/branches/gda-dev/lib/libqof/qof/qofinstance.c	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/lib/libqof/qof/qofinstance.c	2007-04-14 00:35:53 UTC (rev 15878)
@@ -39,22 +39,21 @@
 
 /* ========================================================== */
 
-QofInstance*
-qof_instance_create (QofIdType type, QofBook *book)
+QOF_GOBJECT_GET_TYPE(QofInstance, qof_instance, G_TYPE_OBJECT, {});
+QOF_GOBJECT_FINALIZE(qof_instance);
+
+static void qof_instance_dispose(GObject*);
+static void qof_instance_class_init(QofInstanceClass *klass)
 {
-	QofInstance *inst;
-
-	inst = g_new0(QofInstance, 1);
-	qof_instance_init(inst, type, book);
-	return inst;
+    GObjectClass *object_class = G_OBJECT_CLASS(klass);
+    object_class->finalize = qof_instance_finalize;
+    object_class->dispose = qof_instance_dispose;
 }
 
-void
-qof_instance_init (QofInstance *inst, QofIdType type, QofBook *book)
+static void
+qof_instance_init (QofInstance *inst)
 {
-	QofCollection *col;
-
-	inst->book = book;
+	inst->book = NULL;
 	inst->kvp_data = kvp_frame_new();
 	inst->last_update.tv_sec = 0;
 	inst->last_update.tv_nsec = -1;
@@ -62,27 +61,45 @@
 	inst->do_free = FALSE;
 	inst->dirty = FALSE;
 	inst->infant = TRUE;
+}
 
+void
+qof_instance_init_data (QofInstance *inst, QofIdType type, QofBook *book)
+{
+	QofCollection *col;
+	g_return_if_fail(QOF_IS_INSTANCE(inst));
+	g_return_if_fail(!inst->book);
+
+	inst->book = book;
 	col = qof_book_get_collection (book, type);
-	qof_entity_init (&inst->entity, type, col);
+	qof_entity_init (inst, type, col);
 }
 
-void
-qof_instance_release (QofInstance *inst)
+static void
+qof_instance_dispose (GObject *instp)
 {
+	QofInstance* inst = QOF_INSTANCE(instp);
+	qof_entity_release (inst);
+	G_OBJECT_CLASS(qof_instance_parent_class)->dispose(instp);
+}
+
+static void
+qof_instance_finalize_real (GObject *instp)
+{
+	QofInstance* inst = QOF_INSTANCE(instp);
+
 	kvp_frame_delete (inst->kvp_data);
 	inst->kvp_data = NULL;
 	inst->editlevel = 0;
 	inst->do_free = FALSE;
 	inst->dirty = FALSE;
-	qof_entity_release (&inst->entity);
 }
 
 const GUID *
 qof_instance_get_guid (const QofInstance *inst)
 {
-	if (!inst) return NULL;
-	return &inst->entity.guid;
+    if (!inst) return guid_null();
+	return &(inst->guid);
 }
 
 QofBook *
@@ -124,13 +141,13 @@
 }
 
 void
-qof_instance_print_dirty (const QofEntity *entity, gpointer dummy)
+qof_instance_print_dirty (const QofInstance *entity, gpointer dummy)
 {
   QofInstance *inst = QOF_INSTANCE(entity);
 
   if (inst->dirty)
-    printf("%s instance %s is dirty.\n", inst->entity.e_type,
-	   guid_to_string(&inst->entity.guid));
+    printf("%s instance %s is dirty.\n", inst->e_type,
+	   guid_to_string(&inst->guid));
 }
 
 gboolean
@@ -141,7 +158,7 @@
 	if (!inst) { return FALSE; }
 	if (qof_get_alt_dirty_mode())
 	  return inst->dirty;
-	coll = inst->entity.collection;
+	coll = inst->collection;
 	if(qof_collection_is_dirty(coll)) { return inst->dirty; }
 	inst->dirty = FALSE;
 	return FALSE;
@@ -154,7 +171,7 @@
 
 	inst->dirty = TRUE;
 	if (!qof_get_alt_dirty_mode()) {
-	  coll = inst->entity.collection;
+	  coll = inst->collection;
 	  qof_collection_mark_dirty(coll);
 	}
 }
@@ -222,12 +239,12 @@
 
   /* Make a note of where the copy came from */
   gnc_kvp_bag_add (to->kvp_data, "gemini", now,
-                                  "inst_guid", &from->entity.guid,
-                                  "book_guid", &from->book->inst.entity.guid,
+                                  "inst_guid", &from->guid,
+                                  "book_guid", &from->book->inst.guid,
                                   NULL);
   gnc_kvp_bag_add (from->kvp_data, "gemini", now,
-                                  "inst_guid", &to->entity.guid,
-                                  "book_guid", &to->book->inst.entity.guid,
+                                  "inst_guid", &to->guid,
+                                  "book_guid", &to->book->inst.guid,
                                   NULL);
 
   to->dirty = TRUE;
@@ -245,11 +262,11 @@
 	ENTER (" ");
 
 	fr = gnc_kvp_bag_find_by_guid (src->kvp_data, "gemini",
-	                             "book_guid", &target_book->inst.entity.guid);
+	                             "book_guid", &target_book->inst.guid);
 
 	twin_guid = kvp_frame_get_guid (fr, "inst_guid");
 
-	col = qof_book_get_collection (target_book, src->entity.e_type);
+	col = qof_book_get_collection (target_book, src->e_type);
 	twin = (QofInstance *) qof_collection_lookup_entity (col, twin_guid);
 
 	LEAVE (" found twin=%p", twin);

Modified: gnucash/branches/gda-dev/lib/libqof/qof/qofinstance.h
===================================================================
--- gnucash/branches/gda-dev/lib/libqof/qof/qofinstance.h	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/lib/libqof/qof/qofinstance.h	2007-04-14 00:35:53 UTC (rev 15878)
@@ -22,7 +22,7 @@
 /** @addtogroup Entity
     @{ */
 /** @addtogroup Instance
-    Qof Instances are a derived type of QofEntity.  The Instance
+    Qof Instances are a derived type of QofInstance.  The Instance
     adds some common features and functions that most objects
     will want to use.
 
@@ -36,26 +36,83 @@
 #ifndef QOF_INSTANCE_H
 #define QOF_INSTANCE_H
 
+typedef struct _QofInstanceClass QofInstanceClass;
+typedef struct QofInstance_s QofInstance;
+
+/** \brief QofBook reference */
+typedef struct _QofBook       QofBook;
+
+#include "qofid.h"
 #include "guid.h"
 #include "gnc-date.h"
 #include "kvp_frame.h"
-#include "qofbook.h"
-#include "qofid.h"
+#include "qof-gobject.h"
 
 /* --- type macros --- */
-/* cheesy, but will do for now, eventually should be more gtk-like, handle
- * thunks, etc.  */
-#define QOF_INSTANCE(object) ((QofInstance *)(object))
+#define QOF_TYPE_INSTANCE            (qof_instance_get_type ())
+#define QOF_INSTANCE(o)              \
+     (G_TYPE_CHECK_INSTANCE_CAST ((o), QOF_TYPE_INSTANCE, QofInstance))
+#define QOF_INSTANCE_CLASS(k)        \
+     (G_TYPE_CHECK_CLASS_CAST((k), QOF_TYPE_INSTANCE, QofInstanceClass))
+#define QOF_IS_INSTANCE(o)           \
+     (G_TYPE_CHECK_INSTANCE_TYPE ((o), QOF_TYPE_INSTANCE))
+#define QOF_IS_INSTANCE_CLASS(k)     \
+     (G_TYPE_CHECK_CLASS_TYPE ((k), QOF_TYPE_INSTANCE))
+#define QOF_INSTANCE_GET_CLASS(o)    \
+     (G_TYPE_INSTANCE_GET_CLASS ((o), QOF_TYPE_INSTANCE, QofInstanceClass))
 
-typedef struct QofInstance_s QofInstance;
+struct QofInstance_s
+{
+   GObject object;
 
-/** Initialise the memory associated with an instance */
-void qof_instance_init (QofInstance *, QofIdType, QofBook *);
+   /* Globally unique id identifying this instance */
+   QofIdType        e_type;		   /**<	Entity type */
+   GUID             guid;		   /**< GUID for the entity */
+   QofCollection  * collection;		   /**< Entity collection */
 
-/** release the data associated with this instance. Dont actually free 
- * the memory associated with the instance. */
-void qof_instance_release (QofInstance *inst);
+   /* The entity_table in which this instance is stored */
+   QofBook * book;
 
+  /* kvp_data is a key-value pair database for storing arbirtary
+   * information associated with this instance.  
+   * See src/engine/kvp_doc.txt for a list and description of the 
+   * important keys. */
+   KvpFrame *kvp_data;
+
+   /*  Timestamp used to track the last modification to this 
+    *  instance.  Typically used to compare two versions of the
+    *  same object, to see which is newer.  When used with the 
+    *  SQL backend, this field is reserved for SQL use, to compare
+    *  the version in local memory to the remote, server version.
+    */
+   Timespec last_update;
+
+   /*  Keep track of nesting level of begin/end edit calls */
+   int    editlevel;
+
+   /*  In process of being destroyed */
+   gboolean  do_free;
+
+   /*  dirty/clean flag. If dirty, then this instance has been modified,
+    *  but has not yet been written out to storage (file/database)
+    */
+   gboolean  dirty;
+
+   /* True iff this instance has never been committed. */
+   gboolean infant;
+};
+
+struct _QofInstanceClass
+{
+   GObjectClass parent_class;
+};
+
+/** Return the GType of a QofInstance */
+GType qof_instance_get_type(void);
+
+/** Initialise the settings associated with an instance */
+void qof_instance_init_data (QofInstance *, QofIdType, QofBook *);
+
 /** Return the book pointer */
 QofBook * qof_instance_get_book (const QofInstance *);
 
@@ -81,7 +138,7 @@
  */
 int qof_instance_version_cmp (const QofInstance *left, const QofInstance *right);
 
-void qof_instance_print_dirty (const QofEntity *entity, gpointer dummy);
+void qof_instance_print_dirty (const QofInstance *entity, gpointer dummy);
 
 /** Return value of is_dirty flag */
 gboolean qof_instance_is_dirty (QofInstance *);
@@ -101,8 +158,6 @@
 
 void qof_instance_mark_free(QofInstance *inst);
 
-QofInstance* qof_instance_create (QofIdType type, QofBook *book);
-
 /** Pair things up.  This routine inserts a kvp value into each instance
  *  containing the guid of the other.  In this way, if one has one of the
  *  pair, one can always find the other by looking up it's guid.  Typically,

Modified: gnucash/branches/gda-dev/lib/libqof/qof/qofobject.c
===================================================================
--- gnucash/branches/gda-dev/lib/libqof/qof/qofobject.c	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/lib/libqof/qof/qofobject.c	2007-04-14 00:35:53 UTC (rev 15878)
@@ -156,7 +156,7 @@
 
 void 
 qof_object_foreach (QofIdTypeConst type_name, QofBook *book, 
-                    QofEntityForeachCB cb, gpointer user_data)
+                    QofInstanceForeachCB cb, gpointer user_data)
 {
   QofCollection *col;
   const QofObject *obj;

Modified: gnucash/branches/gda-dev/lib/libqof/qof/qofobject.h
===================================================================
--- gnucash/branches/gda-dev/lib/libqof/qof/qofobject.h	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/lib/libqof/qof/qofobject.h	2007-04-14 00:35:53 UTC (rev 15878)
@@ -104,7 +104,7 @@
    *  provide this routine, as without it, little of interest can 
     * be done.
    */
-  void                (*foreach)(const QofCollection *, QofEntityForeachCB, gpointer);
+  void                (*foreach)(const QofCollection *, QofInstanceForeachCB, gpointer);
 
   /** Given a particular item of this type, return a printable string. 
    */
@@ -160,7 +160,7 @@
  *  be invoked only for those instances stored in the book.
  */
 void qof_object_foreach (QofIdTypeConst type_name, QofBook *book, 
-                         QofEntityForeachCB cb, gpointer user_data);
+                         QofInstanceForeachCB cb, gpointer user_data);
 
 /** Register and lookup backend-specific data for this particular object */
 gboolean qof_object_register_backend (QofIdTypeConst type_name,

Modified: gnucash/branches/gda-dev/lib/libqof/qof/qofquery.c
===================================================================
--- gnucash/branches/gda-dev/lib/libqof/qof/qofquery.c	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/lib/libqof/qof/qofquery.c	2007-04-14 00:35:53 UTC (rev 15878)
@@ -809,7 +809,7 @@
 
     /* And then iterate over all the objects */
     qof_object_foreach (qcb->query->search_for, book,
-			(QofEntityForeachCB) check_item_cb, qcb);
+			(QofInstanceForeachCB) check_item_cb, qcb);
   }
 }
 

Modified: gnucash/branches/gda-dev/lib/libqof/qof/qofquerycore.c
===================================================================
--- gnucash/branches/gda-dev/lib/libqof/qof/qofquerycore.c	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/lib/libqof/qof/qofquerycore.c	2007-04-14 00:35:53 UTC (rev 15878)
@@ -1450,13 +1450,13 @@
 }
 
 static void
-query_collect_cb(QofEntity* ent, gpointer user_data)
+query_collect_cb(QofInstance* ent, gpointer user_data)
 {
 	query_coll_t pdata;
 	GUID *guid;
 
 	guid = guid_malloc();
-	guid = (GUID*)qof_entity_get_guid(ent);
+	guid = (GUID*)qof_instance_get_guid(ent);
 	pdata = (query_coll_t)user_data;
 	pdata->guids = g_list_append(pdata->guids, guid);
 }

Modified: gnucash/branches/gda-dev/lib/libqof/qof/qofreference.c
===================================================================
--- gnucash/branches/gda-dev/lib/libqof/qof/qofreference.c	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/lib/libqof/qof/qofreference.c	2007-04-14 00:35:53 UTC (rev 15878)
@@ -26,16 +26,16 @@
 #include "qofreference.h"
 
 static void
-entity_set_reference_cb(QofEntity *ent, gpointer user_data)
+entity_set_reference_cb(QofInstance *ent, gpointer user_data)
 {
-	void (*reference_setter) (QofEntity*, QofEntity*);
-	void (*choice_setter) (QofEntity*, QofEntity*);
-	void (*collect_setter)(QofEntity*, QofCollection*);
-	QofEntityReference *ref;
+	void (*reference_setter) (QofInstance*, QofInstance*);
+	void (*choice_setter) (QofInstance*, QofInstance*);
+	void (*collect_setter)(QofInstance*, QofCollection*);
+	QofInstanceReference *ref;
 	GList *book_ref_list;
 	QofCollection *coll;
 	QofIdType type;
-	QofEntity *reference;
+	QofInstance *reference;
 	QofBook *partial_book;
 	
 	partial_book = (QofBook*)user_data;
@@ -45,8 +45,8 @@
 	book_ref_list = qof_book_get_data(partial_book, ENTITYREFERENCE);
 	while(book_ref_list)
 	{
-		ref = (QofEntityReference*)book_ref_list->data;
-		if(0 == guid_compare(ref->ref_guid, qof_entity_get_guid(ent)))
+		ref = (QofInstanceReference*)book_ref_list->data;
+		if(0 == guid_compare(ref->ref_guid, qof_instance_get_guid(ent)))
 		{
 			/* avoid setting the entity's own guid as a reference. */
 			book_ref_list = g_list_next(book_ref_list);
@@ -56,7 +56,7 @@
 		type = ref->param->param_type;
 		coll = qof_book_get_collection(partial_book, type);
 		reference = qof_collection_lookup_entity(coll, ref->ref_guid);
-		reference_setter = (void(*)(QofEntity*, QofEntity*))ref->param->param_setfcn;
+		reference_setter = (void(*)(QofInstance*, QofInstance*))ref->param->param_setfcn;
 		if((reference) && (reference_setter))
 		{
 			qof_begin_edit((QofInstance*)ent);
@@ -66,10 +66,10 @@
 			qof_commit_edit((QofInstance*)reference);
 		}
 		/* collect and choice handling */
-		collect_setter = (void(*)(QofEntity*, QofCollection*))ref->param->param_setfcn;
-		choice_setter = (void(*)(QofEntity*, QofEntity*))ref->param->param_setfcn;
+		collect_setter = (void(*)(QofInstance*, QofCollection*))ref->param->param_setfcn;
+		choice_setter = (void(*)(QofInstance*, QofInstance*))ref->param->param_setfcn;
 		if ((0 == safe_strcmp(ref->param->param_type, QOF_TYPE_COLLECT)) &&
-			(0 == guid_compare(qof_entity_get_guid(ent), ref->ent_guid)) &&
+			(0 == guid_compare(qof_instance_get_guid(ent), ref->ent_guid)) &&
 			(0 == safe_strcmp(ref->type, ent->e_type)))
 		{
 			QofCollection *temp_col;
@@ -113,18 +113,18 @@
 	qof_object_foreach(obj->e_type, book, entity_set_reference_cb, book);
 }
 
-static QofEntityReference*
-create_reference(QofEntity *ent, const QofParam *param)
+static QofInstanceReference*
+create_reference(QofInstance *ent, const QofParam *param)
 {
-	QofEntityReference *reference;
-	QofEntity          *ref_ent;
+	QofInstanceReference *reference;
+	QofInstance          *ref_ent;
 	const GUID         *cm_guid;
 	char                cm_sa[GUID_ENCODING_LENGTH + 1];
 	gchar              *cm_string;
 
-	ref_ent = (QofEntity*)param->param_getfcn(ent, param);
+	ref_ent = QOF_INSTANCE(param->param_getfcn(ent, param));
 	if(!ref_ent) { return NULL; }
-	reference = g_new0(QofEntityReference, 1);
+	reference = g_new0(QofInstanceReference, 1);
 	reference->type = ent->e_type;
 	reference->ref_guid = g_new(GUID, 1);
 	reference->ent_guid = &ent->guid;
@@ -133,7 +133,7 @@
 		reference->choice_type = ref_ent->e_type; 
 	}
 	reference->param = param;
-	cm_guid = qof_entity_get_guid(ref_ent);
+	cm_guid = qof_instance_get_guid(ref_ent);
 	guid_to_string_buff(cm_guid, cm_sa);
 	cm_string = g_strdup(cm_sa);
 	if(TRUE == string_to_guid(cm_string, reference->ref_guid)) {
@@ -144,8 +144,8 @@
 	return NULL;
 }
 
-QofEntityReference*
-qof_entity_get_reference_from(QofEntity *ent, const QofParam *param)
+QofInstanceReference*
+qof_instance_get_reference_from(QofInstance *ent, const QofParam *param)
 {
 	g_return_val_if_fail(param, NULL);
 	param = qof_class_get_parameter(ent->e_type, param->param_name);

Modified: gnucash/branches/gda-dev/lib/libqof/qof/qofreference.h
===================================================================
--- gnucash/branches/gda-dev/lib/libqof/qof/qofreference.h	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/lib/libqof/qof/qofreference.h	2007-04-14 00:35:53 UTC (rev 15878)
@@ -39,15 +39,15 @@
 
 Different backends have different requirements for a complete book - some
 (like gnucash) are highly customised to that application - however all complete
-QofBooks must be self-contained, only a partial book uses QofEntityReference.
+QofBooks must be self-contained, only a partial book uses QofInstanceReference.
 
 To retain the relationships between entities, including between a partial and 
-a complete book, QofEntityReference data is stored in the QofBook. This data
+a complete book, QofInstanceReference data is stored in the QofBook. This data
 should be read by backends that support partial books so that the exported 
 data contains the GUID and QofIdType of the referenced entity. Even if that 
 entity does not then exist within the partial book, it can be located when
 the partial book is merged back into the original, complete, book. (Remember 
-that given the GUID and QofIdType of any QofEntity it is possible to uniquely
+that given the GUID and QofIdType of any QofInstance it is possible to uniquely
 identify that entity in another book.)
 
 Entities in partial books may need to refer to the entities that remain within
@@ -81,7 +81,7 @@
 The QSF backend rebuilds the references by linking to real entities.
 Other backends can process the list in similar ways.
 
-The list stores the QofEntityReference to the referenced entity -
+The list stores the QofInstanceReference to the referenced entity -
 a struct that contains the GUID and the QofIdType of the referenced
 entity as well as the parameter used to obtain the reference.
 
@@ -102,7 +102,7 @@
 Creates a GList stored in the Book hashtable to contain
 repeated references for a single entity.
 */
-typedef struct qof_entity_reference {
+typedef struct qof_instance_reference {
 	QofIdType       choice_type;/**< Used when the reference is a QOF_TYPE_CHOICE type
 	- stores the actual type of the reference from the list of available choices. */
 	QofIdType       type;       /**< The type of the original entity -
@@ -112,7 +112,7 @@
 	const QofParam  *param;      /**< The parameter of the original entity to use 
 	to get or set the reference. */
 	const GUID      *ent_guid;   /**< The GUID of the original entity. */
-}QofEntityReference;
+}QofInstanceReference;
 
 /** \brief Adds a new reference to the partial book data hash.
 
@@ -122,17 +122,17 @@
 partial.
 */
 void
-qof_session_update_reference_list(QofSession *session, QofEntityReference *reference);
+qof_session_update_reference_list(QofSession *session, QofInstanceReference *reference);
 
 /** Used as the key value for the QofBook data hash.
  *
  * Retrieved later by QSF (or any other suitable backend) to
- * rebuild the references from the QofEntityReference struct
+ * rebuild the references from the QofInstanceReference struct
  * that contains the QofIdType and GUID of the referenced entity
  * of the original QofBook as well as the parameter data and the
  * GUID of the original entity.
  * */
-#define ENTITYREFERENCE "QofEntityReference"
+#define ENTITYREFERENCE "QofInstanceReference"
 
 /** \brief Flag indicating a partial QofBook.
 
@@ -143,11 +143,11 @@
 
 #define PARTIAL_QOFBOOK "PartialQofBook"
 
-/** \brief Read QofEntityReference data for this book and set values.
+/** \brief Read QofInstanceReference data for this book and set values.
 
 @param book The partial book containing the referenceList
 
-The referenceList is a GList of QofEntityReference structures that contain
+The referenceList is a GList of QofInstanceReference structures that contain
 the GUID of each end of a reference. e.g. where one entity refers to another.
 
 The referenceList is used in partial books to store relationships between
@@ -173,14 +173,14 @@
 been checked \b NOT to be QOF_TYPE_COLLECT or other known QOF types
 because this function expects to return a single reference and
 a collect parameter would need to return a list of references, other
-parameters would not return a viable QofEntity. (A string cannot be
+parameters would not return a viable QofInstance. (A string cannot be
 cast to an entity.)
 
 Used in the preparation of a partial QofBook when the known entity
 (the one currently being copied into the partial book) refers to
 any other entity, usually as a parent or child.
 The routine calls the param_getfcn of the supplied parameter,
-which must return an object (QofEntity*), not a known QOF data type, to
+which must return an object (QofInstance*), not a known QOF data type, to
 retrieve the referenced entity and therefore the GUID. The GUID of
 both entities are stored in the reference which then needs to be added
 to the reference list which is added to the partial book data hash.
@@ -199,10 +199,10 @@
 @param ent   The known entity.
 @param param  The parameter to use to get the referenced entity.
 
- at return FALSE on error, otherwise a pointer to the QofEntityReference.
+ at return FALSE on error, otherwise a pointer to the QofInstanceReference.
 */
-QofEntityReference*
-qof_entity_get_reference_from(QofEntity *ent, const QofParam *param);
+QofInstanceReference*
+qof_instance_get_reference_from(QofInstance *ent, const QofParam *param);
 
 /** @} */
 /** @} */

Modified: gnucash/branches/gda-dev/lib/libqof/qof/qofsession-p.h
===================================================================
--- gnucash/branches/gda-dev/lib/libqof/qof/qofsession-p.h	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/lib/libqof/qof/qofsession-p.h	2007-04-14 00:35:53 UTC (rev 15878)
@@ -38,7 +38,7 @@
    * an Entity.  NOTE:  THIS IS NOT AN ENTITY!  THE ONLY PART OF ENTITY
    * THAT IS VALID IS E_TYPE!
    */
-  QofEntity entity;
+  QofInstance entity;
 
   /* A book holds pointers to the various types of datasets.
    * A session may have multiple books. */

Modified: gnucash/branches/gda-dev/lib/libqof/qof/qofsession.c
===================================================================
--- gnucash/branches/gda-dev/lib/libqof/qof/qofsession.c	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/lib/libqof/qof/qofsession.c	2007-04-14 00:35:53 UTC (rev 15878)
@@ -305,15 +305,15 @@
 
 /* =============================================================== */
 
-typedef struct qof_entity_copy_data {
-	QofEntity *from;
-	QofEntity *to;
+typedef struct qof_instance_copy_data {
+	QofInstance *from;
+	QofInstance *to;
 	QofParam  *param;
 	GList  *referenceList;
 	GSList *param_list;
 	QofSession *new_session;
 	gboolean error;
-}QofEntityCopyData;
+}QofInstanceCopyData;
 
 static void
 qof_book_set_partial(QofBook *book)
@@ -328,7 +328,7 @@
 }
 
 void
-qof_session_update_reference_list(QofSession *session, QofEntityReference *reference)
+qof_session_update_reference_list(QofSession *session, QofInstanceReference *reference)
 {
 	QofBook  *book;
 	GList    *book_ref_list;
@@ -341,12 +341,12 @@
 }
 
 static void
-qof_entity_param_cb(QofParam *param, gpointer data)
+qof_instance_param_cb(QofParam *param, gpointer data)
 {
-	QofEntityCopyData *qecd;
+	QofInstanceCopyData *qecd;
 
 	g_return_if_fail(data != NULL);
-	qecd = (QofEntityCopyData*)data;
+	qecd = (QofInstanceCopyData*)data;
 	g_return_if_fail(param != NULL);
 	/* KVP doesn't need a set routine to be copied. */
 	if(0 == safe_strcmp(param->param_type, QOF_TYPE_KVP)) {
@@ -359,24 +359,24 @@
 }
 
 static void
-col_ref_cb (QofEntity* ref_ent, gpointer user_data)
+col_ref_cb (QofInstance* ref_ent, gpointer user_data)
 {
-	QofEntityReference *ref;
-	QofEntityCopyData  *qecd;
-	QofEntity *ent;
+	QofInstanceReference *ref;
+	QofInstanceCopyData  *qecd;
+	QofInstance *ent;
 	const GUID   *cm_guid;
 	char         cm_sa[GUID_ENCODING_LENGTH + 1];
 	gchar        *cm_string;
 
-	qecd = (QofEntityCopyData*)user_data;
+	qecd = (QofInstanceCopyData*)user_data;
 	ent = qecd->from;
-	ref = g_new0(QofEntityReference, 1);
+	ref = g_new0(QofInstanceReference, 1);
 	ref->type = ent->e_type;
 	ref->ref_guid = g_new(GUID, 1);
 	ref->ent_guid = &ent->guid;
 	ref->param = qof_class_get_parameter(ent->e_type, 
 		qecd->param->param_name);
-	cm_guid = qof_entity_get_guid(ref_ent);
+	cm_guid = qof_instance_get_guid(ref_ent);
 	guid_to_string_buff(cm_guid, cm_sa);
 	cm_string = g_strdup(cm_sa);
 	if(TRUE == string_to_guid(cm_string, ref->ref_guid)) {
@@ -386,11 +386,11 @@
 }
 
 static void
-qof_entity_foreach_copy(gpointer data, gpointer user_data)
+qof_instance_foreach_copy(gpointer data, gpointer user_data)
 {
-	QofEntity          *importEnt, *targetEnt/*, *referenceEnt*/;
-	QofEntityCopyData 	*context;
-	QofEntityReference  *reference;
+	QofInstance          *importEnt, *targetEnt/*, *referenceEnt*/;
+	QofInstanceCopyData 	*context;
+	QofInstanceReference  *reference;
 	gboolean		registered_type;
 	/* cm_ prefix used for variables that hold the data to commit */
 	QofParam 		*cm_param;
@@ -399,26 +399,26 @@
 	KvpFrame 		*cm_kvp;
 	QofCollection *cm_col;
 	/* function pointers and variables for parameter getters that don't use pointers normally */
-	gnc_numeric 	cm_numeric, (*numeric_getter)	(QofEntity*, QofParam*);
-	double 			cm_double, 	(*double_getter)	(QofEntity*, QofParam*);
-	gboolean 		cm_boolean, (*boolean_getter)	(QofEntity*, QofParam*);
-	gint32 			cm_i32, 	(*int32_getter)		(QofEntity*, QofParam*);
-	gint64 			cm_i64, 	(*int64_getter)		(QofEntity*, QofParam*);
-	Timespec 		cm_date, 	(*date_getter)		(QofEntity*, QofParam*);
+	gnc_numeric 	cm_numeric, (*numeric_getter)	(QofInstance*, QofParam*);
+	double 			cm_double, 	(*double_getter)	(QofInstance*, QofParam*);
+	gboolean 		cm_boolean, (*boolean_getter)	(QofInstance*, QofParam*);
+	gint32 			cm_i32, 	(*int32_getter)		(QofInstance*, QofParam*);
+	gint64 			cm_i64, 	(*int64_getter)		(QofInstance*, QofParam*);
+	Timespec 		cm_date, 	(*date_getter)		(QofInstance*, QofParam*);
 	/* function pointers to the parameter setters */
-	void	(*string_setter)	(QofEntity*, const char*);
-	void	(*date_setter)		(QofEntity*, Timespec);
-	void	(*numeric_setter)	(QofEntity*, gnc_numeric);
-	void	(*guid_setter)		(QofEntity*, const GUID*);
-	void	(*double_setter)	(QofEntity*, double);
-	void	(*boolean_setter)	(QofEntity*, gboolean);
-	void	(*i32_setter)		(QofEntity*, gint32);
-	void	(*i64_setter)		(QofEntity*, gint64);
-	void	(*char_setter)		(QofEntity*, char*);
-	void	(*kvp_frame_setter)	(QofEntity*, KvpFrame*);
+	void	(*string_setter)	(QofInstance*, const char*);
+	void	(*date_setter)		(QofInstance*, Timespec);
+	void	(*numeric_setter)	(QofInstance*, gnc_numeric);
+	void	(*guid_setter)		(QofInstance*, const GUID*);
+	void	(*double_setter)	(QofInstance*, double);
+	void	(*boolean_setter)	(QofInstance*, gboolean);
+	void	(*i32_setter)		(QofInstance*, gint32);
+	void	(*i64_setter)		(QofInstance*, gint64);
+	void	(*char_setter)		(QofInstance*, char*);
+	void	(*kvp_frame_setter)	(QofInstance*, KvpFrame*);
 	
 	g_return_if_fail(user_data != NULL);
-	context = (QofEntityCopyData*) user_data;
+	context = (QofInstanceCopyData*) user_data;
 	cm_date.tv_nsec = 0;
 	cm_date.tv_sec =  0;
 	importEnt = context->from;
@@ -430,63 +430,63 @@
 	if(safe_strcmp(cm_param->param_type, QOF_TYPE_STRING) == 0)  { 
 		cm_string = (gchar*)cm_param->param_getfcn(importEnt, cm_param);
 		if(cm_string) {
-		string_setter = (void(*)(QofEntity*, const char*))cm_param->param_setfcn;
+		string_setter = (void(*)(QofInstance*, const char*))cm_param->param_setfcn;
 		if(string_setter != NULL) {	string_setter(targetEnt, cm_string); }
 		}
 		registered_type = TRUE;
 	}
 	if(safe_strcmp(cm_param->param_type, QOF_TYPE_DATE) == 0) { 
-		date_getter = (Timespec (*)(QofEntity*, QofParam*))cm_param->param_getfcn;
+		date_getter = (Timespec (*)(QofInstance*, QofParam*))cm_param->param_getfcn;
 		cm_date = date_getter(importEnt, cm_param);
-		date_setter = (void(*)(QofEntity*, Timespec))cm_param->param_setfcn;
+		date_setter = (void(*)(QofInstance*, Timespec))cm_param->param_setfcn;
 		if(date_setter != NULL) { date_setter(targetEnt, cm_date); }
 		registered_type = TRUE;
 	}
 	if((safe_strcmp(cm_param->param_type, QOF_TYPE_NUMERIC) == 0)  ||
 	(safe_strcmp(cm_param->param_type, QOF_TYPE_DEBCRED) == 0)) { 
-		numeric_getter = (gnc_numeric (*)(QofEntity*, QofParam*))cm_param->param_getfcn;
+		numeric_getter = (gnc_numeric (*)(QofInstance*, QofParam*))cm_param->param_getfcn;
 		cm_numeric = numeric_getter(importEnt, cm_param);
-		numeric_setter = (void(*)(QofEntity*, gnc_numeric))cm_param->param_setfcn;
+		numeric_setter = (void(*)(QofInstance*, gnc_numeric))cm_param->param_setfcn;
 		if(numeric_setter != NULL) { numeric_setter(targetEnt, cm_numeric); }
 		registered_type = TRUE;
 	}
 	if(safe_strcmp(cm_param->param_type, QOF_TYPE_GUID) == 0) { 
 		cm_guid = (const GUID*)cm_param->param_getfcn(importEnt, cm_param);
-		guid_setter = (void(*)(QofEntity*, const GUID*))cm_param->param_setfcn;
+		guid_setter = (void(*)(QofInstance*, const GUID*))cm_param->param_setfcn;
 		if(guid_setter != NULL) { guid_setter(targetEnt, cm_guid); }
 		registered_type = TRUE;
 	}
 	if(safe_strcmp(cm_param->param_type, QOF_TYPE_INT32) == 0) { 
-		int32_getter = (gint32 (*)(QofEntity*, QofParam*)) cm_param->param_getfcn;
+		int32_getter = (gint32 (*)(QofInstance*, QofParam*)) cm_param->param_getfcn;
 		cm_i32 = int32_getter(importEnt, cm_param);
-		i32_setter = (void(*)(QofEntity*, gint32))cm_param->param_setfcn;
+		i32_setter = (void(*)(QofInstance*, gint32))cm_param->param_setfcn;
 		if(i32_setter != NULL) { i32_setter(targetEnt, cm_i32); }
 		registered_type = TRUE;
 	}
 	if(safe_strcmp(cm_param->param_type, QOF_TYPE_INT64) == 0) { 
-		int64_getter = (gint64 (*)(QofEntity*, QofParam*)) cm_param->param_getfcn;
+		int64_getter = (gint64 (*)(QofInstance*, QofParam*)) cm_param->param_getfcn;
 		cm_i64 = int64_getter(importEnt, cm_param);
-		i64_setter = (void(*)(QofEntity*, gint64))cm_param->param_setfcn;
+		i64_setter = (void(*)(QofInstance*, gint64))cm_param->param_setfcn;
 		if(i64_setter != NULL) { i64_setter(targetEnt, cm_i64); }
 		registered_type = TRUE;
 	}
 	if(safe_strcmp(cm_param->param_type, QOF_TYPE_DOUBLE) == 0) { 
-		double_getter = (double (*)(QofEntity*, QofParam*)) cm_param->param_getfcn;
+		double_getter = (double (*)(QofInstance*, QofParam*)) cm_param->param_getfcn;
 		cm_double = double_getter(importEnt, cm_param);
-		double_setter = (void(*)(QofEntity*, double))cm_param->param_setfcn;
+		double_setter = (void(*)(QofInstance*, double))cm_param->param_setfcn;
 		if(double_setter != NULL) { double_setter(targetEnt, cm_double); }
 		registered_type = TRUE;
 	}
 	if(safe_strcmp(cm_param->param_type, QOF_TYPE_BOOLEAN) == 0){ 
-		boolean_getter = (gboolean (*)(QofEntity*, QofParam*)) cm_param->param_getfcn;
+		boolean_getter = (gboolean (*)(QofInstance*, QofParam*)) cm_param->param_getfcn;
 		cm_boolean = boolean_getter(importEnt, cm_param);
-		boolean_setter = (void(*)(QofEntity*, gboolean))cm_param->param_setfcn;
+		boolean_setter = (void(*)(QofInstance*, gboolean))cm_param->param_setfcn;
 		if(boolean_setter != NULL) { boolean_setter(targetEnt, cm_boolean); }
 		registered_type = TRUE;
 	}
 	if(safe_strcmp(cm_param->param_type, QOF_TYPE_KVP) == 0) { 
 		cm_kvp = (KvpFrame*)cm_param->param_getfcn(importEnt,cm_param);
-		kvp_frame_setter = (void(*)(QofEntity*, KvpFrame*))cm_param->param_setfcn;
+		kvp_frame_setter = (void(*)(QofInstance*, KvpFrame*))cm_param->param_setfcn;
 		if(kvp_frame_setter != NULL) { kvp_frame_setter(targetEnt, cm_kvp); }
 		else
 		{
@@ -500,7 +500,7 @@
 	}
 	if(safe_strcmp(cm_param->param_type, QOF_TYPE_CHAR) == 0) { 
 		cm_char = (gchar*)cm_param->param_getfcn(importEnt,cm_param);
-		char_setter = (void(*)(QofEntity*, char*))cm_param->param_setfcn;
+		char_setter = (void(*)(QofInstance*, char*))cm_param->param_setfcn;
 		if(char_setter != NULL) { char_setter(targetEnt, cm_char); }
 		registered_type = TRUE;
 	}
@@ -514,10 +514,10 @@
 		registered_type = TRUE;
 	}
 	if(registered_type == FALSE) {
-/*		referenceEnt = (QofEntity*)cm_param->param_getfcn(importEnt, cm_param);
+/*		referenceEnt = QOF_INSTANCE(cm_param->param_getfcn(importEnt, cm_param));
 		if(!referenceEnt) { return; }
 		if(!referenceEnt->e_type) { return; }*/
-		reference = qof_entity_get_reference_from(importEnt, cm_param);
+		reference = qof_instance_get_reference_from(importEnt, cm_param);
 		if(reference) {
 			qof_session_update_reference_list(context->new_session, reference);
 		}
@@ -525,9 +525,9 @@
 }
 
 static gboolean
-qof_entity_guid_match(QofSession *new_session, QofEntity *original)
+qof_instance_guid_match(QofSession *new_session, QofInstance *original)
 {
-	QofEntity *copy;
+	QofInstance *copy;
 	const GUID *g;
 	QofIdTypeConst type;
 	QofBook *targetBook;
@@ -537,7 +537,7 @@
 	g_return_val_if_fail(original != NULL, FALSE);
 	targetBook = qof_session_get_book(new_session);
 	g_return_val_if_fail(targetBook != NULL, FALSE);
-	g = qof_entity_get_guid(original);
+	g = qof_instance_get_guid(original);
 	type = g_strdup(original->e_type);
 	coll = qof_book_get_collection(targetBook, type);
 	copy = qof_collection_lookup_entity(coll, g);
@@ -546,19 +546,19 @@
 }
 
 static void
-qof_entity_list_foreach(gpointer data, gpointer user_data)
+qof_instance_list_foreach(gpointer data, gpointer user_data)
 {
-	QofEntityCopyData *qecd;
-	QofEntity *original;
+	QofInstanceCopyData *qecd;
+	QofInstance *original;
 	QofInstance *inst;
 	QofBook *book;
 	const GUID *g;
 	
 	g_return_if_fail(data != NULL);
-	original = (QofEntity*)data;
+	original = QOF_INSTANCE(data);
 	g_return_if_fail(user_data != NULL);
-	qecd = (QofEntityCopyData*)user_data;
-	if(qof_entity_guid_match(qecd->new_session, original)) { return; }
+	qecd = (QofInstanceCopyData*)user_data;
+	if(qof_instance_guid_match(qecd->new_session, original)) { return; }
 	qecd->from = original;
 	if(!qof_object_compliance(original->e_type, FALSE)) 
 	{
@@ -573,69 +573,69 @@
 		qecd->error = TRUE;
 		return;
 	}
-	qecd->to = &inst->entity;
-	g = qof_entity_get_guid(original);
-	qof_entity_set_guid(qecd->to, g);
+	qecd->to = inst;
+	g = qof_instance_get_guid(original);
+	qof_instance_set_guid(qecd->to, g);
 	if(qecd->param_list != NULL) { 
 		g_slist_free(qecd->param_list);
 		qecd->param_list = NULL;
 	}
-	qof_class_param_foreach(original->e_type, qof_entity_param_cb, qecd);
+	qof_class_param_foreach(original->e_type, qof_instance_param_cb, qecd);
 	qof_begin_edit(inst);
-	g_slist_foreach(qecd->param_list, qof_entity_foreach_copy, qecd);
+	g_slist_foreach(qecd->param_list, qof_instance_foreach_copy, qecd);
 	qof_commit_edit(inst);
 }
 
 static void
-qof_entity_coll_foreach(QofEntity *original, gpointer user_data)
+qof_instance_coll_foreach(QofInstance *original, gpointer user_data)
 {
-	QofEntityCopyData *qecd;
+	QofInstanceCopyData *qecd;
 	const GUID *g;
 	QofBook *targetBook;
 	QofCollection *coll;
-	QofEntity *copy;
+	QofInstance *copy;
 	
 	g_return_if_fail(user_data != NULL);
 	copy = NULL;
-	qecd = (QofEntityCopyData*)user_data;
+	qecd = (QofInstanceCopyData*)user_data;
 	targetBook = qof_session_get_book(qecd->new_session);
-	g = qof_entity_get_guid(original);
+	g = qof_instance_get_guid(original);
 	coll = qof_book_get_collection(targetBook, original->e_type);
 	copy = qof_collection_lookup_entity(coll, g);
 	if(copy) { qecd->error = TRUE; }
 }
 
 static void
-qof_entity_coll_copy(QofEntity *original, gpointer user_data)
+qof_instance_coll_copy(QofInstance *original, gpointer user_data)
 {
-	QofEntityCopyData *qecd;
+	QofInstanceCopyData *qecd;
 	QofBook *book;
 	QofInstance *inst;
 	const GUID *g;
 	
 	g_return_if_fail(user_data != NULL);
-	qecd = (QofEntityCopyData*)user_data;
+	qecd = (QofInstanceCopyData*)user_data;
 	book = qof_session_get_book(qecd->new_session);
 	if(!qof_object_compliance(original->e_type, TRUE)) { return; }
 	inst = (QofInstance*)qof_object_new_instance(original->e_type, book);
-	qecd->to = &inst->entity;
+	qecd->to = inst;
 	qecd->from = original;
-	g = qof_entity_get_guid(original);
-	qof_entity_set_guid(qecd->to, g);
+	g = qof_instance_get_guid(original);
+	qof_instance_set_guid(qecd->to, g);
 	qof_begin_edit(inst);
-	g_slist_foreach(qecd->param_list, qof_entity_foreach_copy, qecd);
+	g_slist_foreach(qecd->param_list, qof_instance_foreach_copy, qecd);
 	qof_commit_edit(inst);
 }
 
 gboolean 
-qof_entity_copy_to_session(QofSession* new_session, QofEntity* original)
+qof_instance_copy_to_session(QofSession* new_session, QofInstance* original)
 {
-	QofEntityCopyData qecd;
+	QofInstanceCopyData qecd;
 	QofInstance *inst;
 	QofBook *book;
 
 	if(!new_session || !original) { return FALSE; }
-	if(qof_entity_guid_match(new_session, original)) { return FALSE; }
+	if(qof_instance_guid_match(new_session, original)) { return FALSE; }
 	if(!qof_object_compliance(original->e_type, TRUE)) { return FALSE; }
 	qof_event_suspend();
 	qecd.param_list = NULL;
@@ -643,31 +643,31 @@
 	qecd.new_session = new_session;
 	qof_book_set_partial(book);
 	inst = (QofInstance*)qof_object_new_instance(original->e_type, book);
-	qecd.to = &inst->entity;
+	qecd.to = inst;
 	qecd.from = original;
-	qof_entity_set_guid(qecd.to, qof_entity_get_guid(original));
+	qof_instance_set_guid(qecd.to, qof_instance_get_guid(original));
 	qof_begin_edit(inst);
-	qof_class_param_foreach(original->e_type, qof_entity_param_cb, &qecd);
+	qof_class_param_foreach(original->e_type, qof_instance_param_cb, &qecd);
 	qof_commit_edit(inst);
 	if(g_slist_length(qecd.param_list) == 0) { return FALSE; }
-	g_slist_foreach(qecd.param_list, qof_entity_foreach_copy, &qecd);
+	g_slist_foreach(qecd.param_list, qof_instance_foreach_copy, &qecd);
 	g_slist_free(qecd.param_list);
 	qof_event_resume();
 	return TRUE;
 }
 
-gboolean qof_entity_copy_list(QofSession *new_session, GList *entity_list)
+gboolean qof_instance_copy_list(QofSession *new_session, GList *entity_list)
 {
-	QofEntityCopyData *qecd;
+	QofInstanceCopyData *qecd;
 
 	if(!new_session || !entity_list) { return FALSE; }
 	ENTER (" list=%d", g_list_length(entity_list));
-	qecd = g_new0(QofEntityCopyData, 1);
+	qecd = g_new0(QofInstanceCopyData, 1);
 	qof_event_suspend();
 	qecd->param_list = NULL;
 	qecd->new_session = new_session;
 	qof_book_set_partial(qof_session_get_book(new_session));
-	g_list_foreach(entity_list, qof_entity_list_foreach, qecd);
+	g_list_foreach(entity_list, qof_instance_list_foreach, qecd);
 	qof_event_resume();
 	if(qecd->error) 
 	{ 
@@ -679,9 +679,9 @@
 }
 
 gboolean 
-qof_entity_copy_coll(QofSession *new_session, QofCollection *entity_coll)
+qof_instance_copy_coll(QofSession *new_session, QofCollection *entity_coll)
 {
-	QofEntityCopyData qecd;
+	QofInstanceCopyData qecd;
 
 	g_return_val_if_fail(new_session, FALSE);
 	if(!entity_coll) { return FALSE; }
@@ -689,10 +689,10 @@
 	qecd.param_list = NULL;
 	qecd.new_session = new_session;
 	qof_book_set_partial(qof_session_get_book(qecd.new_session));
-	qof_collection_foreach(entity_coll, qof_entity_coll_foreach, &qecd);
+	qof_collection_foreach(entity_coll, qof_instance_coll_foreach, &qecd);
 	qof_class_param_foreach(qof_collection_get_type(entity_coll), 
-		qof_entity_param_cb, &qecd);
-	qof_collection_foreach(entity_coll, qof_entity_coll_copy, &qecd);
+		qof_instance_param_cb, &qecd);
+	qof_collection_foreach(entity_coll, qof_instance_coll_copy, &qecd);
 	if(qecd.param_list != NULL) { g_slist_free(qecd.param_list); }
 	qof_event_resume();
 	return TRUE;
@@ -707,25 +707,25 @@
 };
 
 static void
-recurse_collection_cb (QofEntity *ent, gpointer user_data)
+recurse_collection_cb (QofInstance *ent, gpointer user_data)
 {
 	struct recurse_s *store;
 
 	if(user_data == NULL) { return; }
 	store = (struct recurse_s*)user_data;
 	if(!ent || !store) { return; }
-	store->success = qof_entity_copy_to_session(store->session, ent);
+	store->success = qof_instance_copy_to_session(store->session, ent);
 	if(store->success) {
 	store->ent_list = g_list_append(store->ent_list, ent);
 	}
 }
 
 static void
-recurse_ent_cb(QofEntity *ent, gpointer user_data)
+recurse_ent_cb(QofInstance *ent, gpointer user_data)
 {
 	GList      *ref_list, *i, *j, *ent_list, *child_list;
 	QofParam   *ref_param;
-	QofEntity  *ref_ent, *child_ent;
+	QofInstance  *ref_ent, *child_ent;
 	QofSession *session;
 	struct recurse_s *store;
 	gboolean   success;
@@ -756,17 +756,17 @@
 			}
 			continue;
 		}
-		ref_ent = (QofEntity*)ref_param->param_getfcn(ent, ref_param);
+		ref_ent = QOF_INSTANCE(ref_param->param_getfcn(ent, ref_param));
 		if((ref_ent)&&(ref_ent->e_type))
 		{
-			store->success = qof_entity_copy_to_session(session, ref_ent);
+			store->success = qof_instance_copy_to_session(session, ref_ent);
 			if(store->success) { ent_list = g_list_append(ent_list, ref_ent); }
 		}
 	}
 	for(i = ent_list; i != NULL; i = i->next)
 	{
 		if(i->data == NULL) { continue; }
-		child_ent = (QofEntity*)i->data;
+		child_ent = QOF_INSTANCE(i->data);
 		if(child_ent == NULL) { continue; }
 		ref_list = qof_class_get_referenceList(child_ent->e_type);
 		for(j = ref_list; j != NULL; j = j->next)
@@ -776,7 +776,7 @@
 			ref_ent = ref_param->param_getfcn(child_ent, ref_param);
 			if(ref_ent != NULL)
 			{
-				success = qof_entity_copy_to_session(session, ref_ent);
+				success = qof_instance_copy_to_session(session, ref_ent);
 				if(success) { child_list = g_list_append(child_list, ref_ent); }
 			}
 		}
@@ -784,7 +784,7 @@
 	for(i = child_list; i != NULL; i = i->next)
 	{
 		if(i->data == NULL) { continue; }
-		ref_ent = (QofEntity*)i->data;
+		ref_ent = QOF_INSTANCE(i->data);
 		if(ref_ent == NULL) { continue; }
 		ref_list = qof_class_get_referenceList(ref_ent->e_type);
 		for(j = ref_list; j != NULL; j = j->next)
@@ -794,14 +794,14 @@
 			child_ent = ref_param->param_getfcn(ref_ent, ref_param);
 			if(child_ent != NULL)
 			{
-				qof_entity_copy_to_session(session, child_ent);
+				qof_instance_copy_to_session(session, child_ent);
 			}
 		}
 	}
 }
 
 gboolean
-qof_entity_copy_coll_r(QofSession *new_session, QofCollection *coll)
+qof_instance_copy_coll_r(QofSession *new_session, QofCollection *coll)
 {
 	struct recurse_s store;
 	gboolean success;
@@ -812,12 +812,12 @@
 	store.success = success;
 	store.ent_list = NULL;
 	store.ref_list = qof_class_get_referenceList(qof_collection_get_type(coll));
-	success = qof_entity_copy_coll(new_session, coll);
+	success = qof_instance_copy_coll(new_session, coll);
 	if(success){ qof_collection_foreach(coll, recurse_ent_cb, &store); }
 	return success;
 }
 
-gboolean qof_entity_copy_one_r(QofSession *new_session, QofEntity *ent)
+gboolean qof_instance_copy_one_r(QofSession *new_session, QofInstance *ent)
 {
 	struct recurse_s store;
 	QofCollection *coll;
@@ -828,7 +828,7 @@
 	success = TRUE;
 	store.success = success;
 	store.ref_list = qof_class_get_referenceList(ent->e_type);
-	success = qof_entity_copy_to_session(new_session, ent);
+	success = qof_instance_copy_to_session(new_session, ent);
 	if(success == TRUE) {
 		coll = qof_book_get_collection(qof_session_get_book(new_session), ent->e_type);
 		if(coll) { qof_collection_foreach(coll, recurse_ent_cb, &store); }

Modified: gnucash/branches/gda-dev/lib/libqof/qof/qofsession.h
===================================================================
--- gnucash/branches/gda-dev/lib/libqof/qof/qofsession.h	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/lib/libqof/qof/qofsession.h	2007-04-14 00:35:53 UTC (rev 15878)
@@ -264,7 +264,7 @@
 
 Copied entities are identical to the source entity, all parameters
 defined with ::QofAccessFunc and ::QofSetterFunc in QOF are copied
-and the ::GUID of the original ::QofEntity is set in the new entity.
+and the ::GUID of the original ::QofInstance is set in the new entity.
 Sessions containing copied entities are intended for use
 as mechanisms for data export.
 
@@ -280,19 +280,19 @@
 
 */
 
-/** \brief Copy a single QofEntity to another session
+/** \brief Copy a single QofInstance to another session
  
 Checks first that no entity in the session book contains
 the GUID of the source entity. 
 
  @param new_session - the target session
- @param original - the QofEntity* to copy
+ @param original - the QofInstance* to copy
 
 @return FALSE without copying if the session contains an entity
 with the same GUID already, otherwise TRUE.
 */
 
-gboolean qof_entity_copy_to_session(QofSession* new_session, QofEntity* original);
+gboolean qof_instance_copy_to_session(QofSession* new_session, QofInstance* original);
 
 /** @brief Copy a GList of entities to another session
 
@@ -301,18 +301,18 @@
 no support for handling collisions, instead use \ref BookMerge
 
 Note that the GList (e.g. from ::qof_sql_query_run) can contain
-QofEntity pointers of any ::QofIdType, in any sequence. As long
-as all members of the list are ::QofEntity*, and all GUID's are
+QofInstance pointers of any ::QofIdType, in any sequence. As long
+as all members of the list are ::QofInstance*, and all GUID's are
 unique, the list can be copied.
 
  @param new_session - the target session
- @param entity_list - a GList of QofEntity pointers of any type(s).
+ @param entity_list - a GList of QofInstance pointers of any type(s).
 
 @return FALSE, without copying, if new_session contains any entities
 with the same GUID. Otherwise TRUE.
 
 */
-gboolean qof_entity_copy_list(QofSession *new_session, GList *entity_list);
+gboolean qof_instance_copy_list(QofSession *new_session, GList *entity_list);
 
 /** @brief Copy a QofCollection of entities.
 
@@ -327,12 +327,12 @@
 with the same GUID. Otherwise TRUE.
 */
 
-gboolean qof_entity_copy_coll(QofSession *new_session, QofCollection *entity_coll);
+gboolean qof_instance_copy_coll(QofSession *new_session, QofCollection *entity_coll);
 
 /** \brief Recursively copy a collection of entities to a session.
 
 \note This function creates a <b>partial QofBook</b>. See 
-::qof_entity_copy_to_session for more information.
+::qof_instance_copy_to_session for more information.
 
 The QofBook in the new_session must \b not contain any entities
 with the same GUID as any entities to be copied - there is
@@ -341,7 +341,7 @@
 Objects can be defined solely in terms of QOF data types or
 as a mix of data types and other objects, which may in turn
 include other objects. These references can be copied recursively
-down to the third level. See ::QofEntityReference.
+down to the third level. See ::QofInstanceReference.
 
 \note This is a deep recursive copy - every referenced entity is copied
 to the new session, including all parameters. The starting point is all
@@ -358,7 +358,7 @@
 
 */
 gboolean
-qof_entity_copy_coll_r(QofSession *new_session, QofCollection *coll);
+qof_instance_copy_coll_r(QofSession *new_session, QofCollection *coll);
 
 /** \brief Recursively copy a single entity to a new session.
 
@@ -369,7 +369,7 @@
 
 This is a deep copy - all parameters of all referenced entities are copied. If 
 the top level entity has no references, this is identical to 
-::qof_entity_copy_to_session.
+::qof_instance_copy_to_session.
 
 @param ent A single entity that may or may not have references.
 
@@ -380,7 +380,7 @@
 one of the references fails to copy.
 */
 gboolean
-qof_entity_copy_one_r(QofSession *new_session, QofEntity *ent);
+qof_instance_copy_one_r(QofSession *new_session, QofInstance *ent);
 
 /** @} 
 */

Modified: gnucash/branches/gda-dev/lib/libqof/qof/qofsql.c
===================================================================
--- gnucash/branches/gda-dev/lib/libqof/qof/qofsql.c	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/lib/libqof/qof/qofsql.c	2007-04-14 00:35:53 UTC (rev 15878)
@@ -52,7 +52,7 @@
 	char * single_global_tablename;
 	KvpFrame *kvp_join;
 	GList *param_list;
-	QofEntity *inserted_entity;
+	QofInstance *inserted_entity;
 };
 
 /* ========================================================== */
@@ -573,7 +573,7 @@
 	QofIdTypeConst type;
 	sql_insert_statement *sis;
 	gboolean    registered_type;
-	QofEntity   *ent;
+	QofInstance   *ent;
 	struct tm   query_time;
 	time_t      query_time_t;
 	/* cm_ prefix used for variables that hold the data to commit */
@@ -588,15 +588,15 @@
 /*	KvpFrame       *cm_kvp;
 	KvpValue       *cm_value;
 	KvpValueType   cm_type;*/
-	void (*string_setter)    (QofEntity*, const char*);
-	void (*date_setter)      (QofEntity*, Timespec);
-	void (*numeric_setter)   (QofEntity*, gnc_numeric);
-	void (*double_setter)    (QofEntity*, double);
-	void (*boolean_setter)   (QofEntity*, gboolean);
-	void (*i32_setter)       (QofEntity*, gint32);
-	void (*i64_setter)       (QofEntity*, gint64);
-	void (*char_setter)      (QofEntity*, char);
-/*	void (*kvp_frame_setter) (QofEntity*, KvpFrame*);*/
+	void (*string_setter)    (QofInstance*, const char*);
+	void (*date_setter)      (QofInstance*, Timespec);
+	void (*numeric_setter)   (QofInstance*, gnc_numeric);
+	void (*double_setter)    (QofInstance*, double);
+	void (*boolean_setter)   (QofInstance*, gboolean);
+	void (*i32_setter)       (QofInstance*, gint32);
+	void (*i64_setter)       (QofInstance*, gint64);
+	void (*char_setter)      (QofInstance*, char);
+/*	void (*kvp_frame_setter) (QofInstance*, KvpFrame*);*/
 
 	g_return_if_fail(param || insert_string || query);
 	ent = query->inserted_entity;
@@ -606,12 +606,12 @@
 	ENTER (" param=%s param_type=%s type=%s content=%s", 
 		param->param_name, param->param_type, type, insert_string);
 	if(safe_strcmp(param->param_type, QOF_TYPE_STRING) == 0)  { 
-		string_setter = (void(*)(QofEntity*, const char*))param->param_setfcn;
+		string_setter = (void(*)(QofInstance*, const char*))param->param_setfcn;
 		if(string_setter != NULL) { string_setter(ent, insert_string); }
 		registered_type = TRUE;
 	}
 	if(safe_strcmp(param->param_type, QOF_TYPE_DATE) == 0) { 
-		date_setter = (void(*)(QofEntity*, Timespec))param->param_setfcn;
+		date_setter = (void(*)(QofInstance*, Timespec))param->param_setfcn;
 		strptime(insert_string, QOF_UTC_DATE_FORMAT, &query_time);
 		query_time_t = mktime(&query_time);
 		timespecFromTime_t(&cm_date, query_time_t);
@@ -619,7 +619,7 @@
 	}
 	if((safe_strcmp(param->param_type, QOF_TYPE_NUMERIC) == 0)  ||
 	(safe_strcmp(param->param_type, QOF_TYPE_DEBCRED) == 0)) { 
-		numeric_setter = (void(*)(QofEntity*, gnc_numeric))param->param_setfcn;
+		numeric_setter = (void(*)(QofInstance*, gnc_numeric))param->param_setfcn;
 		string_to_gnc_numeric(insert_string, &cm_numeric);
 		if(numeric_setter != NULL) { numeric_setter(ent, cm_numeric); }
 	}
@@ -633,10 +633,10 @@
 /*			reference_type = xmlGetProp(node, QSF_OBJECT_TYPE);
 		if(0 == safe_strcmp(QOF_PARAM_GUID, reference_type)) 
 		{
-			qof_entity_set_guid(qsf_ent, cm_guid);
+			qof_instance_set_guid(qsf_ent, cm_guid);
 		}
 		else {
-			reference = qof_entity_get_reference_from(qsf_ent, cm_param);
+			reference = qof_instance_get_reference_from(qsf_ent, cm_param);
 			if(reference) {
 				params->referenceList = g_list_append(params->referenceList, reference);
 			}
@@ -646,7 +646,7 @@
 		errno = 0;
 		cm_i32 = (gint32)strtol (insert_string, &tail, 0);
 		if(errno == 0) {
-			i32_setter = (void(*)(QofEntity*, gint32))param->param_setfcn;
+			i32_setter = (void(*)(QofInstance*, gint32))param->param_setfcn;
 			if(i32_setter != NULL) { i32_setter(ent, cm_i32); }
 		}
 		else 
@@ -663,7 +663,7 @@
 		errno = 0;
 		cm_i64 = strtoll(insert_string, &tail, 0);
 		if(errno == 0) {
-			i64_setter = (void(*)(QofEntity*, gint64))param->param_setfcn;
+			i64_setter = (void(*)(QofInstance*, gint64))param->param_setfcn;
 			if(i64_setter != NULL) { i64_setter(ent, cm_i64); }
 		}
 		else 
@@ -680,7 +680,7 @@
 		errno = 0;
 		cm_double = strtod(insert_string, &tail);
 		if(errno == 0) {
-			double_setter = (void(*)(QofEntity*, double))param->param_setfcn;
+			double_setter = (void(*)(QofInstance*, double))param->param_setfcn;
 			if(double_setter != NULL) { double_setter(ent, cm_double); }
 		}
 	}
@@ -691,7 +691,7 @@
 			cm_boolean = TRUE;
 		}
 		else { cm_boolean = FALSE; }
-		boolean_setter = (void(*)(QofEntity*, gboolean))param->param_setfcn;
+		boolean_setter = (void(*)(QofInstance*, gboolean))param->param_setfcn;
 		if(boolean_setter != NULL) { boolean_setter(ent, cm_boolean); }
 	}
 	if(safe_strcmp(param->param_type, QOF_TYPE_KVP) == 0) {
@@ -699,7 +699,7 @@
 	}
 	if(safe_strcmp(param->param_type, QOF_TYPE_CHAR) == 0) { 
 		cm_char = *insert_string;
-		char_setter = (void(*)(QofEntity*, char))param->param_setfcn;
+		char_setter = (void(*)(QofInstance*, char))param->param_setfcn;
 		if(char_setter != NULL) { char_setter(ent, cm_char); }
 	}
 	LEAVE (" ");
@@ -725,7 +725,7 @@
 	}
 }
 
-static QofEntity*
+static QofInstance*
 qof_query_insert(QofSqlQuery *query)
 {
 	GList *field_list, *value_list, *cur;
@@ -755,7 +755,7 @@
 		LEAVE (" unable to create instance of type %s", type); 
 		return NULL; 
 	}
-	query->inserted_entity = &inst->entity;
+	query->inserted_entity = inst;
 	value_list = sis->values;
 	for (field_list = sis->fields; field_list != NULL; field_list = field_list->next) 
 	{

Modified: gnucash/branches/gda-dev/lib/libqof/qof/qofsql.h
===================================================================
--- gnucash/branches/gda-dev/lib/libqof/qof/qofsql.h	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/lib/libqof/qof/qofsql.h	2007-04-14 00:35:53 UTC (rev 15878)
@@ -62,7 +62,7 @@
 underlying QofQuery code.
 
 However, by repeating queries and adding the entities to a new session using
-::qof_entity_copy_list, a series of queries can be added to a single
+::qof_instance_copy_list, a series of queries can be added to a single
 book. e.g. You can insert multiple entities and save out as a QSF XML
 file or use multiple SELECT queries to build a precise list - this
 can be used to replicate most of the functionality of a SQL join.
@@ -77,7 +77,7 @@
 entity in the QofBook, you can produce the effect of a join from running
 the two SELECT queries for each value of param_id held in 'value'.
 
-See ::QofEntityForeachCB and ::qof_object_foreach.
+See ::QofInstanceForeachCB and ::qof_object_foreach.
 
 Date queries handle full date and time strings, using the format
 exported by the QSF backend. To query dates and times, convert

Modified: gnucash/branches/gda-dev/lib/libqof/qof/qofutil.c
===================================================================
--- gnucash/branches/gda-dev/lib/libqof/qof/qofutil.c	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/lib/libqof/qof/qofutil.c	2007-04-14 00:35:53 UTC (rev 15878)
@@ -306,7 +306,7 @@
     }
     if (dirty && qof_get_alt_dirty_mode() && 
         !(inst->infant && inst->do_free)) {
-      qof_collection_mark_dirty(inst->entity.collection);
+      qof_collection_mark_dirty(inst->collection);
       qof_book_mark_dirty(inst->book);
     }
     inst->infant = FALSE;
@@ -397,7 +397,7 @@
 }
 
 gchar*
-qof_util_param_as_string(QofEntity *ent, QofParam *param)
+qof_util_param_as_string(QofInstance *ent, QofParam *param)
 {
 	gchar       *param_string, param_date[MAX_DATE_LENGTH];
 	gchar       param_sa[GUID_ENCODING_LENGTH + 1];
@@ -405,13 +405,13 @@
 	QofType     paramType;
 	const GUID *param_guid;
 	time_t      param_t;
-	gnc_numeric param_numeric,  (*numeric_getter) (QofEntity*, QofParam*);
-	Timespec    param_ts,       (*date_getter)    (QofEntity*, QofParam*);
-	double      param_double,   (*double_getter)  (QofEntity*, QofParam*);
-	gboolean    param_boolean,  (*boolean_getter) (QofEntity*, QofParam*);
-	gint32      param_i32,      (*int32_getter)   (QofEntity*, QofParam*);
-	gint64      param_i64,      (*int64_getter)   (QofEntity*, QofParam*);
-	gchar       param_char,     (*char_getter)    (QofEntity*, QofParam*);
+	gnc_numeric param_numeric,  (*numeric_getter) (QofInstance*, QofParam*);
+	Timespec    param_ts,       (*date_getter)    (QofInstance*, QofParam*);
+	double      param_double,   (*double_getter)  (QofInstance*, QofParam*);
+	gboolean    param_boolean,  (*boolean_getter) (QofInstance*, QofParam*);
+	gint32      param_i32,      (*int32_getter)   (QofInstance*, QofParam*);
+	gint64      param_i64,      (*int64_getter)   (QofInstance*, QofParam*);
+	gchar       param_char,     (*char_getter)    (QofInstance*, QofParam*);
 
 	param_string = NULL;
     known_type = FALSE;
@@ -423,7 +423,7 @@
 			return param_string;
 		}
 		if(safe_strcmp(paramType, QOF_TYPE_DATE) == 0) { 
-			date_getter = (Timespec (*)(QofEntity*, QofParam*))param->param_getfcn;
+			date_getter = (Timespec (*)(QofInstance*, QofParam*))param->param_getfcn;
 			param_ts = date_getter(ent, param);
 			param_t = timespecToTime_t(param_ts);
 			qof_strftime(param_date, MAX_DATE_LENGTH, 
@@ -434,7 +434,7 @@
 		}
 		if((safe_strcmp(paramType, QOF_TYPE_NUMERIC) == 0)  ||
 		(safe_strcmp(paramType, QOF_TYPE_DEBCRED) == 0)) { 
-			numeric_getter = (gnc_numeric (*)(QofEntity*, QofParam*)) param->param_getfcn;
+			numeric_getter = (gnc_numeric (*)(QofInstance*, QofParam*)) param->param_getfcn;
 			param_numeric = numeric_getter(ent, param);
 			param_string = g_strdup(gnc_numeric_to_string(param_numeric));
             known_type = TRUE;
@@ -448,28 +448,28 @@
 			return param_string;
 		}
 		if(safe_strcmp(paramType, QOF_TYPE_INT32) == 0) { 
-			int32_getter = (gint32 (*)(QofEntity*, QofParam*)) param->param_getfcn;
+			int32_getter = (gint32 (*)(QofInstance*, QofParam*)) param->param_getfcn;
 			param_i32 = int32_getter(ent, param);
 			param_string = g_strdup_printf("%d", param_i32);
             known_type = TRUE;
 			return param_string;
 		}
 		if(safe_strcmp(paramType, QOF_TYPE_INT64) == 0) { 
-			int64_getter = (gint64 (*)(QofEntity*, QofParam*)) param->param_getfcn;
+			int64_getter = (gint64 (*)(QofInstance*, QofParam*)) param->param_getfcn;
 			param_i64 = int64_getter(ent, param);
 			param_string = g_strdup_printf("%"G_GINT64_FORMAT, param_i64);
             known_type = TRUE;
 			return param_string;
 		}
 		if(safe_strcmp(paramType, QOF_TYPE_DOUBLE) == 0) { 
-			double_getter = (double (*)(QofEntity*, QofParam*)) param->param_getfcn;
+			double_getter = (double (*)(QofInstance*, QofParam*)) param->param_getfcn;
 			param_double = double_getter(ent, param);
 			param_string = g_strdup_printf("%f", param_double);
             known_type = TRUE;
 			return param_string;
 		}
 		if(safe_strcmp(paramType, QOF_TYPE_BOOLEAN) == 0){ 
-			boolean_getter = (gboolean (*)(QofEntity*, QofParam*)) param->param_getfcn;
+			boolean_getter = (gboolean (*)(QofInstance*, QofParam*)) param->param_getfcn;
 			param_boolean = boolean_getter(ent, param);
 			/* Boolean values need to be lowercase for QSF validation. */
 			if(param_boolean == TRUE) { param_string = g_strdup("true"); }
@@ -491,7 +491,7 @@
             return param_string; 
         }
 		if(safe_strcmp(paramType, QOF_TYPE_CHAR) == 0) { 
-			char_getter = (gchar (*)(QofEntity*, QofParam*)) param->param_getfcn;
+			char_getter = (gchar (*)(QofInstance*, QofParam*)) param->param_getfcn;
 			param_char = char_getter(ent, param);
             known_type = TRUE;
 			return g_strdup_printf("%c", param_char);
@@ -507,7 +507,7 @@
         }
         if(safe_strcmp(paramType, QOF_TYPE_CHOICE) == 0)
         {
-            QofEntity *child = NULL;
+            QofInstance *child = NULL;
             child = param->param_getfcn(ent, param);
             if(!child) { return param_string; }
             known_type = TRUE;
@@ -534,7 +534,7 @@
         }
         if(!known_type)
         {
-            QofEntity *child = NULL;
+            QofInstance *child = NULL;
             child = param->param_getfcn(ent, param);
             if(!child) { return param_string; }
             return g_strdup(qof_object_printable(child->e_type, child));
@@ -545,7 +545,8 @@
 void
 qof_init (void)
 {
-    qof_log_init();
+	g_type_init();
+	qof_log_init();
 	qof_util_get_string_cache ();
 	guid_init ();
 	qof_object_initialize ();

Modified: gnucash/branches/gda-dev/lib/libqof/qof/qofutil.h
===================================================================
--- gnucash/branches/gda-dev/lib/libqof/qof/qofutil.h	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/lib/libqof/qof/qofutil.h	2007-04-14 00:35:53 UTC (rev 15878)
@@ -235,7 +235,7 @@
 
 The returned string must be freed by the caller.
 */
-gchar* qof_util_param_as_string(QofEntity *ent, QofParam *param);
+gchar* qof_util_param_as_string(QofInstance *ent, QofParam *param);
 
 /** The QOF String Cache:
  *

Modified: gnucash/branches/gda-dev/packaging/win32/README
===================================================================
--- gnucash/branches/gda-dev/packaging/win32/README	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/packaging/win32/README	2007-04-14 00:35:53 UTC (rev 15878)
@@ -1,9 +1,9 @@
-These scripts try to download and install a Windows/mingw32 build
-environment for GnuCash on Windows. 
-
-For cross-compiling the windows executable on Linux, see the lower
-section of this file.
-
+These scripts try to download and install a Windows/mingw32 build
+environment for GnuCash on Windows. 
+
+For cross-compiling the windows executable on Linux, see the lower
+section of this file.
+
 Before you start with the automated build, you have to complete these
 steps manually. The directory variables are set in custom.sh.
 
@@ -11,10 +11,10 @@
 from http://www.mingw.org/download.shtml -> Current -> MSYS -> (bin, *.exe)
 to $DOWNLOAD_DIR
 
-* Install MSYS (no postinstall)
-to $MSYS_DIR
-
-* Download wget
+* Install MSYS (no postinstall)
+to $MSYS_DIR
+
+* Download wget
 from http://www.mingw.org/download.shtml -> Current -> mingwPORT -> (bin, wget-*)
 to $DOWNLOAD_DIR
 
@@ -49,17 +49,17 @@
 
 These steps need to be performed:
 
-1. Edit the file create_cross_mingw.sh and set the PREFIX= variable to
-   the preferred prefix of the mingw32 gcc/binutils on your
-   Linux. (It is strongly recommended to choose a different prefix
-   than your normal compiler toolchain in order to distinguish
-   your native vs. cross compiler more easily.) Then run the
-   script create_cross_mingw.sh - it will
-   download, compile, and install a mingw32 toolchain.
-
-2. Edit the file custom.sh: Make a globale search-and-replace of
-   '\\' into '/' so that all directories are specified in unix
-   conventions. Set the variable cross_compile to "yes". Then
+1. Edit the file create_cross_mingw.sh and set the PREFIX= variable to
+   the preferred prefix of the mingw32 gcc/binutils on your
+   Linux. (It is strongly recommended to choose a different prefix
+   than your normal compiler toolchain in order to distinguish
+   your native vs. cross compiler more easily.) Then run the
+   script create_cross_mingw.sh - it will
+   download, compile, and install a mingw32 toolchain.
+
+2. Edit the file custom.sh: Make a globale search-and-replace of
+   '\\' into '/' so that all directories are specified in unix
+   conventions. Set the variable cross_compile to "yes". Then
    adjust the directories in custom.sh according to your
    preferred installation, especially $GLOBAL_DIR.
 
@@ -72,11 +72,11 @@
    custom.sh. It should download, compile, and install everything
    automatically. Eventually the windows gnucash is installed into
    $GNUCASH_DIR. 
-
-5. The content of $GNUCASH_DIR (as well as all the other binary
-   packages) should then be copied to a windows machine. The paths
-   in $GNUCASH_DIR/bin/gnucash and/or $GNUCASH_DIR/bin/gnucash.bat
-   need to be adjusted for the installation location on the
-   windows machine.
-
-Good luck!
+
+5. The content of $GNUCASH_DIR (as well as all the other binary
+   packages) should then be copied to a windows machine. The paths
+   in $GNUCASH_DIR/bin/gnucash and/or $GNUCASH_DIR/bin/gnucash.bat
+   need to be adjusted for the installation location on the
+   windows machine.
+
+Good luck!

Modified: gnucash/branches/gda-dev/src/app-utils/gnc-component-manager.c
===================================================================
--- gnucash/branches/gda-dev/src/app-utils/gnc-component-manager.c	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/src/app-utils/gnc-component-manager.c	2007-04-14 00:35:53 UTC (rev 15878)
@@ -253,12 +253,12 @@
 }
 
 static void
-gnc_cm_event_handler (QofEntity *entity,
+gnc_cm_event_handler (QofInstance *entity,
                       QofEventId event_type,
                       gpointer user_data,
 		      gpointer event_data)
 {
-  const GUID *guid = qof_entity_get_guid(entity);
+  const GUID *guid = qof_instance_get_guid(entity);
 #if CM_DEBUG
   fprintf (stderr, "event_handler: event %d, entity %p, guid %s\n", event_type,
 	   entity, guid);

Modified: gnucash/branches/gda-dev/src/app-utils/gnc-sx-instance-model.c
===================================================================
--- gnucash/branches/gda-dev/src/app-utils/gnc-sx-instance-model.c	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/src/app-utils/gnc-sx-instance-model.c	2007-04-14 00:35:53 UTC (rev 15878)
@@ -56,7 +56,7 @@
 
 static GncSxVariable* gnc_sx_variable_new(gchar *name);
 
-static void _gnc_sx_instance_event_handler(QofEntity *ent, QofEventId event_type, gpointer user_data, gpointer evt_data);
+static void _gnc_sx_instance_event_handler(QofInstance *ent, QofEventId event_type, gpointer user_data, gpointer evt_data);
 
 /* ------------------------------------------------------------ */
 
@@ -301,13 +301,13 @@
 
     if (! parent->variable_names_parsed)
     {
-        parent->variable_names = g_hash_table_new(g_str_hash, g_str_equal);
+        parent->variable_names = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free);
         gnc_sx_get_variables(parent->sx, parent->variable_names);
         g_hash_table_foreach(parent->variable_names, (GHFunc)_wipe_parsed_sx_var, NULL);
         parent->variable_names_parsed = TRUE;
     }
 
-    rtn->variable_bindings = g_hash_table_new(g_str_hash, g_str_equal);
+    rtn->variable_bindings = g_hash_table_new_full(g_str_hash, g_str_equal, NULL, g_free);
     g_hash_table_foreach(parent->variable_names, _clone_sx_var_hash_entry, rtn->variable_bindings);
 
     {
@@ -337,8 +337,6 @@
 {
     GList *vars = NULL;
     g_hash_table_foreach(inst->variable_bindings, _build_list_from_hash_elts, &vars);
-    // @@fixme sort by name
-    // @@fixme make sure the returned list is freed by callers.
     return vars;
 }
 
@@ -373,7 +371,7 @@
             seq_num = gnc_sx_get_instance_count(sx, postponed->data);
             inst = gnc_sx_instance_new(instances, SX_INSTANCE_STATE_POSTPONED, &inst_date, postponed->data, seq_num);
             //inst->temporal_state = postponed->data;
-            instances->list = g_list_append(instances->list, inst);
+            instances->instance_list = g_list_append(instances->instance_list, inst);
         }
     }
 
@@ -388,7 +386,7 @@
         int seq_num;
         seq_num = gnc_sx_get_instance_count(sx, sequence_ctx);
         inst = gnc_sx_instance_new(instances, SX_INSTANCE_STATE_TO_CREATE, &cur_date, sequence_ctx, seq_num);
-        instances->list = g_list_append(instances->list, inst);
+        instances->instance_list = g_list_append(instances->instance_list, inst);
         gnc_sx_incr_temporal_state(sx, sequence_ctx);
         cur_date = xaccSchedXactionGetInstanceAfter(sx, &cur_date, sequence_ctx);
     }
@@ -400,7 +398,7 @@
         int seq_num;
         seq_num = gnc_sx_get_instance_count(sx, sequence_ctx);
         inst = gnc_sx_instance_new(instances, SX_INSTANCE_STATE_REMINDER, &cur_date, sequence_ctx, seq_num);
-        instances->list = g_list_append(instances->list, inst);
+        instances->instance_list = g_list_append(instances->instance_list, inst);
         gnc_sx_incr_temporal_state(sx, sequence_ctx);
         cur_date = xaccSchedXactionGetInstanceAfter(sx, &cur_date, sequence_ctx);
     }
@@ -500,9 +498,13 @@
 static void
 gnc_sx_instance_free(GncSxInstance *instance)
 {
-    // @fixme:
-    // variable_bindings elts + map
-    // temporal_state (iff not postponed?)
+    gnc_sx_destroy_temporal_state(instance->temporal_state);
+
+    if (instance->variable_bindings != NULL)
+    {
+        g_hash_table_destroy(instance->variable_bindings);
+    }
+    instance->variable_bindings = NULL;
      
     g_free(instance);
 }
@@ -511,17 +513,22 @@
 gnc_sx_instances_free(GncSxInstances *instances)
 {
     GList *instance_iter;
-    // @fixme:
-    // variable_names
-    // sx = null
 
-    for (instance_iter = instances->list; instance_iter != NULL; instance_iter = instance_iter->next)
+    if (instances->variable_names != NULL)
     {
+        g_hash_table_destroy(instances->variable_names);
+    }
+    instances->variable_names = NULL;
+
+    instances->sx = NULL;
+
+    for (instance_iter = instances->instance_list; instance_iter != NULL; instance_iter = instance_iter->next)
+    {
         GncSxInstance *inst = (GncSxInstance*)instance_iter->data;
         gnc_sx_instance_free(inst);
     }
-    g_list_free(instances->list);
-    instances->list = NULL;
+    g_list_free(instances->instance_list);
+    instances->instance_list = NULL;
 
     g_free(instances);
 }
@@ -612,7 +619,7 @@
 }
 
 static void
-_gnc_sx_instance_event_handler(QofEntity *ent, QofEventId event_type, gpointer user_data, gpointer evt_data)
+_gnc_sx_instance_event_handler(QofInstance *ent, QofEventId event_type, gpointer user_data, gpointer evt_data)
 {
     GncSxInstanceModel *instances = GNC_SX_INSTANCE_MODEL(user_data);
 
@@ -739,8 +746,8 @@
         // step through the lists pairwise, and retain the existing
         // instance if the dates align, as soon as they don't stop and
         // cleanup.
-        existing_iter = existing->list;
-        new_iter = new_instances->list;
+        existing_iter = existing->instance_list;
+        new_iter = new_instances->instance_list;
         for (; existing_iter != NULL && new_iter != NULL; existing_iter = existing_iter->next, new_iter = new_iter->next)
         {
             GncSxInstance *existing_inst, *new_inst;
@@ -759,7 +766,7 @@
         if (existing_remain)
         {
             // delete excess
-            gnc_g_list_cut(&existing->list, existing_iter);
+            gnc_g_list_cut(&existing->instance_list, existing_iter);
             g_list_foreach(existing_iter, (GFunc)gnc_sx_instance_free, NULL);
         }
 
@@ -767,13 +774,13 @@
         {
             // append new
             GList *new_iter_iter;
-            gnc_g_list_cut(&new_instances->list, new_iter);
+            gnc_g_list_cut(&new_instances->instance_list, new_iter);
 
             for (new_iter_iter = new_iter; new_iter_iter != NULL; new_iter_iter = new_iter_iter->next)
             {
                 GncSxInstance *inst = (GncSxInstance*)new_iter_iter->data;
                 inst->parent = existing;
-                existing->list = g_list_append(existing->list, new_iter_iter->data);
+                existing->instance_list = g_list_append(existing->instance_list, new_iter_iter->data);
             }
             g_list_free(new_iter);
         }
@@ -797,11 +804,14 @@
         added_var_names = added_cb_data.list;
         g_debug("%d added variables", g_list_length(added_var_names));
 
-        g_hash_table_destroy(existing->variable_names);
+        if (existing->variable_names != NULL)
+        {
+            g_hash_table_destroy(existing->variable_names);
+        }
         existing->variable_names = new_instances->variable_names;
         new_instances->variable_names = NULL;
 
-        for (inst_iter = existing->list; inst_iter != NULL; inst_iter = inst_iter->next)
+        for (inst_iter = existing->instance_list; inst_iter != NULL; inst_iter = inst_iter->next)
         {
             GList *var_iter;
             GncSxInstance *inst = (GncSxInstance*)inst_iter->data;
@@ -888,10 +898,10 @@
                                       NULL);
     if (kvp_val == NULL)
     {
-        // @@fixme: this should be more of an assert...
         GString *err = g_string_new("");
         g_string_printf(err, "Null account kvp value for SX [%s], cancelling creation.",
                         xaccSchedXactionGetName(instance->parent->sx));
+        g_critical("%s", err->str);
         *creation_errors = g_list_append(*creation_errors, err);
         return FALSE;
     }
@@ -943,7 +953,11 @@
                             gnc_exp_parser_error_string());
             *creation_errors = g_list_append(*creation_errors, err);
         }
-        g_hash_table_destroy(parser_vars);
+
+        if (parser_vars != NULL)
+        {
+            g_hash_table_destroy(parser_vars);
+        }
     }
 }
 
@@ -1176,14 +1190,14 @@
         // If there are no instances, then skip; specifically, skip
         // re-setting SchedXaction fields, which will dirty the book
         // spuriously.
-        if (g_list_length(instances->list) == 0)
+        if (g_list_length(instances->instance_list) == 0)
             continue;
 
         last_occur_date = xaccSchedXactionGetLastOccurDate(instances->sx);
         instance_count = gnc_sx_get_instance_count(instances->sx, NULL);
         remain_occur_count = xaccSchedXactionGetRemOccur(instances->sx);
 
-        for (instance_iter = instances->list; instance_iter != NULL; instance_iter = instance_iter->next)
+        for (instance_iter = instances->instance_list; instance_iter != NULL; instance_iter = instance_iter->next)
         {
             GncSxInstance *inst = (GncSxInstance*)instance_iter->data;
             gboolean sx_is_auto_create;
@@ -1255,7 +1269,7 @@
     // ensure 'remind' constraints are met:
     {
         GList *inst_iter;
-        inst_iter = g_list_find(instance->parent->list, instance);
+        inst_iter = g_list_find(instance->parent->instance_list, instance);
         g_assert(inst_iter != NULL);
         if (instance->state != SX_INSTANCE_STATE_REMINDER)
         {
@@ -1312,7 +1326,7 @@
     for (sx_iter = model->sx_instance_list; sx_iter != NULL; sx_iter = sx_iter->next)
     {
         GncSxInstances *instances = (GncSxInstances*)sx_iter->data;
-        for (inst_iter = instances->list; inst_iter != NULL; inst_iter = inst_iter->next)
+        for (inst_iter = instances->instance_list; inst_iter != NULL; inst_iter = inst_iter->next)
         {
             GncSxInstance *inst = (GncSxInstance*)inst_iter->data;
 
@@ -1357,7 +1371,7 @@
         GncSxInstances *instances = (GncSxInstances*)sx_iter->data;
         gboolean sx_is_auto_create = FALSE, sx_notify = FALSE;
         xaccSchedXactionGetAutoCreate(instances->sx, &sx_is_auto_create, &sx_notify);
-        for (inst_iter = instances->list; inst_iter != NULL; inst_iter = inst_iter->next)
+        for (inst_iter = instances->instance_list; inst_iter != NULL; inst_iter = inst_iter->next)
         {
             GncSxInstance *inst = (GncSxInstance*)inst_iter->data;
             summary->num_instances++;

Modified: gnucash/branches/gda-dev/src/app-utils/gnc-sx-instance-model.h
===================================================================
--- gnucash/branches/gda-dev/src/app-utils/gnc-sx-instance-model.h	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/src/app-utils/gnc-sx-instance-model.h	2007-04-14 00:35:53 UTC (rev 15878)
@@ -75,7 +75,7 @@
      GDate next_instance_date;
      
      /** GList<GncSxInstance*> **/
-    GList *list; /* @fixme: s/list/?/ */
+    GList *instance_list;
 } GncSxInstances;
 
 typedef enum 
@@ -126,7 +126,7 @@
 void gnc_sx_instance_model_update_sx_instances(GncSxInstanceModel *model, SchedXaction *sx);
 void gnc_sx_instance_model_remove_sx_instances(GncSxInstanceModel *model, SchedXaction *sx);
 
-/** @return GList<GncSxVariable*> **/
+/** @return GList<GncSxVariable*>. Caller owns the list, but not the items. **/
 GList *gnc_sx_instance_get_variables(GncSxInstance *inst);
 
 Account* gnc_sx_get_template_transaction_account(SchedXaction *sx);

Modified: gnucash/branches/gda-dev/src/app-utils/gnc-ui-util.c
===================================================================
--- gnucash/branches/gda-dev/src/app-utils/gnc-ui-util.c	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/src/app-utils/gnc-ui-util.c	2007-04-14 00:35:53 UTC (rev 15878)
@@ -1364,13 +1364,15 @@
     guint8 num_decimal_places = 0;
     char *temp_ptr = temp_buf;
 
-    decimal_point = info->monetary ?
-      lc->mon_decimal_point : lc->decimal_point;
+    decimal_point = info->monetary
+        ? lc->mon_decimal_point
+        : lc->decimal_point;
     g_utf8_strncpy(temp_ptr, decimal_point, 1);
     temp_ptr = g_utf8_find_next_char(temp_ptr, NULL);
 
-    while (!gnc_numeric_zero_p (val) && (val.denom != 1) &&
-	   (num_decimal_places < max_dp))
+    while (!gnc_numeric_zero_p (val)
+           && (val.denom != 1)
+           && (num_decimal_places < max_dp))
     {
       gint64 digit;
 

Modified: gnucash/branches/gda-dev/src/app-utils/options.scm
===================================================================
--- gnucash/branches/gda-dev/src/app-utils/options.scm	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/src/app-utils/options.scm	2007-04-14 00:35:53 UTC (rev 15878)
@@ -35,33 +35,35 @@
          ;; option. The function should restore the option to the original
          ;; value.
          generate-restore-form
-	 ;; the scm->kvp and kvp->scm functions should save and load
-	 ;; the option to a kvp.  The arguments to these function will be
-	 ;; a kvp-frame and a base key-path list for this option.
-	 scm->kvp
-	 kvp->scm	 
+         ;; the scm->kvp and kvp->scm functions should save and load
+         ;; the option to a kvp.  The arguments to these function will be
+         ;; a kvp-frame and a base key-path list for this option.
+         scm->kvp
+         kvp->scm	 
          ;; Validation func should accept a value and return (#t value)
          ;; on success, and (#f "failure-message") on failure. If #t,
          ;; the supplied value will be used by the gui to set the option.
          value-validator
-	 ;;; free-form storage depending on type.
+         ;;; free-form storage depending on type.
          option-data 
-	 ;; If this is a "multiple choice" type of option,
-	 ;; this should be a vector of the following five functions
-	 ;; one taking no arguments giving the number of choices
-         ;; one taking one argument, a non-negative integer, that
+         ;; If this is a "multiple choice" type of option,
+         ;; this should be a vector of the following five functions:
+         ;; 
+         ;; Function 1: taking no arguments, giving the number of choices
+         ;;
+         ;; Function 2: taking one argument, a non-negative integer, that
          ;; returns the scheme value (usually a symbol) matching the
          ;; nth choice
          ;;
-	 ;; one taking one argument, a non-negative integer,
-	 ;; that returns the string matching the nth choice
+         ;; Function 3: taking one argument, a non-negative integer,
+         ;; that returns the string matching the nth choice
          ;;
-	 ;; the third takes one argument and returns the description
-	 ;; containing the nth choice
-	 ;;
-	 ;; the fourth giving a possible value and returning the index
-	 ;; if an option doesn't use these,  this should just be a #f
-	 option-data-fns
+         ;; Function 4: takes one argument and returns the description
+         ;; containing the nth choice
+         ;;
+         ;; Function 5: giving a possible value and returning the index
+         ;; if an option doesn't use these,  this should just be a #f
+         option-data-fns
          ;; This function should return a list of all the strings
          ;; in the option other than the section, name, (define
          ;; (list-lookup list item) and documentation-string that

Modified: gnucash/branches/gda-dev/src/app-utils/test/test-sx.c
===================================================================
--- gnucash/branches/gda-dev/src/app-utils/test/test-sx.c	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/src/app-utils/test/test-sx.c	2007-04-14 00:35:53 UTC (rev 15878)
@@ -35,8 +35,8 @@
 
           do_test(g_list_length(model->sx_instance_list) == 1, "1 GncSxInstances");
           insts = (GncSxInstances*)model->sx_instance_list->data;
-          do_test(g_list_length(insts->list) == 3, "yesterday, today and tomorrow");
-          for (iter = insts->list; iter != NULL; iter = iter->next)
+          do_test(g_list_length(insts->instance_list) == 3, "yesterday, today and tomorrow");
+          for (iter = insts->instance_list; iter != NULL; iter = iter->next)
           {
                GncSxInstance *inst = (GncSxInstance*)iter->data;
                do_test(inst->state == SX_INSTANCE_STATE_TO_CREATE, "to-create");
@@ -90,8 +90,8 @@
 
      do_test(g_list_length(model->sx_instance_list) == 1, "1 instances");
      instances = (GncSxInstances*)model->sx_instance_list->data;
-     do_test(g_list_length(instances->list) == 1, "1 instance");
-     instance = (GncSxInstance*)instances->list->data;
+     do_test(g_list_length(instances->instance_list) == 1, "1 instance");
+     instance = (GncSxInstance*)instances->instance_list->data;
      do_test(g_date_compare(when, &instances->next_instance_date) == 0, "next instance is expected");
      do_test(g_date_compare(when, &instance->date) == 0, "instance date is expected");
 
@@ -103,7 +103,7 @@
 static GncSxInstance*
 _nth_instance(GncSxInstances *instances, int i)
 {
-     return (GncSxInstance*)g_list_nth_data(instances->list, i);
+     return (GncSxInstance*)g_list_nth_data(instances->instance_list, i);
 }
 
 static void
@@ -127,7 +127,7 @@
 
      do_test(g_list_length(model->sx_instance_list) == 1, "one sx");
      insts = (GncSxInstances*)g_list_nth_data(model->sx_instance_list, 0);
-     do_test(g_list_length(insts->list) == 4, "4 instances");
+     do_test(g_list_length(insts->instance_list) == 4, "4 instances");
 
      inst = _nth_instance(insts, 2);
      gnc_sx_instance_model_change_instance_state(model, inst, SX_INSTANCE_STATE_TO_CREATE);

Modified: gnucash/branches/gda-dev/src/backend/dwi/qofmap.c
===================================================================
--- gnucash/branches/gda-dev/src/backend/dwi/qofmap.c	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/src/backend/dwi/qofmap.c	2007-04-14 00:35:53 UTC (rev 15878)
@@ -364,7 +364,7 @@
 {
 	if (!inst) return;
 
-	GUID *guid = &QOF_ENTITY(inst)->guid;
+	GUID *guid = &QOF_INSTANCE(inst)->guid;
 
 	dui_connection_lock(qm->db_conn, qm->table_name);
 	/* Use a temp book when loading from the database */
@@ -376,8 +376,8 @@
 
 	/* See if we got something back from the DB */
 	QofCollection *col;
-	col = qof_book_get_collection (qm->tmp_book, QOF_ENTITY(inst)->e_type);
-	QofEntity * db_ent = qof_collection_lookup_entity (col, guid);
+	col = qof_book_get_collection (qm->tmp_book, QOF_INSTANCE(inst)->e_type);
+	QofInstance * db_ent = qof_collection_lookup_entity (col, guid);
 	QofInstance *db_inst = QOF_INSTANCE(db_ent);
 
 	/* If its not already in the database, then insert it in */

Modified: gnucash/branches/gda-dev/src/backend/file/gnc-backend-file.c
===================================================================
--- gnucash/branches/gda-dev/src/backend/file/gnc-backend-file.c	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/src/backend/file/gnc-backend-file.c	2007-04-14 00:35:53 UTC (rev 15878)
@@ -594,7 +594,7 @@
         }
         if(g_unlink(datafile) != 0 && errno != ENOENT)
         {
-            qof_backend_set_error(be, ERR_FILEIO_BACKUP_ERROR);
+            qof_backend_set_error(be, ERR_BACKEND_READONLY);
             PWARN("unable to unlink filename %s: %s",
                   datafile ? datafile : "(null)", 
                   strerror(errno) ? strerror(errno) : ""); 
@@ -821,7 +821,7 @@
     QofBook *book = gp;
     const char * filepath;
 
-    QofIdTypeConst typ = QOF_ENTITY(inst)->e_type;
+    QofIdTypeConst typ = QOF_INSTANCE(inst)->e_type;
     if (strcmp (GNC_ID_PERIOD, typ)) return;
     filepath = build_period_filepath(fbe, book);
     PINFO (" ====================== book=%p filepath=%s\n", book, filepath);

Modified: gnucash/branches/gda-dev/src/backend/file/gnc-book-xml-v2.c
===================================================================
--- gnucash/branches/gda-dev/src/backend/file/gnc-book-xml-v2.c	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/src/backend/file/gnc-book-xml-v2.c	2007-04-14 00:35:53 UTC (rev 15878)
@@ -196,7 +196,7 @@
     GUID *guid;
 
     guid = dom_tree_to_guid(node);
-    qof_entity_set_guid(QOF_ENTITY(book), guid);
+    qof_instance_set_guid(QOF_INSTANCE(book), guid);
     g_free(guid);
     
     return TRUE;

Modified: gnucash/branches/gda-dev/src/backend/file/gnc-budget-xml-v2.c
===================================================================
--- gnucash/branches/gda-dev/src/backend/file/gnc-budget-xml-v2.c	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/src/backend/file/gnc-budget-xml-v2.c	2007-04-14 00:35:53 UTC (rev 15878)
@@ -111,7 +111,7 @@
 
     guid = dom_tree_to_guid(node);
     g_return_val_if_fail(guid, FALSE);
-    qof_entity_set_guid(QOF_ENTITY(bgt), guid);
+    qof_instance_set_guid(QOF_INSTANCE(bgt), guid);
     g_free(guid);
     return TRUE;
 }

Modified: gnucash/branches/gda-dev/src/backend/file/gnc-pricedb-xml-v2.c
===================================================================
--- gnucash/branches/gda-dev/src/backend/file/gnc-pricedb-xml-v2.c	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/src/backend/file/gnc-pricedb-xml-v2.c	2007-04-14 00:35:53 UTC (rev 15878)
@@ -115,7 +115,7 @@
   } else if(safe_strcmp("price:type", (char*)sub_node->name) == 0) {
     char *text = dom_tree_to_text(sub_node);
     if(!text) return FALSE;
-    gnc_price_set_type(p, text);
+    gnc_price_set_typestr(p, text);
     g_free(text);
   } else if(safe_strcmp("price:value", (char*)sub_node->name) == 0) {
     gnc_numeric *value = dom_tree_to_gnc_numeric(sub_node);
@@ -406,7 +406,7 @@
     if(!add_child_or_kill_parent(price_xml, tmpnode)) return NULL;
   }
     
-  typestr = gnc_price_get_type(price);
+  typestr = gnc_price_get_typestr(price);
   if(typestr && (strlen(typestr) != 0)) {
     tmpnode = text_to_dom_tree("price:type", typestr);
     if(!add_child_or_kill_parent(price_xml, tmpnode)) return NULL;

Modified: gnucash/branches/gda-dev/src/backend/file/io-gncxml-v1.c
===================================================================
--- gnucash/branches/gda-dev/src/backend/file/io-gncxml-v1.c	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/src/backend/file/io-gncxml-v1.c	2007-04-14 00:35:53 UTC (rev 15878)
@@ -3585,7 +3585,7 @@
   } else if(safe_strcmp("price:type", (char*)sub_node->name) == 0) {
     char *text = dom_tree_to_text(sub_node);
     if(!text) return FALSE;
-    gnc_price_set_type(p, text);
+    gnc_price_set_typestr(p, text);
     g_free(text);
   } else if(safe_strcmp("price:value", (char*)sub_node->name) == 0) {
     gnc_numeric *value = dom_tree_to_gnc_numeric(sub_node);

Modified: gnucash/branches/gda-dev/src/backend/file/io-gncxml-v2.c
===================================================================
--- gnucash/branches/gda-dev/src/backend/file/io-gncxml-v2.c	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/src/backend/file/io-gncxml-v2.c	2007-04-14 00:35:53 UTC (rev 15878)
@@ -860,7 +860,7 @@
 static void write_transactions (FILE *out, QofBook *book, sixtp_gdv2 *gd);
 static void write_template_transaction_data (FILE *out, QofBook *book, sixtp_gdv2 *gd);
 static void write_schedXactions(FILE *out, QofBook *book, sixtp_gdv2 *gd);
-static void write_budget (QofEntity *ent, gpointer data);
+static void write_budget (QofInstance *ent, gpointer data);
 
 static void
 write_counts_cb (const char *type, gpointer data_p, gpointer be_data_p)
@@ -1098,7 +1098,7 @@
 }
 
 static void
-write_budget (QofEntity *ent, gpointer data)
+write_budget (QofInstance *ent, gpointer data)
 {
     xmlNodePtr node;
     struct file_backend* be = data;

Modified: gnucash/branches/gda-dev/src/backend/gda/gnc-account-gda.c
===================================================================
--- gnucash/branches/gda-dev/src/backend/gda/gnc-account-gda.c	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/src/backend/gda/gnc-account-gda.c	2007-04-14 00:35:53 UTC (rev 15878)
@@ -56,16 +56,16 @@
 
 static col_cvt_t col_table[] =
 {
-    { "guid",			CT_GUID,	0, COL_NNUL|COL_PKEY,	NULL,
-            (QofAccessFunc)qof_entity_get_guid,
+    { "guid",		CT_GUID,	0, COL_NNUL|COL_PKEY,	NULL,
+            (QofAccessFunc)qof_instance_get_guid,
             (QofSetterFunc)xaccAccountSetGUID },
-    { "name",			CT_STRING,	ACCOUNT_MAX_NAME_LEN, COL_NNUL,	ACCOUNT_NAME_ },
-    { "account_type",	CT_STRING,	ACCOUNT_MAX_TYPE_LEN, COL_NNUL,	ACCOUNT_TYPE_ },
+    { "name",		CT_STRING, ACCOUNT_MAX_NAME_LEN, COL_NNUL, ACCOUNT_NAME_ },
+    { "account_type",	CT_STRING, ACCOUNT_MAX_TYPE_LEN, COL_NNUL, ACCOUNT_TYPE_ },
     { "commodity_guid",	CT_GUID,	0, COL_NNUL,	NULL,
             get_commodity, set_commodity },
     { "parent_guid",	CT_GUID,	0, 0,	NULL, get_parent, set_parent },
-    { "code",			CT_STRING,	ACCOUNT_MAX_CODE_LEN, 0,	ACCOUNT_CODE_ },
-    { "description",	CT_STRING,	ACCOUNT_MAX_DESCRIPTION_LEN, 0,	ACCOUNT_DESCRIPTION_ },
+    { "code",		CT_STRING, ACCOUNT_MAX_CODE_LEN, 0,	ACCOUNT_CODE_ },
+    { "description",	CT_STRING, ACCOUNT_MAX_DESCRIPTION_LEN, 0,	ACCOUNT_DESCRIPTION_ },
     { NULL }
 };
 

Modified: gnucash/branches/gda-dev/src/backend/gda/gnc-backend-gda.c
===================================================================
--- gnucash/branches/gda-dev/src/backend/gda/gnc-backend-gda.c	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/src/backend/gda/gnc-backend-gda.c	2007-04-14 00:35:53 UTC (rev 15878)
@@ -135,6 +135,8 @@
     if( be->pConnection == NULL ) {
         g_critical( "SQL error: %s\n", error->message );
         qof_backend_set_error( be_start, ERR_BACKEND_NO_SUCH_DB );
+
+        LEAVE( " " );
         return;
     }
 
@@ -213,7 +215,7 @@
     GncGdaBackend *be = (GncGdaBackend*)be_start;
     gda_backend be_data;
 
-    ENTER (" ");
+    ENTER( "be=%p, book=%p", be, book );
 
     g_assert( be->primary_book == NULL );
     be->primary_book = book;
@@ -221,6 +223,13 @@
     /* Load any initial stuff */
     be->loading = TRUE;
     
+#if 0
+    /* Some of this needs to happen in a certain order */
+    initial_load_cb( GNC_ID_BOOK,
+		    qof_object_lookup_backend( GNC_ID_BOOK, GNC_GDA_BACKEND ),
+                    &be_data );
+#endif
+
     be_data.ok = FALSE;
     be_data.be = be;
     be_data.inst = NULL;
@@ -309,20 +318,20 @@
 static void
 commit_cb( const gchar* type, gpointer data_p, gpointer be_data_p )
 {
-	GncGdaDataType_t* pData = data_p;
-	gda_backend* be_data = be_data_p;
+    GncGdaDataType_t* pData = data_p;
+    gda_backend* be_data = be_data_p;
 
-	g_return_if_fail( type != NULL && pData != NULL && be_data != NULL );
-	g_return_if_fail( pData->version == GNC_GDA_BACKEND_VERSION );
+    g_return_if_fail( type != NULL && pData != NULL && be_data != NULL );
+    g_return_if_fail( pData->version == GNC_GDA_BACKEND_VERSION );
 
-	/* If this has already been handled, or is not the correct handler, return */
-	g_return_if_fail( strcmp( pData->type_name, be_data->inst->entity.e_type ) == 0 );
-	g_return_if_fail( !be_data->ok );
+    /* If this has already been handled, or is not the correct handler, return */
+    g_return_if_fail( strcmp( pData->type_name, be_data->inst->e_type ) == 0 );
+    g_return_if_fail( !be_data->ok );
 
-	if( pData->commit != NULL ) {
-		(pData->commit)( be_data->be, be_data->inst );
-		be_data->ok = TRUE;
-	}
+    if( pData->commit != NULL ) {
+        (pData->commit)( be_data->be, be_data->inst );
+        be_data->ok = TRUE;
+    }
 }
 
 /* Commit_edit handler - find the correct backend handler for this object
@@ -339,7 +348,9 @@
 
     if( be->loading ) return;
 
-    g_debug( "gda_commit_edit(): %s dirty = %d, do_free=%d\n", inst->entity.e_type, inst->dirty, inst->do_free );
+    g_debug( "gda_commit_edit(): %s dirty = %d, do_free=%d\n",
+             (inst->e_type ? inst->e_type : "(null)"),
+             inst->dirty, inst->do_free );
 
     if( !inst->dirty && !inst->do_free && GNC_IS_TRANS(inst) ) {
         gnc_gda_transaction_commit_splits( be, GNC_TRANS(inst) );
@@ -354,7 +365,7 @@
 
     if( !be_data.ok ) {
         g_critical( "gnc_gda_commit_edit(): Unknown object type %s\n",
-                inst->entity.e_type );
+                inst->e_type );
         return;
     }
 

Modified: gnucash/branches/gda-dev/src/backend/gda/gnc-book-gda.c
===================================================================
--- gnucash/branches/gda-dev/src/backend/gda/gnc-book-gda.c	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/src/backend/gda/gnc-book-gda.c	2007-04-14 00:35:53 UTC (rev 15878)
@@ -40,20 +40,77 @@
 
 #include "gnc-engine.h"
 #include "gnc-book.h"
+#include "SX-book.h"
+#include "SX-book-p.h"
 
 #define BOOK_TABLE "books"
 
 static QofLogModule log_module = GNC_MOD_BACKEND;
 
+static gpointer get_root_account_guid( gpointer pObject, const QofParam* );
+static void set_root_account_guid( gpointer pObject, gpointer pValue );
+static gpointer get_root_template_guid( gpointer pObject, const QofParam* );
+static void set_root_template_guid( gpointer pObject, gpointer pValue );
+
 static col_cvt_t col_table[] =
 {
     { "guid",            CT_GUID,    0, COL_NNUL|COL_PKEY,    NULL,
-            (QofAccessFunc)qof_entity_get_guid,
-            (QofSetterFunc)qof_entity_set_guid },
+            (QofAccessFunc)qof_instance_get_guid,
+            (QofSetterFunc)qof_instance_set_guid },
+    { "root_account_guid", CT_GUID,  0, COL_NNUL,             NULL,
+            get_root_account_guid, set_root_account_guid },
+    { "root_template_guid", CT_GUID, 0, COL_NNUL,             NULL,
+            get_root_template_guid, set_root_template_guid },
     { NULL }
 };
 
 /* ================================================================= */
+static gpointer
+get_root_account_guid( gpointer pObject, const QofParam* param )
+{
+    GNCBook* book = QOF_BOOK(pObject);
+    const Account* root = gnc_book_get_root_account( book );
+
+    return (gpointer)qof_instance_get_guid( QOF_INSTANCE( root ) );
+}
+
+static void 
+set_root_account_guid( gpointer pObject, gpointer pValue )
+{
+    GNCBook* book = QOF_BOOK(pObject);
+    const Account* root = gnc_book_get_root_account( book );
+    GUID* guid = (GUID*)pValue;
+
+    qof_instance_set_guid( QOF_INSTANCE( root ), guid );
+}
+
+static gpointer
+get_root_template_guid( gpointer pObject, const QofParam* param )
+{
+    const GNCBook* book = QOF_BOOK(pObject);
+    const Account* root = gnc_book_get_template_root( book );
+
+    return (gpointer)qof_instance_get_guid( QOF_INSTANCE( root ) );
+}
+
+static void 
+set_root_template_guid( gpointer pObject, gpointer pValue )
+{
+    GNCBook* book = QOF_BOOK(pObject);
+    GUID* guid = (GUID*)pValue;
+    Account* root = gnc_book_get_template_root( book );
+
+    if( root == NULL ) {
+        root = xaccMallocAccount( book );
+        xaccAccountBeginEdit( root );
+        xaccAccountSetType( root, ACCT_TYPE_ROOT );
+        xaccAccountCommitEdit( root );
+        gnc_book_set_template_root( book, root );
+    }
+    qof_instance_set_guid( QOF_INSTANCE( root ), guid );
+}
+
+/* ================================================================= */
 static GNCBook*
 load_book( GncGdaBackend* be, GdaDataModel* pModel, int row,
             GNCBook* pBook )
@@ -110,7 +167,7 @@
 static void
 commit_book( GncGdaBackend* be, QofInstance* inst )
 {
-    GNCBook* pBook = GNC_BOOK(inst);
+    GNCBook* pBook = QOF_BOOK(inst);
     const GUID* guid;
 
     (void)gnc_gda_do_db_operation( be,

Modified: gnucash/branches/gda-dev/src/backend/gda/gnc-budget-gda.c
===================================================================
--- gnucash/branches/gda-dev/src/backend/gda/gnc-budget-gda.c	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/src/backend/gda/gnc-budget-gda.c	2007-04-14 00:35:53 UTC (rev 15878)
@@ -59,8 +59,8 @@
 static col_cvt_t col_table[] =
 {
     { "guid",            CT_GUID,    0, COL_NNUL|COL_PKEY,    NULL,
-            (QofAccessFunc)qof_entity_get_guid,
-            (QofSetterFunc)qof_entity_set_guid },
+            (QofAccessFunc)qof_instance_get_guid,
+            (QofSetterFunc)qof_instance_set_guid },
     { "name",            CT_STRING,    BUDGET_MAX_NAME_LEN, COL_NNUL,    "name" },
     { "description",    CT_STRING,    BUDGET_MAX_DESCRIPTION_LEN, 0,    "description" },
     { "num_periods",    CT_INT,        0, COL_NNUL, "num_periods" },

Modified: gnucash/branches/gda-dev/src/backend/gda/gnc-commodity-gda.c
===================================================================
--- gnucash/branches/gda-dev/src/backend/gda/gnc-commodity-gda.c	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/src/backend/gda/gnc-commodity-gda.c	2007-04-14 00:35:53 UTC (rev 15878)
@@ -58,8 +58,8 @@
 
 static col_cvt_t col_table[] = {
     { "guid",            CT_GUID,    0, COL_NNUL|COL_PKEY,    NULL,
-            (QofAccessFunc)qof_entity_get_guid,
-            (QofSetterFunc)qof_entity_set_guid },
+            (QofAccessFunc)qof_instance_get_guid,
+            (QofSetterFunc)qof_instance_set_guid },
     { "namespace",        CT_STRING,    COMMODITY_MAX_NAMESPACE_LEN, COL_NNUL,    NULL,
             (QofAccessFunc)gnc_commodity_get_namespace,
             (QofSetterFunc)gnc_commodity_set_namespace },
@@ -154,9 +154,9 @@
             if( pCommodity != NULL ) {
                 GUID guid;
 
-                guid = *qof_entity_get_guid( QOF_ENTITY(pCommodity) );
+                guid = *qof_instance_get_guid( QOF_INSTANCE(pCommodity) );
                 pCommodity = gnc_commodity_table_insert( pTable, pCommodity );
-                qof_entity_set_guid( QOF_ENTITY(pCommodity), &guid );
+                qof_instance_set_guid( QOF_INSTANCE(pCommodity), &guid );
             }
         }
     }

Modified: gnucash/branches/gda-dev/src/backend/gda/gnc-lots-gda.c
===================================================================
--- gnucash/branches/gda-dev/src/backend/gda/gnc-lots-gda.c	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/src/backend/gda/gnc-lots-gda.c	2007-04-14 00:35:53 UTC (rev 15878)
@@ -51,8 +51,8 @@
 static col_cvt_t col_table[] =
 {
     { "guid",            CT_GUID,    0, COL_NNUL|COL_PKEY,    NULL,
-            (QofAccessFunc)qof_entity_get_guid,
-            (QofSetterFunc)qof_entity_set_guid },
+            (QofAccessFunc)qof_instance_get_guid,
+            (QofSetterFunc)qof_instance_set_guid },
     { "account_guid",    CT_GUID,      0, COL_NNUL,    NULL,
             get_lot_account, set_lot_account },
     { "is_closed",        CT_STRING,  1, COL_NNUL, NULL,

Modified: gnucash/branches/gda-dev/src/backend/gda/gnc-price-gda.c
===================================================================
--- gnucash/branches/gda-dev/src/backend/gda/gnc-price-gda.c	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/src/backend/gda/gnc-price-gda.c	2007-04-14 00:35:53 UTC (rev 15878)
@@ -58,8 +58,8 @@
 static col_cvt_t col_table[] =
 {
     { "guid",            CT_GUID,    0, COL_NNUL|COL_PKEY,    NULL,
-            (QofAccessFunc)qof_entity_get_guid,
-            (QofSetterFunc)qof_entity_set_guid },
+            (QofAccessFunc)qof_instance_get_guid,
+            (QofSetterFunc)qof_instance_set_guid },
     { "commodity_guid",    CT_GUID,    0, COL_NNUL, NULL,
             get_commodity_guid, set_commodity_guid },
     { "currency_guid",    CT_GUID,    0, COL_NNUL, NULL,

Modified: gnucash/branches/gda-dev/src/backend/gda/gnc-schedxaction-gda.c
===================================================================
--- gnucash/branches/gda-dev/src/backend/gda/gnc-schedxaction-gda.c	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/src/backend/gda/gnc-schedxaction-gda.c	2007-04-14 00:35:53 UTC (rev 15878)
@@ -54,8 +54,8 @@
 static col_cvt_t col_table[] =
 {
     { "guid",            CT_GUID,    0, COL_NNUL|COL_PKEY,    NULL,
-            (QofAccessFunc)qof_entity_get_guid,
-            (QofSetterFunc)qof_entity_set_guid },
+            (QofAccessFunc)qof_instance_get_guid,
+            (QofSetterFunc)qof_instance_set_guid },
     { "name",            CT_STRING, SX_MAX_NAME_LEN, COL_NNUL, GNC_SX_NAME },
     { "start_date",        CT_GDATE,    0, COL_NNUL, GNC_SX_START_DATE },
     { "last_occur",        CT_GDATE,    0, COL_NNUL, GNC_SX_LAST_DATE },
@@ -138,7 +138,7 @@
     }
 
     gnc_gda_load_object( pModel, row, /*GNC_ID_SCHEDXACTION*/GNC_SX_ID, pSx, col_table );
-    gnc_gda_slots_load( be, qof_entity_get_guid( QOF_ENTITY(pSx) ),
+    gnc_gda_slots_load( be, qof_instance_get_guid( QOF_INSTANCE(pSx) ),
                             qof_instance_get_slots( QOF_INSTANCE(pSx) ) );
 
     qof_instance_mark_clean( QOF_INSTANCE(pSx) );

Modified: gnucash/branches/gda-dev/src/backend/gda/gnc-transaction-gda.c
===================================================================
--- gnucash/branches/gda-dev/src/backend/gda/gnc-transaction-gda.c	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/src/backend/gda/gnc-transaction-gda.c	2007-04-14 00:35:53 UTC (rev 15878)
@@ -135,16 +135,16 @@
 static gpointer
 get_guid( gpointer pObject, const QofParam* param )
 {
-    return (gpointer)qof_entity_get_guid( QOF_ENTITY(pObject) );
+    return (gpointer)qof_instance_get_guid( QOF_INSTANCE(pObject) );
 }
 
 static void 
 set_guid( gpointer pObject, gpointer pValue )
 {
-    QofEntity* pEntity = QOF_ENTITY(pObject);
+    QofInstance* pInstance = QOF_INSTANCE(pObject);
     GUID* guid = (GUID*)pValue;
 
-    qof_entity_set_guid( pEntity, guid );
+    qof_instance_set_guid( pInstance, guid );
 }
 
 static gpointer

Modified: gnucash/branches/gda-dev/src/backend/postgres/PostgresBackend.c
===================================================================
--- gnucash/branches/gda-dev/src/backend/postgres/PostgresBackend.c	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/src/backend/postgres/PostgresBackend.c	2007-04-14 00:35:53 UTC (rev 15878)
@@ -184,7 +184,7 @@
 
 struct _iter {
   const GUID *guid;
-  QofEntity *ent;
+  QofInstance *ent;
 };
 
 static void
@@ -1627,7 +1627,7 @@
 pgend_do_begin (QofBackend *bend, QofInstance *inst)
 {
   PGBackend *be = (PGBackend*)bend;
-  QofIdTypeConst type = inst->entity.e_type;
+  QofIdTypeConst type = inst->e_type;
 
   ENTER ("be=%p, type=%s", bend, type);
   // if (!safe_strcmp (type, GNC_ID_PERIOD))
@@ -1653,7 +1653,7 @@
 pgend_do_commit (QofBackend *bend, QofInstance *inst)
 {
   PGBackend *be = (PGBackend*)bend;
-  QofIdTypeConst type = inst->entity.e_type;
+  QofIdTypeConst type = inst->e_type;
 
   ENTER ("be=%p, type=%s", bend, type);
   // if (!safe_strcmp (type, GNC_ID_PERIOD))
@@ -1689,7 +1689,7 @@
 pgend_do_rollback (QofBackend *bend, QofInstance *inst)
 {
   PGBackend *be = (PGBackend*)bend;
-  QofIdTypeConst type = inst->entity.e_type;
+  QofIdTypeConst type = inst->e_type;
 
   ENTER ("be=%p, type=%s", bend, type);
   switch (be->session_mode) {

Modified: gnucash/branches/gda-dev/src/backend/postgres/book.c
===================================================================
--- gnucash/branches/gda-dev/src/backend/postgres/book.c	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/src/backend/postgres/book.c	2007-04-14 00:35:53 UTC (rev 15878)
@@ -139,7 +139,7 @@
    guid = nullguid;  /* just in case the read fails ... */
    string_to_guid (DB_GET_VAL("bookGuid",j), &guid);
 
-   qof_entity_set_guid ((QofEntity*)book, &guid);
+   qof_instance_set_guid (QOF_INSTANCE(book), &guid);
 
    if((DB_GET_VAL("book_open",j))[0] == 'n')
    {
@@ -208,14 +208,14 @@
    for (node=blist; node; node=node->next)
    {
       book = node->data;
-      if (guid_equal (qof_entity_get_guid((QofEntity*)book), &guid)) break;
+      if (guid_equal (qof_instance_get_guid(QOF_INSTANCE(book)), &guid)) break;
       book = NULL;
    }
    
    if (!book) 
    {
       book = qof_book_new();
-      qof_entity_set_guid ((QofEntity*)book, &guid);
+      qof_instance_set_guid (QOF_INSTANCE(book), &guid);
    }
 
    if((DB_GET_VAL("book_open",j))[0] == 'n')

Modified: gnucash/branches/gda-dev/src/backend/postgres/events.c
===================================================================
--- gnucash/branches/gda-dev/src/backend/postgres/events.c	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/src/backend/postgres/events.c	2007-04-14 00:35:53 UTC (rev 15878)
@@ -259,7 +259,7 @@
    {
       Event *ev = (Event *) node->data;
       QofIdType local_obj_type;
-      QofEntity *ent;
+      QofInstance *ent;
 
       ent = NULL;
       /* lets see if the local cache has this item in it */
@@ -290,14 +290,14 @@
 
                /* if the remote user created an account, mirror it here */
                acc = pgendCopyAccountToEngine (be, &(ev->guid));
-               ent = (QofEntity*)acc;
+               ent = QOF_INSTANCE(acc);
                break;
             }
             case QOF_EVENT_DESTROY: {
                Account * acc = pgendAccountLookup (be, &(ev->guid));
                xaccAccountBeginEdit (acc);
                xaccAccountDestroy (acc);
-               ent = (QofEntity*)acc;
+               ent = QOF_INSTANCE(acc);
                break;
             }
          }
@@ -319,7 +319,7 @@
                /* don't mirror transaction creations. If a register needs
                 * it, it will do a query. */
                trans = pgendTransLookup (be, &(ev->guid));
-               ent = (QofEntity*)trans;
+               ent = QOF_INSTANCE(trans);
                PINFO ("create transaction");
                break;
 			}
@@ -327,7 +327,7 @@
                Transaction *trans;
                trans = pgendTransLookup (be, &(ev->guid));
                pgendCopyTransactionToEngine (be, &(ev->guid));
-               ent = (QofEntity*)trans;
+               ent = QOF_INSTANCE(trans);
                break;
 			}
             case QOF_EVENT_DESTROY: {
@@ -336,7 +336,7 @@
                /* mark trans for freeing */
                xaccTransDestroy (trans);
                xaccTransCommitEdit (trans);
-               ent = (QofEntity*)trans;
+               ent = QOF_INSTANCE(trans);
                break;
             }
          }

Modified: gnucash/branches/gda-dev/src/backend/postgres/price.c
===================================================================
--- gnucash/branches/gda-dev/src/backend/postgres/price.c	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/src/backend/postgres/price.c	2007-04-14 00:35:53 UTC (rev 15878)
@@ -307,7 +307,7 @@
    gnc_price_set_time (pr, ts);
 
    gnc_price_set_source (pr, DB_GET_VAL("source",j));
-   gnc_price_set_type (pr, DB_GET_VAL("type",j));
+   gnc_price_set_typestr (pr, DB_GET_VAL("type",j));
 
    num = strtoll (DB_GET_VAL("valueNum", j), NULL, 0);
    denom = strtoll (DB_GET_VAL("valueDenom", j), NULL, 0);

Modified: gnucash/branches/gda-dev/src/backend/postgres/putil.h
===================================================================
--- gnucash/branches/gda-dev/src/backend/postgres/putil.h	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/src/backend/postgres/putil.h	2007-04-14 00:35:53 UTC (rev 15878)
@@ -358,7 +358,7 @@
       for (node=be->blist; node; node=node->next)                \
       {                                                          \
          book = node->data;                                      \
-         if (guid_equal (qof_entity_get_guid((QofEntity*)book), &book_guid)) break; \
+         if (guid_equal (qof_instance_get_guid((QofInstance*)book), &book_guid)) break; \
          book = NULL;                                            \
       }                                                          \
       if (!book) return data;                                    \

Modified: gnucash/branches/gda-dev/src/backend/postgres/table.m4
===================================================================
--- gnucash/branches/gda-dev/src/backend/postgres/table.m4	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/src/backend/postgres/table.m4	2007-04-14 00:35:53 UTC (rev 15878)
@@ -13,7 +13,7 @@
        commodity,      , char *, gnc_commodity_get_unique_name(xaccAccountGetCommodity(ptr)),
        version,        , int32,  xaccAccountGetVersion(ptr),
        iguid,          , int32,  ptr->idata,
-       bookGUID,       , GUID *, qof_entity_get_guid((QofEntity*)gnc_account_get_book(ptr)),
+       bookGUID,       , GUID *, qof_instance_get_guid((QofInstance*)gnc_account_get_book(ptr)),
        parentGUID,     , GUID *, xaccAccountGetGUID(gnc_account_get_parent(ptr)),
        accountGUID, KEY, GUID *, xaccAccountGetGUID(ptr),
        ')
@@ -73,7 +73,7 @@
        currency,     , commod,   gnc_commodity_get_unique_name(gnc_price_get_currency(ptr)),
        time,         , Timespec, gnc_price_get_time(ptr),
        source,       , char *,   gnc_price_get_source(ptr),
-       type,         , char *,   gnc_price_get_type(ptr),
+       type,         , char *,   gnc_price_get_typestr(ptr),
        valueNum,     , int64,    gnc_numeric_num(gnc_price_get_value(ptr)),
        valueDenom,   , int64,    gnc_numeric_denom(gnc_price_get_value(ptr)),
        version,      , int32,    gnc_price_get_version(ptr),
@@ -362,7 +362,7 @@
 
    p = be->buff; *p = 0;
    p = stpcpy (p, "SELECT version FROM tablename($@) WHERE key_fieldname($@) = ''`");
-   p = guid_to_string_buff (qof_entity_get_guid(QOF_ENTITY(ptr)), p);
+   p = guid_to_string_buff (qof_instance_get_guid(QOF_INSTANCE(ptr)), p);
    p = stpcpy (p, "''`;");
    SEND_QUERY (be,be->buff, -1);
    sql_version = GPOINTER_TO_INT(pgendGetResults (be, get_version_cb, (gpointer) -1));
@@ -392,7 +392,7 @@
 
    p = be->buff; *p = 0;
    p = stpcpy (p, "SELECT version FROM tablename($@)" "Trail WHERE key_fieldname($@) = ''`");
-   p = guid_to_string_buff (qof_entity_get_guid(QOF_ENTITY(ptr)), p);
+   p = guid_to_string_buff (qof_instance_get_guid(QOF_INSTANCE(ptr)), p);
    p = stpcpy (p, "''` AND change = ''`d''`;");
    SEND_QUERY (be,be->buff, -1);
    sql_version = GPOINTER_TO_INT(pgendGetResults (be, get_version_cb, (gpointer) -1));

Modified: gnucash/branches/gda-dev/src/backend/postgres/txn.c
===================================================================
--- gnucash/branches/gda-dev/src/backend/postgres/txn.c	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/src/backend/postgres/txn.c	2007-04-14 00:35:53 UTC (rev 15878)
@@ -171,7 +171,7 @@
         {
           Split *s = split_node->data;
 
-          if (s && guid_equal (&s->inst.entity.guid, &dti->guid))
+          if (s && guid_equal (&s->inst.guid, &dti->guid))
           {
             pgendStoreAuditSplit (be, s, SQL_DELETE);
             break;

Modified: gnucash/branches/gda-dev/src/business/business-core/file/gnc-bill-term-xml-v2.c
===================================================================
--- gnucash/branches/gda-dev/src/business/business-core/file/gnc-bill-term-xml-v2.c	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/src/business/business-core/file/gnc-bill-term-xml-v2.c	2007-04-14 00:35:53 UTC (rev 15878)
@@ -482,7 +482,7 @@
 }
 
 static void
-do_count (QofEntity *term_p, gpointer count_p)
+do_count (QofInstance *term_p, gpointer count_p)
 {
   int *count = count_p;
   (*count)++;
@@ -497,7 +497,7 @@
 }
 
 static void
-xml_add_billterm (QofEntity *term_p, gpointer out_p)
+xml_add_billterm (QofInstance *term_p, gpointer out_p)
 {
   xmlNodePtr node;
   GncBillTerm *term = (GncBillTerm *) term_p;
@@ -556,7 +556,7 @@
 
 /* build a list of bill terms that are grandchildren or bogus (empty entry list). */
 static void
-billterm_scrub_cb (QofEntity *term_p, gpointer list_p)
+billterm_scrub_cb (QofInstance *term_p, gpointer list_p)
 {
   GncBillTerm *term = GNC_BILLTERM(term_p);
   GList **list = list_p;
@@ -590,7 +590,7 @@
  * grandchildren, then fix them to point to the most senior child
  */
 static void
-billterm_scrub_invoices (QofEntity * invoice_p, gpointer ht_p)
+billterm_scrub_invoices (QofInstance * invoice_p, gpointer ht_p)
 {
   GHashTable *ht = ht_p;
   GncInvoice *invoice = GNC_INVOICE(invoice_p);
@@ -617,7 +617,7 @@
 }
 
 static void
-billterm_scrub_cust (QofEntity * cust_p, gpointer ht_p)
+billterm_scrub_cust (QofInstance * cust_p, gpointer ht_p)
 {
   GHashTable *ht = ht_p;
   GncCustomer *cust = GNC_CUSTOMER(cust_p);
@@ -637,7 +637,7 @@
 }
 
 static void
-billterm_scrub_vendor (QofEntity * vendor_p, gpointer ht_p)
+billterm_scrub_vendor (QofInstance * vendor_p, gpointer ht_p)
 {
   GHashTable *ht = ht_p;
   GncVendor *vendor = GNC_VENDOR(vendor_p);

Modified: gnucash/branches/gda-dev/src/business/business-core/file/gnc-customer-xml-v2.c
===================================================================
--- gnucash/branches/gda-dev/src/business/business-core/file/gnc-customer-xml-v2.c	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/src/business/business-core/file/gnc-customer-xml-v2.c	2007-04-14 00:35:53 UTC (rev 15878)
@@ -470,7 +470,7 @@
 }
 
 static void
-do_count (QofEntity * cust_p, gpointer count_p)
+do_count (QofInstance * cust_p, gpointer count_p)
 {
   int *count = count_p;
   if (customer_should_be_saved ((GncCustomer *)cust_p))
@@ -486,7 +486,7 @@
 }
 
 static void
-xml_add_customer (QofEntity * cust_p, gpointer out_p)
+xml_add_customer (QofInstance * cust_p, gpointer out_p)
 {
   xmlNodePtr node;
   GncCustomer *cust = (GncCustomer *) cust_p;

Modified: gnucash/branches/gda-dev/src/business/business-core/file/gnc-employee-xml-v2.c
===================================================================
--- gnucash/branches/gda-dev/src/business/business-core/file/gnc-employee-xml-v2.c	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/src/business/business-core/file/gnc-employee-xml-v2.c	2007-04-14 00:35:53 UTC (rev 15878)
@@ -389,7 +389,7 @@
 }
 
 static void
-do_count (QofEntity * employee_p, gpointer count_p)
+do_count (QofInstance * employee_p, gpointer count_p)
 {
   int *count = count_p;
   if (employee_should_be_saved ((GncEmployee *) employee_p))
@@ -405,7 +405,7 @@
 }
 
 static void
-xml_add_employee (QofEntity * employee_p, gpointer out_p)
+xml_add_employee (QofInstance * employee_p, gpointer out_p)
 {
   xmlNodePtr node;
   GncEmployee *employee = (GncEmployee *) employee_p;

Modified: gnucash/branches/gda-dev/src/business/business-core/file/gnc-entry-xml-v2.c
===================================================================
--- gnucash/branches/gda-dev/src/business/business-core/file/gnc-entry-xml-v2.c	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/src/business/business-core/file/gnc-entry-xml-v2.c	2007-04-14 00:35:53 UTC (rev 15878)
@@ -781,7 +781,7 @@
 }
 
 static void
-do_count (QofEntity * entry_p, gpointer count_p)
+do_count (QofInstance * entry_p, gpointer count_p)
 {
   int *count = count_p;
   (*count)++;
@@ -796,7 +796,7 @@
 }
 
 static void
-xml_add_entry (QofEntity * entry_p, gpointer out_p)
+xml_add_entry (QofInstance * entry_p, gpointer out_p)
 {
   xmlNodePtr node;
   GncEntry *entry = (GncEntry *) entry_p;

Modified: gnucash/branches/gda-dev/src/business/business-core/file/gnc-invoice-xml-v2.c
===================================================================
--- gnucash/branches/gda-dev/src/business/business-core/file/gnc-invoice-xml-v2.c	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/src/business/business-core/file/gnc-invoice-xml-v2.c	2007-04-14 00:35:53 UTC (rev 15878)
@@ -501,7 +501,7 @@
 }
 
 static void
-do_count (QofEntity * invoice_p, gpointer count_p)
+do_count (QofInstance * invoice_p, gpointer count_p)
 {
   int *count = count_p;
   if (invoice_should_be_saved ((GncInvoice *)invoice_p))
@@ -517,7 +517,7 @@
 }
 
 static void
-xml_add_invoice (QofEntity * invoice_p, gpointer out_p)
+xml_add_invoice (QofInstance * invoice_p, gpointer out_p)
 {
   xmlNodePtr node;
   GncInvoice *invoice = (GncInvoice *) invoice_p;

Modified: gnucash/branches/gda-dev/src/business/business-core/file/gnc-job-xml-v2.c
===================================================================
--- gnucash/branches/gda-dev/src/business/business-core/file/gnc-job-xml-v2.c	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/src/business/business-core/file/gnc-job-xml-v2.c	2007-04-14 00:35:53 UTC (rev 15878)
@@ -288,7 +288,7 @@
 }
 
 static void
-do_count (QofEntity * job_p, gpointer count_p)
+do_count (QofInstance * job_p, gpointer count_p)
 {
   int *count = count_p;
   if (job_should_be_saved ((GncJob *)job_p))
@@ -304,7 +304,7 @@
 }
 
 static void
-xml_add_job (QofEntity * job_p, gpointer out_p)
+xml_add_job (QofInstance * job_p, gpointer out_p)
 {
   xmlNodePtr node;
   GncJob *job = (GncJob *) job_p;

Modified: gnucash/branches/gda-dev/src/business/business-core/file/gnc-order-xml-v2.c
===================================================================
--- gnucash/branches/gda-dev/src/business/business-core/file/gnc-order-xml-v2.c	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/src/business/business-core/file/gnc-order-xml-v2.c	2007-04-14 00:35:53 UTC (rev 15878)
@@ -331,7 +331,7 @@
 }
 
 static void
-do_count (QofEntity * order_p, gpointer count_p)
+do_count (QofInstance * order_p, gpointer count_p)
 {
   int *count = count_p;
   if (order_should_be_saved ((GncOrder *) order_p))
@@ -347,7 +347,7 @@
 }
 
 static void
-xml_add_order (QofEntity * order_p, gpointer out_p)
+xml_add_order (QofInstance * order_p, gpointer out_p)
 {
   xmlNodePtr node;
   GncOrder *order = (GncOrder *) order_p;

Modified: gnucash/branches/gda-dev/src/business/business-core/file/gnc-tax-table-xml-v2.c
===================================================================
--- gnucash/branches/gda-dev/src/business/business-core/file/gnc-tax-table-xml-v2.c	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/src/business/business-core/file/gnc-tax-table-xml-v2.c	2007-04-14 00:35:53 UTC (rev 15878)
@@ -445,7 +445,7 @@
 }
 
 static void
-do_count (QofEntity * table_p, gpointer count_p)
+do_count (QofInstance * table_p, gpointer count_p)
 {
   int *count = count_p;
   (*count)++;
@@ -460,7 +460,7 @@
 }
 
 static void
-xml_add_taxtable (QofEntity * table_p, gpointer out_p)
+xml_add_taxtable (QofInstance * table_p, gpointer out_p)
 {
   xmlNodePtr node;
   GncTaxTable *table = (GncTaxTable *) table_p;
@@ -520,7 +520,7 @@
 
 /* build a list of tax tables that are grandchildren or bogus (empty entry list). */
 static void
-taxtable_scrub_cb (QofEntity * table_p, gpointer list_p)
+taxtable_scrub_cb (QofInstance * table_p, gpointer list_p)
 {
   GncTaxTable *table = GNC_TAXTABLE(table_p);
   GList **list = list_p;
@@ -533,7 +533,7 @@
  * grandchildren, then fix them to point to the most senior child
  */
 static void
-taxtable_scrub_entries (QofEntity * entry_p, gpointer ht_p)
+taxtable_scrub_entries (QofInstance * entry_p, gpointer ht_p)
 {
   GHashTable *ht = ht_p;
   GncEntry *entry = GNC_ENTRY(entry_p);
@@ -578,7 +578,7 @@
 }
 
 static void
-taxtable_scrub_cust (QofEntity * cust_p, gpointer ht_p)
+taxtable_scrub_cust (QofInstance * cust_p, gpointer ht_p)
 {
   GHashTable *ht = ht_p;
   GncCustomer *cust = GNC_CUSTOMER(cust_p);
@@ -594,7 +594,7 @@
 }
 
 static void
-taxtable_scrub_vendor (QofEntity * vendor_p, gpointer ht_p)
+taxtable_scrub_vendor (QofInstance * vendor_p, gpointer ht_p)
 {
   GHashTable *ht = ht_p;
   GncVendor *vendor = GNC_VENDOR(vendor_p);

Modified: gnucash/branches/gda-dev/src/business/business-core/file/gnc-vendor-xml-v2.c
===================================================================
--- gnucash/branches/gda-dev/src/business/business-core/file/gnc-vendor-xml-v2.c	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/src/business/business-core/file/gnc-vendor-xml-v2.c	2007-04-14 00:35:53 UTC (rev 15878)
@@ -407,7 +407,7 @@
 }
 
 static void
-do_count (QofEntity * vendor_p, gpointer count_p)
+do_count (QofInstance * vendor_p, gpointer count_p)
 {
   int *count = count_p;
   if (vendor_should_be_saved ((GncVendor *)vendor_p))
@@ -423,7 +423,7 @@
 }
 
 static void
-xml_add_vendor (QofEntity * vendor_p, gpointer out_p)
+xml_add_vendor (QofInstance * vendor_p, gpointer out_p)
 {
   xmlNodePtr node;
   GncVendor *vendor = (GncVendor *) vendor_p;

Modified: gnucash/branches/gda-dev/src/business/business-core/gncAddress.c
===================================================================
--- gnucash/branches/gda-dev/src/business/business-core/gncAddress.c	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/src/business/business-core/gncAddress.c	2007-04-14 00:35:53 UTC (rev 15878)
@@ -38,7 +38,7 @@
   QofInstance inst;
 
   QofBook *	book;
-  QofEntity * parent;
+  QofInstance * parent;
   gboolean	dirty;
   char *	name;
   char *	addr1;
@@ -50,6 +50,11 @@
   char *	email;
 };
 
+struct _gncAddressClass
+{
+  QofInstanceClass parent_class;
+};
+
 static QofLogModule log_module = GNC_MOD_BUSINESS;
 
 #define _GNC_MOD_NAME	GNC_ADDRESS_MODULE_NAME
@@ -62,17 +67,35 @@
   qof_event_gen (address->parent, QOF_EVENT_MODIFY, NULL);
 }
 
+/* GObject Initialization */
+QOF_GOBJECT_IMPL(gnc_address, GncAddress, QOF_TYPE_INSTANCE);
+
+static void
+gnc_address_init(GncAddress* addr)
+{
+}
+
+static void
+gnc_address_dispose_real (GObject *addrp)
+{
+}
+
+static void
+gnc_address_finalize_real(GObject* addrp)
+{
+}
+
 /* Create/Destroy functions */
 
 GncAddress * 
-gncAddressCreate (QofBook *book, QofEntity *prnt)
+gncAddressCreate (QofBook *book, QofInstance *prnt)
 {
   GncAddress *addr;
 
   if (!book) return NULL;
 
-  addr = g_new0 (GncAddress, 1);
-  qof_instance_init(&addr->inst, GNC_ID_ADDRESS, book);
+  addr = g_object_new (GNC_TYPE_ADDRESS, NULL);
+  qof_instance_init_data(&addr->inst, GNC_ID_ADDRESS, book);
   addr->book = book;
   addr->dirty = FALSE;
   addr->parent = prnt;
@@ -97,13 +120,13 @@
 }
 
 static void
-qofAddressSetOwner(GncAddress *addr, QofEntity *ent)
+qofAddressSetOwner(GncAddress *addr, QofInstance *ent)
 {
 	if(!addr || !ent) { return; }
 	if(addr->parent == NULL) { addr->parent = ent; }
 }
 
-static QofEntity*
+static QofInstance*
 qofAddressGetOwner(GncAddress *addr)
 {
 
@@ -112,13 +135,14 @@
 }
 
 GncAddress * 
-gncCloneAddress (GncAddress *from, QofEntity *new_parent, QofBook *book)
+gncCloneAddress (GncAddress *from, QofInstance *new_parent, QofBook *book)
 {
   GncAddress *addr;
 
   if (!book) return NULL;
 
-  addr = g_new0 (GncAddress, 1);
+  addr = g_object_new (GNC_TYPE_ADDRESS, NULL);
+  qof_instance_init_data(&addr->inst, GNC_ID_ADDRESS, book);
   addr->book = book;
   addr->dirty = TRUE;
   addr->parent = new_parent;
@@ -148,7 +172,7 @@
 {
   if (!addr) return;
 
-  qof_event_gen (&addr->inst.entity, QOF_EVENT_DESTROY, NULL);
+  qof_event_gen (&addr->inst, QOF_EVENT_DESTROY, NULL);
 
   CACHE_REMOVE (addr->name);
   CACHE_REMOVE (addr->addr1);
@@ -159,8 +183,8 @@
   CACHE_REMOVE (addr->fax);
   CACHE_REMOVE (addr->email);
 
-  qof_instance_release (&addr->inst);
-  g_free (addr);
+  /* qof_instance_release (&addr->inst); */
+  g_object_unref (addr);
 }
 
 

Modified: gnucash/branches/gda-dev/src/business/business-core/gncAddress.h
===================================================================
--- gnucash/branches/gda-dev/src/business/business-core/gncAddress.h	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/src/business/business-core/gncAddress.h	2007-04-14 00:35:53 UTC (rev 15878)
@@ -65,7 +65,7 @@
 
 @param  QofInstance The address instance.
 @param	QofBook*	  Copy of the book pointer.
- at param	QofEntity* parent entity.
+ at param	QofInstance* parent entity.
 @param	gboolean	dirty flag
 @param	char*	name of addressee
 @param	char*	first line of address
@@ -77,10 +77,25 @@
 @param	char*	email address
 */
 typedef struct _gncAddress GncAddress;
+typedef struct _gncAddressClass GncAddressClass;
 
+/* --- type macros --- */
+#define GNC_TYPE_ADDRESS            (gnc_address_get_type ())
+#define GNC_ADDRESS(o)              \
+     (G_TYPE_CHECK_INSTANCE_CAST ((o), GNC_TYPE_ADDRESS, GncAddress))
+#define GNC_ADDRESS_CLASS(k)        \
+     (G_TYPE_CHECK_CLASS_CAST((k), GNC_TYPE_ADDRESS, GncAddressClass))
+#define GNC_IS_ADDRESS(o)           \
+     (G_TYPE_CHECK_INSTANCE_TYPE ((o), GNC_TYPE_ADDRESS))
+#define GNC_IS_ADDRESS_CLASS(k)     \
+     (G_TYPE_CHECK_CLASS_TYPE ((k), GNC_TYPE_ADDRESS))
+#define GNC_ADDRESS_GET_CLASS(o)    \
+     (G_TYPE_INSTANCE_GET_CLASS ((o), GNC_TYPE_ADDRESS, GncAddressClass))
+GType gnc_address_get_type(void);
+
 /** @name Create/Destroy functions 
  @{ */
-GncAddress *gncAddressCreate (QofBook *book, QofEntity *parent);
+GncAddress *gncAddressCreate (QofBook *book, QofInstance *parent);
 void gncAddressDestroy (GncAddress *addr);
 void gncAddressBeginEdit (GncAddress *addr);
 void gncAddressCommitEdit (GncAddress *addr);

Modified: gnucash/branches/gda-dev/src/business/business-core/gncAddressP.h
===================================================================
--- gnucash/branches/gda-dev/src/business/business-core/gncAddressP.h	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/src/business/business-core/gncAddressP.h	2007-04-14 00:35:53 UTC (rev 15878)
@@ -33,7 +33,7 @@
 gboolean gncAddressRegister (void);
 
 /** Make a copy of the address, setting the parent to 'new_parent' */
-GncAddress * gncCloneAddress (GncAddress *from, QofEntity *new_parent, QofBook *book);
+GncAddress * gncCloneAddress (GncAddress *from, QofInstance *new_parent, QofBook *book);
 
 
 #endif /* GNC_ADDRESSP_H_ */

Modified: gnucash/branches/gda-dev/src/business/business-core/gncBillTerm.c
===================================================================
--- gnucash/branches/gda-dev/src/business/business-core/gncBillTerm.c	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/src/business/business-core/gncBillTerm.c	2007-04-14 00:35:53 UTC (rev 15878)
@@ -56,6 +56,11 @@
   GList *         children;    /* list of children for disconnection */
 };
 
+struct _gncBillTermClass
+{
+  QofInstanceClass parent_class;
+};
+
 struct _book_info 
 {
   GList *         terms;        /* visible terms */
@@ -85,7 +90,7 @@
 mark_term (GncBillTerm *term)
 {
   qof_instance_set_dirty(&term->inst);
-  qof_event_gen (&term->inst.entity, QOF_EVENT_MODIFY, NULL);
+  qof_event_gen (&term->inst, QOF_EVENT_MODIFY, NULL);
 }
 
 static inline void maybe_resort_list (GncBillTerm *term)
@@ -128,19 +133,37 @@
 
 /* ============================================================== */
 
+/* GObject Initialization */
+QOF_GOBJECT_IMPL(gnc_billterm, GncBillTerm, QOF_TYPE_INSTANCE);
+
+static void
+gnc_billterm_init(GncBillTerm* bt)
+{
+}
+
+static void
+gnc_billterm_dispose_real (GObject *btp)
+{
+}
+
+static void
+gnc_billterm_finalize_real(GObject* btp)
+{
+}
+
 /* Create/Destroy Functions */
 GncBillTerm * gncBillTermCreate (QofBook *book)
 {
   GncBillTerm *term;
   if (!book) return NULL;
 
-  term = g_new0 (GncBillTerm, 1);
-  qof_instance_init(&term->inst, _GNC_MOD_NAME, book);
+  term = g_object_new (GNC_TYPE_BILLTERM, NULL);
+  qof_instance_init_data(&term->inst, _GNC_MOD_NAME, book);
   term->name = CACHE_INSERT ("");
   term->desc = CACHE_INSERT ("");
   term->discount = gnc_numeric_zero ();
   addObj (term);
-  qof_event_gen (&term->inst.entity,  QOF_EVENT_CREATE, NULL);
+  qof_event_gen (&term->inst,  QOF_EVENT_CREATE, NULL);
   return term;
 }
 
@@ -161,7 +184,7 @@
 
   if (!term) return;
 
-  qof_event_gen (&term->inst.entity,  QOF_EVENT_DESTROY, NULL);
+  qof_event_gen (&term->inst,  QOF_EVENT_DESTROY, NULL);
   CACHE_REMOVE (term->name);
   CACHE_REMOVE (term->desc);
   remObj (term);
@@ -180,8 +203,8 @@
   }
   g_list_free(term->children);
 
-  qof_instance_release(&term->inst);
-  g_free (term);
+  /* qof_instance_release(&term->inst); */
+  g_object_unref (term);
 }
 
 GncBillTerm *
@@ -192,8 +215,8 @@
 
   if (!book || !from) return NULL;
 
-  term = g_new0 (GncBillTerm, 1);
-  qof_instance_init(&term->inst, _GNC_MOD_NAME, book);
+  term = g_object_new (GNC_TYPE_BILLTERM, NULL);
+  qof_instance_init_data(&term->inst, _GNC_MOD_NAME, book);
   qof_instance_gemini (&term->inst, &from->inst);
 
   term->name = CACHE_INSERT (from->name);
@@ -228,7 +251,7 @@
   }
 
   addObj (term);
-  qof_event_gen (&term->inst.entity, QOF_EVENT_CREATE, NULL);
+  qof_event_gen (&term->inst, QOF_EVENT_CREATE, NULL);
   return term;
 }
 

Modified: gnucash/branches/gda-dev/src/business/business-core/gncBillTerm.h
===================================================================
--- gnucash/branches/gda-dev/src/business/business-core/gncBillTerm.h	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/src/business/business-core/gncBillTerm.h	2007-04-14 00:35:53 UTC (rev 15878)
@@ -32,15 +32,28 @@
 #define GNC_BILLTERM_H_
 
 typedef struct _gncBillTerm GncBillTerm;
+typedef struct _gncBillTermClass GncBillTermClass;
 
 #include "qof.h"
 #ifdef GNUCASH_MAJOR_VERSION
 #include "gncBusiness.h"
 #endif
 #define GNC_ID_BILLTERM       "gncBillTerm"
-#define GNC_IS_BILLTERM(obj)  (QOF_CHECK_TYPE((obj), GNC_ID_BILLTERM))
-#define GNC_BILLTERM(obj)     (QOF_CHECK_CAST((obj), GNC_ID_BILLTERM, GncBillTerm))
 
+/* --- type macros --- */
+#define GNC_TYPE_BILLTERM            (gnc_billterm_get_type ())
+#define GNC_BILLTERM(o)              \
+     (G_TYPE_CHECK_INSTANCE_CAST ((o), GNC_TYPE_BILLTERM, GncBillTerm))
+#define GNC_BILLTERM_CLASS(k)        \
+     (G_TYPE_CHECK_CLASS_CAST((k), GNC_TYPE_BILLTERM, GncBillTermClass))
+#define GNC_IS_BILLTERM(o)           \
+     (G_TYPE_CHECK_INSTANCE_TYPE ((o), GNC_TYPE_BILLTERM))
+#define GNC_IS_BILLTERM_CLASS(k)     \
+     (G_TYPE_CHECK_CLASS_TYPE ((k), GNC_TYPE_BILLTERM))
+#define GNC_BILLTERM_GET_CLASS(o)    \
+     (G_TYPE_INSTANCE_GET_CLASS ((o), GNC_TYPE_BILLTERM, GncBillTermClass))
+GType gnc_billterm_get_type(void);
+
 /** @name BillTerm parameter names
  @{ */
 #define GNC_BILLTERM_NAME 		"name"

Modified: gnucash/branches/gda-dev/src/business/business-core/gncBillTermP.h
===================================================================
--- gnucash/branches/gda-dev/src/business/business-core/gncBillTermP.h	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/src/business/business-core/gncBillTermP.h	2007-04-14 00:35:53 UTC (rev 15878)
@@ -64,7 +64,7 @@
  */
 GncBillTerm * gncBillTermObtainTwin (GncBillTerm *from, QofBook *book);
 
-#define gncBillTermSetGUID(E,G) qof_entity_set_guid(QOF_ENTITY(E),(G))
+#define gncBillTermSetGUID(E,G) qof_instance_set_guid(QOF_INSTANCE(E),(G))
 
 
 #endif /* GNC_BILLTERMP_H_ */

Modified: gnucash/branches/gda-dev/src/business/business-core/gncCustomer.c
===================================================================
--- gnucash/branches/gda-dev/src/business/business-core/gncCustomer.c	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/src/business/business-core/gncCustomer.c	2007-04-14 00:35:53 UTC (rev 15878)
@@ -68,6 +68,11 @@
   GncAddress *    shipaddr;
 };
 
+struct _gncCustomerClass
+{
+  QofInstanceClass parent_class;
+};
+
 static QofLogModule log_module = GNC_MOD_BUSINESS;
 
 #define _GNC_MOD_NAME        GNC_ID_CUSTOMER
@@ -79,34 +84,52 @@
 void mark_customer (GncCustomer *customer)
 {
   qof_instance_set_dirty(&customer->inst);
-  qof_event_gen (&customer->inst.entity, QOF_EVENT_MODIFY, NULL);
+  qof_event_gen (&customer->inst, QOF_EVENT_MODIFY, NULL);
 }
 
 /* ============================================================== */
+
+/* GObject Initialization */
+QOF_GOBJECT_IMPL(gnc_customer, GncCustomer, QOF_TYPE_INSTANCE);
+
+static void
+gnc_customer_init(GncCustomer* cust)
+{
+}
+
+static void
+gnc_customer_dispose_real (GObject *custp)
+{
+}
+
+static void
+gnc_customer_finalize_real(GObject* custp)
+{
+}
+
 /* Create/Destroy Functions */
-
 GncCustomer *gncCustomerCreate (QofBook *book)
 {
   GncCustomer *cust;
 
   if (!book) return NULL;
 
-  cust = g_new0 (GncCustomer, 1);
-  qof_instance_init (&cust->inst, _GNC_MOD_NAME, book);
+  cust = g_object_new (GNC_TYPE_CUSTOMER, NULL);
+  qof_instance_init_data (&cust->inst, _GNC_MOD_NAME, book);
 
   cust->id = CACHE_INSERT ("");
   cust->name = CACHE_INSERT ("");
   cust->notes = CACHE_INSERT ("");
-  cust->addr = gncAddressCreate (book, &cust->inst.entity);
+  cust->addr = gncAddressCreate (book, &cust->inst);
   cust->taxincluded = GNC_TAXINCLUDED_USEGLOBAL;
   cust->active = TRUE;
   cust->jobs = NULL;
 
   cust->discount = gnc_numeric_zero();
   cust->credit = gnc_numeric_zero();
-  cust->shipaddr = gncAddressCreate (book, &cust->inst.entity);
+  cust->shipaddr = gncAddressCreate (book, &cust->inst);
 
-  qof_event_gen (&cust->inst.entity, QOF_EVENT_CREATE, NULL);
+  qof_event_gen (&cust->inst, QOF_EVENT_CREATE, NULL);
 
   return cust;
 }
@@ -118,9 +141,9 @@
   GList *node;
   GncCustomer *cust;
 
-  cust = g_new0 (GncCustomer, 1);
+  cust = g_object_new (GNC_TYPE_CUSTOMER, NULL);
 
-  qof_instance_init (&cust->inst, _GNC_MOD_NAME, book);
+  qof_instance_init_data (&cust->inst, _GNC_MOD_NAME, book);
   qof_instance_gemini (&cust->inst, &from->inst);
 
   cust->id = CACHE_INSERT (from->id);
@@ -132,8 +155,8 @@
   cust->active = from->active;
   cust->taxtable_override = from->taxtable_override;
 
-  cust->addr = gncCloneAddress (from->addr, &cust->inst.entity, book);
-  cust->shipaddr = gncCloneAddress (from->shipaddr, &cust->inst.entity, book);
+  cust->addr = gncCloneAddress (from->addr, &cust->inst, book);
+  cust->shipaddr = gncCloneAddress (from->shipaddr, &cust->inst, book);
 
   /* Find the matching currency in the new book, assumes
    * currency has already been copied into new book. */
@@ -150,7 +173,7 @@
     cust->jobs = g_list_prepend(cust->jobs, job);
   }
 
-  qof_event_gen (&cust->inst.entity, QOF_EVENT_CREATE, NULL);
+  qof_event_gen (&cust->inst, QOF_EVENT_CREATE, NULL);
 
   return cust;
 }
@@ -167,12 +190,14 @@
 {
   if (!cust) return;
 
-  qof_event_gen (&cust->inst.entity, QOF_EVENT_DESTROY, NULL);
+  qof_event_gen (&cust->inst, QOF_EVENT_DESTROY, NULL);
 
   CACHE_REMOVE (cust->id);
   CACHE_REMOVE (cust->name);
   CACHE_REMOVE (cust->notes);
+  gncAddressBeginEdit (cust->addr);
   gncAddressDestroy (cust->addr);
+  gncAddressBeginEdit (cust->shipaddr);
   gncAddressDestroy (cust->shipaddr);
   g_list_free (cust->jobs);
 
@@ -182,8 +207,8 @@
     gncTaxTableDecRef (cust->taxtable);
   }
 
-  qof_instance_release (&cust->inst);
-  g_free (cust);
+  /* qof_instance_release (&cust->inst); */
+  g_object_unref (cust);
 }
 
 GncCustomer *
@@ -340,7 +365,7 @@
     cust->jobs = g_list_insert_sorted (cust->jobs, job,
                                        (GCompareFunc)gncJobCompare);
 
-  qof_event_gen (&cust->inst.entity, QOF_EVENT_MODIFY, NULL);
+  qof_event_gen (&cust->inst, QOF_EVENT_MODIFY, NULL);
 }
 
 void gncCustomerRemoveJob (GncCustomer *cust, GncJob *job)
@@ -357,7 +382,7 @@
     cust->jobs = g_list_remove_link (cust->jobs, node);
     g_list_free_1 (node);
   }
-  qof_event_gen (&cust->inst.entity, QOF_EVENT_MODIFY, NULL);
+  qof_event_gen (&cust->inst, QOF_EVENT_MODIFY, NULL);
 }
 
 void gncCustomerBeginEdit (GncCustomer *cust)
@@ -412,28 +437,34 @@
 }
 
 static void
-qofCustomerSetAddr (GncCustomer *cust, QofEntity *addr_ent)
+qofCustomerSetAddr (GncCustomer *cust, QofInstance *addr_ent)
 {
 	GncAddress *addr;
 
 	if(!cust || !addr_ent) { return; }
 	addr = (GncAddress*)addr_ent;
 	if(addr == cust->addr) { return; }
-	if(cust->addr != NULL) { gncAddressDestroy(cust->addr); }
+	if(cust->addr != NULL) {
+		gncAddressBeginEdit(cust->addr);
+		gncAddressDestroy(cust->addr);
+	}
 	gncCustomerBeginEdit(cust);
 	cust->addr = addr;
 	gncCustomerCommitEdit(cust);
 }
 
 static void
-qofCustomerSetShipAddr (GncCustomer *cust, QofEntity *ship_addr_ent)
+qofCustomerSetShipAddr (GncCustomer *cust, QofInstance *ship_addr_ent)
 {
 	GncAddress *ship_addr;
 
 	if(!cust || !ship_addr_ent) { return; }
 	ship_addr = (GncAddress*)ship_addr_ent;
 	if(ship_addr == cust->shipaddr) { return; }
-	if(cust->shipaddr != NULL) { gncAddressDestroy(cust->shipaddr); }
+	if(cust->shipaddr != NULL) {
+		gncAddressBeginEdit(cust->shipaddr);
+		gncAddressDestroy(cust->shipaddr);
+	}
 	gncCustomerBeginEdit(cust);
 	cust->shipaddr = ship_addr;
 	gncCustomerCommitEdit(cust);

Modified: gnucash/branches/gda-dev/src/business/business-core/gncCustomer.h
===================================================================
--- gnucash/branches/gda-dev/src/business/business-core/gncCustomer.h	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/src/business/business-core/gncCustomer.h	2007-04-14 00:35:53 UTC (rev 15878)
@@ -55,6 +55,7 @@
 
 */
 typedef struct _gncCustomer GncCustomer;
+typedef struct _gncCustomerClass GncCustomerClass;
 
 #include "gncAddress.h"
 #include "gncBillTerm.h"
@@ -62,9 +63,21 @@
 #include "gncJob.h"
 
 #define GNC_ID_CUSTOMER       "gncCustomer"
-#define GNC_IS_CUSTOMER(obj)  (QOF_CHECK_TYPE((obj), GNC_ID_CUSTOMER))
-#define GNC_CUSTOMER(obj)     (QOF_CHECK_CAST((obj), GNC_ID_CUSTOMER, GncCustomer))
 
+/* --- type macros --- */
+#define GNC_TYPE_CUSTOMER            (gnc_customer_get_type ())
+#define GNC_CUSTOMER(o)              \
+     (G_TYPE_CHECK_INSTANCE_CAST ((o), GNC_TYPE_CUSTOMER, GncCustomer))
+#define GNC_CUSTOMER_CLASS(k)        \
+     (G_TYPE_CHECK_CLASS_CAST((k), GNC_TYPE_CUSTOMER, GncCustomerClass))
+#define GNC_IS_CUSTOMER(o)           \
+     (G_TYPE_CHECK_INSTANCE_TYPE ((o), GNC_TYPE_CUSTOMER))
+#define GNC_IS_CUSTOMER_CLASS(k)     \
+     (G_TYPE_CHECK_CLASS_TYPE ((k), GNC_TYPE_CUSTOMER))
+#define GNC_CUSTOMER_GET_CLASS(o)    \
+     (G_TYPE_INSTANCE_GET_CLASS ((o), GNC_TYPE_CUSTOMER, GncCustomerClass))
+GType gnc_customer_get_type(void);
+
 /** @name Create/Destroy Functions 
  @{ */
 GncCustomer *gncCustomerCreate (QofBook *book);

Modified: gnucash/branches/gda-dev/src/business/business-core/gncCustomerP.h
===================================================================
--- gnucash/branches/gda-dev/src/business/business-core/gncCustomerP.h	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/src/business/business-core/gncCustomerP.h	2007-04-14 00:35:53 UTC (rev 15878)
@@ -53,6 +53,6 @@
  */
 GncCustomer * gncCustomerObtainTwin (GncCustomer *from, QofBook *book);
 
-#define gncCustomerSetGUID(E,G) qof_entity_set_guid(QOF_ENTITY(E),(G))
+#define gncCustomerSetGUID(E,G) qof_instance_set_guid(QOF_INSTANCE(E),(G))
 
 #endif /* GNC_CUSTOMERP_H_ */

Modified: gnucash/branches/gda-dev/src/business/business-core/gncEmployee.c
===================================================================
--- gnucash/branches/gda-dev/src/business/business-core/gncEmployee.c	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/src/business/business-core/gncEmployee.c	2007-04-14 00:35:53 UTC (rev 15878)
@@ -54,6 +54,11 @@
   Account *        ccard_acc;
 };
 
+struct _gncEmployeeClass
+{
+  QofInstanceClass parent_class;
+};
+
 static QofLogModule log_module = GNC_MOD_BUSINESS;
 
 #define _GNC_MOD_NAME        GNC_ID_EMPLOYEE
@@ -62,31 +67,48 @@
 void mark_employee (GncEmployee *employee)
 {
   qof_instance_set_dirty(&employee->inst);
-  qof_event_gen (&employee->inst.entity, QOF_EVENT_MODIFY, NULL);
+  qof_event_gen (&employee->inst, QOF_EVENT_MODIFY, NULL);
 }
 
 /* ============================================================== */
+/* GObject Initialization */
+QOF_GOBJECT_IMPL(gnc_employee, GncEmployee, QOF_TYPE_INSTANCE);
+
+static void
+gnc_employee_init(GncEmployee* emp)
+{
+}
+
+static void
+gnc_employee_dispose_real (GObject *empp)
+{
+}
+
+static void
+gnc_employee_finalize_real(GObject* empp)
+{
+}
+
 /* Create/Destroy Functions */
-
 GncEmployee *gncEmployeeCreate (QofBook *book)
 {
   GncEmployee *employee;
 
   if (!book) return NULL;
 
-  employee = g_new0 (GncEmployee, 1);
-  qof_instance_init (&employee->inst, _GNC_MOD_NAME, book);
+  employee = g_object_new (GNC_TYPE_EMPLOYEE, NULL);
+  qof_instance_init_data (&employee->inst, _GNC_MOD_NAME, book);
   
   employee->id = CACHE_INSERT ("");
   employee->username = CACHE_INSERT ("");
   employee->language = CACHE_INSERT ("");
   employee->acl = CACHE_INSERT ("");
-  employee->addr = gncAddressCreate (book, &employee->inst.entity);
+  employee->addr = gncAddressCreate (book, &employee->inst);
   employee->workday = gnc_numeric_zero();
   employee->rate = gnc_numeric_zero();
   employee->active = TRUE;
   
-  qof_event_gen (&employee->inst.entity, QOF_EVENT_CREATE, NULL);
+  qof_event_gen (&employee->inst, QOF_EVENT_CREATE, NULL);
 
   return employee;
 }
@@ -102,16 +124,17 @@
 {
   if (!employee) return;
 
-  qof_event_gen (&employee->inst.entity, QOF_EVENT_DESTROY, NULL);
+  qof_event_gen (&employee->inst, QOF_EVENT_DESTROY, NULL);
 
   CACHE_REMOVE (employee->id);
   CACHE_REMOVE (employee->username);
   CACHE_REMOVE (employee->language);
   CACHE_REMOVE (employee->acl);
+  gncAddressBeginEdit (employee->addr);
   gncAddressDestroy (employee->addr);
 
-  qof_instance_release (&employee->inst);
-  g_free (employee);
+  /* qof_instance_release (&employee->inst); */
+  g_object_unref (employee);
 }
 
 GncEmployee *
@@ -120,15 +143,15 @@
   GncEmployee *employee;
   if (!book || !from) return NULL;
 
-  employee = g_new0 (GncEmployee, 1);
-  qof_instance_init(&employee->inst, _GNC_MOD_NAME, book);
+  employee = g_object_new (GNC_TYPE_EMPLOYEE, NULL);
+  qof_instance_init_data(&employee->inst, _GNC_MOD_NAME, book);
   qof_instance_gemini (&employee->inst, &from->inst);
 
   employee->id = CACHE_INSERT (from->id);
   employee->username = CACHE_INSERT (from->username);
   employee->language = CACHE_INSERT (from->language);
   employee->acl = CACHE_INSERT (from->acl);
-  employee->addr = gncCloneAddress (from->addr, &employee->inst.entity, book);
+  employee->addr = gncCloneAddress (from->addr, &employee->inst, book);
   employee->workday = from->workday;
   employee->rate = from->rate;
   employee->active = from->active;
@@ -136,7 +159,7 @@
   employee->ccard_acc = 
      GNC_ACCOUNT(qof_instance_lookup_twin(QOF_INSTANCE(from->ccard_acc), book));
   
-  qof_event_gen (&employee->inst.entity, QOF_EVENT_CREATE, NULL);
+  qof_event_gen (&employee->inst, QOF_EVENT_CREATE, NULL);
 
   return employee;
 }
@@ -258,14 +281,17 @@
 }
 
 void
-qofEmployeeSetAddr (GncEmployee *employee, QofEntity *addr_ent)
+qofEmployeeSetAddr (GncEmployee *employee, QofInstance *addr_ent)
 {
 	GncAddress *addr;
 
 	if(!employee || !addr_ent) { return; }
 	addr = (GncAddress*)addr_ent;
 	if(addr == employee->addr) { return; }
-	if(employee->addr != NULL) { gncAddressDestroy(employee->addr); }
+	if(employee->addr != NULL) {
+		gncAddressBeginEdit(employee->addr);
+		gncAddressDestroy(employee->addr);
+	}
 	gncEmployeeBeginEdit(employee);
 	employee->addr = addr;
 	gncEmployeeCommitEdit(employee);

Modified: gnucash/branches/gda-dev/src/business/business-core/gncEmployee.h
===================================================================
--- gnucash/branches/gda-dev/src/business/business-core/gncEmployee.h	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/src/business/business-core/gncEmployee.h	2007-04-14 00:35:53 UTC (rev 15878)
@@ -32,14 +32,27 @@
 #define GNC_EMPLOYEE_H_
 
 typedef struct _gncEmployee GncEmployee;
+typedef struct _gncEmployeeClass GncEmployeeClass;
 
 #include "gncAddress.h"
 #include "Account.h"
 
 #define GNC_ID_EMPLOYEE "gncEmployee"
-#define GNC_IS_EMPLOYEE(obj)  (QOF_CHECK_TYPE((obj), GNC_ID_EMPLOYEE))
-#define GNC_EMPLOYEE(obj)     (QOF_CHECK_CAST((obj), GNC_ID_EMPLOYEE, GncEmployee))
 
+/* --- type macros --- */
+#define GNC_TYPE_EMPLOYEE            (gnc_employee_get_type ())
+#define GNC_EMPLOYEE(o)              \
+     (G_TYPE_CHECK_INSTANCE_CAST ((o), GNC_TYPE_EMPLOYEE, GncEmployee))
+#define GNC_EMPLOYEE_CLASS(k)        \
+     (G_TYPE_CHECK_CLASS_CAST((k), GNC_TYPE_EMPLOYEE, GncEmployeeClass))
+#define GNC_IS_EMPLOYEE(o)           \
+     (G_TYPE_CHECK_INSTANCE_TYPE ((o), GNC_TYPE_EMPLOYEE))
+#define GNC_IS_EMPLOYEE_CLASS(k)     \
+     (G_TYPE_CHECK_CLASS_TYPE ((k), GNC_TYPE_EMPLOYEE))
+#define GNC_EMPLOYEE_GET_CLASS(o)    \
+     (G_TYPE_INSTANCE_GET_CLASS ((o), GNC_TYPE_EMPLOYEE, GncEmployeeClass))
+GType gnc_employee_get_type(void);
+
 /** @name Create/Destroy Functions 
  @{ */
 GncEmployee *gncEmployeeCreate (QofBook *book);
@@ -60,7 +73,7 @@
 void gncEmployeeSetCurrency (GncEmployee *employee, gnc_commodity * currency);
 void gncEmployeeSetActive (GncEmployee *employee, gboolean active);
 void gncEmployeeSetCCard (GncEmployee *employee, Account* ccard_acc);
-void qofEmployeeSetAddr (GncEmployee *employee, QofEntity *addr_ent);
+void qofEmployeeSetAddr (GncEmployee *employee, QofInstance *addr_ent);
 
 /** @} */
 
@@ -101,9 +114,9 @@
 #define EMPLOYEE_CC    "credit_card_account"
 
 /** deprecated routines */
-#define gncEmployeeGetGUID(E) qof_entity_get_guid(QOF_ENTITY(E))
+#define gncEmployeeGetGUID(E) qof_instance_get_guid(QOF_INSTANCE(E))
 #define gncEmployeeGetBook(E) qof_instance_get_book(QOF_INSTANCE(E))
-#define gncEmployeeRetGUID(E) (E ? *(qof_entity_get_guid(QOF_ENTITY(E))) : *(guid_null()))
+#define gncEmployeeRetGUID(E) (E ? *(qof_instance_get_guid(QOF_INSTANCE(E))) : *(guid_null()))
 #define gncEmployeeLookupDirect(G,B) gncEmployeeLookup((B),&(G))
 
 #endif /* GNC_EMPLOYEE_H_ */

Modified: gnucash/branches/gda-dev/src/business/business-core/gncEmployeeP.h
===================================================================
--- gnucash/branches/gda-dev/src/business/business-core/gncEmployeeP.h	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/src/business/business-core/gncEmployeeP.h	2007-04-14 00:35:53 UTC (rev 15878)
@@ -57,6 +57,6 @@
  */
 GncEmployee * gncEmployeeObtainTwin (GncEmployee *from, QofBook *book);
 
-#define gncEmployeeSetGUID(E,G) qof_entity_set_guid(QOF_ENTITY(E),(G))
+#define gncEmployeeSetGUID(E,G) qof_instance_set_guid(QOF_INSTANCE(E),(G))
 
 #endif /* GNC_EMPLOYEEP_H_ */

Modified: gnucash/branches/gda-dev/src/business/business-core/gncEntry.c
===================================================================
--- gnucash/branches/gda-dev/src/business/business-core/gncEntry.c	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/src/business/business-core/gncEntry.c	2007-04-14 00:35:53 UTC (rev 15878)
@@ -96,6 +96,11 @@
   Timespec	b_taxtable_modtime;
 };
 
+struct _gncEntryClass
+{
+  QofInstanceClass parent_class;
+};
+
 static QofLogModule log_module = GNC_MOD_BUSINESS;
 
 /* You must edit the functions in this block in tandem.  KEEP THEM IN
@@ -169,12 +174,29 @@
 void mark_entry (GncEntry *entry)
 {
   qof_instance_set_dirty(&entry->inst);
-  qof_event_gen (&entry->inst.entity, QOF_EVENT_MODIFY, NULL);
+  qof_event_gen (&entry->inst, QOF_EVENT_MODIFY, NULL);
 }
 
 /* ================================================================ */
+/* GObject Initialization */
+QOF_GOBJECT_IMPL(gnc_entry, GncEntry, QOF_TYPE_INSTANCE);
+
+static void
+gnc_entry_init(GncEntry* entry)
+{
+}
+
+static void
+gnc_entry_dispose_real (GObject *entryp)
+{
+}
+
+static void
+gnc_entry_finalize_real(GObject* entryp)
+{
+}
+
 /* Create/Destroy Functions */
-
 GncEntry *gncEntryCreate (QofBook *book)
 {
   GncEntry *entry;
@@ -182,8 +204,8 @@
 
   if (!book) return NULL;
 
-  entry = g_new0 (GncEntry, 1);
-  qof_instance_init (&entry->inst, _GNC_MOD_NAME, book);
+  entry = g_object_new (GNC_TYPE_ENTRY, NULL);
+  qof_instance_init_data (&entry->inst, _GNC_MOD_NAME, book);
 
   entry->desc = CACHE_INSERT ("");
   entry->action = CACHE_INSERT ("");
@@ -203,7 +225,7 @@
 
   entry->values_dirty = TRUE;
 
-  qof_event_gen (&entry->inst.entity, QOF_EVENT_CREATE, NULL);
+  qof_event_gen (&entry->inst, QOF_EVENT_CREATE, NULL);
 
   return entry;
 }
@@ -219,7 +241,7 @@
 {
   if (!entry) return;
 
-  qof_event_gen (&entry->inst.entity, QOF_EVENT_DESTROY, NULL);
+  qof_event_gen (&entry->inst, QOF_EVENT_DESTROY, NULL);
 
   CACHE_REMOVE (entry->desc);
   CACHE_REMOVE (entry->action);
@@ -233,8 +255,8 @@
   if (entry->b_tax_table)
     gncTaxTableDecRef (entry->b_tax_table);
 
-  qof_instance_release (&entry->inst);
-  g_free (entry);
+  /* qof_instance_release (&entry->inst); */
+  g_object_unref (entry);
 }
 
 GncEntry *
@@ -1209,7 +1231,7 @@
   compare = safe_strcmp (a->action, b->action);
   if (compare) return compare;
 
-  return guid_compare (&(a->inst.entity.guid), &(b->inst.entity.guid));
+  return guid_compare (&(a->inst.guid), &(b->inst.guid));
 }
 
 /* ============================================================= */

Modified: gnucash/branches/gda-dev/src/business/business-core/gncEntry.h
===================================================================
--- gnucash/branches/gda-dev/src/business/business-core/gncEntry.h	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/src/business/business-core/gncEntry.h	2007-04-14 00:35:53 UTC (rev 15878)
@@ -32,6 +32,7 @@
 #define GNC_ENTRY_H_
 
 typedef struct _gncEntry GncEntry;
+typedef struct _gncEntryClass GncEntryClass;
 
 typedef enum {
   GNC_PAYMENT_CASH = 1,
@@ -53,9 +54,21 @@
 #include "gncOwner.h"
 
 #define GNC_ID_ENTRY "gncEntry"
-#define GNC_IS_ENTRY(obj)  (QOF_CHECK_TYPE((obj), GNC_ID_ENTRY))
-#define GNC_ENTRY(obj)     (QOF_CHECK_CAST((obj), GNC_ID_ENTRY, GncEntry))
 
+/* --- type macros --- */
+#define GNC_TYPE_ENTRY            (gnc_entry_get_type ())
+#define GNC_ENTRY(o)              \
+     (G_TYPE_CHECK_INSTANCE_CAST ((o), GNC_TYPE_ENTRY, GncEntry))
+#define GNC_ENTRY_CLASS(k)        \
+     (G_TYPE_CHECK_CLASS_CAST((k), GNC_TYPE_ENTRY, GncEntryClass))
+#define GNC_IS_ENTRY(o)           \
+     (G_TYPE_CHECK_INSTANCE_TYPE ((o), GNC_TYPE_ENTRY))
+#define GNC_IS_ENTRY_CLASS(k)     \
+     (G_TYPE_CHECK_CLASS_TYPE ((k), GNC_TYPE_ENTRY))
+#define GNC_ENTRY_GET_CLASS(o)    \
+     (G_TYPE_INSTANCE_GET_CLASS ((o), GNC_TYPE_ENTRY, GncEntryClass))
+GType gnc_entry_get_type(void);
+
 /** How to apply the discount and taxes.  There are three distinct ways to
  * apply them:
  *

Modified: gnucash/branches/gda-dev/src/business/business-core/gncEntryP.h
===================================================================
--- gnucash/branches/gda-dev/src/business/business-core/gncEntryP.h	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/src/business/business-core/gncEntryP.h	2007-04-14 00:35:53 UTC (rev 15878)
@@ -59,6 +59,6 @@
  */
 GncEntry * gncEntryObtainTwin (GncEntry *from, QofBook *book);
 
-#define gncEntrySetGUID(E,G) qof_entity_set_guid(QOF_ENTITY(E),(G))
+#define gncEntrySetGUID(E,G) qof_instance_set_guid(QOF_INSTANCE(E),(G))
 
 #endif /* GNC_ENTRYP_H_ */

Modified: gnucash/branches/gda-dev/src/business/business-core/gncInvoice.c
===================================================================
--- gnucash/branches/gda-dev/src/business/business-core/gncInvoice.c	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/src/business/business-core/gncInvoice.c	2007-04-14 00:35:53 UTC (rev 15878)
@@ -69,6 +69,11 @@
   GNCLot      *posted_lot;
 };
 
+struct _gncInvoiceClass
+{
+  QofInstanceClass parent_class;
+};
+
 static QofLogModule log_module = GNC_MOD_BUSINESS;
 
 #define _GNC_MOD_NAME	GNC_ID_INVOICE
@@ -91,7 +96,7 @@
 mark_invoice (GncInvoice *invoice)
 {
   qof_instance_set_dirty(&invoice->inst);
-  qof_event_gen (&invoice->inst.entity, QOF_EVENT_MODIFY, NULL);
+  qof_event_gen (&invoice->inst, QOF_EVENT_MODIFY, NULL);
 }
 
 QofBook * gncInvoiceGetBook(GncInvoice *x)
@@ -100,16 +105,33 @@
 }
 
 /* ================================================================== */
+/* GObject Initialization */
+QOF_GOBJECT_IMPL(gnc_invoice, GncInvoice, QOF_TYPE_INSTANCE);
+
+static void
+gnc_invoice_init(GncInvoice* inv)
+{
+}
+
+static void
+gnc_invoice_dispose_real (GObject *invp)
+{
+}
+
+static void
+gnc_invoice_finalize_real(GObject* invp)
+{
+}
+
 /* Create/Destroy Functions */
-
 GncInvoice *gncInvoiceCreate (QofBook *book)
 {
   GncInvoice *invoice;
 
   if (!book) return NULL;
 
-  invoice = g_new0 (GncInvoice, 1);
-  qof_instance_init (&invoice->inst, _GNC_MOD_NAME, book);
+  invoice = g_object_new (GNC_TYPE_INVOICE, NULL);
+  qof_instance_init_data (&invoice->inst, _GNC_MOD_NAME, book);
 
   invoice->id = CACHE_INSERT ("");
   invoice->notes = CACHE_INSERT ("");
@@ -120,7 +142,7 @@
 
   invoice->to_charge_amount = gnc_numeric_zero();
 
-  qof_event_gen (&invoice->inst.entity, QOF_EVENT_CREATE, NULL);
+  qof_event_gen (&invoice->inst, QOF_EVENT_CREATE, NULL);
 
   return invoice;
 }
@@ -136,7 +158,7 @@
 {
   if (!invoice) return;
 
-  qof_event_gen (&invoice->inst.entity, QOF_EVENT_DESTROY, NULL);
+  qof_event_gen (&invoice->inst, QOF_EVENT_DESTROY, NULL);
 
   CACHE_REMOVE (invoice->id);
   CACHE_REMOVE (invoice->notes);
@@ -148,8 +170,8 @@
   if (invoice->terms)
     gncBillTermDecRef (invoice->terms);
 
-  qof_instance_release (&invoice->inst);
-  g_free (invoice);
+  /* qof_instance_release (&invoice->inst); */
+  g_object_unref (invoice);
 }
 
 GncInvoice *
@@ -160,8 +182,8 @@
 
   if (!book) return NULL;
 
-  invoice = g_new0 (GncInvoice, 1);
-  qof_instance_init (&invoice->inst, _GNC_MOD_NAME, book);
+  invoice = g_object_new (GNC_TYPE_INVOICE, NULL);
+  qof_instance_init_data (&invoice->inst, _GNC_MOD_NAME, book);
 
   invoice->id = CACHE_INSERT (from->id);
   invoice->notes = CACHE_INSERT (from->notes);
@@ -199,7 +221,7 @@
   GNCLot *	posted_lot;
 #endif
 
-  qof_event_gen (&invoice->inst.entity, QOF_EVENT_CREATE, NULL);
+  qof_event_gen (&invoice->inst, QOF_EVENT_CREATE, NULL);
 
   return invoice;
 }
@@ -241,7 +263,7 @@
 }
 
 static void
-qofInvoiceSetOwner (GncInvoice *invoice, QofEntity *ent)
+qofInvoiceSetOwner (GncInvoice *invoice, QofInstance *ent)
 {
 	if(!invoice || !ent) { return; }
 	gncInvoiceBeginEdit (invoice);
@@ -251,7 +273,7 @@
 }
 
 static void
-qofInvoiceSetBillTo (GncInvoice *invoice, QofEntity *ent)
+qofInvoiceSetBillTo (GncInvoice *invoice, QofInstance *ent)
 {
 	if(!invoice || !ent) { return; }
 	gncInvoiceBeginEdit (invoice);
@@ -459,18 +481,24 @@
   return &invoice->owner;
 }
 
-static QofEntity*
+static QofInstance*
 qofInvoiceGetOwner (GncInvoice *invoice)
 {
+	GncOwner *owner;
+
 	if(!invoice) { return NULL; }
-	return (QofEntity*)&invoice->owner;
+	owner = &invoice->owner;
+	return QOF_INSTANCE(owner);
 }
 
-static QofEntity*
+static QofInstance*
 qofInvoiceGetBillTo (GncInvoice *invoice)
 {
+	GncOwner *billto;
+
 	if(!invoice) { return NULL; }
-	return (QofEntity*)&invoice->billto;
+	billto = &invoice->billto;
+	return QOF_INSTANCE(billto);
 }
 
 Timespec gncInvoiceGetDateOpened (GncInvoice *invoice)
@@ -655,19 +683,19 @@
 {
 	QofCollection *entry_coll;
 	GList         *list;
-	QofEntity     *entry;
+	QofInstance     *entry;
 
 	entry_coll = qof_collection_new(GNC_ID_ENTRY);
 	for(list = gncInvoiceGetEntries(invoice); list != NULL; list = list->next)
 	{
-		entry = (QofEntity*)list->data;
+		entry = QOF_INSTANCE(list->data);
 		qof_collection_add_entity(entry_coll, entry);
 	}
 	return entry_coll;
 }
 
 static void
-qofInvoiceEntryCB (QofEntity *ent, gpointer user_data)
+qofInvoiceEntryCB (QofInstance *ent, gpointer user_data)
 {
 	GncInvoice *invoice;
 
@@ -1385,7 +1413,7 @@
     /* Now send an event for the invoice so it gets updated as paid */
     this_invoice = gncInvoiceGetInvoiceFromLot(lot);
     if (this_invoice)
-      qof_event_gen (&this_invoice->inst.entity, QOF_EVENT_MODIFY, NULL);
+      qof_event_gen (&this_invoice->inst, QOF_EVENT_MODIFY, NULL);
 
     if (gnc_numeric_zero_p (amount))
       break;
@@ -1482,7 +1510,7 @@
   compare = timespec_cmp (&(a->date_posted), &(b->date_posted));
   if (compare) return compare;
 
-  return guid_compare (&(a->inst.entity.guid), &(b->inst.entity.guid));
+  return guid_compare (&(a->inst.guid), &(b->inst.guid));
 }
 
 /* ============================================================= */

Modified: gnucash/branches/gda-dev/src/business/business-core/gncInvoice.h
===================================================================
--- gnucash/branches/gda-dev/src/business/business-core/gncInvoice.h	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/src/business/business-core/gncInvoice.h	2007-04-14 00:35:53 UTC (rev 15878)
@@ -38,6 +38,7 @@
 
 struct _gncInvoice;
 typedef struct _gncInvoice GncInvoice;
+typedef struct _gncInvoiceClass GncInvoiceClass;
 
 #include "gncBillTerm.h"
 #include "gncEntry.h"
@@ -46,9 +47,21 @@
 #include "qofbook.h"
 
 #define GNC_ID_INVOICE    "gncInvoice"
-#define GNC_IS_INVOICE(obj)  (QOF_CHECK_TYPE((obj), GNC_ID_INVOICE))
-#define GNC_INVOICE(obj)     (QOF_CHECK_CAST((obj), GNC_ID_INVOICE, GncInvoice))
 
+/* --- type macros --- */
+#define GNC_TYPE_INVOICE            (gnc_invoice_get_type ())
+#define GNC_INVOICE(o)              \
+     (G_TYPE_CHECK_INSTANCE_CAST ((o), GNC_TYPE_INVOICE, GncInvoice))
+#define GNC_INVOICE_CLASS(k)        \
+     (G_TYPE_CHECK_CLASS_CAST((k), GNC_TYPE_INVOICE, GncInvoiceClass))
+#define GNC_IS_INVOICE(o)           \
+     (G_TYPE_CHECK_INSTANCE_TYPE ((o), GNC_TYPE_INVOICE))
+#define GNC_IS_INVOICE_CLASS(k)     \
+     (G_TYPE_CHECK_CLASS_TYPE ((k), GNC_TYPE_INVOICE))
+#define GNC_INVOICE_GET_CLASS(o)    \
+     (G_TYPE_INSTANCE_GET_CLASS ((o), GNC_TYPE_INVOICE, GncInvoiceClass))
+GType gnc_invoice_get_type(void);
+
 /** @name Create/Destroy Functions 
  @{ */
 GncInvoice *gncInvoiceCreate (QofBook *book);

Modified: gnucash/branches/gda-dev/src/business/business-core/gncInvoiceP.h
===================================================================
--- gnucash/branches/gda-dev/src/business/business-core/gncInvoiceP.h	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/src/business/business-core/gncInvoiceP.h	2007-04-14 00:35:53 UTC (rev 15878)
@@ -63,5 +63,5 @@
  * different ways.
  */
 GncInvoice * gncInvoiceObtainTwin (GncInvoice *from, QofBook *book);
-#define gncInvoiceSetGUID(I,G) qof_entity_set_guid(QOF_ENTITY(I),(G))
+#define gncInvoiceSetGUID(I,G) qof_instance_set_guid(QOF_INSTANCE(I),(G))
 #endif /* GNC_INVOICEP_H_ */

Modified: gnucash/branches/gda-dev/src/business/business-core/gncJob.c
===================================================================
--- gnucash/branches/gda-dev/src/business/business-core/gncJob.c	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/src/business/business-core/gncJob.c	2007-04-14 00:35:53 UTC (rev 15878)
@@ -46,6 +46,11 @@
   gboolean      active;
 };
 
+struct _gncJobClass
+{
+  QofInstanceClass parent_class;
+};
+
 static QofLogModule log_module = GNC_MOD_BUSINESS;
 
 #define _GNC_MOD_NAME        GNC_ID_JOB
@@ -57,20 +62,37 @@
 void mark_job (GncJob *job)
 {
   qof_instance_set_dirty(&job->inst);
-  qof_event_gen (&job->inst.entity, QOF_EVENT_MODIFY, NULL);
+  qof_event_gen (&job->inst, QOF_EVENT_MODIFY, NULL);
 }
 
 /* ================================================================== */
+/* GObject Initialization */
+QOF_GOBJECT_IMPL(gnc_job, GncJob, QOF_TYPE_INSTANCE);
+
+static void
+gnc_job_init(GncJob* job)
+{
+}
+
+static void
+gnc_job_dispose_real (GObject *jobp)
+{
+}
+
+static void
+gnc_job_finalize_real(GObject* jobp)
+{
+}
+
 /* Create/Destroy Functions */
-
 GncJob *gncJobCreate (QofBook *book)
 {
   GncJob *job;
 
   if (!book) return NULL;
 
-  job = g_new0 (GncJob, 1);
-  qof_instance_init (&job->inst, _GNC_MOD_NAME, book);
+  job = g_object_new (GNC_TYPE_JOB, NULL);
+  qof_instance_init_data (&job->inst, _GNC_MOD_NAME, book);
 
   job->id = CACHE_INSERT ("");
   job->name = CACHE_INSERT ("");
@@ -78,7 +100,7 @@
   job->active = TRUE;
 
   /* GncOwner not initialized */
-  qof_event_gen (&job->inst.entity, QOF_EVENT_CREATE, NULL);
+  qof_event_gen (&job->inst, QOF_EVENT_CREATE, NULL);
 
   return job;
 }
@@ -90,8 +112,8 @@
                                                                                 
   if (!book) return NULL;
                                                                                 
-  job = g_new0 (GncJob, 1);
-  qof_instance_init (&job->inst, _GNC_MOD_NAME, book);
+  job = g_object_new (GNC_TYPE_JOB, NULL);
+  qof_instance_init_data (&job->inst, _GNC_MOD_NAME, book);
   qof_instance_gemini (&job->inst, &from->inst);
                                                                                 
   job->id = CACHE_INSERT (from->id);
@@ -101,7 +123,7 @@
 
   job->owner = gncCloneOwner(&from->owner, book);
 
-  qof_event_gen (&job->inst.entity, QOF_EVENT_CREATE, NULL);
+  qof_event_gen (&job->inst, QOF_EVENT_CREATE, NULL);
                                                                                 
   return job;
 }
@@ -117,7 +139,7 @@
 {
   if (!job) return;
 
-  qof_event_gen (&job->inst.entity, QOF_EVENT_DESTROY, NULL);
+  qof_event_gen (&job->inst, QOF_EVENT_DESTROY, NULL);
 
   CACHE_REMOVE (job->id);
   CACHE_REMOVE (job->name);
@@ -134,8 +156,8 @@
     break;
   }
 
-  qof_instance_release (&job->inst);
-  g_free (job);
+  /* qof_instance_release (&job->inst); */
+  g_object_unref (job);
 }
 
 GncJob *
@@ -248,7 +270,7 @@
 }
 
 static void
-qofJobSetOwner (GncJob *job, QofEntity *ent)
+qofJobSetOwner (GncJob *job, QofInstance *ent)
 {
 	if(!job || !ent) { return; }
 	qof_begin_edit(&job->inst);
@@ -315,11 +337,11 @@
   return job->active;
 }
 
-static QofEntity*
+static QofInstance*
 qofJobGetOwner (GncJob *job)
 {
 	if(!job) { return NULL; }
-	return (QofEntity*)qofOwnerGetOwner(&job->owner);
+	return QOF_INSTANCE(qofOwnerGetOwner(&job->owner));
 }
 
 /* Other functions */

Modified: gnucash/branches/gda-dev/src/business/business-core/gncJob.h
===================================================================
--- gnucash/branches/gda-dev/src/business/business-core/gncJob.h	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/src/business/business-core/gncJob.h	2007-04-14 00:35:53 UTC (rev 15878)
@@ -32,14 +32,27 @@
 #define GNC_JOB_H_
 
 typedef struct _gncJob GncJob;
+typedef struct _gncJobClass GncJobClass;
 
 #include "gncAddress.h"
 #include "gncOwner.h"
 
 #define GNC_ID_JOB "gncJob"
-#define GNC_IS_JOB(obj)  (QOF_CHECK_TYPE((obj), GNC_ID_JOB))
-#define GNC_JOB(obj)     (QOF_CHECK_CAST((obj), GNC_ID_JOB, GncJob))
 
+/* --- type macros --- */
+#define GNC_TYPE_JOB            (gnc_job_get_type ())
+#define GNC_JOB(o)              \
+     (G_TYPE_CHECK_INSTANCE_CAST ((o), GNC_TYPE_JOB, GncJob))
+#define GNC_JOB_CLASS(k)        \
+     (G_TYPE_CHECK_CLASS_CAST((k), GNC_TYPE_JOB, GncJobClass))
+#define GNC_IS_JOB(o)           \
+     (G_TYPE_CHECK_INSTANCE_TYPE ((o), GNC_TYPE_JOB))
+#define GNC_IS_JOB_CLASS(k)     \
+     (G_TYPE_CHECK_CLASS_TYPE ((k), GNC_TYPE_JOB))
+#define GNC_JOB_GET_CLASS(o)    \
+     (G_TYPE_INSTANCE_GET_CLASS ((o), GNC_TYPE_JOB, GncJobClass))
+GType gnc_job_get_type(void);
+
 /* Create/Destroy Functions */
 
 GncJob *gncJobCreate (QofBook *book);

Modified: gnucash/branches/gda-dev/src/business/business-core/gncJobP.h
===================================================================
--- gnucash/branches/gda-dev/src/business/business-core/gncJobP.h	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/src/business/business-core/gncJobP.h	2007-04-14 00:35:53 UTC (rev 15878)
@@ -53,6 +53,6 @@
  */
 GncJob * gncJobObtainTwin (GncJob *from, QofBook *book);
 
-#define gncJobSetGUID(E,G) qof_entity_set_guid(QOF_ENTITY(E),(G))
+#define gncJobSetGUID(E,G) qof_instance_set_guid(QOF_INSTANCE(E),(G))
 
 #endif /* GNC_JOBP_H_ */

Modified: gnucash/branches/gda-dev/src/business/business-core/gncOrder.c
===================================================================
--- gnucash/branches/gda-dev/src/business/business-core/gncOrder.c	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/src/business/business-core/gncOrder.c	2007-04-14 00:35:53 UTC (rev 15878)
@@ -53,6 +53,11 @@
   Timespec 	closed;
 };
 
+struct _gncOrderClass
+{
+  QofInstanceClass parent_class;
+};
+
 static QofLogModule log_module = GNC_MOD_BUSINESS;
 
 #define _GNC_MOD_NAME	GNC_ID_ORDER
@@ -71,20 +76,37 @@
 void mark_order (GncOrder *order)
 {
   qof_instance_set_dirty(&order->inst);
-  qof_event_gen (&order->inst.entity, QOF_EVENT_MODIFY, NULL);
+  qof_event_gen (&order->inst, QOF_EVENT_MODIFY, NULL);
 }
 
 /* =============================================================== */
+/* GObject Initialization */
+QOF_GOBJECT_IMPL(gnc_order, GncOrder, QOF_TYPE_INSTANCE);
+
+static void
+gnc_order_init(GncOrder* order)
+{
+}
+
+static void
+gnc_order_dispose_real (GObject *orderp)
+{
+}
+
+static void
+gnc_order_finalize_real(GObject* orderp)
+{
+}
+
 /* Create/Destroy Functions */
-
 GncOrder *gncOrderCreate (QofBook *book)
 {
   GncOrder *order;
 
   if (!book) return NULL;
 
-  order = g_new0 (GncOrder, 1);
-  qof_instance_init (&order->inst, _GNC_MOD_NAME, book);
+  order = g_object_new (GNC_TYPE_ORDER, NULL);
+  qof_instance_init_data (&order->inst, _GNC_MOD_NAME, book);
 
   order->id = CACHE_INSERT ("");
   order->notes = CACHE_INSERT ("");
@@ -92,7 +114,7 @@
 
   order->active = TRUE;
 
-  qof_event_gen (&order->inst.entity, QOF_EVENT_CREATE, NULL);
+  qof_event_gen (&order->inst, QOF_EVENT_CREATE, NULL);
 
   return order;
 }
@@ -108,7 +130,7 @@
 {
   if (!order) return;
 
-  qof_event_gen (&order->inst.entity, QOF_EVENT_DESTROY, NULL);
+  qof_event_gen (&order->inst, QOF_EVENT_DESTROY, NULL);
 
   g_list_free (order->entries);
   CACHE_REMOVE (order->id);
@@ -117,8 +139,8 @@
 
   if (order->printname) g_free (order->printname);
 
-  qof_instance_release (&order->inst);
-  g_free (order);
+  /* qof_instance_release (&order->inst); */
+  g_object_unref (order);
 }
 
 GncOrder *
@@ -129,8 +151,8 @@
 
   if (!book) return NULL;
 
-  order = g_new0 (GncOrder, 1);
-  qof_instance_init (&order->inst, _GNC_MOD_NAME, book);
+  order = g_object_new (GNC_TYPE_ORDER, NULL);
+  qof_instance_init_data (&order->inst, _GNC_MOD_NAME, book);
   qof_instance_gemini (&order->inst, &from->inst);
 
   order->id = CACHE_INSERT (from->id);
@@ -152,7 +174,7 @@
     order->entries = g_list_prepend (order->entries, entry);
   }
 
-  qof_event_gen (&order->inst.entity, QOF_EVENT_CREATE, NULL);
+  qof_event_gen (&order->inst, QOF_EVENT_CREATE, NULL);
 
   return order;
 }
@@ -373,7 +395,7 @@
   compare = timespec_cmp (&(a->closed), &(b->closed));
   if (compare) return compare;
 
-  return guid_compare (&(a->inst.entity.guid), &(b->inst.entity.guid));
+  return guid_compare (&(a->inst.guid), &(b->inst.guid));
 }
 
 /* =========================================================== */

Modified: gnucash/branches/gda-dev/src/business/business-core/gncOrder.h
===================================================================
--- gnucash/branches/gda-dev/src/business/business-core/gncOrder.h	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/src/business/business-core/gncOrder.h	2007-04-14 00:35:53 UTC (rev 15878)
@@ -35,15 +35,28 @@
 #define GNC_ORDER_H_
 
 typedef struct _gncOrder GncOrder;
+typedef struct _gncOrderClass GncOrderClass;
 
 #include "gncEntry.h"
 #include "gncOwner.h"
 #include "qof.h"
 
 #define GNC_ID_ORDER "gncOrder"
-#define GNC_IS_ORDER(obj)  (QOF_CHECK_TYPE((obj), GNC_ID_ORDER))
-#define GNC_ORDER(obj)     (QOF_CHECK_CAST((obj), GNC_ID_ORDER, GncOrder))
 
+/* --- type macros --- */
+#define GNC_TYPE_ORDER            (gnc_order_get_type ())
+#define GNC_ORDER(o)              \
+     (G_TYPE_CHECK_INSTANCE_CAST ((o), GNC_TYPE_ORDER, GncOrder))
+#define GNC_ORDER_CLASS(k)        \
+     (G_TYPE_CHECK_CLASS_CAST((k), GNC_TYPE_ORDER, GncOrderClass))
+#define GNC_IS_ORDER(o)           \
+     (G_TYPE_CHECK_INSTANCE_TYPE ((o), GNC_TYPE_ORDER))
+#define GNC_IS_ORDER_CLASS(k)     \
+     (G_TYPE_CHECK_CLASS_TYPE ((k), GNC_TYPE_ORDER))
+#define GNC_ORDER_GET_CLASS(o)    \
+     (G_TYPE_INSTANCE_GET_CLASS ((o), GNC_TYPE_ORDER, GncOrderClass))
+GType gnc_order_get_type(void);
+
 /* Create/Destroy Functions */
 
 GncOrder *gncOrderCreate (QofBook *book);

Modified: gnucash/branches/gda-dev/src/business/business-core/gncOrderP.h
===================================================================
--- gnucash/branches/gda-dev/src/business/business-core/gncOrderP.h	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/src/business/business-core/gncOrderP.h	2007-04-14 00:35:53 UTC (rev 15878)
@@ -54,6 +54,6 @@
  */
 GncOrder * gncOrderObtainTwin (GncOrder *from, QofBook *book);
 
-#define gncOrderSetGUID(O,G) qof_entity_set_guid(QOF_ENTITY(O),(G))
+#define gncOrderSetGUID(O,G) qof_instance_set_guid(QOF_INSTANCE(O),(G))
 
 #endif /* GNC_ORDERP_H_ */

Modified: gnucash/branches/gda-dev/src/business/business-core/gncOwner.c
===================================================================
--- gnucash/branches/gda-dev/src/business/business-core/gncOwner.c	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/src/business/business-core/gncOwner.c	2007-04-14 00:35:53 UTC (rev 15878)
@@ -138,10 +138,10 @@
 	return type;
 }
 
-QofEntity*
+QofInstance*
 qofOwnerGetOwner (GncOwner *owner)
 {
-	QofEntity *ent;
+	QofInstance *ent;
 
 	if(!owner) { return NULL; }
 	ent = NULL;
@@ -154,19 +154,19 @@
 			break;
 		}
 		case GNC_OWNER_CUSTOMER : {
-			ent = (QofEntity*)owner->owner.customer;
+			ent = QOF_INSTANCE(owner->owner.customer);
 			break;
 		}
 		case GNC_OWNER_JOB : {
-			ent = (QofEntity*)owner->owner.job;
+			ent = QOF_INSTANCE(owner->owner.job);
 			break;
 		}
 		case GNC_OWNER_VENDOR : {
-			ent = (QofEntity*)owner->owner.vendor;
+			ent = QOF_INSTANCE(owner->owner.vendor);
 			break;
 		}
 		case GNC_OWNER_EMPLOYEE : {
-			ent = (QofEntity*)owner->owner.employee;
+			ent = QOF_INSTANCE(owner->owner.employee);
 			break;
 		}
 	}
@@ -174,7 +174,7 @@
 }
 
 void
-qofOwnerSetEntity (GncOwner *owner, QofEntity *ent)
+qofOwnerSetEntity (GncOwner *owner, QofInstance *ent)
 {
 	if(!owner || !ent) { return; }
 	if(0 == safe_strcmp(ent->e_type, GNC_ID_CUSTOMER))

Modified: gnucash/branches/gda-dev/src/business/business-core/gncOwner.h
===================================================================
--- gnucash/branches/gda-dev/src/business/business-core/gncOwner.h	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/src/business/business-core/gncOwner.h	2007-04-14 00:35:53 UTC (rev 15878)
@@ -63,9 +63,9 @@
 /** return the type for the collection. */
 QofIdType qofOwnerGetType(GncOwner *owner);
 /** return the owner itself as an entity. */
-QofEntity* qofOwnerGetOwner (GncOwner *owner);
+QofInstance* qofOwnerGetOwner (GncOwner *owner);
 /** set the owner from the entity. */
-void qofOwnerSetEntity (GncOwner *owner, QofEntity *ent);
+void qofOwnerSetEntity (GncOwner *owner, QofInstance *ent);
 
 gboolean
 gncOwnerRegister(void);

Modified: gnucash/branches/gda-dev/src/business/business-core/gncTaxTable.c
===================================================================
--- gnucash/branches/gda-dev/src/business/business-core/gncTaxTable.c	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/src/business/business-core/gncTaxTable.c	2007-04-14 00:35:53 UTC (rev 15878)
@@ -48,6 +48,11 @@
   GList *         children;     /* list of children for disconnection */
 };
 
+struct _gncTaxTableClass
+{
+  QofInstanceClass parent_class;
+};
+
 struct _gncTaxTableEntry 
 {
   GncTaxTable *   table;
@@ -144,7 +149,7 @@
 mark_table (GncTaxTable *table)
 {
   qof_instance_set_dirty(&table->inst);
-  qof_event_gen (&table->inst.entity, QOF_EVENT_MODIFY, NULL);
+  qof_event_gen (&table->inst, QOF_EVENT_MODIFY, NULL);
 }
 
 static inline void 
@@ -200,19 +205,36 @@
 }
 
 /* =============================================================== */
+/* GObject Initialization */
+QOF_GOBJECT_IMPL(gnc_taxtable, GncTaxTable, QOF_TYPE_INSTANCE);
+
+static void
+gnc_taxtable_init(GncTaxTable* tt)
+{
+}
+
+static void
+gnc_taxtable_dispose_real (GObject *ttp)
+{
+}
+
+static void
+gnc_taxtable_finalize_real(GObject* ttp)
+{
+}
+
 /* Create/Destroy Functions */
-
 GncTaxTable * 
 gncTaxTableCreate (QofBook *book)
 {
   GncTaxTable *table;
   if (!book) return NULL;
 
-  table = g_new0 (GncTaxTable, 1);
-  qof_instance_init (&table->inst, _GNC_MOD_NAME, book);
+  table = g_object_new (GNC_TYPE_TAXTABLE, NULL);
+  qof_instance_init_data (&table->inst, _GNC_MOD_NAME, book);
   table->name = CACHE_INSERT ("");
   addObj (table);
-  qof_event_gen (&table->inst.entity, QOF_EVENT_CREATE, NULL);
+  qof_event_gen (&table->inst, QOF_EVENT_CREATE, NULL);
   return table;
 }
 
@@ -224,8 +246,8 @@
   GncTaxTable *table;
   if (!book) return NULL;
 
-  table = g_new0 (GncTaxTable, 1);
-  qof_instance_init (&table->inst, _GNC_MOD_NAME, book);
+  table = g_object_new (GNC_TYPE_TAXTABLE, NULL);
+  qof_instance_init_data (&table->inst, _GNC_MOD_NAME, book);
   qof_instance_gemini (&table->inst, &from->inst);
   
   table->name = CACHE_INSERT (from->name);
@@ -264,7 +286,7 @@
   }
 
   addObj (table);
-  qof_event_gen (&table->inst.entity, QOF_EVENT_CREATE, NULL);
+  qof_event_gen (&table->inst, QOF_EVENT_CREATE, NULL);
   return table;
 }
 
@@ -300,7 +322,7 @@
 
   if (!table) return;
 
-  qof_event_gen (&table->inst.entity, QOF_EVENT_DESTROY, NULL);
+  qof_event_gen (&table->inst, QOF_EVENT_DESTROY, NULL);
   CACHE_REMOVE (table->name);
   remObj (table);
 
@@ -323,8 +345,8 @@
   }
   g_list_free(table->children);
 
-  qof_instance_release (&table->inst);
-  g_free (table);
+  /* qof_instance_release (&table->inst); */
+  g_object_unref (table);
 }
 
 /* =============================================================== */

Modified: gnucash/branches/gda-dev/src/business/business-core/gncTaxTable.h
===================================================================
--- gnucash/branches/gda-dev/src/business/business-core/gncTaxTable.h	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/src/business/business-core/gncTaxTable.h	2007-04-14 00:35:53 UTC (rev 15878)
@@ -49,6 +49,7 @@
 @param 	GList *         children; list of children for disconnection 
 */
 typedef struct _gncTaxTable GncTaxTable;
+typedef struct _gncTaxTableClass GncTaxTableClass;
 
 /** @struct GncTaxTableEntry
 
@@ -70,9 +71,21 @@
 #endif
 
 #define GNC_ID_TAXTABLE       "gncTaxTable"
-#define GNC_IS_TAXTABLE(obj)  (QOF_CHECK_TYPE((obj), GNC_ID_TAXTABLE))
-#define GNC_TAXTABLE(obj)     (QOF_CHECK_CAST((obj), GNC_ID_TAXTABLE, GncTaxTable))
 
+/* --- type macros --- */
+#define GNC_TYPE_TAXTABLE            (gnc_taxtable_get_type ())
+#define GNC_TAXTABLE(o)              \
+     (G_TYPE_CHECK_INSTANCE_CAST ((o), GNC_TYPE_TAXTABLE, GncTaxTable))
+#define GNC_TAXTABLE_CLASS(k)        \
+     (G_TYPE_CHECK_CLASS_CAST((k), GNC_TYPE_TAXTABLE, GncTaxTableClass))
+#define GNC_IS_TAXTABLE(o)           \
+     (G_TYPE_CHECK_INSTANCE_TYPE ((o), GNC_TYPE_TAXTABLE))
+#define GNC_IS_TAXTABLE_CLASS(k)     \
+     (G_TYPE_CHECK_CLASS_TYPE ((k), GNC_TYPE_TAXTABLE))
+#define GNC_TAXTABLE_GET_CLASS(o)    \
+     (G_TYPE_INSTANCE_GET_CLASS ((o), GNC_TYPE_TAXTABLE, GncTaxTableClass))
+GType gnc_taxtable_get_type(void);
+
 /**
  * How to interpret the amount.
  * You can interpret it as a VALUE or a PERCENT.

Modified: gnucash/branches/gda-dev/src/business/business-core/gncTaxTableP.h
===================================================================
--- gnucash/branches/gda-dev/src/business/business-core/gncTaxTableP.h	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/src/business/business-core/gncTaxTableP.h	2007-04-14 00:35:53 UTC (rev 15878)
@@ -63,6 +63,6 @@
  */
 GncTaxTable * gncTaxTableObtainTwin (GncTaxTable *from, QofBook *book);
 
-#define gncTaxTableSetGUID(E,G) qof_entity_set_guid(QOF_ENTITY(E),(G))
+#define gncTaxTableSetGUID(E,G) qof_instance_set_guid(QOF_INSTANCE(E),(G))
 
 #endif /* GNC_TAXTABLEP_H_ */

Modified: gnucash/branches/gda-dev/src/business/business-core/gncVendor.c
===================================================================
--- gnucash/branches/gda-dev/src/business/business-core/gncVendor.c	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/src/business/business-core/gncVendor.c	2007-04-14 00:35:53 UTC (rev 15878)
@@ -57,6 +57,11 @@
   GList *         jobs;
 };
 
+struct _gncVendorClass
+{
+  QofInstanceClass parent_class;
+};
+
 static QofLogModule log_module = GNC_MOD_BUSINESS;
 
 #define _GNC_MOD_NAME        GNC_ID_VENDOR
@@ -68,30 +73,47 @@
 void mark_vendor (GncVendor *vendor)
 {
   qof_instance_set_dirty(&vendor->inst);
-  qof_event_gen (&vendor->inst.entity, QOF_EVENT_MODIFY, NULL);
+  qof_event_gen (&vendor->inst, QOF_EVENT_MODIFY, NULL);
 }
 
 /* ============================================================== */
+/* GObject Initialization */
+QOF_GOBJECT_IMPL(gnc_vendor, GncVendor, QOF_TYPE_INSTANCE);
+
+static void
+gnc_vendor_init(GncVendor* vendor)
+{
+}
+
+static void
+gnc_vendor_dispose_real (GObject *vendorp)
+{
+}
+
+static void
+gnc_vendor_finalize_real(GObject* vendorp)
+{
+}
+
 /* Create/Destroy Functions */
-
 GncVendor *gncVendorCreate (QofBook *book)
 {
   GncVendor *vendor;
 
   if (!book) return NULL;
 
-  vendor = g_new0 (GncVendor, 1);
-  qof_instance_init (&vendor->inst, _GNC_MOD_NAME, book);
+  vendor = g_object_new (GNC_TYPE_VENDOR, NULL);
+  qof_instance_init_data (&vendor->inst, _GNC_MOD_NAME, book);
   
   vendor->id = CACHE_INSERT ("");
   vendor->name = CACHE_INSERT ("");
   vendor->notes = CACHE_INSERT ("");
-  vendor->addr = gncAddressCreate (book, &vendor->inst.entity);
+  vendor->addr = gncAddressCreate (book, &vendor->inst);
   vendor->taxincluded = GNC_TAXINCLUDED_USEGLOBAL;
   vendor->active = TRUE;
   vendor->jobs = NULL;
 
-  qof_event_gen (&vendor->inst.entity, QOF_EVENT_CREATE, NULL);
+  qof_event_gen (&vendor->inst, QOF_EVENT_CREATE, NULL);
 
   return vendor;
 }
@@ -107,11 +129,12 @@
 {
   if (!vendor) return;
 
-  qof_event_gen (&vendor->inst.entity, QOF_EVENT_DESTROY, NULL);
+  qof_event_gen (&vendor->inst, QOF_EVENT_DESTROY, NULL);
 
   CACHE_REMOVE (vendor->id);
   CACHE_REMOVE (vendor->name);
   CACHE_REMOVE (vendor->notes);
+  gncAddressBeginEdit (vendor->addr);
   gncAddressDestroy (vendor->addr);
   g_list_free (vendor->jobs);
 
@@ -120,8 +143,8 @@
   if (vendor->taxtable)
     gncTaxTableDecRef (vendor->taxtable);
 
-  qof_instance_release (&vendor->inst);
-  g_free (vendor);
+  /* qof_instance_release (&vendor->inst); */
+  g_object_unref (vendor);
 }
 
 /** Create a copy of a vendor, placing the copy into a new book. */
@@ -133,14 +156,14 @@
 
   if (!book) return NULL;
 
-  vendor = g_new0 (GncVendor, 1);
-  qof_instance_init (&vendor->inst, _GNC_MOD_NAME, book);
+  vendor = g_object_new (GNC_TYPE_VENDOR, NULL);
+  qof_instance_init_data (&vendor->inst, _GNC_MOD_NAME, book);
   qof_instance_gemini (&vendor->inst, &from->inst);
   
   vendor->id = CACHE_INSERT (from->id);
   vendor->name = CACHE_INSERT (from->name);
   vendor->notes = CACHE_INSERT (from->notes);
-  vendor->addr = gncCloneAddress (from->addr, &vendor->inst.entity, book);
+  vendor->addr = gncCloneAddress (from->addr, &vendor->inst, book);
   vendor->taxincluded = from->taxincluded;
   vendor->taxtable_override = from->taxtable_override;
   vendor->active = from->active;
@@ -161,7 +184,7 @@
     vendor->jobs = g_list_prepend(vendor->jobs, job);
   }
 
-  qof_event_gen (&vendor->inst.entity, QOF_EVENT_CREATE, NULL);
+  qof_event_gen (&vendor->inst, QOF_EVENT_CREATE, NULL);
 
   return vendor;
 }
@@ -293,14 +316,17 @@
 }
 
 static void
-qofVendorSetAddr (GncVendor *vendor, QofEntity *addr_ent)
+qofVendorSetAddr (GncVendor *vendor, QofInstance *addr_ent)
 {
 	GncAddress *addr;
 
 	if(!vendor || !addr_ent) { return; }
 	addr = (GncAddress*)addr_ent;
 	if(addr == vendor->addr) { return; }
-	if(vendor->addr != NULL) { gncAddressDestroy(vendor->addr); }
+	if(vendor->addr != NULL) {
+		gncAddressBeginEdit(vendor->addr);
+		gncAddressDestroy(vendor->addr);
+	}
 	gncVendorBeginEdit(vendor);
 	vendor->addr = addr;
 	gncVendorCommitEdit(vendor);
@@ -396,7 +422,7 @@
     vendor->jobs = g_list_insert_sorted (vendor->jobs, job,
                                          (GCompareFunc)gncJobCompare);
 
-  qof_event_gen (&vendor->inst.entity, QOF_EVENT_MODIFY, NULL);
+  qof_event_gen (&vendor->inst, QOF_EVENT_MODIFY, NULL);
 }
 
 void gncVendorRemoveJob (GncVendor *vendor, GncJob *job)
@@ -414,7 +440,7 @@
     g_list_free_1 (node);
   }
 
-  qof_event_gen (&vendor->inst.entity, QOF_EVENT_MODIFY, NULL);
+  qof_event_gen (&vendor->inst, QOF_EVENT_MODIFY, NULL);
 }
 
 void gncVendorBeginEdit (GncVendor *vendor)

Modified: gnucash/branches/gda-dev/src/business/business-core/gncVendor.h
===================================================================
--- gnucash/branches/gda-dev/src/business/business-core/gncVendor.h	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/src/business/business-core/gncVendor.h	2007-04-14 00:35:53 UTC (rev 15878)
@@ -32,6 +32,7 @@
 #define GNC_VENDOR_H_
 
 typedef struct _gncVendor GncVendor;
+typedef struct _gncVendorClass GncVendorClass;
 
 #include "gncAddress.h"
 #include "gncBillTerm.h"
@@ -39,9 +40,21 @@
 #include "gncJob.h"
 
 #define GNC_ID_VENDOR       "gncVendor"
-#define GNC_IS_VENDOR(obj)  (QOF_CHECK_TYPE((obj), GNC_ID_VENDOR))
-#define GNC_VENDOR(obj)     (QOF_CHECK_CAST((obj), GNC_ID_VENDOR, GncVendor))
 
+/* --- type macros --- */
+#define GNC_TYPE_VENDOR            (gnc_vendor_get_type ())
+#define GNC_VENDOR(o)              \
+     (G_TYPE_CHECK_INSTANCE_CAST ((o), GNC_TYPE_VENDOR, GncVendor))
+#define GNC_VENDOR_CLASS(k)        \
+     (G_TYPE_CHECK_CLASS_CAST((k), GNC_TYPE_VENDOR, GncVendorClass))
+#define GNC_IS_VENDOR(o)           \
+     (G_TYPE_CHECK_INSTANCE_TYPE ((o), GNC_TYPE_VENDOR))
+#define GNC_IS_VENDOR_CLASS(k)     \
+     (G_TYPE_CHECK_CLASS_TYPE ((k), GNC_TYPE_VENDOR))
+#define GNC_VENDOR_GET_CLASS(o)    \
+     (G_TYPE_INSTANCE_GET_CLASS ((o), GNC_TYPE_VENDOR, GncVendorClass))
+GType gnc_vendor_get_type(void);
+
 /* Create/Destroy Functions */
 
 GncVendor *gncVendorCreate (QofBook *book);

Modified: gnucash/branches/gda-dev/src/business/business-core/gncVendorP.h
===================================================================
--- gnucash/branches/gda-dev/src/business/business-core/gncVendorP.h	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/src/business/business-core/gncVendorP.h	2007-04-14 00:35:53 UTC (rev 15878)
@@ -52,7 +52,7 @@
  * different ways.
  */
 GncVendor * gncVendorObtainTwin (GncVendor *from, QofBook *book);
-#define gncVendorSetGUID(V,G) qof_entity_set_guid(QOF_ENTITY(V),(G))
+#define gncVendorSetGUID(V,G) qof_instance_set_guid(QOF_INSTANCE(V),(G))
 
 
 #endif /* GNC_VENDORP_H_ */

Modified: gnucash/branches/gda-dev/src/business/business-core/test/test-address.c
===================================================================
--- gnucash/branches/gda-dev/src/business/business-core/test/test-address.c	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/src/business/business-core/test/test-address.c	2007-04-14 00:35:53 UTC (rev 15878)
@@ -38,7 +38,7 @@
 static void
 test_address (void)
 {
-  QofEntity ent;
+  QofInstance ent;
   GncAddress *address;
   QofBook *book = qof_book_new ();
 
@@ -52,6 +52,7 @@
     address = gncAddressCreate (book, &ent);
     do_test (address != NULL, "address create");
 
+    gncAddressBeginEdit (address);
     gncAddressDestroy (address);
     success ("create/destroy");
   }

Modified: gnucash/branches/gda-dev/src/business/business-core/test/test-customer.c
===================================================================
--- gnucash/branches/gda-dev/src/business/business-core/test/test-customer.c	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/src/business/business-core/test/test-customer.c	2007-04-14 00:35:53 UTC (rev 15878)
@@ -208,19 +208,13 @@
 int
 main (int argc, char **argv)
 {
-  qof_log_init();
-  guid_init ();
-  qof_query_init ();
-  qof_object_initialize ();
-  qof_book_register ();
+  qof_init();
   do_test (cashobjects_register(), "Cannot register cash objects");
   do_test (gncInvoiceRegister(), "Cannot register GncInvoice");
   do_test (gncJobRegister (),  "Cannot register GncJob");
   do_test (gncCustomerRegister(), "Cannot register GncCustomer");
   test_customer();
   print_test_results();
-  qof_query_shutdown();
-  guid_shutdown();
-  qof_object_shutdown ();
+  qof_close ();
   return 0;
 }

Modified: gnucash/branches/gda-dev/src/business/business-core/test/test-employee.c
===================================================================
--- gnucash/branches/gda-dev/src/business/business-core/test/test-employee.c	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/src/business/business-core/test/test-employee.c	2007-04-14 00:35:53 UTC (rev 15878)
@@ -218,19 +218,13 @@
 int
 main (int argc, char **argv)
 { 
-  qof_log_init();
-  guid_init ();
-  qof_query_init ();
-  qof_object_initialize ();
-  qof_book_register ();
+  qof_init();
   do_test (gncInvoiceRegister(), "Cannot register GncInvoice");
   do_test (gncJobRegister (),  "Cannot register GncJob");
   do_test (gncCustomerRegister(), "Cannot register GncCustomer");
   do_test (gncEmployeeRegister(), "Cannot register GncEmployee");
   test_employee();
   print_test_results();
-  qof_query_shutdown();
-  guid_shutdown();
-  qof_object_shutdown ();
+  qof_close();
   return 0;
 }

Modified: gnucash/branches/gda-dev/src/business/business-core/test/test-job.c
===================================================================
--- gnucash/branches/gda-dev/src/business/business-core/test/test-job.c	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/src/business/business-core/test/test-job.c	2007-04-14 00:35:53 UTC (rev 15878)
@@ -235,19 +235,13 @@
 int
 main (int argc, char **argv)
 {
-  qof_log_init();
-  guid_init ();
-  qof_query_init ();
-  qof_object_initialize ();
-  qof_book_register ();
+  qof_init();
   do_test (gncInvoiceRegister(), "Cannot register GncInvoice");
   do_test (gncJobRegister (),  "Cannot register GncJob");
   do_test (gncCustomerRegister(), "Cannot register GncCustomer");
   test_job();
   print_test_results();
-  qof_query_shutdown();
-  guid_shutdown();
-  qof_object_shutdown ();
+  qof_close();
   return 0;
 }
 

Modified: gnucash/branches/gda-dev/src/business/business-core/test/test-vendor.c
===================================================================
--- gnucash/branches/gda-dev/src/business/business-core/test/test-vendor.c	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/src/business/business-core/test/test-vendor.c	2007-04-14 00:35:53 UTC (rev 15878)
@@ -216,19 +216,13 @@
 int
 main (int argc, char **argv)
 {
-  qof_log_init();
-  guid_init ();
-  qof_query_init ();
-  qof_object_initialize ();
-  qof_book_register ();
+  qof_init();
   do_test (gncInvoiceRegister(), "Cannot register GncInvoice");
   do_test (gncJobRegister (),  "Cannot register GncJob");
   do_test (gncCustomerRegister(), "Cannot register GncCustomer");
   do_test (gncVendorRegister(), "Cannot register GncVendor");		
   test_vendor();
   print_test_results();
-  qof_query_shutdown();
-  guid_shutdown();
-  qof_object_shutdown ();
+  qof_close();
   return 0;
 }

Modified: gnucash/branches/gda-dev/src/business/business-gnome/business-urls.c
===================================================================
--- gnucash/branches/gda-dev/src/business/business-gnome/business-urls.c	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/src/business/business-gnome/business-urls.c	2007-04-14 00:35:53 UTC (rev 15878)
@@ -79,7 +79,7 @@
 customerCB (const char *location, const char *label,
            gboolean new_window, GNCURLResult * result)
 {
-  QofEntity *entity;
+  QofInstance *entity;
   GncCustomer *customer;
 
   /* href="...:customer=<guid>" */
@@ -94,7 +94,7 @@
 vendorCB (const char *location, const char *label,
            gboolean new_window, GNCURLResult * result)
 {
-  QofEntity *entity;
+  QofInstance *entity;
   GncVendor *vendor;
 
   /* href="...:vendor=<guid>" */
@@ -109,7 +109,7 @@
 employeeCB (const char *location, const char *label,
            gboolean new_window, GNCURLResult * result)
 {
-  QofEntity *entity;
+  QofInstance *entity;
   GncEmployee *employee;
 
   /* href="...:employee=<guid>" */
@@ -125,7 +125,7 @@
 invoiceCB (const char *location, const char *label,
            gboolean new_window, GNCURLResult * result)
 {
-  QofEntity *entity;
+  QofInstance *entity;
   GncInvoice *invoice;
 
   /* href="...:invoice=<guid>" */
@@ -141,7 +141,7 @@
 jobCB (const char *location, const char *label,
            gboolean new_window, GNCURLResult * result)
 {
-  QofEntity *entity;
+  QofInstance *entity;
   GncJob *job;
 
   /* href="...:job=<guid>" */

Modified: gnucash/branches/gda-dev/src/business/business-gnome/gnc-plugin-business.c
===================================================================
--- gnucash/branches/gda-dev/src/business/business-gnome/gnc-plugin-business.c	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/src/business/business-gnome/gnc-plugin-business.c	2007-04-14 00:35:53 UTC (rev 15878)
@@ -727,10 +727,10 @@
 	{
 		qof_session_begin(chart_session, filename, TRUE, TRUE);
 		coll = qof_book_get_collection(book, GNC_ID_INVOICE);
-		success = qof_entity_copy_coll_r(chart_session, coll);
+		success = qof_instance_copy_coll_r(chart_session, coll);
 		/* Need to get the GList of GncEntry's - KVP */
 		coll = qof_book_get_collection(book, GNC_ID_CUSTOMER);
-		success = qof_entity_copy_coll_r(chart_session, coll);
+		success = qof_instance_copy_coll_r(chart_session, coll);
 		if(success) 
 		{ 
 			qof_session_save(chart_session, NULL);
@@ -762,7 +762,7 @@
 	{
 		qof_session_begin(chart_session, filename, TRUE, TRUE);
 		coll = qof_book_get_collection(book, GNC_ID_CUSTOMER);
-		success = qof_entity_copy_coll_r(chart_session, coll);
+		success = qof_instance_copy_coll_r(chart_session, coll);
 		if(success) 
 		{ 
 			qof_session_save(chart_session, NULL);
@@ -794,7 +794,7 @@
 	{
 		qof_session_begin(chart_session, filename, TRUE, TRUE);
 		coll = qof_book_get_collection(book, GNC_ID_VENDOR);
-		success = qof_entity_copy_coll_r(chart_session, coll);
+		success = qof_instance_copy_coll_r(chart_session, coll);
 		if(success) 
 		{ 
 			qof_session_save(chart_session, NULL);
@@ -826,7 +826,7 @@
 	{
 		qof_session_begin(chart_session, filename, TRUE, TRUE);
 		coll = qof_book_get_collection(book, GNC_ID_EMPLOYEE);
-		success = qof_entity_copy_coll_r(chart_session, coll);
+		success = qof_instance_copy_coll_r(chart_session, coll);
 		if(success) 
 		{ 
 			qof_session_save(chart_session, NULL);

Modified: gnucash/branches/gda-dev/src/core-utils/gnc-gdate-utils.c
===================================================================
--- gnucash/branches/gda-dev/src/core-utils/gnc-gdate-utils.c	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/src/core-utils/gnc-gdate-utils.c	2007-04-14 00:35:53 UTC (rev 15878)
@@ -28,23 +28,14 @@
 #include "gnc-gdate-utils.h"
 
 
-gint
-g_date_equals( gconstpointer gda, gconstpointer gdb )
+gboolean
+gnc_gdate_equal(gconstpointer gda, gconstpointer gdb)
 {
-  if ( !g_date_valid( (GDate*)gda )
-       || !g_date_valid( (GDate*)gdb ) ) {
-#if 0
-    DEBUG( "invalid: %p(%s), %p(%s)",
-           gda, ( g_date_valid((GDate*)gda) ? "" : "*" ),
-           gdb, ( g_date_valid((GDate*)gdb) ? "" : "*" ) );
-#endif
-  }
-  return ( g_date_compare( (GDate*)gda, (GDate*)gdb )
-           == 0 ? TRUE : FALSE );
+  return (g_date_compare( (GDate*)gda, (GDate*)gdb ) == 0 ? TRUE : FALSE);
 }
 
 guint
-g_date_hash( gconstpointer gd )
+gnc_gdate_hash( gconstpointer gd )
 {
   gint val = (g_date_get_year( (GDate*)gd ) * 10000)
     + (g_date_get_month( (GDate*)gd ) * 100)

Modified: gnucash/branches/gda-dev/src/core-utils/gnc-gdate-utils.h
===================================================================
--- gnucash/branches/gda-dev/src/core-utils/gnc-gdate-utils.h	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/src/core-utils/gnc-gdate-utils.h	2007-04-14 00:35:53 UTC (rev 15878)
@@ -44,12 +44,12 @@
 
 /** Compares two GDate*'s for equality; useful for using GDate*'s as
  *  GHashTable keys. */
-gint g_date_equals( gconstpointer gda, gconstpointer gdb );
+gint gnc_gdate_equal(gconstpointer gda, gconstpointer gdb);
 
 
 /** Provides a "hash" of a GDate* value; useful for using GDate*'s as
  *  GHashTable keys. */
-guint g_date_hash( gconstpointer gd );
+guint gnc_gdate_hash( gconstpointer gd );
 
 /** @} */
 

Modified: gnucash/branches/gda-dev/src/doc/backend-api.txt
===================================================================
--- gnucash/branches/gda-dev/src/doc/backend-api.txt	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/src/doc/backend-api.txt	2007-04-14 00:35:53 UTC (rev 15878)
@@ -29,7 +29,7 @@
 the type of the referenced object and the GUID of the referenced object
 as the value and the GUID of the original object as the key in a
 GHashTable or other lookup mechanism within the backend. See
-::QofEntityReference.
+::QofInstanceReference.
 
 \section backendqueries Handling Queries:
 

Modified: gnucash/branches/gda-dev/src/doc/sx.rst
===================================================================
--- gnucash/branches/gda-dev/src/doc/sx.rst	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/src/doc/sx.rst	2007-04-14 00:35:53 UTC (rev 15878)
@@ -83,17 +83,28 @@
 
 - sx editor
   - [/] clean up source formatting
-  - [ ] re-layout dialog
+  - [ ] move "non-editor" general app/ui code out of bottom of dialog-sx-editor.c
+  - [x] re-layout dialog
     - tabs: "overview", "frequency", "template transaction" [, "estimation"]
   - [ ] model-ize
     - (check_consistent, especially...)
 
+GncSxEditModel* gnc_sx_edit_model_new(SchedXaction *sx);
+
+gnc_sxed_check_changed( GncSxEditorDialog *sxed )
+gnc_sxed_check_consistent( GncSxEditorDialog *sxed )
+gnc_sxed_save_sx( GncSxEditorDialog *sxed )
+
+
+gchar* gnc_sx_edit_model_get_name(GncSxEditModel *mdl);
+void gnc_sx_edit_model_set_name(GncSxEditModel *mdl, gchar *new_name);
+
 - gnc_dense_cal
   - [x] {0, 1, 2, 3, 4, 6, 12} month selection for dense calendar
     - [x] conf-save value
   - [ ] code cleanup
-    - [ ] min-size
-  - [ ] start-of-week := {sun,mon} (via locale)
+    - [x] min-size
+  - [x] start-of-week := {sun,mon} (via locale)
   - [ ] change number-of-month properties to display-named properties (width, length)
   - [ ] gconf setting for dense-cal font-size reduction
   - [?] better transient/floating window
@@ -158,7 +169,7 @@
   - [ ] support nth-weekday Recurrence period.
 
 - since-last-run
-  - [ ] "reminder" instances show number of days until due
+  - [ ] "reminder" instances should show number of days until due
   - [ ] "Find unfinished" button; count; sensitize Ok as function of unfinished.
 ! - [x] save/restore dialog window size
   - [x] remove split pane

Modified: gnucash/branches/gda-dev/src/engine/Account.c
===================================================================
--- gnucash/branches/gda-dev/src/engine/Account.c	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/src/engine/Account.c	2007-04-14 00:35:53 UTC (rev 15878)
@@ -108,11 +108,29 @@
 /********************************************************************\
 \********************************************************************/
 
+/* GObject Initialization */
+QOF_GOBJECT_IMPL(gnc_account, Account, QOF_TYPE_INSTANCE);
+
 static void
+gnc_account_init(Account* acc)
+{
+}
+
+static void
+gnc_account_dispose_real (GObject *acctp)
+{
+}
+
+static void
+gnc_account_finalize_real(GObject* acctp)
+{
+}
+
+static void
 xaccInitAccount (Account * acc, QofBook *book)
 {
   ENTER ("book=%p\n", book);
-  qof_instance_init (&acc->inst, GNC_ID_ACCOUNT, book);
+  qof_instance_init_data (&acc->inst, GNC_ID_ACCOUNT, book);
 
   acc->parent   = NULL;
   acc->children = NULL;
@@ -231,9 +249,9 @@
 
   g_return_val_if_fail (book, NULL);
 
-  acc = g_new (Account, 1);
+  acc = g_object_new (GNC_TYPE_ACCOUNT, NULL);
   xaccInitAccount (acc, book);
-  qof_event_gen (&acc->inst.entity, QOF_EVENT_CREATE, NULL);
+  qof_event_gen (&acc->inst, QOF_EVENT_CREATE, NULL);
 
   return acc;
 }
@@ -260,7 +278,7 @@
     if (!from || !book) return NULL;
     ENTER (" ");
 
-    ret = g_new (Account, 1);
+    ret = g_object_new (GNC_TYPE_ACCOUNT, NULL);
     g_return_val_if_fail (ret, NULL);
 
     xaccInitAccount (ret, book);
@@ -342,7 +360,7 @@
 
   if (!acc) return;
 
-  qof_event_gen (&acc->inst.entity, QOF_EVENT_DESTROY, NULL);
+  qof_event_gen (&acc->inst, QOF_EVENT_DESTROY, NULL);
 
   if (acc->children) 
   {
@@ -412,8 +430,8 @@
   acc->balance_dirty = FALSE;
   acc->sort_dirty = FALSE;
 
-  qof_instance_release (&acc->inst);
-  g_free(acc);
+  /* qof_instance_release (&acc->inst); */
+  g_object_unref(acc);
 }
 
 /********************************************************************\
@@ -430,7 +448,7 @@
 static void on_done(QofInstance *inst) 
 {
     /* old event style */
-    qof_event_gen (&inst->entity, QOF_EVENT_MODIFY, NULL);
+    qof_event_gen (inst, QOF_EVENT_MODIFY, NULL);
 }
 
 static void on_err (QofInstance *inst, QofBackendError errcode)
@@ -448,7 +466,7 @@
 }
 
 static void
-destroy_pending_splits_for_account(QofEntity *ent, gpointer acc)
+destroy_pending_splits_for_account(QofInstance *ent, gpointer acc)
 {
     Transaction *trans = (Transaction *) ent;
     Split *split;
@@ -629,7 +647,7 @@
   }
 
   if(check_guids) {
-    if(!guid_equal(&aa->inst.entity.guid, &ab->inst.entity.guid))
+    if(!guid_equal(&aa->inst.guid, &ab->inst.guid))
     {
       PWARN ("GUIDs differ");
       return FALSE;
@@ -804,7 +822,7 @@
 {
   if (!acc || !acc->sort_dirty || (!force && acc->inst.editlevel > 0)) return;
 
-  acc->splits = g_list_sort(acc->splits, (GCompareFunc)xaccSplitDateOrder);
+  acc->splits = g_list_sort(acc->splits, (GCompareFunc)xaccSplitOrder);
   acc->sort_dirty = FALSE;
   acc->balance_dirty = TRUE;
 }
@@ -831,7 +849,7 @@
   /* XXX this looks fishy and weird to me ... */
   PINFO("acct=%p", acc);
   xaccAccountBeginEdit (acc);
-  qof_entity_set_guid (&acc->inst.entity, guid);
+  qof_instance_set_guid (&acc->inst, guid);
   qof_instance_set_dirty(&acc->inst);
   xaccAccountCommitEdit (acc);
 }
@@ -1160,7 +1178,7 @@
     return result;
 
   /* guarantee a stable sort */
-  return guid_compare (&(aa->inst.entity.guid), &(ab->inst.entity.guid));
+  return guid_compare (&(aa->inst.guid), &(ab->inst.guid));
 }
 
 static int
@@ -1222,7 +1240,7 @@
 }
 
 static void
-qofAccountSetParent (Account *acc, QofEntity *parent) 
+qofAccountSetParent (Account *acc, QofInstance *parent) 
 {
 	Account *parent_acc;
 	
@@ -1407,10 +1425,10 @@
        */
       PWARN ("reparenting accounts across books is not correctly supported\n");
 
-      qof_event_gen (&child->inst.entity, QOF_EVENT_DESTROY, NULL);
+      qof_event_gen (&child->inst, QOF_EVENT_DESTROY, NULL);
       col = qof_book_get_collection (new_parent->inst.book, GNC_ID_ACCOUNT);
-      qof_collection_insert_entity (col, &child->inst.entity);
-      qof_event_gen (&child->inst.entity, QOF_EVENT_CREATE, NULL);
+      qof_collection_insert_entity (col, &child->inst);
+      qof_event_gen (&child->inst, QOF_EVENT_CREATE, NULL);
     }
   }
   child->parent = new_parent;
@@ -1422,8 +1440,8 @@
    * to send a MODIFY event. If the gtktreemodelfilter code gets the
    * MODIFY before it gets the ADD, it gets very confused and thinks
    * that two nodes have been added. */
-  qof_event_gen (&child->inst.entity, QOF_EVENT_ADD, NULL);
-  // qof_event_gen (&new_parent->inst.entity, QOF_EVENT_MODIFY, NULL);
+  qof_event_gen (&child->inst, QOF_EVENT_ADD, NULL);
+  // qof_event_gen (&new_parent->inst, QOF_EVENT_MODIFY, NULL);
 
   xaccAccountCommitEdit (child);
   //  xaccAccountCommitEdit(new_parent);
@@ -1453,12 +1471,12 @@
   parent->children = g_list_remove (parent->children, child);
 
   /* Now send the event. */
-  qof_event_gen(&child->inst.entity, QOF_EVENT_REMOVE, &ed);
+  qof_event_gen(&child->inst, QOF_EVENT_REMOVE, &ed);
 
   /* clear the account's parent pointer after REMOVE event generation. */
   child->parent = NULL;
 
-  qof_event_gen (&parent->inst.entity, QOF_EVENT_MODIFY, NULL);
+  qof_event_gen (&parent->inst, QOF_EVENT_MODIFY, NULL);
 }
 
 Account *
@@ -3180,7 +3198,7 @@
 	gnc_account_copy_children(to_acc, from_acc);
       }
       xaccAccountCommitEdit (to_acc);
-      qof_event_gen (&to_acc->inst.entity, QOF_EVENT_CREATE, NULL);
+      qof_event_gen (&to_acc->inst, QOF_EVENT_CREATE, NULL);
       /* DRH - Should this send ADD/REMOVE events */
    }
    xaccAccountCommitEdit(from);
@@ -3227,8 +3245,8 @@
 	  gnc_account_append_child (acc_a, (Account *)worker->data);
 	g_list_free(work);
 
-	qof_event_gen (&acc_a->inst.entity, QOF_EVENT_MODIFY, NULL);
-	qof_event_gen (&acc_b->inst.entity, QOF_EVENT_MODIFY, NULL);
+	qof_event_gen (&acc_a->inst, QOF_EVENT_MODIFY, NULL);
+	qof_event_gen (&acc_b->inst, QOF_EVENT_MODIFY, NULL);
       }
 
       /* recurse to do the children's children */

Modified: gnucash/branches/gda-dev/src/engine/Account.h
===================================================================
--- gnucash/branches/gda-dev/src/engine/Account.h	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/src/engine/Account.h	2007-04-14 00:35:53 UTC (rev 15878)
@@ -59,9 +59,22 @@
 typedef void (*AccountCb)(Account *a, gpointer data);
 typedef gpointer (*AccountCb2)(Account *a, gpointer data);
 
-#define GNC_IS_ACCOUNT(obj)  (QOF_CHECK_TYPE((obj), GNC_ID_ACCOUNT))
-#define GNC_ACCOUNT(obj)     (QOF_CHECK_CAST((obj), GNC_ID_ACCOUNT, Account))
+typedef struct _AccountClass AccountClass;
 
+/* --- type macros --- */
+#define GNC_TYPE_ACCOUNT            (gnc_account_get_type ())
+#define GNC_ACCOUNT(o)              \
+     (G_TYPE_CHECK_INSTANCE_CAST ((o), GNC_TYPE_ACCOUNT, Account))
+#define GNC_ACCOUNT_CLASS(k)        \
+     (G_TYPE_CHECK_CLASS_CAST((k), GNC_TYPE_ACCOUNT, AccountClass))
+#define GNC_IS_ACCOUNT(o)           \
+     (G_TYPE_CHECK_INSTANCE_TYPE ((o), GNC_TYPE_ACCOUNT))
+#define GNC_IS_ACCOUNT_CLASS(k)     \
+     (G_TYPE_CHECK_CLASS_TYPE ((k), GNC_TYPE_ACCOUNT))
+#define GNC_ACCOUNT_GET_CLASS(o)    \
+     (G_TYPE_INSTANCE_GET_CLASS ((o), GNC_TYPE_ACCOUNT, AccountClass))
+GType gnc_account_get_type(void);
+
 /** The account types are used to determine how the transaction data
  * in the account is displayed.   These values can be safely changed
  * from one release to the next.  Note that if values are added,
@@ -216,8 +229,8 @@
 void gnc_book_set_root_account(QofBook *book, Account *root);
 
 /** @deprecated */
-#define xaccAccountGetGUID(X)     qof_entity_get_guid(QOF_ENTITY(X))
-#define xaccAccountReturnGUID(X) (X ? *(qof_entity_get_guid(QOF_ENTITY(X))) : *(guid_null()))
+#define xaccAccountGetGUID(X)     qof_instance_get_guid(QOF_INSTANCE(X))
+#define xaccAccountReturnGUID(X) (X ? *(qof_instance_get_guid(QOF_INSTANCE(X))) : *(guid_null()))
 
 /** The xaccAccountLookup() subroutine will return the
  *    account associated with the given id, or NULL

Modified: gnucash/branches/gda-dev/src/engine/AccountP.h
===================================================================
--- gnucash/branches/gda-dev/src/engine/AccountP.h	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/src/engine/AccountP.h	2007-04-14 00:35:53 UTC (rev 15878)
@@ -133,6 +133,11 @@
   guint32  idata;     /* used by the sql backend for kvp management */
 };
 
+struct _AccountClass
+{
+  QofInstanceClass parent_class;
+};
+
 /* The xaccAccountSortSplits() routine will resort the account's 
  * splits if the sort is dirty. If 'force' is true, the account 
  * is sorted even if the editlevel is not zero. 

Modified: gnucash/branches/gda-dev/src/engine/FreqSpec.c
===================================================================
--- gnucash/branches/gda-dev/src/engine/FreqSpec.c	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/src/engine/FreqSpec.c	2007-04-14 00:35:53 UTC (rev 15878)
@@ -158,6 +158,24 @@
   return month_name;
 }
 
+/* GObject initialization */
+QOF_GOBJECT_IMPL(gnc_freqspec, FreqSpec, QOF_TYPE_INSTANCE);
+
+static void
+gnc_freqspec_init(FreqSpec* fs)
+{
+}
+
+static void
+gnc_freqspec_dispose_real (GObject *fsp)
+{
+}
+
+static void
+gnc_freqspec_finalize_real(GObject* fsp)
+{
+}
+
 /*
  * Initializes a FreqSpec by setting it's to type INVALID.
  * Use this to initialise a stack object.
@@ -168,12 +186,10 @@
 static void
 xaccFreqSpecInit( FreqSpec *fs, QofBook *book )
 {
-   QofCollection *col;
    g_return_if_fail( fs );
    g_return_if_fail (book);
 
-   col = qof_book_get_collection (book, QOF_ID_FREQSPEC);
-   qof_entity_init (&fs->entity, QOF_ID_FREQSPEC, col);
+   qof_instance_init_data (&fs->entity, QOF_ID_FREQSPEC, book);
 
    fs->type = INVALID;
    fs->uift = UIFREQ_ONCE;
@@ -188,7 +204,7 @@
 
    g_return_val_if_fail (book, NULL);
 
-   fs = g_new0(FreqSpec, 1);
+   fs = g_object_new(GNC_TYPE_FREQSPEC, NULL);
    xaccFreqSpecInit( fs, book );
    qof_event_gen( &fs->entity, QOF_EVENT_CREATE , NULL);
    return fs;
@@ -224,8 +240,8 @@
    qof_event_gen( &fs->entity, QOF_EVENT_DESTROY , NULL);
    xaccFreqSpecCleanUp( fs );
 
-   qof_entity_release (&fs->entity);
-   g_free( fs );
+   /* qof_instance_release (&fs->entity); */
+   g_object_unref( fs );
 }
 
 FreqType

Modified: gnucash/branches/gda-dev/src/engine/FreqSpec.h
===================================================================
--- gnucash/branches/gda-dev/src/engine/FreqSpec.h	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/src/engine/FreqSpec.h	2007-04-14 00:35:53 UTC (rev 15878)
@@ -59,10 +59,27 @@
 #ifndef XACC_FREQSPEC_H
 #define XACC_FREQSPEC_H
 
+typedef struct _FreqSpecClass FreqSpecClass;
+
 #include "gnc-engine.h"
 #include <glib.h>
 #include "qof.h"
 
+/* --- type macros --- */
+#define GNC_TYPE_FREQSPEC            (gnc_freqspec_get_type ())
+#define GNC_FREQSPEC(o)              \
+     (G_TYPE_CHECK_INSTANCE_CAST ((o), GNC_TYPE_FREQSPEC, FreqSpec))
+#define GNC_FREQSPEC_CLASS(k)        \
+     (G_TYPE_CHECK_CLASS_CAST((k), GNC_TYPE_FREQSPEC, FreqSpecClass))
+#define GNC_IS_FREQSPEC(o)           \
+     (G_TYPE_CHECK_INSTANCE_TYPE ((o), GNC_TYPE_FREQSPEC))
+#define GNC_IS_FREQSPEC_CLASS(k)     \
+     (G_TYPE_CHECK_CLASS_TYPE ((k), GNC_TYPE_FREQSPEC))
+#define GNC_FREQSPEC_GET_CLASS(o)    \
+     (G_TYPE_INSTANCE_GET_CLASS ((o), GNC_TYPE_FREQSPEC, FreqSpecClass))
+GType gnc_freqspec_get_type(void);
+
+
 #define ENUM_LIST_TYPE(_) \
         _(INVALID,) \
         _(ONCE,) \

Modified: gnucash/branches/gda-dev/src/engine/FreqSpecP.h
===================================================================
--- gnucash/branches/gda-dev/src/engine/FreqSpecP.h	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/src/engine/FreqSpecP.h	2007-04-14 00:35:53 UTC (rev 15878)
@@ -37,7 +37,7 @@
 
 struct gncp_freq_spec 
 {
-        QofEntity       entity;
+        QofInstance       entity;
         FreqType        type;
         UIFreqType      uift;
         union u {
@@ -91,4 +91,9 @@
         gint            value;
 };
 
+struct _FreqSpecClass
+{
+  QofInstanceClass	parent_class;
+};
+
 #endif /* XACC_FREQSPECP_H */

Modified: gnucash/branches/gda-dev/src/engine/GNCId.h
===================================================================
--- gnucash/branches/gda-dev/src/engine/GNCId.h	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/src/engine/GNCId.h	2007-04-14 00:35:53 UTC (rev 15878)
@@ -5,7 +5,7 @@
  * void xaccGUIDNew (GUID *guid, QofBook *book)
  */
 #define xaccGUIDNew(guid,book)     \
-      qof_entity_guid_new (qof_book_get_entity_table (book), (guid))
+      qof_instance_guid_new (qof_book_get_entity_table (book), (guid))
                                                                                 
 
 		#define xaccGUIDNULL guid_null
@@ -14,16 +14,16 @@
 
 		#define GNCIdTypeConst QofIdTypeConst
 		#define GNCIdType QofIdType
-		#define GNCEntityTable QofEntityTable
+		#define GNCEntityTable QofInstanceTable
 		#define xaccGUIDTypeEntityTable qof_guid_type
 
-		#define xaccEntityTableNew qof_entity_new
-		#define xaccEntityTableDestroy qof_entity_destroy
-		#define xaccGUIDNewEntityTable qof_entity_guid_new
-		#define xaccLookupEntity qof_entity_lookup
-		#define xaccStoreEntity qof_entity_store
-		#define xaccRemoveEntity qof_entity_remove
-		#define xaccForeachEntity qof_entity_foreach
+		#define xaccEntityTableNew qof_instance_new
+		#define xaccEntityTableDestroy qof_instance_destroy
+		#define xaccGUIDNewEntityTable qof_instance_guid_new
+		#define xaccLookupEntity qof_instance_lookup
+		#define xaccStoreEntity qof_instance_store
+		#define xaccRemoveEntity qof_instance_remove
+		#define xaccForeachEntity qof_instance_foreach
 
-		#define foreachObjectCB QofEntityForeachCB
+		#define foreachObjectCB QofInstanceForeachCB
 

Modified: gnucash/branches/gda-dev/src/engine/Period.c
===================================================================
--- gnucash/branches/gda-dev/src/engine/Period.c	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/src/engine/Period.c	2007-04-14 00:35:53 UTC (rev 15878)
@@ -89,7 +89,7 @@
 
    /* Fiddle the transaction into place in the new book */
    col = qof_book_get_collection (book, GNC_ID_TRANS);
-   qof_collection_insert_entity (col, &newtrans->inst.entity);
+   qof_collection_insert_entity (col, &newtrans->inst);
    newtrans->inst.book = book;
 
    col = qof_book_get_collection (book, GNC_ID_SPLIT);
@@ -101,7 +101,7 @@
 
       /* move the split into the new book ... */
       s->inst.book = book;
-      qof_collection_insert_entity(col, &s->inst.entity);
+      qof_collection_insert_entity(col, &s->inst);
 
       /* find the twin account, and re-parent to that. */
       twin = xaccAccountLookupTwin (s->acc, book);
@@ -118,7 +118,7 @@
    }
 
    xaccTransCommitEdit (newtrans);
-   qof_event_gen (&newtrans->inst.entity, QOF_EVENT_CREATE, NULL);
+   qof_event_gen (&newtrans->inst, QOF_EVENT_CREATE, NULL);
    LEAVE ("trans=%p %s", trans, trans->description);
 }
 
@@ -152,7 +152,7 @@
 
    col = qof_book_get_collection (book, GNC_ID_TRANS);
    trans->inst.book = book;
-   qof_collection_insert_entity (col, &trans->inst.entity);
+   qof_collection_insert_entity (col, &trans->inst);
 
    col = qof_book_get_collection (book, GNC_ID_SPLIT);
    for (node = trans->splits; node; node = node->next)
@@ -164,7 +164,7 @@
       if (s->inst.book != book)
       {
          s->inst.book = book;
-         qof_collection_insert_entity (col, &s->inst.entity);
+         qof_collection_insert_entity (col, &s->inst);
       }
 
       /* Find the twin account, and re-parent to that. */
@@ -186,7 +186,7 @@
    }
 
    xaccTransCommitEdit (trans);
-   qof_event_gen (&trans->inst.entity, QOF_EVENT_MODIFY, NULL);
+   qof_event_gen (&trans->inst, QOF_EVENT_MODIFY, NULL);
    LEAVE ("trans=%p %s", trans, trans->description);
 }
 
@@ -228,7 +228,7 @@
 
    col = qof_book_get_collection (book, GNC_ID_LOT);
    lot->inst.book = book;
-   qof_collection_insert_entity (col, &lot->inst.entity);
+   qof_collection_insert_entity (col, &lot->inst);
 
    /* Move the splits over (only if they haven't already been moved). */
    col = qof_book_get_collection (book, GNC_ID_SPLIT);
@@ -238,7 +238,7 @@
       if (s->inst.book != book)
       {
          s->inst.book = book;
-         qof_collection_insert_entity (col, &s->inst.entity);
+         qof_collection_insert_entity (col, &s->inst);
       }
    }
 
@@ -280,7 +280,7 @@
 
    col = qof_book_get_collection (book, GNC_ID_PRICE);
    pr->inst.book = book;
-   qof_collection_insert_entity (col, &pr->inst.entity);
+   qof_collection_insert_entity (col, &pr->inst);
 
    gnc_pricedb_remove_price (pr->db, pr);
    gnc_pricedb_add_price (gnc_pricedb_get_db (book), pr);

Modified: gnucash/branches/gda-dev/src/engine/Recurrence.c
===================================================================
--- gnucash/branches/gda-dev/src/engine/Recurrence.c	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/src/engine/Recurrence.c	2007-04-14 00:35:53 UTC (rev 15878)
@@ -393,25 +393,7 @@
     return TRUE;
 }
 
-/**
- * Localized DOW abbrev.
- * @fixme - ripped from gnc-dense-cal.c; there can be only one. :p
- * @param dow struct tm semantics: 0=sunday .. 6=saturday
- **/
 static void
-_dow_abbrev(gchar *buf, int buf_len, int dow)
-{
-    struct tm my_tm;
-    int i;
-    
-    memset(buf, 0, buf_len);
-    memset(&my_tm, 0, sizeof(struct tm));
-    my_tm.tm_wday = dow;
-    i = qof_strftime(buf, buf_len - 1, "%a", &my_tm);
-    buf[i] = 0;
-}
-
-static void
 _weekly_list_to_compact_string(GList *rs, GString *buf)
 {
     int dow_idx;
@@ -428,7 +410,9 @@
             continue;
         }
         dow_present_bits |= (1 << (dow % 7));
-        // broken, @fixme.
+
+        // there's not necessarily a single multiplier, but for all intents
+        // and purposes this will be fine.
         multiplier = recurrenceGetMultiplier(r);
     }
     g_string_printf(buf, _("Weekly"));
@@ -445,7 +429,7 @@
         if ((dow_present_bits & (1 << dow_idx)) != 0)
         {
             gchar dbuf[10];
-            _dow_abbrev(dbuf, 10, dow_idx);
+            gnc_dow_abbrev(dbuf, 9, dow_idx);
             g_string_append_printf(buf, "%c", dbuf[0]);
         }
         else
@@ -462,9 +446,9 @@
     if (recurrenceGetPeriodType(r) == PERIOD_LAST_WEEKDAY)
     {
         gint abbrev_day_name_bufsize = 10;
-        gchar day_name_buf[abbrev_day_name_bufsize];
+        gchar day_name_buf[abbrev_day_name_bufsize+1];
                 
-        _dow_abbrev(day_name_buf, abbrev_day_name_bufsize, g_date_get_weekday(&date) % 7);
+        gnc_dow_abbrev(day_name_buf, abbrev_day_name_bufsize, g_date_get_weekday(&date) % 7);
             
         /* translators: %s is an already-localized form of the day of the week. */
         g_string_append_printf(buf, _("last %s"), day_name_buf);

Modified: gnucash/branches/gda-dev/src/engine/SX-book.c
===================================================================
--- gnucash/branches/gda-dev/src/engine/SX-book.c	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/src/engine/SX-book.c	2007-04-14 00:35:53 UTC (rev 15878)
@@ -61,7 +61,7 @@
 }
 
 Account *
-gnc_book_get_template_root( QofBook *book )
+gnc_book_get_template_root( const QofBook *book )
 {
   QofCollection *col;
   if (!book) return NULL;
@@ -197,7 +197,7 @@
   if (g_list_find(sxes->sx_list, sx) != NULL)
     return;
   sxes->sx_list = g_list_append(sxes->sx_list, sx);
-  qof_event_gen(&sxes->inst.entity, GNC_EVENT_ITEM_ADDED, (gpointer)sx);
+  qof_event_gen(&sxes->inst, GNC_EVENT_ITEM_ADDED, (gpointer)sx);
 }
 
 void
@@ -208,13 +208,31 @@
   if (to_remove == NULL)
     return;
   sxes->sx_list = g_list_delete_link(sxes->sx_list, to_remove);
-  qof_event_gen(&sxes->inst.entity, GNC_EVENT_ITEM_REMOVED, (gpointer)sx);
+  qof_event_gen(&sxes->inst, GNC_EVENT_ITEM_REMOVED, (gpointer)sx);
 }
 
 /* ====================================================================== */
 /* SX-trans stuff */
 
+/* GObject initialization */
+QOF_GOBJECT_IMPL(gnc_schedxactions, SchedXactions, QOF_TYPE_INSTANCE);
+
 static void
+gnc_schedxactions_init(SchedXactions* sxs)
+{
+}
+
+static void
+gnc_schedxactions_dispose_real (GObject *sxsp)
+{
+}
+
+static void
+gnc_schedxactions_finalize_real(GObject* sxsp)
+{
+}
+
+static void
 mark_sx_clean(gpointer data, gpointer user_data)
 {
   SchedXaction *sx = (SchedXaction *) data;
@@ -228,11 +246,14 @@
      SchedXactions *sxes;
 
      col = qof_book_get_collection(book, GNC_ID_SCHEDXACTION);
-     sxes = g_new (SchedXactions, 1);
-     qof_instance_init(&sxes->inst, GNC_ID_SXES, book);
+     sxes = g_object_new (GNC_TYPE_SCHEDXACTIONS, NULL);
+     g_assert(sxes);
+     qof_instance_init_data(&sxes->inst, GNC_ID_SXES, book);
      sxes->sx_list = NULL;
      sxes->sx_notsaved = TRUE;
      qof_collection_set_data(col, sxes);
+
+     /* XXX: FIXME:  MEMORY LEAK.  This object is never freed. */
 }
 
 static void

Modified: gnucash/branches/gda-dev/src/engine/SX-book.h
===================================================================
--- gnucash/branches/gda-dev/src/engine/SX-book.h	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/src/engine/SX-book.h	2007-04-14 00:35:53 UTC (rev 15878)
@@ -39,28 +39,48 @@
 #ifndef GNC_SX_BOOK_H
 #define GNC_SX_BOOK_H
 
+typedef struct xaccSchedXactionsDef SchedXactions;
+typedef struct _SchedXactionsClass SchedXactionsClass;
+
 #include <glib.h>
 #include "SchedXaction.h"
 #include "qof.h"
 
-typedef struct xaccSchedXactionsDef SchedXactions;
-
 struct xaccSchedXactionsDef {
   QofInstance inst;
   GList* sx_list;
   gboolean sx_notsaved;
 };
 
-#define GNC_IS_SXES(obj)  (QOF_CHECK_TYPE((obj), GNC_ID_SXES))
-#define GNC_SXES(obj)     (QOF_CHECK_CAST((obj), GNC_ID_SXES, SchedXactions))
+struct _SchedXactionsClass
+{
+  QofInstanceClass parent_class;
+};
 
+/* --- type macros --- */
+#define GNC_TYPE_SCHEDXACTIONS            (gnc_schedxactions_get_type ())
+#define GNC_SCHEDXACTIONS(o)              \
+     (G_TYPE_CHECK_INSTANCE_CAST ((o), GNC_TYPE_SCHEDXACTIONS, SchedXactions))
+#define GNC_SCHEDXACTIONS_CLASS(k)        \
+     (G_TYPE_CHECK_CLASS_CAST((k), GNC_TYPE_SCHEDXACTIONS, SchedXactionsClass))
+#define GNC_IS_SCHEDXACTIONS(o)           \
+     (G_TYPE_CHECK_INSTANCE_TYPE ((o), GNC_TYPE_SCHEDXACTIONS))
+#define GNC_IS_SCHEDXACTIONS_CLASS(k)     \
+     (G_TYPE_CHECK_CLASS_TYPE ((k), GNC_TYPE_SCHEDXACTIONS))
+#define GNC_SCHEDXACTIONS_GET_CLASS(o)    \
+     (G_TYPE_INSTANCE_GET_CLASS ((o), GNC_TYPE_SCHEDXACTIONS, SchedXactionsClass))
+GType gnc_schedxactions_get_type(void);
+
+#define GNC_IS_SXES(obj)  GNC_IS_SCHEDXACTIONS(obj)
+#define GNC_SXES(obj)     GNC_SCHEDXACTIONS(obj)
+
 SchedXactions* gnc_book_get_schedxactions(QofBook* book);
 
 void gnc_sxes_add_sx(SchedXactions* sxes, SchedXaction* sx);
 void gnc_sxes_del_sx(SchedXactions* sxes, SchedXaction* sx);
 
 /** Returns the template group from the book. **/
-Account *gnc_book_get_template_root(QofBook *book);
+Account *gnc_book_get_template_root(const QofBook *book);
 
 /** @return The list of SXes which reference the given Account. Caller should free this list. **/
 GList* gnc_sx_get_sxes_referencing_account(QofBook *book, Account *acct);

Modified: gnucash/branches/gda-dev/src/engine/SchedXaction.c
===================================================================
--- gnucash/branches/gda-dev/src/engine/SchedXaction.c	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/src/engine/SchedXaction.c	2007-04-14 00:35:53 UTC (rev 15878)
@@ -45,12 +45,30 @@
 
 void sxprivtransactionListMapDelete( gpointer data, gpointer user_data );
 
+/* GObject initialization */
+QOF_GOBJECT_IMPL(gnc_schedxaction, SchedXaction, QOF_TYPE_INSTANCE);
+
 static void
+gnc_schedxaction_init(SchedXaction* sx)
+{
+}
+
+static void
+gnc_schedxaction_dispose_real (GObject *sxp)
+{
+}
+
+static void
+gnc_schedxaction_finalize_real(GObject* sxp)
+{
+}
+
+static void
 xaccSchedXactionInit(SchedXaction *sx, QofBook *book)
 {
    Account        *ra;
 
-   qof_instance_init (&sx->inst, GNC_ID_SCHEDXACTION, book);
+   qof_instance_init_data (&sx->inst, GNC_ID_SCHEDXACTION, book);
 
    sx->schedule = NULL;
    sx->freq = xaccFreqSpecMalloc(book);
@@ -71,7 +89,7 @@
    /* create a new template account for our splits */
    sx->template_acct = xaccMallocAccount(book);
    xaccAccountSetName( sx->template_acct,
-                       guid_to_string( &sx->inst.entity.guid ));
+                       guid_to_string( &sx->inst.guid ));
    xaccAccountSetCommodity
      (sx->template_acct,
       gnc_commodity_new( book,
@@ -89,9 +107,9 @@
 
    g_return_val_if_fail (book, NULL);
 
-   sx = g_new0( SchedXaction, 1 );
+   sx = g_object_new(GNC_TYPE_SCHEDXACTION, NULL);
    xaccSchedXactionInit( sx, book );
-   qof_event_gen( &sx->inst.entity, QOF_EVENT_CREATE , NULL);
+   qof_event_gen( &sx->inst, QOF_EVENT_CREATE , NULL);
 
    return sx;
 }
@@ -158,7 +176,7 @@
   if ( sx == NULL ) return;
   
   xaccFreqSpecFree( sx->freq );
-  qof_event_gen( &sx->inst.entity, QOF_EVENT_DESTROY , NULL);
+  qof_event_gen( &sx->inst, QOF_EVENT_DESTROY , NULL);
   
   if ( sx->name )
     g_free( sx->name );
@@ -187,8 +205,8 @@
           sx->deferredList = NULL;
   }
   
-  qof_instance_release (&sx->inst);
-  g_free( sx );
+  /* qof_instance_release (&sx->inst); */
+  g_object_unref( sx );
 }
 
 /* ============================================================ */
@@ -206,7 +224,7 @@
 
 static void commit_done(QofInstance *inst)
 {
-  qof_event_gen (&inst->entity, QOF_EVENT_MODIFY, NULL);
+  qof_event_gen (inst, QOF_EVENT_MODIFY, NULL);
 }
 
 static void noop(QofInstance *inst) {}
@@ -290,7 +308,7 @@
 }
 
 gboolean
-xaccSchedXactionHasEndDate( SchedXaction *sx )
+xaccSchedXactionHasEndDate( const SchedXaction *sx )
 {
    return g_date_valid( &sx->end_date );
 }

Modified: gnucash/branches/gda-dev/src/engine/SchedXaction.h
===================================================================
--- gnucash/branches/gda-dev/src/engine/SchedXaction.h	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/src/engine/SchedXaction.h	2007-04-14 00:35:53 UTC (rev 15878)
@@ -36,6 +36,8 @@
 #ifndef XACC_SCHEDXACTION_H
 #define XACC_SCHEDXACTION_H
 
+typedef struct _SchedXactionClass SchedXactionClass;
+
 #include <time.h>
 #include <glib.h>
 #include "qof.h"
@@ -43,9 +45,23 @@
 #include "Recurrence.h"
 #include "gnc-engine.h"
 
-#define GNC_IS_SX(obj)  (QOF_CHECK_TYPE((obj), GNC_ID_SCHEDXACTION))
-#define GNC_SX(obj)     (QOF_CHECK_CAST((obj), GNC_ID_SCHEDXACTION, SchedXaction))
+/* --- type macros --- */
+#define GNC_TYPE_SCHEDXACTION            (gnc_schedxaction_get_type ())
+#define GNC_SCHEDXACTION(o)              \
+     (G_TYPE_CHECK_INSTANCE_CAST ((o), GNC_TYPE_SCHEDXACTION, SchedXaction))
+#define GNC_SCHEDXACTION_CLASS(k)        \
+     (G_TYPE_CHECK_CLASS_CAST((k), GNC_TYPE_SCHEDXACTION, SchedXactionClass))
+#define GNC_IS_SCHEDXACTION(o)           \
+     (G_TYPE_CHECK_INSTANCE_TYPE ((o), GNC_TYPE_SCHEDXACTION))
+#define GNC_IS_SCHEDXACTION_CLASS(k)     \
+     (G_TYPE_CHECK_CLASS_TYPE ((k), GNC_TYPE_SCHEDXACTION))
+#define GNC_SCHEDXACTION_GET_CLASS(o)    \
+     (G_TYPE_INSTANCE_GET_CLASS ((o), GNC_TYPE_SCHEDXACTION, SchedXactionClass))
+GType gnc_schedxaction_get_type(void);
 
+#define GNC_IS_SX(obj)  GNC_IS_SCHEDXACTION(obj)
+#define GNC_SX(obj)     GNC_SCHEDXACTION(obj)
+
 typedef struct _SchedXaction SchedXaction;
 
 /**
@@ -104,6 +120,11 @@
   GList /* <temporalStateData*> */ *deferredList;
 };
 
+struct _SchedXactionClass
+{
+  QofInstanceClass parent_class;
+};
+
 /** Just the variable temporal bits from the SX structure. */
 typedef struct _temporalStateData {
   GDate last_date;
@@ -111,7 +132,7 @@
   gint num_inst;
 } temporalStateData;
 
-#define xaccSchedXactionSetGUID(X,G) qof_entity_set_guid(QOF_ENTITY(X),(G))
+#define xaccSchedXactionSetGUID(X,G) qof_instance_set_guid(QOF_INSTANCE(X),(G))
 
 /**
  * Creates and initializes a scheduled transaction.
@@ -149,7 +170,7 @@
 GDate* xaccSchedXactionGetStartDate( SchedXaction *sx );
 void xaccSchedXactionSetStartDate( SchedXaction *sx, GDate* newStart );
 
-int xaccSchedXactionHasEndDate( SchedXaction *sx );
+int xaccSchedXactionHasEndDate( const SchedXaction *sx );
 /**
  * Returns invalid date when there is no end-date specified.
 */
@@ -297,7 +318,7 @@
 /** \deprecated */
 #define xaccSchedXactionIsDirty(X) qof_instance_is_dirty (QOF_INSTANCE(X))
 /** \deprecated */
-#define xaccSchedXactionGetGUID(X) qof_entity_get_guid(QOF_ENTITY(X))
+#define xaccSchedXactionGetGUID(X) qof_instance_get_guid(QOF_INSTANCE(X))
 /** \deprecated */
 #define xaccSchedXactionGetSlots(X) qof_instance_get_slots(QOF_INSTANCE(X))
 

Modified: gnucash/branches/gda-dev/src/engine/Scrub.c
===================================================================
--- gnucash/branches/gda-dev/src/engine/Scrub.c	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/src/engine/Scrub.c	2007-04-14 00:35:53 UTC (rev 15878)
@@ -173,7 +173,10 @@
   ENTER ("(split=%p)", split);
 
   trans = xaccSplitGetParent (split);
-  if (!trans) return;
+  if (!trans) {
+    LEAVE("no trans");
+    return;
+  }
 
   account = xaccSplitGetAccount (split);
 
@@ -193,6 +196,7 @@
   if (!account) 
   {
     PINFO ("Free Floating Transaction!");
+    LEAVE ("no account");
     return;  
   }
 
@@ -232,6 +236,7 @@
 
   if (gnc_numeric_same (amount, value, scu, GNC_HOW_RND_ROUND))
   {
+    LEAVE("(split=%p) different values", split);
     return;
   }
 
@@ -361,7 +366,10 @@
 
   /* If the transaction is balanced, nothing more to do */
   imbalance = xaccTransGetImbalance (trans);
-  if (gnc_numeric_zero_p (imbalance)) return;
+  if (gnc_numeric_zero_p (imbalance)) {
+    LEAVE("zero imbalance");
+    return;
+  }
 
   if (!account)
   {
@@ -372,6 +380,7 @@
        {
           /* This can't occur, things should be in books */
           PERR ("Bad data corruption, no root account in book");
+          LEAVE("");
           return;
        }
     }
@@ -379,6 +388,7 @@
         trans->common_currency, _("Imbalance"));
     if (!account) {
         PERR ("Can't get balancing account");
+        LEAVE("");
         return;
     }
   }

Modified: gnucash/branches/gda-dev/src/engine/Scrub2.c
===================================================================
--- gnucash/branches/gda-dev/src/engine/Scrub2.c	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/src/engine/Scrub2.c	2007-04-14 00:35:53 UTC (rev 15878)
@@ -319,7 +319,7 @@
 
    /* Find and remove the matching guid's */
    ksub = (KvpFrame*)gnc_kvp_bag_find_by_guid (sa->inst.kvp_data, "lot-split",
-                    "peer_guid", &sb->inst.entity.guid);
+                    "peer_guid", &sb->inst.guid);
    if (ksub) 
    {
       gnc_kvp_bag_remove_frame (sa->inst.kvp_data, "lot-split", ksub);
@@ -328,7 +328,7 @@
 
    /* Now do it in the other direction */
    ksub = (KvpFrame*)gnc_kvp_bag_find_by_guid (sb->inst.kvp_data, "lot-split",
-                    "peer_guid", &sa->inst.entity.guid);
+                    "peer_guid", &sa->inst.guid);
    if (ksub) 
    {
       gnc_kvp_bag_remove_frame (sb->inst.kvp_data, "lot-split", ksub);
@@ -422,7 +422,7 @@
        * repeatedly merging adjacent subsplits, we'll get the non-
        * adjacent ones too. */
       if (gnc_kvp_bag_find_by_guid (split->inst.kvp_data, "lot-split",
-                                    "peer_guid", &s->inst.entity.guid) == NULL)
+                                    "peer_guid", &s->inst.guid) == NULL)
          continue;
          
       merge_splits (split, s);

Modified: gnucash/branches/gda-dev/src/engine/Split.c
===================================================================
--- gnucash/branches/gda-dev/src/engine/Split.c	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/src/engine/Split.c	2007-04-14 00:35:53 UTC (rev 15878)
@@ -55,6 +55,24 @@
 /* This static indicates the debugging module that this .o belongs to.  */
 static QofLogModule log_module = GNC_MOD_ENGINE;
 
+/* GObject Initialization */
+QOF_GOBJECT_IMPL(gnc_split, Split, QOF_TYPE_INSTANCE);
+
+static void
+gnc_split_init(Split* split)
+{
+}
+
+static void
+gnc_split_dispose_real (GObject *splitp)
+{
+}
+
+static void
+gnc_split_finalize_real(GObject* splitp)
+{
+}
+
 /********************************************************************\
  * xaccInitSplit
  * Initialize a Split structure
@@ -87,7 +105,7 @@
   split->gains = GAINS_STATUS_UNKNOWN;
   split->gains_split = NULL;
 
-  qof_instance_init(&split->inst, GNC_ID_SPLIT, book);
+  qof_instance_init_data(&split->inst, GNC_ID_SPLIT, book);
 }
 
 void
@@ -130,7 +148,7 @@
   Split *split;
   g_return_val_if_fail (book, NULL);
 
-  split = g_new0 (Split, 1);
+  split = g_object_new (GNC_TYPE_SPLIT, NULL);
   xaccInitSplit (split, book);
 
   return split;
@@ -148,15 +166,15 @@
 Split *
 xaccDupeSplit (const Split *s)
 {
-  Split *split = g_new0 (Split, 1);
+  Split *split = g_object_new (GNC_TYPE_SPLIT, NULL);
 
   /* Trash the entity table. We don't want to mistake the cloned
    * splits as something official.  If we ever use this split, we'll
    * have to fix this up.
    */
-  split->inst.entity.e_type = NULL;
-  split->inst.entity.collection = NULL;
-  split->inst.entity.guid = s->inst.entity.guid;
+  split->inst.e_type = NULL;
+  split->inst.collection = NULL;
+  split->inst.guid = s->inst.guid;
   split->inst.book = s->inst.book;
 
   split->parent = s->parent;
@@ -187,7 +205,7 @@
 Split *
 xaccSplitClone (const Split *s)
 {
-  Split *split = g_new0 (Split, 1);
+  Split *split = g_object_new (GNC_TYPE_SPLIT, NULL);
 
   split->parent              = NULL;
   split->memo                = CACHE_INSERT(s->memo);
@@ -204,7 +222,7 @@
   split->gains = GAINS_STATUS_UNKNOWN;
   split->gains_split = NULL;
 
-  qof_instance_init(&split->inst, GNC_ID_SPLIT, s->inst.book);
+  qof_instance_init_data(&split->inst, GNC_ID_SPLIT, s->inst.book);
   kvp_frame_delete(split->inst.kvp_data);
   split->inst.kvp_data = kvp_frame_copy(s->inst.kvp_data);
 
@@ -274,8 +292,8 @@
 
   // Is this right? 
   if (split->gains_split) split->gains_split->gains_split = NULL;
-  qof_instance_release(&split->inst);
-  g_free(split);
+  /* qof_instance_release(&split->inst); */
+  g_object_unref(split);
 }
 
 static void mark_acc(Account *acc)
@@ -336,7 +354,7 @@
   if (sa == sb) return TRUE;
 
   if (check_guids) {
-    if (!guid_equal(&(sa->inst.entity.guid), &(sb->inst.entity.guid)))
+    if (!guid_equal(&(sa->inst.guid), &(sb->inst.guid)))
     {
       PWARN ("GUIDs differ");
       return FALSE;
@@ -512,9 +530,9 @@
         if (node) {
             orig_acc->splits = g_list_delete_link (orig_acc->splits, node);
             //FIXME: find better event type
-            qof_event_gen (&orig_acc->inst.entity, QOF_EVENT_MODIFY, NULL);
+            qof_event_gen (&orig_acc->inst, QOF_EVENT_MODIFY, NULL);
 	    // And send the account-based event, too
-	    qof_event_gen(&orig_acc->inst.entity, GNC_EVENT_ITEM_REMOVED, s);
+	    qof_event_gen(&orig_acc->inst, GNC_EVENT_ITEM_REMOVED, s);
         } else PERR("Account lost track of moved or deleted split.");
         orig_acc->balance_dirty = TRUE;
         xaccAccountRecomputeBalance(orig_acc);
@@ -525,7 +543,7 @@
         if (!g_list_find(acc->splits, s)) {
             if (acc->inst.editlevel == 0) {
                 acc->splits = g_list_insert_sorted(
-                    acc->splits, s, (GCompareFunc)xaccSplitDateOrder);
+                    acc->splits, s, (GCompareFunc)xaccSplitOrder);
             } else {
                 acc->splits = g_list_prepend(acc->splits, s);
                 acc->sort_dirty = TRUE;
@@ -537,10 +555,10 @@
                 xaccAccountInsertLot (acc, s->lot);
 
             //FIXME: find better event
-            qof_event_gen (&acc->inst.entity, QOF_EVENT_MODIFY, NULL);
+            qof_event_gen (&acc->inst, QOF_EVENT_MODIFY, NULL);
 
 	    /* Also send an event based on the account */
-	    qof_event_gen(&acc->inst.entity, GNC_EVENT_ITEM_ADDED, s);
+	    qof_event_gen(&acc->inst, GNC_EVENT_ITEM_ADDED, s);
         } else PERR("Account grabbed split prematurely.");
         acc->balance_dirty = TRUE;
         xaccSplitSetAmount(s, xaccSplitGetAmount(s));
@@ -549,12 +567,12 @@
     if (s->parent != s->orig_parent) {
         //FIXME: find better event
         if (s->orig_parent)
-            qof_event_gen(&s->orig_parent->inst.entity, QOF_EVENT_MODIFY, 
+            qof_event_gen(&s->orig_parent->inst, QOF_EVENT_MODIFY, 
                           NULL);
     }
     if (s->lot) {
         /* A change of value/amnt affects gains display, etc. */
-        qof_event_gen (&s->lot->inst.entity, QOF_EVENT_MODIFY, NULL);
+        qof_event_gen (&s->lot->inst, QOF_EVENT_MODIFY, NULL);
     }
 
     /* Important: we save off the original parent transaction and account
@@ -590,7 +608,7 @@
         s->inst.do_free = FALSE;
         ed.node = s;
         ed.idx = -1; /* unused */
-        qof_event_gen(&s->parent->inst.entity, GNC_EVENT_ITEM_ADDED, &ed);
+        qof_event_gen(&s->parent->inst, GNC_EVENT_ITEM_ADDED, &ed);
     }
 
     /* But for the parent trans, we want the intermediate events, so
@@ -1117,7 +1135,7 @@
    ed.idx = xaccTransGetSplitIndex(trans, split);
    qof_instance_set_dirty(QOF_INSTANCE(split));
    split->inst.do_free = TRUE;
-   qof_event_gen(&trans->inst.entity, GNC_EVENT_ITEM_REMOVED, &ed);
+   qof_event_gen(&trans->inst, GNC_EVENT_ITEM_REMOVED, &ed);
    xaccTransCommitEdit(trans);
 
    return TRUE;
@@ -1126,8 +1144,8 @@
 /********************************************************************\
 \********************************************************************/
 
-int
-xaccSplitDateOrder (const Split *sa, const Split *sb)
+gint
+xaccSplitOrder (const Split *sa, const Split *sb)
 {
   int retval;
   int comp;
@@ -1172,12 +1190,36 @@
   DATE_CMP(sa,sb,date_reconciled);
 
   /* else, sort on guid - keeps sort stable. */
-  retval = guid_compare(&(sa->inst.entity.guid), &(sb->inst.entity.guid));
+  retval = guid_compare(&(sa->inst.guid), &(sb->inst.guid));
   if (retval) return retval;
 
   return 0;
 }
 
+gint
+xaccSplitOrderDateOnly (const Split *sa, const Split *sb)
+{
+  Transaction *ta, *tb;
+
+  if (sa == sb) return 0;
+  /* nothing is always less than something */
+  if (!sa && sb) return -1;
+  if (sa && !sb) return +1;
+
+  ta = sa->parent;
+  tb = sb->parent;
+  if ( ta && !tb ) return -1;
+  if ( !ta && tb ) return +1;
+  if ( !ta && !tb ) return 0;
+
+  /* if dates differ, return */
+  DATE_CMP(ta,tb,date_posted);
+
+  /* If the dates are the same, do not change the order */
+  return -1;
+}
+
+
 static gboolean
 get_corr_account_split(const Split *sa, const Split **retval)
 {
@@ -1487,7 +1529,7 @@
     ed.node = s;
     if (old_trans) {
         ed.idx = xaccTransGetSplitIndex(old_trans, s);
-        qof_event_gen(&old_trans->inst.entity, GNC_EVENT_ITEM_REMOVED, &ed);
+        qof_event_gen(&old_trans->inst, GNC_EVENT_ITEM_REMOVED, &ed);
     }
     s->parent = t;
 
@@ -1503,7 +1545,7 @@
             t->splits = g_list_append(t->splits, s);
         
         ed.idx = -1; /* unused */
-        qof_event_gen(&t->inst.entity, GNC_EVENT_ITEM_ADDED, &ed);
+        qof_event_gen(&t->inst, GNC_EVENT_ITEM_ADDED, &ed);
     }
     xaccTransCommitEdit(t);
 }
@@ -1769,7 +1811,7 @@
 }
 
 static void
-qofSplitSetParentTrans(Split *s, QofEntity *ent)
+qofSplitSetParentTrans(Split *s, QofInstance *ent)
 {
     Transaction *trans = (Transaction*)ent;
 
@@ -1778,7 +1820,7 @@
 }
 
 static void
-qofSplitSetAccount(Split *s, QofEntity *ent)
+qofSplitSetAccount(Split *s, QofInstance *ent)
 {
     Account *acc = (Account*)ent;
 
@@ -1798,7 +1840,7 @@
     { "d-share-amount", QOF_TYPE_DOUBLE,  
       (QofAccessFunc)DxaccSplitGetShareAmount, NULL },
     { "d-share-int64", QOF_TYPE_INT64, 
-      (QofAccessFunc)qof_entity_get_guid, NULL },
+      (QofAccessFunc)qof_instance_get_guid, NULL },
     { SPLIT_BALANCE, QOF_TYPE_NUMERIC, 
       (QofAccessFunc)xaccSplitGetBalance, NULL },
     { SPLIT_CLEARED_BALANCE, QOF_TYPE_NUMERIC,
@@ -1839,11 +1881,11 @@
     { SPLIT_KVP, QOF_TYPE_KVP, (QofAccessFunc)xaccSplitGetSlots, NULL },
     { QOF_PARAM_BOOK, QOF_ID_BOOK, (QofAccessFunc)xaccSplitGetBook, NULL },
     { QOF_PARAM_GUID, QOF_TYPE_GUID, 
-      (QofAccessFunc)qof_entity_get_guid, NULL },
+      (QofAccessFunc)qof_instance_get_guid, NULL },
     { NULL },
   };
 
-  qof_class_register (GNC_ID_SPLIT, (QofSortFunc)xaccSplitDateOrder, params);
+  qof_class_register (GNC_ID_SPLIT, (QofSortFunc)xaccSplitOrder, params);
   qof_class_register (SPLIT_ACCT_FULLNAME,
                       (QofSortFunc)xaccSplitCompareAccountFullNames, NULL);
   qof_class_register (SPLIT_CORR_ACCT_NAME,

Modified: gnucash/branches/gda-dev/src/engine/Split.h
===================================================================
--- gnucash/branches/gda-dev/src/engine/Split.h	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/src/engine/Split.h	2007-04-14 00:35:53 UTC (rev 15878)
@@ -34,11 +34,28 @@
 #ifndef XACC_SPLIT_H
 #define XACC_SPLIT_H
 
+typedef struct _SplitClass SplitClass;
+
 #include <time.h>
 
 #include "gnc-commodity.h"
 #include "gnc-engine.h"
 
+/* --- type macros --- */
+#define GNC_TYPE_SPLIT            (gnc_split_get_type ())
+#define GNC_SPLIT(o)              \
+     (G_TYPE_CHECK_INSTANCE_CAST ((o), GNC_TYPE_SPLIT, Split))
+#define GNC_SPLIT_CLASS(k)        \
+     (G_TYPE_CHECK_CLASS_CAST((k), GNC_TYPE_SPLIT, SplitClass))
+#define GNC_IS_SPLIT(o)           \
+     (G_TYPE_CHECK_INSTANCE_TYPE ((o), GNC_TYPE_SPLIT))
+#define GNC_IS_SPLIT_CLASS(k)     \
+     (G_TYPE_CHECK_CLASS_TYPE ((k), GNC_TYPE_SPLIT))
+#define GNC_SPLIT_GET_CLASS(o)    \
+     (G_TYPE_INSTANCE_GET_CLASS ((o), GNC_TYPE_SPLIT, SplitClass))
+GType gnc_split_get_type(void);
+
+
 /** @name Split Reconciled field values
 
     If you change these
@@ -64,9 +81,6 @@
  * Splits
  *-----------------------------------------------------------------------*/
 
-#define GNC_IS_SPLIT(obj)  (QOF_CHECK_TYPE((obj), GNC_ID_SPLIT))
-#define GNC_SPLIT(obj)     (QOF_CHECK_CAST((obj), GNC_ID_SPLIT, Split))
-
 /** @name Split general getters/setters
 @{
 */
@@ -75,7 +89,7 @@
 Split       * xaccMallocSplit (QofBook *book);
 
 /* Reinit a previously malloc'd split. Split remains in the book it
-   was already in, and the QofEntity portions also remain unchanged.
+   was already in, and the QofInstance portions also remain unchanged.
    It's basically the data elements that are reverted to default
    values. */
 void xaccSplitReinit(Split * split);
@@ -351,7 +365,7 @@
 void xaccSplitMakeStockSplit(Split *s);
 
 /**
- * The xaccSplitDateOrder(sa,sb) method is useful for sorting.
+ * The xaccSplitOrder(sa,sb) method is useful for sorting.
  *    if sa and sb have different transactions, return their xaccTransOrder
  *    return a negative value if split sa has a smaller currency-value than sb,
  *    return a positive value if split sa has a larger currency-value than sb,
@@ -362,7 +376,8 @@
  *    Then it compares the reconciled flags, then the reconciled dates,
  *    Finally, it returns zero if all of the above match.
  */
-int  xaccSplitDateOrder (const Split *sa, const Split *sb);
+gint xaccSplitOrder (const Split *sa, const Split *sb);
+gint xaccSplitOrderDateOnly (const Split *sa, const Split *sb);
 
 
 /*
@@ -485,9 +500,9 @@
 /** @} */
 
 /** \deprecated */
-#define xaccSplitGetGUID(X)      qof_entity_get_guid(QOF_ENTITY(X))
+#define xaccSplitGetGUID(X)      qof_instance_get_guid(QOF_INSTANCE(X))
 /** \deprecated */
-#define xaccSplitReturnGUID(X) (X ? *(qof_entity_get_guid(QOF_ENTITY(X))) : *(guid_null()))
+#define xaccSplitReturnGUID(X) (X ? *(qof_instance_get_guid(QOF_INSTANCE(X))) : *(guid_null()))
 
 #endif /* XACC_SPLIT_H */
 /** @} */

Modified: gnucash/branches/gda-dev/src/engine/SplitP.h
===================================================================
--- gnucash/branches/gda-dev/src/engine/SplitP.h	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/src/engine/SplitP.h	2007-04-14 00:35:53 UTC (rev 15878)
@@ -131,11 +131,16 @@
   guint32  idata;     /* used by the sql backend for kvp management */
 };
 
+struct _SplitClass
+{
+  QofInstanceClass parent_class;
+};
 
+
 /* Set the split's GUID. This should only be done when reading
  * a split from a datafile, or some other external source. Never
  * call this on an existing split! */
-#define xaccSplitSetGUID(s,g) qof_entity_set_guid(QOF_ENTITY(s),g)
+#define xaccSplitSetGUID(s,g) qof_instance_set_guid(QOF_INSTANCE(s),g)
 
 /* The xaccFreeSplit() method simply frees all memory associated
  * with the split.  It does not verify that the split isn't

Modified: gnucash/branches/gda-dev/src/engine/Transaction.c
===================================================================
--- gnucash/branches/gda-dev/src/engine/Transaction.c	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/src/engine/Transaction.c	2007-04-14 00:35:53 UTC (rev 15878)
@@ -219,17 +219,36 @@
     Account *account = s->acc;
     GNCLot *lot = s->lot;
     if (account)
-      qof_event_gen (&account->inst.entity, GNC_EVENT_ITEM_CHANGED, s);
+      qof_event_gen (&account->inst, GNC_EVENT_ITEM_CHANGED, s);
 
     if (lot)
     {
       /* A change of transaction date might affect opening date of lot */
-      qof_event_gen (&lot->inst.entity, QOF_EVENT_MODIFY, NULL);
+      qof_event_gen (&lot->inst, QOF_EVENT_MODIFY, NULL);
     }
   }
 #endif
 }
 
+/* GObject Initialization */
+QOF_GOBJECT_IMPL(gnc_transaction, Transaction, QOF_TYPE_INSTANCE);
+
+static void
+gnc_transaction_init(Transaction* txn)
+{
+}
+
+static void
+gnc_transaction_dispose_real (GObject *txnp)
+{
+}
+
+static void
+gnc_transaction_finalize_real(GObject* txnp)
+{
+}
+
+
 /********************************************************************\
  * xaccInitTransaction
  * Initialize a transaction structure
@@ -258,7 +277,7 @@
   trans->orig = NULL;
 
   trans->idata = 0;
-  qof_instance_init (&trans->inst, GNC_ID_TRANS, book);
+  qof_instance_init_data (&trans->inst, GNC_ID_TRANS, book);
   LEAVE (" ");
 }
 
@@ -272,9 +291,9 @@
 
   g_return_val_if_fail (book, NULL);
 
-  trans = g_new(Transaction, 1);
+  trans = g_object_new(GNC_TYPE_TRANSACTION, NULL);
   xaccInitTransaction (trans, book);
-  qof_event_gen (&trans->inst.entity, QOF_EVENT_CREATE, NULL);
+  qof_event_gen (&trans->inst, QOF_EVENT_CREATE, NULL);
 
   return trans;
 }
@@ -354,7 +373,7 @@
   Transaction *trans;
   GList *node;
 
-  trans = g_new0 (Transaction, 1);
+  trans = g_object_new (GNC_TYPE_TRANSACTION, NULL);
 
   trans->num         = CACHE_INSERT (t->num);
   trans->description = CACHE_INSERT (t->description);
@@ -376,9 +395,9 @@
    * the cloned transaction as something official.  If we ever 
    * use this transaction, we'll have to fix this up.
    */
-  trans->inst.entity.e_type = NULL;
-  trans->inst.entity.guid = *guid_null();
-  trans->inst.entity.collection = NULL;
+  trans->inst.e_type = NULL;
+  trans->inst.guid = *guid_null();
+  trans->inst.collection = NULL;
   trans->inst.book = t->inst.book;
   trans->inst.editlevel = 0;
   trans->inst.do_free = FALSE;
@@ -399,7 +418,7 @@
   GList *node;
 
   qof_event_suspend();
-  trans = g_new0 (Transaction, 1);
+  trans = g_object_new (GNC_TYPE_TRANSACTION, NULL);
 
   trans->date_entered    = t->date_entered;
   trans->date_posted     = t->date_posted;
@@ -412,7 +431,7 @@
   trans->orig            = NULL;
   trans->idata           = 0;
 
-  qof_instance_init (&trans->inst, GNC_ID_TRANS, t->inst.book);
+  qof_instance_init_data (&trans->inst, GNC_ID_TRANS, t->inst.book);
   kvp_frame_delete (trans->inst.kvp_data);
   trans->inst.kvp_data    = kvp_frame_copy (t->inst.kvp_data);
 
@@ -475,8 +494,8 @@
     trans->orig = NULL;
   }
 
-  qof_instance_release (&trans->inst);
-  g_free(trans);
+  /* qof_instance_release (&trans->inst); */
+  g_object_unref(trans);
 
   LEAVE ("(addr=%p)", trans);
 }
@@ -522,7 +541,7 @@
   if (ta == tb) return TRUE;
 
   if (check_guids) {
-    if (!guid_equal(&(ta->inst.entity.guid), &(tb->inst.entity.guid)))
+    if (!guid_equal(&(ta->inst.guid), &(tb->inst.guid)))
     {
       PWARN ("GUIDs differ");
       return FALSE;
@@ -777,7 +796,7 @@
 
     /* This test needs to correspond to the comparison function used when
        sorting the splits for computing the running balance. */
-    if (xaccSplitDateOrder (last_split, split) < 0)
+    if (xaccSplitOrder (last_split, split) < 0)
       last_split = split;
   }
 
@@ -885,7 +904,7 @@
   if (!shutting_down)
     xaccTransWriteLog (trans, 'D');
 
-  qof_event_gen (&trans->inst.entity, QOF_EVENT_DESTROY, NULL);
+  qof_event_gen (&trans->inst, QOF_EVENT_DESTROY, NULL);
 
   /* We only own the splits that still think they belong to us. */
   trans->splits = g_list_copy(trans->splits);
@@ -953,14 +972,14 @@
             ed.node = trans;
             ed.idx = g_list_index(trans->splits, s);
             trans->splits = g_list_remove(trans->splits, s);
-            qof_event_gen(&s->inst.entity, QOF_EVENT_REMOVE, &ed);
+            qof_event_gen(&s->inst, QOF_EVENT_REMOVE, &ed);
         }
 
         if (s->parent == trans) {
             /* Split was either added, destroyed or just changed */
             if (s->inst.do_free)
-                qof_event_gen(&s->inst.entity, QOF_EVENT_DESTROY, NULL);
-            else qof_event_gen(&s->inst.entity, QOF_EVENT_MODIFY, NULL);
+                qof_event_gen(&s->inst, QOF_EVENT_DESTROY, NULL);
+            else qof_event_gen(&s->inst, QOF_EVENT_MODIFY, NULL);
             xaccSplitCommitEdit(s);
         }
     }
@@ -983,15 +1002,19 @@
     g_assert(trans->inst.editlevel == 0);
 
     gen_event_trans (trans); //TODO: could be conditional
-    qof_event_gen (&trans->inst.entity, QOF_EVENT_MODIFY, NULL);
+    qof_event_gen (&trans->inst, QOF_EVENT_MODIFY, NULL);
 }
 
 void
 xaccTransCommitEdit (Transaction *trans)
 {
    if (!trans) return;
+   ENTER ("(trans=%p)", trans);
 
-   if (!qof_commit_edit (QOF_INSTANCE(trans))) return;
+   if (!qof_commit_edit (QOF_INSTANCE(trans))) {
+       LEAVE("editlevel non-zero");
+       return;
+   }
 
    /* We increment this for the duration of the call
     * so other functions don't result in a recursive
@@ -1242,7 +1265,7 @@
     return retval;
 
   /* else, sort on guid - keeps sort stable. */
-  return guid_compare(&(ta->inst.entity.guid), &(tb->inst.entity.guid));
+  return guid_compare(&(ta->inst.guid), &(tb->inst.guid));
 }
 
 /********************************************************************\
@@ -1968,7 +1991,7 @@
     { QOF_PARAM_BOOK, QOF_ID_BOOK,      
       (QofAccessFunc)qof_instance_get_book, NULL },
     { QOF_PARAM_GUID, QOF_TYPE_GUID,    
-      (QofAccessFunc)qof_entity_get_guid, NULL },
+      (QofAccessFunc)qof_instance_get_guid, NULL },
     { NULL },
   };
 

Modified: gnucash/branches/gda-dev/src/engine/Transaction.h
===================================================================
--- gnucash/branches/gda-dev/src/engine/Transaction.h	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/src/engine/Transaction.h	2007-04-14 00:35:53 UTC (rev 15878)
@@ -86,15 +86,32 @@
 #ifndef XACC_TRANSACTION_H
 #define XACC_TRANSACTION_H
 
+typedef struct _TransactionClass TransactionClass;
+
 #include <time.h>
 
 #include "gnc-commodity.h"
 #include "gnc-engine.h"
 #include "Split.h"
 
+/* --- type macros --- */
+#define GNC_TYPE_TRANSACTION            (gnc_transaction_get_type ())
+#define GNC_TRANSACTION(o)              \
+     (G_TYPE_CHECK_INSTANCE_CAST ((o), GNC_TYPE_TRANSACTION, Transaction))
+#define GNC_TRANSACTION_CLASS(k)        \
+     (G_TYPE_CHECK_CLASS_CAST((k), GNC_TYPE_TRANSACTION, TransactionClass))
+#define GNC_IS_TRANSACTION(o)           \
+     (G_TYPE_CHECK_INSTANCE_TYPE ((o), GNC_TYPE_TRANSACTION))
+#define GNC_IS_TRANSACTION_CLASS(k)     \
+     (G_TYPE_CHECK_CLASS_TYPE ((k), GNC_TYPE_TRANSACTION))
+#define GNC_TRANSACTION_GET_CLASS(o)    \
+     (G_TYPE_INSTANCE_GET_CLASS ((o), GNC_TYPE_TRANSACTION, TransactionClass))
+GType gnc_transaction_get_type(void);
+
+
 /* FIXME: These macros are not consistent with the type name */
-#define GNC_IS_TRANS(obj)  (QOF_CHECK_TYPE((obj), GNC_ID_TRANS))
-#define GNC_TRANS(obj)     (QOF_CHECK_CAST((obj), GNC_ID_TRANS, Transaction))
+#define GNC_IS_TRANS(obj)  GNC_IS_TRANSACTION(obj)
+#define GNC_TRANS(obj)     GNC_TRANSACTION(obj)
 
 /** @name Transaction Type field values
 @{
@@ -550,9 +567,9 @@
 /** \deprecated */
 #define xaccTransGetBook(X)      qof_instance_get_book (QOF_INSTANCE(X))
 /** \deprecated */
-#define xaccTransGetGUID(X)      qof_entity_get_guid(QOF_ENTITY(X))
+#define xaccTransGetGUID(X)      qof_instance_get_guid(QOF_INSTANCE(X))
 /** \deprecated */
-#define xaccTransReturnGUID(X) (X ? *(qof_entity_get_guid(QOF_ENTITY(X))) : *(guid_null()))
+#define xaccTransReturnGUID(X) (X ? *(qof_instance_get_guid(QOF_INSTANCE(X))) : *(guid_null()))
 /** \deprecated */
 #define xaccTransGetSlots(X)     qof_instance_get_slots (QOF_INSTANCE(X))
 

Modified: gnucash/branches/gda-dev/src/engine/TransactionP.h
===================================================================
--- gnucash/branches/gda-dev/src/engine/TransactionP.h	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/src/engine/TransactionP.h	2007-04-14 00:35:53 UTC (rev 15878)
@@ -120,10 +120,15 @@
   guint32  idata;     /* used by the sql backend for kvp management */
 };
 
+struct _TransactionClass
+{
+  QofInstanceClass parent_class;
+};
+
 /* Set the transaction's GUID. This should only be done when reading
  * a transaction from a datafile, or some other external source. Never
  * call this on an existing transaction! */
-#define xaccTransSetGUID(t,g) qof_entity_set_guid(QOF_ENTITY(t),g)
+#define xaccTransSetGUID(t,g) qof_instance_set_guid(QOF_INSTANCE(t),g)
 
 /* This routine makes a 'duplicate' of the indicated transaction.
  * This routine cannot be exposed publically since the duplicate

Modified: gnucash/branches/gda-dev/src/engine/cap-gains.c
===================================================================
--- gnucash/branches/gda-dev/src/engine/cap-gains.c	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/src/engine/cap-gains.c	2007-04-14 00:35:53 UTC (rev 15878)
@@ -659,7 +659,7 @@
 
    /* Both splits will be in the same collection, so search there. */
    gains_split = (Split*) qof_collection_lookup_entity (
-       split->inst.entity.collection, gains_guid);
+       split->inst.collection, gains_guid);
    PINFO ("split=%p has gains-split=%p", split, gains_split);
    return gains_split;
 }
@@ -682,7 +682,7 @@
 
    /* Both splits will be in the same collection, so search there. */
    source_split = (Split*) qof_collection_lookup_entity(
-       split->inst.entity.collection, source_guid);
+       split->inst.collection, source_guid);
    PINFO ("split=%p has source-split=%p", split, source_split);
    return source_split;
 }

Modified: gnucash/branches/gda-dev/src/engine/gnc-book.h
===================================================================
--- gnucash/branches/gda-dev/src/engine/gnc-book.h	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/src/engine/gnc-book.h	2007-04-14 00:35:53 UTC (rev 15878)
@@ -12,8 +12,3 @@
 #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
-#define gnc_book_x qof_book_x
-#define gnc_book_x qof_book_x
-#define gnc_book_x qof_book_x
-
-#define GNC_BOOK(obj)     ((GNCBook*)(obj))

Modified: gnucash/branches/gda-dev/src/engine/gnc-budget.c
===================================================================
--- gnucash/branches/gda-dev/src/engine/gnc-budget.c	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/src/engine/gnc-budget.c	2007-04-14 00:35:53 UTC (rev 15878)
@@ -48,6 +48,29 @@
     guint  num_periods;
 };
 
+struct _GncBudgetClass
+{
+  QofInstanceClass parent_class;
+};
+
+/* GObject Initialization */
+QOF_GOBJECT_IMPL(gnc_budget, GncBudget, QOF_TYPE_INSTANCE);
+
+static void
+gnc_budget_init(GncBudget* budget)
+{
+}
+
+static void
+gnc_budget_dispose_real (GObject *budgetp)
+{
+}
+
+static void
+gnc_budget_finalize_real(GObject* budgetp)
+{
+}
+
 static void commit_err (QofInstance *inst, QofBackendError errcode)
 {
   PERR ("Failed to commit: %d", errcode);
@@ -65,13 +88,13 @@
     /* We first send the message that this object is about to be
      * destroyed so that any GUI elements can remove it before it is
      * actually gone. */
-    qof_event_gen( &budget->inst.entity, QOF_EVENT_DESTROY, NULL);
+    qof_event_gen( &budget->inst, QOF_EVENT_DESTROY, NULL);
 
     CACHE_REMOVE(budget->name);
     CACHE_REMOVE(budget->description);
 
-    qof_instance_release (&budget->inst);
-    g_free(budget);
+    /* qof_instance_release (&budget->inst); */
+    g_object_unref(budget);
 }
 
 static void noop (QofInstance *inst) {}
@@ -98,8 +121,8 @@
     g_return_val_if_fail(book, NULL);
 
     ENTER(" ");
-    budget = g_new0(GncBudget, 1);
-    qof_instance_init (&budget->inst, GNC_ID_BUDGET, book);
+    budget = g_object_new(GNC_TYPE_BUDGET, NULL);
+    qof_instance_init_data (&budget->inst, GNC_ID_BUDGET, book);
 
     g_date_set_time_t(&date, time(NULL));
     g_date_subtract_days(&date, g_date_get_day(&date)-1);
@@ -111,7 +134,7 @@
     gnc_budget_set_num_periods(budget, 12);
 	gnc_budget_commit_edit(budget);
 
-    qof_event_gen( &budget->inst.entity, QOF_EVENT_CREATE , NULL);
+    qof_event_gen( &budget->inst, QOF_EVENT_CREATE , NULL);
 
     LEAVE(" ");
     return budget;
@@ -137,7 +160,7 @@
     qof_instance_set_dirty(&budget->inst);
     gnc_budget_commit_edit(budget);
 
-    qof_event_gen( &budget->inst.entity, QOF_EVENT_MODIFY, NULL);
+    qof_event_gen( &budget->inst, QOF_EVENT_MODIFY, NULL);
 }
 
 const gchar*
@@ -158,7 +181,7 @@
     qof_instance_set_dirty(&budget->inst);
     gnc_budget_commit_edit(budget);
 
-    qof_event_gen( &budget->inst.entity, QOF_EVENT_MODIFY, NULL);
+    qof_event_gen( &budget->inst, QOF_EVENT_MODIFY, NULL);
 }
 
 const gchar*
@@ -177,7 +200,7 @@
     qof_instance_set_dirty(&budget->inst);
     gnc_budget_commit_edit(budget);
 
-    qof_event_gen(&budget->inst.entity, QOF_EVENT_MODIFY, NULL);
+    qof_event_gen(&budget->inst, QOF_EVENT_MODIFY, NULL);
 }
 
 const Recurrence *
@@ -192,7 +215,7 @@
 {
     g_return_val_if_fail(budget, NULL);
     g_return_val_if_fail(GNC_IS_BUDGET(budget), NULL);
-    return qof_entity_get_guid(QOF_ENTITY(budget));
+    return qof_instance_get_guid(QOF_INSTANCE(budget));
 }
 
 void
@@ -205,7 +228,7 @@
     qof_instance_set_dirty(&budget->inst);
     gnc_budget_commit_edit(budget);
 
-    qof_event_gen( &budget->inst.entity, QOF_EVENT_MODIFY, NULL);
+    qof_event_gen( &budget->inst, QOF_EVENT_MODIFY, NULL);
 }
 
 guint
@@ -239,7 +262,7 @@
     qof_instance_set_dirty(&budget->inst);
     gnc_budget_commit_edit(budget);
 
-    qof_event_gen( &budget->inst.entity, QOF_EVENT_MODIFY, NULL);
+    qof_event_gen( &budget->inst, QOF_EVENT_MODIFY, NULL);
 
 }
 
@@ -267,7 +290,7 @@
     qof_instance_set_dirty(&budget->inst);
     gnc_budget_commit_edit(budget);
 
-    qof_event_gen( &budget->inst.entity, QOF_EVENT_MODIFY, NULL);
+    qof_event_gen( &budget->inst, QOF_EVENT_MODIFY, NULL);
 
 }
 
@@ -379,7 +402,7 @@
     return GNC_BUDGET(qof_collection_lookup_entity (col, guid));
 }
 
-static void just_get_one(QofEntity *ent, gpointer data)
+static void just_get_one(QofInstance *ent, gpointer data)
 {
     GncBudget **bgt = (GncBudget**)data;
     if (bgt && !*bgt) *bgt = GNC_BUDGET(ent);

Modified: gnucash/branches/gda-dev/src/engine/gnc-budget.h
===================================================================
--- gnucash/branches/gda-dev/src/engine/gnc-budget.h	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/src/engine/gnc-budget.h	2007-04-14 00:35:53 UTC (rev 15878)
@@ -68,13 +68,25 @@
 
 /** The budget data.*/
 typedef struct gnc_budget_private GncBudget;
+typedef struct _GncBudgetClass GncBudgetClass;
 
 #include "qof.h"
 #include "Account.h"
 #include "Recurrence.h"
 
-#define GNC_IS_BUDGET(obj)  (QOF_CHECK_TYPE((obj), GNC_ID_BUDGET))
-#define GNC_BUDGET(obj)     (QOF_CHECK_CAST((obj), GNC_ID_BUDGET, GncBudget))
+/* --- type macros --- */
+#define GNC_TYPE_BUDGET            (gnc_budget_get_type ())
+#define GNC_BUDGET(o)              \
+     (G_TYPE_CHECK_INSTANCE_CAST ((o), GNC_TYPE_BUDGET, GncBudget))
+#define GNC_BUDGET_CLASS(k)        \
+     (G_TYPE_CHECK_CLASS_CAST((k), GNC_TYPE_BUDGET, GncBudgetClass))
+#define GNC_IS_BUDGET(o)           \
+     (G_TYPE_CHECK_INSTANCE_TYPE ((o), GNC_TYPE_BUDGET))
+#define GNC_IS_BUDGET_CLASS(k)     \
+     (G_TYPE_CHECK_CLASS_TYPE ((k), GNC_TYPE_BUDGET))
+#define GNC_BUDGET_GET_CLASS(o)    \
+     (G_TYPE_INSTANCE_GET_CLASS ((o), GNC_TYPE_BUDGET, GncBudgetClass))
+GType gnc_budget_get_type(void);
 
 #define GNC_BUDGET_MAX_NUM_PERIODS_DIGITS 3 // max num periods == 999
 
@@ -90,11 +102,8 @@
 
 const GUID* gnc_budget_get_guid(GncBudget* budget);
 #define gnc_budget_return_guid(X) \
-  (X ? *(qof_entity_get_guid(QOF_ENTITY(X))) : *(guid_null()))
+  (X ? *(qof_instance_get_guid(QOF_INSTANCE(X))) : *(guid_null()))
 
-void gnc_budget_begin_edit(GncBudget* budget);
-void gnc_budget_commit_edit(GncBudget* budget);
-
 /** Set/Get the name of the Budget */
 void gnc_budget_set_name(GncBudget* budget, const gchar* name);
 const gchar* gnc_budget_get_name(GncBudget* budget);

Modified: gnucash/branches/gda-dev/src/engine/gnc-commodity.c
===================================================================
--- gnucash/branches/gda-dev/src/engine/gnc-commodity.c	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/src/engine/gnc-commodity.c	2007-04-14 00:35:53 UTC (rev 15878)
@@ -63,6 +63,11 @@
   char    * quote_tz;
 };
 
+struct _GncCommodityClass
+{
+  QofInstanceClass parent_class;
+};
+
 struct gnc_commodity_namespace_s 
 {
   QofInstance inst;
@@ -73,6 +78,11 @@
   GList      * cm_list;
 };
 
+struct _GncCommodityNamespaceClass
+{
+  QofInstanceClass parent_class;
+};
+
 struct gnc_commodity_table_s 
 {
   GHashTable * ns_table;
@@ -499,7 +509,7 @@
 mark_commodity_dirty (gnc_commodity *cm)
 {
   qof_instance_set_dirty(&cm->inst);
-  qof_event_gen (&cm->inst.entity, QOF_EVENT_MODIFY, NULL);
+  qof_event_gen (&cm->inst, QOF_EVENT_MODIFY, NULL);
 }
 
 static void
@@ -523,15 +533,33 @@
                                        com->mnemonic ? com->mnemonic : "");
 }
 
+/* GObject Initialization */
+QOF_GOBJECT_IMPL(gnc_commodity, gnc_commodity, QOF_TYPE_INSTANCE);
+
+static void
+gnc_commodity_init(gnc_commodity* com)
+{
+}
+
+static void
+gnc_commodity_dispose_real (GObject *nsp)
+{
+}
+
+static void
+gnc_commodity_finalize_real(GObject* comp)
+{
+}
+
 gnc_commodity *
 gnc_commodity_new(QofBook *book, const char * fullname, 
                   const char * namespace, const char * mnemonic, 
                   const char * cusip, int fraction)
 {
-  gnc_commodity * retval = g_new0(gnc_commodity, 1);
+  gnc_commodity * retval = g_object_new(GNC_TYPE_COMMODITY, NULL);
   gnc_commodity_table *table;
 
-  qof_instance_init (&retval->inst, GNC_ID_COMMODITY, book);
+  qof_instance_init_data (&retval->inst, GNC_ID_COMMODITY, book);
   table = gnc_commodity_table_get_table(book);
   if (namespace) {
     retval->namespace = gnc_commodity_table_find_namespace(table, namespace);
@@ -554,7 +582,7 @@
   reset_unique_name(retval);
   if (gnc_commodity_namespace_is_iso(namespace))
     retval->quote_source = gnc_quote_source_lookup_by_internal("currency");
-  qof_event_gen (&retval->inst.entity, QOF_EVENT_CREATE, NULL);
+  qof_event_gen (&retval->inst, QOF_EVENT_CREATE, NULL);
 
   return retval;
 }
@@ -575,7 +603,7 @@
   table = gnc_commodity_table_get_table(book);
   gnc_commodity_table_remove(table, cm);
 
-  qof_event_gen (&cm->inst.entity, QOF_EVENT_DESTROY, NULL);
+  qof_event_gen (&cm->inst, QOF_EVENT_DESTROY, NULL);
 
   /* Set at creation */
   CACHE_REMOVE (cm->fullname);
@@ -596,8 +624,8 @@
 
   cm->mark = 0;
 
-  qof_instance_release (&cm->inst);
-  g_free(cm);
+  /* qof_instance_release (&cm->inst); */
+  g_object_unref(cm);
 }
 
 void
@@ -615,7 +643,8 @@
 gnc_commodity *
 gnc_commodity_clone(gnc_commodity *src)
 {
-  gnc_commodity * dest = g_new0(gnc_commodity, 1);
+  gnc_commodity * dest = g_object_new(GNC_TYPE_COMMODITY, NULL);
+  /* qof_instance_init_data (&dest->inst, GNC_ID_COMMODITY, src->inst.book); */
 
   dest->fullname = CACHE_INSERT(src->fullname);
   dest->mnemonic = CACHE_INSERT(src->mnemonic);
@@ -1268,10 +1297,12 @@
   {
     if (c == comm)
     {
+      LEAVE("already in table");
       return c;
     }
     gnc_commodity_copy (c, comm);
     gnc_commodity_destroy (comm);
+    LEAVE("found at %p", c);
     return c;
   }
 
@@ -1285,7 +1316,7 @@
                       (gpointer)comm);
   nsp->cm_list = g_list_append(nsp->cm_list, comm);
 
-  qof_event_gen (&comm->inst.entity, QOF_EVENT_ADD, NULL);
+  qof_event_gen (&comm->inst, QOF_EVENT_ADD, NULL);
   LEAVE ("(table=%p, comm=%p)", table, comm);
   return comm;
 }
@@ -1310,7 +1341,7 @@
   c = gnc_commodity_table_lookup (table, ns_name, comm->mnemonic);
   if (c != comm) return;
 
-  qof_event_gen (&comm->inst.entity, QOF_EVENT_REMOVE, NULL);
+  qof_event_gen (&comm->inst, QOF_EVENT_REMOVE, NULL);
 
   nsp = gnc_commodity_table_find_namespace(table, ns_name);
   if (!nsp) return;
@@ -1509,6 +1540,24 @@
  * add an empty namespace if it does not exist 
  ********************************************************************/
 
+/* GObject Initialization */
+QOF_GOBJECT_IMPL(gnc_commodity_namespace, gnc_commodity_namespace, QOF_TYPE_INSTANCE);
+
+static void
+gnc_commodity_namespace_init(gnc_commodity_namespace* ns)
+{
+}
+
+static void
+gnc_commodity_namespace_dispose_real (GObject *nsp)
+{
+}
+
+static void
+gnc_commodity_namespace_finalize_real(GObject* nsp)
+{
+}
+
 gnc_commodity_namespace * 
 gnc_commodity_table_add_namespace(gnc_commodity_table * table,
                                   const char * namespace,
@@ -1522,18 +1571,18 @@
   ns = gnc_commodity_table_find_namespace(table, namespace);
   if(!ns) 
   {
-    ns = g_new0(gnc_commodity_namespace, 1);
+    ns = g_object_new(GNC_TYPE_COMMODITY_NAMESPACE, NULL);
     ns->cm_table = g_hash_table_new(g_str_hash, g_str_equal);
     ns->name = CACHE_INSERT((gpointer)namespace);
     ns->iso4217 = gnc_commodity_namespace_is_iso(namespace);
-    qof_instance_init (&ns->inst, GNC_ID_COMMODITY_NAMESPACE, book);
-    qof_event_gen (&ns->inst.entity, QOF_EVENT_CREATE, NULL);
+    qof_instance_init_data (&ns->inst, GNC_ID_COMMODITY_NAMESPACE, book);
+    qof_event_gen (&ns->inst, QOF_EVENT_CREATE, NULL);
     
     g_hash_table_insert(table->ns_table,
 			(gpointer) ns->name, 
 			(gpointer) ns);
     table->ns_list = g_list_append(table->ns_list, ns);
-    qof_event_gen (&ns->inst.entity, QOF_EVENT_ADD, NULL);
+    qof_event_gen (&ns->inst, QOF_EVENT_ADD, NULL);
   }
   return ns;
 }
@@ -1597,7 +1646,7 @@
   if (!ns)
     return;
 
-  qof_event_gen (&ns->inst.entity, QOF_EVENT_REMOVE, NULL);
+  qof_event_gen (&ns->inst, QOF_EVENT_REMOVE, NULL);
   g_hash_table_remove(table->ns_table, namespace);
   table->ns_list = g_list_remove(table->ns_list, ns);
 
@@ -1608,9 +1657,9 @@
   g_hash_table_destroy(ns->cm_table);
   CACHE_REMOVE(ns->name);
 
-  qof_event_gen (&ns->inst.entity, QOF_EVENT_DESTROY, NULL);
-  qof_instance_release(&ns->inst);
-  g_free(ns);
+  qof_event_gen (&ns->inst, QOF_EVENT_DESTROY, NULL);
+  /* qof_instance_release(&ns->inst); */
+  g_object_unref(ns);
 }
 
 /********************************************************************

Modified: gnucash/branches/gda-dev/src/engine/gnc-commodity.h
===================================================================
--- gnucash/branches/gda-dev/src/engine/gnc-commodity.h	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/src/engine/gnc-commodity.h	2007-04-14 00:35:53 UTC (rev 15878)
@@ -46,14 +46,41 @@
 #ifndef GNC_COMMODITY_H
 #define GNC_COMMODITY_H
 
+typedef struct _GncCommodityClass gnc_commodityClass;
+typedef struct _GncCommodityNamespaceClass gnc_commodity_namespaceClass;
+
 #include <glib.h>
 #include "gnc-engine.h"
 
-#define GNC_IS_COMMODITY(obj)  (QOF_CHECK_TYPE((obj), GNC_ID_COMMODITY))
-#define GNC_COMMODITY(obj)     (QOF_CHECK_CAST((obj), GNC_ID_COMMODITY, gnc_commodity))
-#define GNC_IS_COMMODITY_NAMESPACE(obj)  (QOF_CHECK_TYPE((obj), GNC_ID_COMMODITY_NAMESPACE))
-#define GNC_COMMODITY_NAMESPACE(obj)     (QOF_CHECK_CAST((obj), GNC_ID_COMMODITY_NAMESPACE, gnc_commodity_namespace))
+/* --- type macros --- */
+#define GNC_TYPE_COMMODITY            (gnc_commodity_get_type ())
+#define GNC_COMMODITY(o)              \
+     (G_TYPE_CHECK_INSTANCE_CAST ((o), GNC_TYPE_COMMODITY, gnc_commodity))
+#define GNC_COMMODITY_CLASS(k)        \
+     (G_TYPE_CHECK_CLASS_CAST((k), GNC_TYPE_COMMODITY, gnc_commodityClass))
+#define GNC_IS_COMMODITY(o)           \
+     (G_TYPE_CHECK_INSTANCE_TYPE ((o), GNC_TYPE_COMMODITY))
+#define GNC_IS_COMMODITY_CLASS(k)     \
+     (G_TYPE_CHECK_CLASS_TYPE ((k), GNC_TYPE_COMMODITY))
+#define GNC_COMMODITY_GET_CLASS(o)    \
+     (G_TYPE_INSTANCE_GET_CLASS ((o), GNC_TYPE_COMMODITY, gnc_commodityClass))
+GType gnc_commodity_get_type(void);
 
+/* --- type macros --- */
+#define GNC_TYPE_COMMODITY_NAMESPACE            (gnc_commodity_namespace_get_type ())
+#define GNC_COMMODITY_NAMESPACE(o)              \
+     (G_TYPE_CHECK_INSTANCE_CAST ((o), GNC_TYPE_COMMODITY_NAMESPACE, gnc_commodity_namespace))
+#define GNC_COMMODITY_NAMESPACE_CLASS(k)        \
+     (G_TYPE_CHECK_CLASS_CAST((k), GNC_TYPE_COMMODITY_NAMESPACE, gnc_commodity_namespaceClass))
+#define GNC_IS_COMMODITY_NAMESPACE(o)           \
+     (G_TYPE_CHECK_INSTANCE_TYPE ((o), GNC_TYPE_COMMODITY_NAMESPACE))
+#define GNC_IS_COMMODITY_NAMESPACE_CLASS(k)     \
+     (G_TYPE_CHECK_CLASS_TYPE ((k), GNC_TYPE_COMMODITY_NAMESPACE))
+#define GNC_COMMODITY_NAMESPACE_GET_CLASS(o)    \
+     (G_TYPE_INSTANCE_GET_CLASS ((o), GNC_TYPE_COMMODITY_NAMESPACE, gnc_commodity_namespaceClass))
+GType gnc_commodity_namespace_get_type(void);
+
+
 #define GNC_COMMODITY_TABLE "gnc_commodity_table"
 
 /** The commodity namespace definitions are used to tag a commodity by

Modified: gnucash/branches/gda-dev/src/engine/gnc-engine.h
===================================================================
--- gnucash/branches/gda-dev/src/engine/gnc-engine.h	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/src/engine/gnc-engine.h	2007-04-14 00:35:53 UTC (rev 15878)
@@ -196,9 +196,6 @@
 typedef struct gnc_price_s           GNCPrice;
 typedef struct gnc_quote_source_s    gnc_quote_source;
 
-#define GNC_IS_PRICE(obj)  (QOF_CHECK_TYPE((obj), GNC_ID_PRICE))
-#define GNC_PRICE(obj)     (QOF_CHECK_CAST((obj), GNC_ID_PRICE, GNCPrice))
-
 /** GList of Account */
 typedef GList                  AccountList;
 /** GList of GNCLots */

Modified: gnucash/branches/gda-dev/src/engine/gnc-filepath-utils.c
===================================================================
--- gnucash/branches/gda-dev/src/engine/gnc-filepath-utils.c	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/src/engine/gnc-filepath-utils.c	2007-04-14 00:35:53 UTC (rev 15878)
@@ -195,11 +195,14 @@
   /* OK, now we try to find or build an absolute file path */
 
   /* check for an absolute file path */
-  if (g_path_is_absolute(filefrag))
+  if (g_path_is_absolute(filefrag)) {
+    LEAVE("filefrag is absolute path");
     return g_strdup (filefrag);
+  }
 
   if (!g_ascii_strncasecmp(filefrag, "file:", 5))
   {
+      LEAVE("filefrag is file uri");
       return g_strdup(filefrag + 5);
   }
 
@@ -221,6 +224,7 @@
 
 	  if (g_file_test(fullpath, G_FILE_TEST_IS_REGULAR))
 	  {
+	      LEAVE("found %s", fullpath);
 	      return fullpath;
           }
 	  g_free (fullpath);
@@ -251,6 +255,7 @@
       gchar *result;
       result = g_build_filename(pathbuf, filefrag_dup, (gchar *)NULL);
       g_free (filefrag_dup);
+      LEAVE("create new file %s", result);
       return result;
   } 
 
@@ -261,11 +266,13 @@
       gchar *result;
       result = g_build_filename(pathbuf, filefrag_dup, (gchar *)NULL);
       g_free (filefrag_dup);
+      LEAVE("create new file %s", result);
       return result;
   }
 
   g_free (filefrag_dup);
 
+  LEAVE("%s not found", filefrag);
   return NULL;
 }
 

Modified: gnucash/branches/gda-dev/src/engine/gnc-lot-p.h
===================================================================
--- gnucash/branches/gda-dev/src/engine/gnc-lot-p.h	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/src/engine/gnc-lot-p.h	2007-04-14 00:35:53 UTC (rev 15878)
@@ -60,8 +60,13 @@
   unsigned char marker;
 };
 
-#define gnc_lot_set_guid(L,G)  qof_entity_set_guid(QOF_ENTITY(L),&(G))
+struct _GncLotClass
+{
+  QofInstanceClass parent_class;
+};
 
+#define gnc_lot_set_guid(L,G)  qof_instance_set_guid(QOF_INSTANCE(L),&(G))
+
 /* Register with the Query engine */
 gboolean gnc_lot_register (void);
 

Modified: gnucash/branches/gda-dev/src/engine/gnc-lot.c
===================================================================
--- gnucash/branches/gda-dev/src/engine/gnc-lot.c	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/src/engine/gnc-lot.c	2007-04-14 00:35:53 UTC (rev 15878)
@@ -52,16 +52,34 @@
 
 /* ============================================================= */
 
+/* GObject Initialization */
+QOF_GOBJECT_IMPL(gnc_lot, GNCLot, QOF_TYPE_INSTANCE);
+
 static void
-gnc_lot_init (GNCLot *lot, QofBook *book)
+gnc_lot_init(GNCLot* lot)
 {
+}
+
+static void
+gnc_lot_dispose_real (GObject *lotp)
+{
+}
+
+static void
+gnc_lot_finalize_real(GObject* lotp)
+{
+}
+
+static void
+gnc_lot_init_data (GNCLot *lot, QofBook *book)
+{
    ENTER ("(lot=%p, book=%p)", lot, book);
    lot->account = NULL;
    lot->splits = NULL;
    lot->is_closed = -1;
    lot->marker = 0;
   
-   qof_instance_init(&lot->inst, GNC_ID_LOT, book);
+   qof_instance_init_data(&lot->inst, GNC_ID_LOT, book);
    LEAVE ("(lot=%p, book=%p)", lot, book);
 }
 
@@ -71,9 +89,9 @@
    GNCLot *lot;
    g_return_val_if_fail (book, NULL);
 
-   lot = g_new (GNCLot, 1);
-   gnc_lot_init (lot, book);
-   qof_event_gen (&lot->inst.entity, QOF_EVENT_CREATE, NULL);
+   lot = g_object_new (GNC_TYPE_LOT, NULL);
+   gnc_lot_init_data (lot, book);
+   qof_event_gen (&lot->inst, QOF_EVENT_CREATE, NULL);
    return lot;
 }
 
@@ -84,7 +102,7 @@
    if (!lot) return;
    
    ENTER ("(lot=%p)", lot);
-   qof_event_gen (&lot->inst.entity, QOF_EVENT_DESTROY, NULL);
+   qof_event_gen (&lot->inst, QOF_EVENT_DESTROY, NULL);
 
    
    for (node=lot->splits; node; node=node->next)
@@ -96,8 +114,8 @@
    
    lot->account = NULL;
    lot->is_closed = TRUE;
-   qof_instance_release (&lot->inst);
-   g_free (lot);
+   /* qof_instance_release (&lot->inst); */
+   g_object_unref (lot);
 }
 
 /* ============================================================= */
@@ -321,11 +339,13 @@
             "\tlot account=\'%s\', split account=\'%s\'\n",
             xaccAccountGetName(lot->account), xaccAccountGetName (acc));
       gnc_lot_commit_edit(lot);
+      LEAVE("different accounts");
       return;
    }
 
    if (lot == split->lot) {
         gnc_lot_commit_edit(lot);
+        LEAVE("already in lot");
 	return; /* handle not-uncommon no-op */
    }
    if (split->lot)
@@ -340,7 +360,8 @@
    lot->is_closed = -1;
    gnc_lot_commit_edit(lot);
 
-   qof_event_gen (&lot->inst.entity, QOF_EVENT_MODIFY, NULL);
+   qof_event_gen (&lot->inst, QOF_EVENT_MODIFY, NULL);
+   LEAVE("added to lot");
 }
 
 void
@@ -361,7 +382,7 @@
       lot->account = NULL;
    }
    gnc_lot_commit_edit(lot);
-   qof_event_gen (&lot->inst.entity, QOF_EVENT_MODIFY, NULL);
+   qof_event_gen (&lot->inst, QOF_EVENT_MODIFY, NULL);
 }
 
 /* ============================================================== */
@@ -372,7 +393,7 @@
 {
   if (! lot->splits)
     return NULL;
-  lot->splits = g_list_sort (lot->splits, (GCompareFunc) xaccSplitDateOrder);
+  lot->splits = g_list_sort (lot->splits, (GCompareFunc) xaccSplitOrderDateOnly);
   return lot->splits->data;
 }
 
@@ -383,7 +404,7 @@
 
   if (! lot->splits)
     return NULL;
-  lot->splits = g_list_sort (lot->splits, (GCompareFunc) xaccSplitDateOrder);
+  lot->splits = g_list_sort (lot->splits, (GCompareFunc) xaccSplitOrderDateOnly);
 
   for (node = lot->splits; node->next; node = node->next)
     ;
@@ -419,7 +440,7 @@
           (QofAccessFunc) gnc_lot_get_notes, 
           (QofSetterFunc) gnc_lot_set_notes },
         { QOF_PARAM_GUID, QOF_TYPE_GUID, 
-          (QofAccessFunc) qof_entity_get_guid, NULL },
+          (QofAccessFunc) qof_instance_get_guid, NULL },
         { QOF_PARAM_BOOK, QOF_ID_BOOK, 
           (QofAccessFunc) gnc_lot_get_book, NULL },
         { LOT_IS_CLOSED, QOF_TYPE_BOOLEAN, 

Modified: gnucash/branches/gda-dev/src/engine/gnc-lot.h
===================================================================
--- gnucash/branches/gda-dev/src/engine/gnc-lot.h	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/src/engine/gnc-lot.h	2007-04-14 00:35:53 UTC (rev 15878)
@@ -59,12 +59,26 @@
 #ifndef GNC_LOT_H
 #define GNC_LOT_H
 
+typedef struct _GncLotClass GNCLotClass;
+
 #include "qof.h"
 #include "gnc-lot-p.h"
 
-#define GNC_IS_LOT(obj)  (QOF_CHECK_TYPE((obj), GNC_ID_LOT))
-#define GNC_LOT(obj)     (QOF_CHECK_CAST((obj), GNC_ID_LOT, GNCLot))
+/* --- type macros --- */
+#define GNC_TYPE_LOT            (gnc_lot_get_type ())
+#define GNC_LOT(o)              \
+     (G_TYPE_CHECK_INSTANCE_CAST ((o), GNC_TYPE_LOT, GNCLot))
+#define GNC_LOT_CLASS(k)        \
+     (G_TYPE_CHECK_CLASS_CAST((k), GNC_TYPE_LOT, GNCLotClass))
+#define GNC_IS_LOT(o)           \
+     (G_TYPE_CHECK_INSTANCE_TYPE ((o), GNC_TYPE_LOT))
+#define GNC_IS_LOT_CLASS(k)     \
+     (G_TYPE_CHECK_CLASS_TYPE ((k), GNC_TYPE_LOT))
+#define GNC_LOT_GET_CLASS(o)    \
+     (G_TYPE_INSTANCE_GET_CLASS ((o), GNC_TYPE_LOT, GNCLotClass))
+GType gnc_lot_get_type(void);
 
+
 GNCLot * gnc_lot_new (QofBook *);
 void gnc_lot_destroy (GNCLot *);
 
@@ -142,7 +156,7 @@
  * */
 KvpFrame * gnc_lot_get_slots (const GNCLot *);
 
-#define gnc_lot_get_guid(X)  qof_entity_get_guid(QOF_ENTITY(X))
+#define gnc_lot_get_guid(X)  qof_instance_get_guid(QOF_INSTANCE(X))
 
 #define LOT_IS_CLOSED	"is-closed?"
 #define LOT_BALANCE	"balance"

Modified: gnucash/branches/gda-dev/src/engine/gnc-pricedb-p.h
===================================================================
--- gnucash/branches/gda-dev/src/engine/gnc-pricedb-p.h	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/src/engine/gnc-pricedb-p.h	2007-04-14 00:35:53 UTC (rev 15878)
@@ -49,8 +49,11 @@
   guint32  refcount;             /* garbage collection reference count */
 };
 
+struct _GncPriceClass
+{
+  QofInstanceClass parent_class;
+};
 
-
 struct gnc_price_db_s
 {
   QofInstance inst;              /* globally unique object identifier */
@@ -58,6 +61,11 @@
   gboolean bulk_update;		 /* TRUE while reading XML file, etc. */
 };
 
+struct _GncPriceDBClass
+{
+  QofInstanceClass parent_class;
+};
+
 /* These structs define the kind of price lookup being done
  * so that it can be passed to the backend.  This is a rather
  * cheesy, low-brow interface.  It could stand improvement.
@@ -88,7 +96,7 @@
   Timespec time;
 } GNCPriceLookupHelper;
 
-#define  gnc_price_set_guid(P,G)  qof_entity_set_guid(QOF_ENTITY(P),(G))
+#define  gnc_price_set_guid(P,G)  qof_instance_set_guid(QOF_INSTANCE(P),(G))
 void     gnc_pricedb_substitute_commodity(GNCPriceDB *db,
                                           gnc_commodity *old_c,
                                           gnc_commodity *new_c);

Modified: gnucash/branches/gda-dev/src/engine/gnc-pricedb.c
===================================================================
--- gnucash/branches/gda-dev/src/engine/gnc-pricedb.c	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/src/engine/gnc-pricedb.c	2007-04-14 00:35:53 UTC (rev 15878)
@@ -35,6 +35,24 @@
 static gboolean add_price(GNCPriceDB *db, GNCPrice *p);
 static gboolean remove_price(GNCPriceDB *db, GNCPrice *p, gboolean cleanup);
 
+/* GObject Initialization */
+QOF_GOBJECT_IMPL(gnc_price, GNCPrice, QOF_TYPE_INSTANCE);
+
+static void
+gnc_price_init(GNCPrice* price)
+{
+}
+
+static void
+gnc_price_dispose_real (GObject *pricep)
+{
+}
+
+static void
+gnc_price_finalize_real(GObject* pricep)
+{
+}
+
 /* ==================================================================== */
 /* GNCPrice functions
  */
@@ -47,7 +65,7 @@
 
   g_return_val_if_fail (book, NULL);
 
-  p = g_new0(GNCPrice, 1);
+  p = g_object_new(GNC_TYPE_PRICE, NULL);
 
   p->refcount = 1;
   p->version = 0;
@@ -56,8 +74,8 @@
   p->type = NULL;
   p->source = NULL;
 
-  qof_instance_init (&p->inst, GNC_ID_PRICE, book);
-  qof_event_gen (&p->inst.entity, QOF_EVENT_CREATE, NULL);
+  qof_instance_init_data (&p->inst, GNC_ID_PRICE, book);
+  qof_event_gen (&p->inst, QOF_EVENT_CREATE, NULL);
 
   return p;
 }
@@ -66,14 +84,13 @@
 gnc_price_destroy (GNCPrice *p)
 {
   ENTER(" ");
-  qof_event_gen (&p->inst.entity, QOF_EVENT_DESTROY, NULL);
+  qof_event_gen (&p->inst, QOF_EVENT_DESTROY, NULL);
 
   if(p->type) CACHE_REMOVE(p->type);
   if(p->source) CACHE_REMOVE(p->source);
 
-  qof_instance_release (&p->inst);
-  memset(p, 0, sizeof(GNCPrice));
-  g_free(p);
+  /* qof_instance_release (&p->inst); */
+  g_object_unref(p);
   LEAVE (" ");
 }
 
@@ -126,7 +143,7 @@
   gnc_price_set_commodity(new_p, gnc_price_get_commodity(p));
   gnc_price_set_time(new_p, gnc_price_get_time(p));
   gnc_price_set_source(new_p, gnc_price_get_source(p));
-  gnc_price_set_type(new_p, gnc_price_get_type(p));
+  gnc_price_set_typestr(new_p, gnc_price_get_typestr(p));
   gnc_price_set_value(new_p, gnc_price_get_value(p));
   gnc_price_set_currency(new_p, gnc_price_get_currency(p));
   gnc_price_commit_edit(new_p);
@@ -261,7 +278,7 @@
 }
 
 void
-gnc_price_set_type(GNCPrice *p, const char* type)
+gnc_price_set_typestr(GNCPrice *p, const char* type)
 {
   if(!p) return;
   if(safe_strcmp(p->type, type) != 0)
@@ -339,7 +356,7 @@
 }
 
 const char *
-gnc_price_get_type(const GNCPrice *p)
+gnc_price_get_typestr(const GNCPrice *p)
 {
   if(!p) return NULL;
   return p->type;
@@ -396,8 +413,8 @@
                    gnc_price_get_source (p2)) != 0)
     return FALSE;
 
-  if (safe_strcmp (gnc_price_get_type (p1),
-                   gnc_price_get_type (p2)) != 0)
+  if (safe_strcmp (gnc_price_get_typestr (p1),
+                   gnc_price_get_typestr (p2)) != 0)
     return FALSE;
 
   if (!gnc_numeric_eq (gnc_price_get_value (p1),
@@ -555,6 +572,24 @@
    that the value is expressed in terms of.
  */
 
+/* GObject Initialization */
+QOF_GOBJECT_IMPL(gnc_pricedb, GNCPriceDB, QOF_TYPE_INSTANCE);
+
+static void
+gnc_pricedb_init(GNCPriceDB* pdb)
+{
+}
+
+static void
+gnc_pricedb_dispose_real (GObject *pdbp)
+{
+}
+
+static void
+gnc_pricedb_finalize_real(GObject* pdbp)
+{
+}
+
 static GNCPriceDB *
 gnc_pricedb_create(QofBook * book)
 {
@@ -574,8 +609,8 @@
     return result;
   }
 
-  result = g_new0(GNCPriceDB, 1);
-  qof_instance_init (&result->inst, GNC_ID_PRICEDB, book);
+  result = g_object_new(GNC_TYPE_PRICEDB, NULL);
+  qof_instance_init_data (&result->inst, GNC_ID_PRICEDB, book);
   qof_collection_mark_clean(col);
 
   /** \todo This leaks result when the collection is destroyed.  When
@@ -631,8 +666,8 @@
   }
   g_hash_table_destroy (db->commodity_hash);
   db->commodity_hash = NULL;
-  qof_instance_release (&db->inst);
-  g_free(db);
+  /* qof_instance_release (&db->inst); */
+  g_object_unref(db);
 }
 
 void
@@ -820,7 +855,7 @@
   }
   g_hash_table_insert(currency_hash, currency, price_list);
   p->db = db;
-  qof_event_gen (&p->inst.entity, QOF_EVENT_ADD, NULL);
+  qof_event_gen (&p->inst, QOF_EVENT_ADD, NULL);
 
   LEAVE ("db=%p, pr=%p dirty=%d do-free=%d commodity=%s/%s currency_hash=%p",
          db, p, p->inst.dirty, p->inst.do_free,
@@ -885,7 +920,7 @@
   currency_hash = g_hash_table_lookup(db->commodity_hash, commodity);
   if(!currency_hash) { LEAVE (" no currency hash"); return FALSE; }
 
-  qof_event_gen (&p->inst.entity, QOF_EVENT_REMOVE, NULL);
+  qof_event_gen (&p->inst, QOF_EVENT_REMOVE, NULL);
   price_list = g_hash_table_lookup(currency_hash, currency);
   gnc_price_ref(p);
   if(!gnc_price_list_remove(&price_list, p)) {
@@ -2268,7 +2303,7 @@
   str = gnc_price_get_source(p);
   str = str ? str : "(null)";
   fprintf(f, "%s  %s\n", istr, str);
-  str = gnc_price_get_type(p);
+  str = gnc_price_get_typestr(p);
   str = str ? str : "(null)";
   fprintf(f, "%s  %s\n", istr, str);
   fprintf(f, "%s  %g\n", istr, gnc_numeric_to_double(gnc_price_get_value(p)));
@@ -2376,7 +2411,7 @@
 }
 
 static void
-price_foreach(const QofCollection *col, QofEntityForeachCB cb, gpointer data)
+price_foreach(const QofCollection *col, QofInstanceForeachCB cb, gpointer data)
 {
   GNCPriceDB *db;
 
@@ -2452,7 +2487,7 @@
     { PRICE_CURRENCY, GNC_ID_COMMODITY, (QofAccessFunc)gnc_price_get_currency, (QofSetterFunc)gnc_price_set_currency },
     { PRICE_DATE, QOF_TYPE_DATE, (QofAccessFunc)gnc_price_get_time, (QofSetterFunc)gnc_price_set_time },
     { PRICE_SOURCE, QOF_TYPE_STRING, (QofAccessFunc)gnc_price_get_source, (QofSetterFunc)gnc_price_set_source },
-    { PRICE_TYPE, QOF_TYPE_STRING, (QofAccessFunc)gnc_price_get_type, (QofSetterFunc)gnc_price_set_type },
+    { PRICE_TYPE, QOF_TYPE_STRING, (QofAccessFunc)gnc_price_get_typestr, (QofSetterFunc)gnc_price_set_typestr },
     { PRICE_VALUE, QOF_TYPE_NUMERIC, (QofAccessFunc)gnc_price_get_value, (QofSetterFunc)gnc_price_set_value },
     { NULL },
   };

Modified: gnucash/branches/gda-dev/src/engine/gnc-pricedb.h
===================================================================
--- gnucash/branches/gda-dev/src/engine/gnc-pricedb.h	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/src/engine/gnc-pricedb.h	2007-04-14 00:35:53 UTC (rev 15878)
@@ -23,11 +23,43 @@
 #ifndef GNC_PRICEDB_H
 #define GNC_PRICEDB_H
 
+typedef struct _GncPriceClass GNCPriceClass;
+typedef struct _GncPriceDBClass GNCPriceDBClass;
+
 #include <stdio.h>
 #include "qof.h"
 #include "gnc-commodity.h"
 #include "gnc-engine.h"
 
+/* --- type macros --- */
+#define GNC_TYPE_PRICE            (gnc_price_get_type ())
+#define GNC_PRICE(o)              \
+     (G_TYPE_CHECK_INSTANCE_CAST ((o), GNC_TYPE_PRICE, GNCPrice))
+#define GNC_PRICE_CLASS(k)        \
+     (G_TYPE_CHECK_CLASS_CAST((k), GNC_TYPE_PRICE, GNCPriceClass))
+#define GNC_IS_PRICE(o)           \
+     (G_TYPE_CHECK_INSTANCE_TYPE ((o), GNC_TYPE_PRICE))
+#define GNC_IS_PRICE_CLASS(k)     \
+     (G_TYPE_CHECK_CLASS_TYPE ((k), GNC_TYPE_PRICE))
+#define GNC_PRICE_GET_CLASS(o)    \
+     (G_TYPE_INSTANCE_GET_CLASS ((o), GNC_TYPE_PRICE, GNCPriceClass))
+GType gnc_price_get_type(void);
+
+/* --- type macros --- */
+#define GNC_TYPE_PRICEDB            (gnc_pricedb_get_type ())
+#define GNC_PRICEDB(o)              \
+     (G_TYPE_CHECK_INSTANCE_CAST ((o), GNC_TYPE_PRICEDB, GNCPriceDB))
+#define GNC_PRICEDB_CLASS(k)        \
+     (G_TYPE_CHECK_CLASS_CAST((k), GNC_TYPE_PRICEDB, GNCPriceDBClass))
+#define GNC_IS_PRICEDB(o)           \
+     (G_TYPE_CHECK_INSTANCE_TYPE ((o), GNC_TYPE_PRICEDB))
+#define GNC_IS_PRICEDB_CLASS(k)     \
+     (G_TYPE_CHECK_CLASS_TYPE ((k), GNC_TYPE_PRICEDB))
+#define GNC_PRICEDB_GET_CLASS(o)    \
+     (G_TYPE_INSTANCE_GET_CLASS ((o), GNC_TYPE_PRICEDB, GNCPriceDBClass))
+GType gnc_pricedb_get_type(void);
+
+
 /** @addtogroup PriceDB
     @{ */
 /** @file gnc-pricedb.h
@@ -150,7 +182,7 @@
    around (i.e. increase its reference count by 1). */
 void      gnc_price_ref(GNCPrice *p);
 
-/** gnc_price_ref - indicate you're finished with a price
+/** gnc_price_unref - indicate you're finished with a price
    (i.e. decrease its reference count by 1). */
 void      gnc_price_unref(GNCPrice *p);
 /**  @} */
@@ -176,7 +208,7 @@
 void gnc_price_set_currency(GNCPrice *p, gnc_commodity *c);
 void gnc_price_set_time(GNCPrice *p, Timespec t);
 void gnc_price_set_source(GNCPrice *p, const char *source);
-void gnc_price_set_type(GNCPrice *p, const char* type);
+void gnc_price_set_typestr(GNCPrice *p, const char* type);
 void gnc_price_set_value(GNCPrice *p, gnc_numeric value);
 void gnc_price_set_version(GNCPrice *p, gint32 versn);
 /**  @} */
@@ -192,13 +224,13 @@
 gnc_commodity * gnc_price_get_currency(const GNCPrice *p);
 Timespec        gnc_price_get_time(const GNCPrice *p);
 const char *    gnc_price_get_source(const GNCPrice *p);
-const char *    gnc_price_get_type(const GNCPrice *p);
+const char *    gnc_price_get_typestr(const GNCPrice *p);
 gnc_numeric     gnc_price_get_value(const GNCPrice *p);
 gint32          gnc_price_get_version(const GNCPrice *p);
 gboolean        gnc_price_equal(const GNCPrice *p1, const GNCPrice *p2);
 
-#define gnc_price_get_guid(X)    qof_entity_get_guid(QOF_ENTITY(X))
-#define gnc_price_return_guid(X) (*(qof_entity_get_guid(QOF_ENTITY(X))))
+#define gnc_price_get_guid(X)    qof_instance_get_guid(QOF_INSTANCE(X))
+#define gnc_price_return_guid(X) (*(qof_instance_get_guid(QOF_INSTANCE(X))))
 #define gnc_price_get_book(X)    qof_instance_get_book(QOF_INSTANCE(X))
 /**  @} */
 

Modified: gnucash/branches/gda-dev/src/engine/test/test-book-merge.c
===================================================================
--- gnucash/branches/gda-dev/src/engine/test/test-book-merge.c	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/src/engine/test/test-book-merge.c	2007-04-14 00:35:53 UTC (rev 15878)
@@ -58,6 +58,11 @@
 	gint64 		minor;
 }myobj;
 
+typedef struct objclass_s
+{
+  QofInstanceClass parent_class;
+} myobjClass;
+
 myobj* obj_create(QofBook*);
 
 /* obvious setter functions */
@@ -80,13 +85,45 @@
 gint32		obj_getVersion(myobj*);
 gint64		obj_getMinor(myobj*);
 
+/* --- type macros --- */
+#define GNC_TYPE_MYOBJ            (gnc_myobj_get_type ())
+#define GNC_MYOBJ(o)              \
+     (G_TYPE_CHECK_INSTANCE_CAST ((o), GNC_TYPE_MYOBJ, myobj))
+#define GNC_MYOBJ_CLASS(k)        \
+     (G_TYPE_CHECK_CLASS_CAST((k), GNC_TYPE_MYOBJ, myobjClass))
+#define GNC_IS_MYOBJ(o)           \
+     (G_TYPE_CHECK_INSTANCE_TYPE ((o), GNC_TYPE_MYOBJ))
+#define GNC_IS_MYOBJ_CLASS(k)     \
+     (G_TYPE_CHECK_CLASS_TYPE ((k), GNC_TYPE_MYOBJ))
+#define GNC_MYOBJ_GET_CLASS(o)    \
+     (G_TYPE_INSTANCE_GET_CLASS ((o), GNC_TYPE_MYOBJ, myobjClass))
+GType gnc_myobj_get_type(void);
+
+/* GObject Initialization */
+QOF_GOBJECT_IMPL(gnc_myobj, myobj, QOF_TYPE_INSTANCE);
+
+static void
+gnc_myobj_init(myobj* obj)
+{
+}
+
+static void
+gnc_myobj_dispose_real (GObject *objp)
+{
+}
+
+static void
+gnc_myobj_finalize_real(GObject* objp)
+{
+}
+
 myobj*
 obj_create(QofBook *book)
 {
 	myobj *g;
 	g_return_val_if_fail(book, NULL);
-	g = g_new(myobj, 1);
-	qof_instance_init (&g->inst, TEST_MODULE_NAME, book);
+	g = g_object_new(GNC_TYPE_MYOBJ, NULL);
+	qof_instance_init_data (&g->inst, TEST_MODULE_NAME, book);
 	obj_setGUID(g,qof_instance_get_guid(&g->inst));
 	g->date.tv_nsec = 0;
 	g->date.tv_sec = 0;
@@ -94,7 +131,7 @@
 	g->active = TRUE;
 	g->version = 1;
 	g->minor = 1;
-	qof_event_gen(&g->inst.entity, QOF_EVENT_CREATE, NULL);
+	qof_event_gen(&g->inst, QOF_EVENT_CREATE, NULL);
 	return g;
 }
 
@@ -279,14 +316,14 @@
 
 	/* import book objects - tests used */
 	do_test ((NULL != import), "#2 import book is NULL");
-	import_obj = g_new(myobj, 1);
+	import_obj = g_object_new(GNC_TYPE_MYOBJ, NULL);
 	do_test ((NULL != import_obj), "#3 new object create");
-	qof_instance_init (&import_obj->inst, TEST_MODULE_NAME, import);
+	qof_instance_init_data (&import_obj->inst, TEST_MODULE_NAME, import);
 	do_test ((NULL != &import_obj->inst), "#4 instance init");
 	obj_setGUID(import_obj,qof_instance_get_guid(&import_obj->inst));
 	do_test ((NULL != &import_obj->obj_guid), "#5 guid set");
-	qof_event_gen(&import_obj->inst.entity, QOF_EVENT_CREATE, NULL);
-	do_test ((NULL != &import_obj->inst.entity), "#6 gnc event create");
+	qof_event_gen(&import_obj->inst, QOF_EVENT_CREATE, NULL);
+	do_test ((NULL != &import_obj->inst), "#6 gnc event create");
 	obj_setName(import_obj, import_init);
 	do_test ((NULL != &import_obj->Name), "#7 string set");
 	obj_amount = double_to_gnc_numeric(init_value,1, GNC_HOW_DENOM_EXACT);
@@ -310,10 +347,10 @@
 	minor = 3;
 
 	/* second import object - test results would be the same, so not tested. */
-	new_obj = g_new(myobj, 1);
-	qof_instance_init (&new_obj->inst, TEST_MODULE_NAME, import);
+	new_obj = g_object_new(GNC_TYPE_MYOBJ, NULL);
+	qof_instance_init_data (&new_obj->inst, TEST_MODULE_NAME, import);
 	obj_setGUID(new_obj,qof_instance_get_guid(&new_obj->inst));
-	qof_event_gen (&new_obj->inst.entity, QOF_EVENT_CREATE, NULL);
+	qof_event_gen (&new_obj->inst, QOF_EVENT_CREATE, NULL);
 	obj_setName(new_obj, import_init);
 	obj_setAmount(new_obj, obj_amount);
 	obj_setActive(new_obj, active);
@@ -330,10 +367,10 @@
 	tc.tv_nsec = 0;
 
 	/* target object - test results would be the same, so not tested. */
-	target_obj = g_new(myobj, 1);
-	qof_instance_init (&target_obj->inst, TEST_MODULE_NAME, target);
+	target_obj = g_object_new(GNC_TYPE_MYOBJ, NULL);
+	qof_instance_init_data (&target_obj->inst, TEST_MODULE_NAME, target);
 	obj_setGUID(target_obj,qof_instance_get_guid(&target_obj->inst));
-	qof_event_gen (&target_obj->inst.entity, QOF_EVENT_CREATE, NULL);
+	qof_event_gen (&target_obj->inst, QOF_EVENT_CREATE, NULL);
 	obj_setName(target_obj, target_init);
 	obj_setAmount(target_obj, obj_amount);
 	obj_setActive(target_obj, active);

Modified: gnucash/branches/gda-dev/src/engine/test/test-guid.c
===================================================================
--- gnucash/branches/gda-dev/src/engine/test/test-guid.c	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/src/engine/test/test-guid.c	2007-04-14 00:35:53 UTC (rev 15878)
@@ -53,7 +53,7 @@
   int i;
   QofSession *sess;
   QofBook *book;
-  QofEntity *eblk;
+  QofInstance *eblk;
   QofCollection *col;
   QofIdType type;
 
@@ -65,10 +65,10 @@
   type = qof_collection_get_type (col);
   
 #define NENT 500123
-  eblk = g_new0(QofEntity, NENT);
+  eblk = g_new0(QofInstance, NENT);
   for (i=0; i<NENT; i++)
   {
-    QofEntity *ent = &eblk[i];
+    QofInstance *ent = &eblk[i];
     guid_new(&ent->guid);
     do_test ((NULL == qof_collection_lookup_entity (col, &ent->guid)),
 						  "duplicate guid");

Modified: gnucash/branches/gda-dev/src/engine/test/test-object.c
===================================================================
--- gnucash/branches/gda-dev/src/engine/test/test-object.c	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/src/engine/test/test-object.c	2007-04-14 00:35:53 UTC (rev 15878)
@@ -33,7 +33,7 @@
 #define TEST_MODULE_NAME "object-test"
 #define TEST_MODULE_DESC "Test Object"
 
-static void obj_foreach (const QofCollection *, QofEntityForeachCB, gpointer);
+static void obj_foreach (const QofCollection *, QofInstanceForeachCB, gpointer);
 static const char * printable (gpointer obj);
 static void test_printable (const char *name, gpointer obj);
 static void test_foreach (QofBook *, const char *);
@@ -79,7 +79,7 @@
 }
 
 static void
-obj_foreach (const QofCollection *col, QofEntityForeachCB cb, gpointer u_d)
+obj_foreach (const QofCollection *col, QofInstanceForeachCB cb, gpointer u_d)
 {
   int *foo = u_d;
 
@@ -89,7 +89,7 @@
   *foo = 1;
 }
 
-static void foreachCB (QofEntity *ent, gpointer u_d)
+static void foreachCB (QofInstance *ent, gpointer u_d)
 {
   do_test (FALSE, "FAIL");
 }

Modified: gnucash/branches/gda-dev/src/engine/test/test-recursive.c
===================================================================
--- gnucash/branches/gda-dev/src/engine/test/test-recursive.c	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/src/engine/test/test-recursive.c	2007-04-14 00:35:53 UTC (rev 15878)
@@ -65,6 +65,11 @@
 	gint64 	    minor;
 }mychild;
 
+typedef struct childClass_s
+{
+  QofInstanceClass parent_class;
+} mychildClass;
+
 /* simple object structure */
 typedef struct parent_s
 {
@@ -80,6 +85,11 @@
 	gint64      minor;
 }myparent;
 
+typedef struct parentClass_s
+{
+  QofInstanceClass parent_class;
+} myparentClass;
+
 	/* simple object structure */
 typedef struct grand_s
 {
@@ -96,6 +106,11 @@
 	gint64       minor;
 }mygrand;
 
+typedef struct grandClass_s
+{
+  QofInstanceClass parent_class;
+} mygrandClass;
+
 mygrand* grand_create(QofBook*);
 myparent* parent_create(QofBook*);
 mychild* child_create(QofBook*);
@@ -164,14 +179,110 @@
 gint64	    child_getMinor(mychild*);
 gchar       child_getFlag(mychild*);
 
+/* --- type macros --- */
+#define GNC_TYPE_MYCHILD            (gnc_mychild_get_type ())
+#define GNC_MYCHILD(o)              \
+     (G_TYPE_CHECK_INSTANCE_CAST ((o), GNC_TYPE_MYCHILD, mychild))
+#define GNC_MYCHILD_CLASS(k)        \
+     (G_TYPE_CHECK_CLASS_CAST((k), GNC_TYPE_MYCHILD, mychildClass))
+#define GNC_IS_MYCHILD(o)           \
+     (G_TYPE_CHECK_INSTANCE_TYPE ((o), GNC_TYPE_MYCHILD))
+#define GNC_IS_MYCHILD_CLASS(k)     \
+     (G_TYPE_CHECK_CLASS_TYPE ((k), GNC_TYPE_MYCHILD))
+#define GNC_MYCHILD_GET_CLASS(o)    \
+     (G_TYPE_INSTANCE_GET_CLASS ((o), GNC_TYPE_MYCHILD, mychildClass))
+GType gnc_mychild_get_type(void);
+
+/* --- type macros --- */
+#define GNC_TYPE_MYPARENT            (gnc_myparent_get_type ())
+#define GNC_MYPARENT(o)              \
+     (G_TYPE_CHECK_INSTANCE_CAST ((o), GNC_TYPE_MYPARENT, myparent))
+#define GNC_MYPARENT_CLASS(k)        \
+     (G_TYPE_CHECK_CLASS_CAST((k), GNC_TYPE_MYPARENT, myparentClass))
+#define GNC_IS_MYPARENT(o)           \
+     (G_TYPE_CHECK_INSTANCE_TYPE ((o), GNC_TYPE_MYPARENT))
+#define GNC_IS_MYPARENT_CLASS(k)     \
+     (G_TYPE_CHECK_CLASS_TYPE ((k), GNC_TYPE_MYPARENT))
+#define GNC_MYPARENT_GET_CLASS(o)    \
+     (G_TYPE_INSTANCE_GET_CLASS ((o), GNC_TYPE_MYPARENT, myparentClass))
+GType gnc_myparent_get_type(void);
+
+/* --- type macros --- */
+#define GNC_TYPE_MYGRAND            (gnc_mygrand_get_type ())
+#define GNC_MYGRAND(o)              \
+     (G_TYPE_CHECK_INSTANCE_CAST ((o), GNC_TYPE_MYGRAND, mygrand))
+#define GNC_MYGRAND_CLASS(k)        \
+     (G_TYPE_CHECK_CLASS_CAST((k), GNC_TYPE_MYGRAND, mygrandClass))
+#define GNC_IS_MYGRAND(o)           \
+     (G_TYPE_CHECK_INSTANCE_TYPE ((o), GNC_TYPE_MYGRAND))
+#define GNC_IS_MYGRAND_CLASS(k)     \
+     (G_TYPE_CHECK_CLASS_TYPE ((k), GNC_TYPE_MYGRAND))
+#define GNC_MYGRAND_GET_CLASS(o)    \
+     (G_TYPE_INSTANCE_GET_CLASS ((o), GNC_TYPE_MYGRAND, mygrandClass))
+GType gnc_mygrand_get_type(void);
+
+/* GObject Initialization */
+QOF_GOBJECT_IMPL(gnc_mychild, mychild, QOF_TYPE_INSTANCE);
+
+static void
+gnc_mychild_init(mychild* obj)
+{
+}
+
+static void
+gnc_mychild_dispose_real (GObject *objp)
+{
+}
+
+static void
+gnc_mychild_finalize_real(GObject* objp)
+{
+}
+
+/* GObject Initialization */
+QOF_GOBJECT_IMPL(gnc_myparent, myparent, QOF_TYPE_INSTANCE);
+
+static void
+gnc_myparent_init(myparent* obj)
+{
+}
+
+static void
+gnc_myparent_dispose_real (GObject *objp)
+{
+}
+
+static void
+gnc_myparent_finalize_real(GObject* objp)
+{
+}
+
+/* GObject Initialization */
+QOF_GOBJECT_IMPL(gnc_mygrand, mygrand, QOF_TYPE_INSTANCE);
+
+static void
+gnc_mygrand_init(mygrand* obj)
+{
+}
+
+static void
+gnc_mygrand_dispose_real (GObject *objp)
+{
+}
+
+static void
+gnc_mygrand_finalize_real(GObject* objp)
+{
+}
+
 mygrand*
 grand_create(QofBook *book)
 {
 	mygrand *g;
 
 	g_return_val_if_fail(book, NULL);
-	g = g_new0(mygrand, 1);
-	qof_instance_init (&g->inst, GRAND_MODULE_NAME, book);
+	g = g_object_new(GNC_TYPE_MYGRAND, NULL);
+	qof_instance_init_data (&g->inst, GRAND_MODULE_NAME, book);
 	g->date = *get_random_timespec();
 	g->discount = get_random_double();;
 	g->active = get_random_boolean();
@@ -182,7 +293,7 @@
 	g->Amount = get_random_gnc_numeric();
 	g->child = NULL;
 	g->descend = NULL;
-	qof_event_gen(&g->inst.entity, QOF_EVENT_CREATE, NULL);
+	qof_event_gen(&g->inst, QOF_EVENT_CREATE, NULL);
 	return g;
 }
 
@@ -192,8 +303,8 @@
 	myparent *g;
 
 	g_return_val_if_fail(book, NULL);
-	g = g_new0(myparent, 1);
-	qof_instance_init (&g->inst, PARENT_MODULE_NAME, book);
+	g = g_object_new(GNC_TYPE_MYPARENT, NULL);
+	qof_instance_init_data (&g->inst, PARENT_MODULE_NAME, book);
 	g->date = *get_random_timespec();
 	g->discount = get_random_double();
 	g->active = get_random_boolean();
@@ -203,7 +314,7 @@
 	g->Name = get_random_string();
 	g->Amount = get_random_gnc_numeric();
 	g->child = NULL;
-	qof_event_gen(&g->inst.entity, QOF_EVENT_CREATE, NULL);
+	qof_event_gen(&g->inst, QOF_EVENT_CREATE, NULL);
 	return g;
 }
 
@@ -213,8 +324,8 @@
 	mychild *g;
 
 	g_return_val_if_fail(book, NULL);
-	g = g_new0(mychild, 1);
-	qof_instance_init (&g->inst, CHILD_MODULE_NAME, book);
+	g = g_object_new(GNC_TYPE_MYCHILD, NULL);
+	qof_instance_init_data (&g->inst, CHILD_MODULE_NAME, book);
 	g->date = *get_random_timespec();
 	g->discount = get_random_double();
 	g->active = get_random_boolean();
@@ -223,12 +334,12 @@
 	g->flag = get_random_character();
 	g->Name = get_random_string();
 	g->Amount = get_random_gnc_numeric();
-	qof_event_gen(&g->inst.entity, QOF_EVENT_CREATE, NULL);
+	qof_event_gen(&g->inst, QOF_EVENT_CREATE, NULL);
 	return g;
 }
 
 static void
-descend_cb (QofEntity *ent, gpointer user_data)
+descend_cb (QofInstance *ent, gpointer user_data)
 {
 	mygrand *g = (mygrand*)user_data;
 
@@ -251,14 +362,14 @@
 grand_getDescend(mygrand *g)
 {
 	QofCollection *col;
-	QofEntity *ent;
+	QofInstance *ent;
 	GList *list;
 
 	g_return_val_if_fail(g, NULL);
 	col = qof_collection_new(CHILD_MODULE_NAME);
 	for(list = g_list_copy(g->descend);list;list=list->next)
 	{
-		ent = (QofEntity*)list->data;
+		ent = QOF_INSTANCE(list->data);
 		if(!ent) { break; }
 		do_test(0 == safe_strcmp(ent->e_type, CHILD_MODULE_NAME), "wrong entity");
 		qof_collection_add_entity(col, ent);
@@ -869,9 +980,9 @@
 			do_test((coll != NULL), "grandparent not valid");
 			if(coll)
 			{
-				QofEntity *ent;
+				QofInstance *ent;
 
-				ent = (QofEntity*)child1;
+				ent = QOF_INSTANCE(child1);
 				qof_collection_add_entity(coll, ent);
 				grand_setDescend(grand1, coll);
 				qof_collection_destroy(coll);
@@ -891,9 +1002,9 @@
 };
 
 static void
-check_cb (QofEntity *ent, gpointer data)
+check_cb (QofInstance *ent, gpointer data)
 {
-	QofEntity *parent, *child;
+	QofInstance *parent, *child;
 	QofCollection *coll;
 	struct tally *c;
 	const QofParam *param;
@@ -913,7 +1024,7 @@
 	c->collect = qof_collection_count(coll);
 	if(c->book) { qof_book_set_references(c->book); }
 	param = qof_class_get_parameter(GRAND_MODULE_NAME, OBJ_RELATIVE);
-	parent = (QofEntity*)param->param_getfcn(ent, param);
+	parent = QOF_INSTANCE(param->param_getfcn(ent, param));
 	testp = grand_getChild((mygrand*)ent);
 	/* not all grandparents have family so just keep count. */
 	if(!parent) { c->nulls++; return; }
@@ -945,7 +1056,7 @@
 	copy = qof_session_new();
 	if(debug) { qof_session_begin(copy, QOF_STDOUT, TRUE, FALSE); }
 	/* TODO: implement QOF_TYPE_CHOICE testing. */
-	qof_entity_copy_coll_r(copy, grand_coll);
+	qof_instance_copy_coll_r(copy, grand_coll);
 	/* test the original */
 	qof_object_foreach(GRAND_MODULE_NAME, book, check_cb, &c);
 	book = qof_session_get_book(copy);

Modified: gnucash/branches/gda-dev/src/engine/test-core/test-engine-stuff.c
===================================================================
--- gnucash/branches/gda-dev/src/engine/test-core/test-engine-stuff.c	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/src/engine/test-core/test-engine-stuff.c	2007-04-14 00:35:53 UTC (rev 15878)
@@ -662,7 +662,7 @@
   g_free (string);
 
   string = get_random_string ();
-  gnc_price_set_type (p, string);
+  gnc_price_set_typestr (p, string);
   g_free (string);
 
   gnc_price_set_value (p, get_random_gnc_numeric ());

Modified: gnucash/branches/gda-dev/src/engine/xlate.pl
===================================================================
--- gnucash/branches/gda-dev/src/engine/xlate.pl	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/src/engine/xlate.pl	2007-04-14 00:35:53 UTC (rev 15878)
@@ -192,18 +192,18 @@
 
 		s/GNCIdTypeConst/QofIdTypeConst/g;
 		s/GNCIdType/QofIdType/g;
-		s/GNCEntityTable/QofEntityTable/g;
+		s/GNCEntityTable/QofInstanceTable/g;
 		s/xaccGUIDTypeEntityTable/qof_guid_type/g;
 
-		s/xaccEntityTableNew/qof_entity_new/g;
-		s/xaccEntityTableDestroy/qof_entity_destroy/g;
-		s/xaccGUIDNewEntityTable/qof_entity_guid_new/g;
-		s/xaccLookupEntity/qof_entity_lookup/g;
-		s/xaccStoreEntity/qof_entity_store/g;
-		s/xaccRemoveEntity/qof_entity_remove/g;
-		s/xaccForeachEntity/qof_entity_foreach/g;
+		s/xaccEntityTableNew/qof_instance_new/g;
+		s/xaccEntityTableDestroy/qof_instance_destroy/g;
+		s/xaccGUIDNewEntityTable/qof_instance_guid_new/g;
+		s/xaccLookupEntity/qof_instance_lookup/g;
+		s/xaccStoreEntity/qof_instance_store/g;
+		s/xaccRemoveEntity/qof_instance_remove/g;
+		s/xaccForeachEntity/qof_instance_foreach/g;
 
-		s/foreachObjectCB/QofEntityForeachCB/g;
+		s/foreachObjectCB/QofInstanceForeachCB/g;
 		s/GNC_OBJECT_VERSION/QOF_OBJECT_VERSION/g;
 
 		s/GNCSession/QofSession/g;

Modified: gnucash/branches/gda-dev/src/gnome/dialog-chart-export.c
===================================================================
--- gnucash/branches/gda-dev/src/gnome/dialog-chart-export.c	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/src/gnome/dialog-chart-export.c	2007-04-14 00:35:53 UTC (rev 15878)
@@ -58,7 +58,7 @@
 }chart_data;
 
 static void
-chart_collection_cb(QofEntity *ent, gpointer user_data)
+chart_collection_cb(QofInstance *ent, gpointer user_data)
 {
 	chart_data *data;
 	Account *acc;
@@ -73,9 +73,9 @@
 	if(0 == safe_strcmp(EQUITY_ACCOUNT_NAME, xaccAccountGetName(acc)) 
 		&& (xaccAccountGetType(acc) == ACCT_TYPE_EQUITY))
 	{
-		success = qof_entity_copy_to_session(data->chart_session, ent);
+		success = qof_instance_copy_to_session(data->chart_session, ent);
 		if(!success) { return; }
-		guid = qof_entity_get_guid(ent);
+		guid = qof_instance_get_guid(ent);
 		book = qof_session_get_book(data->chart_session);
 		copy_coll = qof_book_get_collection(book, GNC_ID_ACCOUNT);
 		data->equity_account = (Account*)qof_collection_lookup_entity(copy_coll, guid);
@@ -84,9 +84,9 @@
 }
 
 static void
-chart_reference_cb(QofEntity *ent, gpointer user_data)
+chart_reference_cb(QofInstance *ent, gpointer user_data)
 {
-	QofEntityReference *reference;
+	QofInstanceReference *reference;
 	QofParam     *ref_param;
 	chart_data   *data;
 
@@ -94,14 +94,14 @@
 	data = (chart_data*)user_data;
 	while(data->param_ref_list != NULL) {
 		ref_param = data->param_ref_list->data;
-		reference = qof_entity_get_reference_from(ent, ref_param);
+		reference = qof_instance_get_reference_from(ent, ref_param);
 		qof_session_update_reference_list(data->chart_session, reference);
 		data->param_ref_list = data->param_ref_list->next;
 	}
 }
 
 static void
-chart_entity_cb(QofEntity *ent, gpointer user_data)
+chart_entity_cb(QofInstance *ent, gpointer user_data)
 {
 	chart_data *data;
 	Account *acc_ent, *equity_account;
@@ -113,19 +113,19 @@
 	const GUID *guid;
 	time_t trans_time;
 	GList *ref;
-	QofEntityReference *ent_ref;
+	QofInstanceReference *ent_ref;
 	
 	g_return_if_fail(user_data != NULL);
 	data = (chart_data*)user_data;
 	trans_time = data->chart_time_t;
 	data->param_ref_list = NULL;
-	guid = qof_entity_get_guid(ent);
+	guid = qof_instance_get_guid(ent);
 	acc_ent = (Account*)ent;
 	ref = NULL;
 	equity_account = data->equity_account;
 	g_return_if_fail(equity_account != NULL);
 	balance = xaccAccountGetBalanceAsOfDate(acc_ent, data->chart_time_t);
-	qof_entity_copy_to_session(data->chart_session, ent);
+	qof_instance_copy_to_session(data->chart_session, ent);
 	book = qof_session_get_book(data->chart_session);
 	coll = qof_book_get_collection(book, GNC_ID_ACCOUNT);
 	acc_ent = (Account*)qof_collection_lookup_entity(coll, guid);
@@ -151,7 +151,7 @@
 	xaccSplitSetValue (split, balance);
 	ref = qof_class_get_referenceList(GNC_ID_SPLIT);
 	while(ref != NULL) {
-		ent_ref = qof_entity_get_reference_from((QofEntity*)split, ref->data);
+		ent_ref = qof_instance_get_reference_from(QOF_INSTANCE(split), ref->data);
 		qof_session_update_reference_list(data->chart_session, ent_ref);
 		ref = g_list_next(ref);
 	}
@@ -168,14 +168,14 @@
 	xaccAccountCommitEdit (acc_ent);
 	ref = qof_class_get_referenceList(GNC_ID_TRANS);
 	while(ref != NULL) {
-		ent_ref = qof_entity_get_reference_from((QofEntity*)trans, ref->data);
+		ent_ref = qof_instance_get_reference_from(QOF_INSTANCE(trans), ref->data);
 		qof_session_update_reference_list(data->chart_session, ent_ref);
 		ref = g_list_next(ref);
 	}
 	g_list_free(ref);
 	ref = qof_class_get_referenceList(GNC_ID_SPLIT);
 	while(ref != NULL) {
-		ent_ref = qof_entity_get_reference_from((QofEntity*)split, ref->data);
+		ent_ref = qof_instance_get_reference_from(QOF_INSTANCE(split), ref->data);
 		qof_session_update_reference_list(data->chart_session, ent_ref);
 		ref = g_list_next(ref);
 	}

Modified: gnucash/branches/gda-dev/src/gnome/dialog-chart-export.h
===================================================================
--- gnucash/branches/gda-dev/src/gnome/dialog-chart-export.h	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/src/gnome/dialog-chart-export.h	2007-04-14 00:35:53 UTC (rev 15878)
@@ -31,8 +31,8 @@
 */
 /** @addtogroup ChartExport Export a chart of accounts.
 
-Remember to use qof_entity_copy routines
-like ::qof_entity_copy_to_session so that the QofBook is marked
+Remember to use qof_instance_copy routines
+like ::qof_instance_copy_to_session so that the QofBook is marked
 as \a partial. 
 
 \par guidelines Guidelines for partial book export

Modified: gnucash/branches/gda-dev/src/gnome/dialog-price-editor.c
===================================================================
--- gnucash/branches/gda-dev/src/gnome/dialog-price-editor.c	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/src/gnome/dialog-price-editor.c	2007-04-14 00:35:53 UTC (rev 15878)
@@ -127,7 +127,7 @@
     currency = gnc_price_get_currency (pedit_dialog->price);
     date = gnc_price_get_time (pedit_dialog->price);
     source = gnc_price_get_source (pedit_dialog->price);
-    type = gnc_price_get_type (pedit_dialog->price);
+    type = gnc_price_get_typestr (pedit_dialog->price);
     value = gnc_price_get_value (pedit_dialog->price);
   }
   else
@@ -196,7 +196,7 @@
   gnc_price_set_commodity (pedit_dialog->price, commodity);
   gnc_price_set_currency (pedit_dialog->price, currency);
   gnc_price_set_time (pedit_dialog->price, date);
-  gnc_price_set_type (pedit_dialog->price, type);
+  gnc_price_set_typestr (pedit_dialog->price, type);
   gnc_price_set_value (pedit_dialog->price, value);
   gnc_price_commit_edit (pedit_dialog->price);
 

Modified: gnucash/branches/gda-dev/src/gnome/dialog-print-check.c
===================================================================
--- gnucash/branches/gda-dev/src/gnome/dialog-print-check.c	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/src/gnome/dialog-print-check.c	2007-04-14 00:35:53 UTC (rev 15878)
@@ -1423,7 +1423,7 @@
 
     pkgdatadir = gnc_path_get_pkgdatadir();
     tmp_name = g_build_filename(pkgdatadir, CHECK_FMT_DIR, filename, (char *)NULL);
-    if (!g_file_exists(tmp_name)) {
+    if (!g_file_test(tmp_name, G_FILE_TEST_EXISTS)) {
         g_free(tmp_name);
 	dirname = gnc_build_dotgnucash_path(CHECK_FMT_DIR);
 	tmp_name = g_build_filename(dirname, filename, (char *)NULL);

Modified: gnucash/branches/gda-dev/src/gnome/dialog-sx-editor.c
===================================================================
--- gnucash/branches/gda-dev/src/gnome/dialog-sx-editor.c	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/src/gnome/dialog-sx-editor.c	2007-04-14 00:35:53 UTC (rev 15878)
@@ -251,7 +251,7 @@
     gnc_sxed_save_sx( sxed );
 
     /* add to list */
-    // @@fixme -- forget 'new'-flag: check for existance.
+    // @@fixme -- forget 'new'-flag: check for existance of the SX [?]
     if ( sxed->newsxP ) {
         book = gnc_get_current_book ();
         sxes = gnc_book_get_schedxactions(book);
@@ -1236,6 +1236,9 @@
     /* Do not call show_all here. Screws up the gtkuimanager code */
     gtk_widget_show(sxed->dialog);
 
+    gtk_notebook_set_page(
+        GTK_NOTEBOOK(glade_xml_get_widget(sxed->gxml, "editor_notebook")), 0);
+
     /* Refresh the cal and the ledger */
     gtk_widget_queue_resize( GTK_WIDGET( sxed->example_cal ) );
     gnc_ledger_display_refresh( sxed->ledger );
@@ -1659,7 +1662,7 @@
 }
 
 static void
-_sx_engine_event_handler(QofEntity *ent, QofEventId event_type, gpointer user_data, gpointer evt_data)
+_sx_engine_event_handler(QofInstance *ent, QofEventId event_type, gpointer user_data, gpointer evt_data)
 {
     Account *acct;
     QofBook *book;

Modified: gnucash/branches/gda-dev/src/gnome/dialog-sx-from-trans.c
===================================================================
--- gnucash/branches/gda-dev/src/gnome/dialog-sx-from-trans.c	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/src/gnome/dialog-sx-from-trans.c	2007-04-14 00:35:53 UTC (rev 15878)
@@ -363,9 +363,12 @@
     w = GTK_WIDGET(glade_xml_get_widget( sxfti->gxml, SXFTD_EX_CAL_FRAME ));
     sxfti->dense_cal_model = gnc_dense_cal_store_new(num_marks);
     sxfti->example_cal = GNC_DENSE_CAL(gnc_dense_cal_new_with_model(GNC_DENSE_CAL_MODEL(sxfti->dense_cal_model)));
-    // gobject-2.10: g_object_ref_sink(sxfti->example_cal);
+#ifdef HAVE_GTK_2_10
+    g_object_ref_sink(sxfti->example_cal);
+#else
     g_object_ref(G_OBJECT(sxfti->example_cal));
     gtk_object_sink(GTK_OBJECT(sxfti->example_cal));
+#endif
 
     g_assert(sxfti->example_cal);
     gnc_dense_cal_set_num_months( sxfti->example_cal, SXFTD_EXCAL_NUM_MONTHS );

Modified: gnucash/branches/gda-dev/src/gnome/dialog-sx-since-last-run.c
===================================================================
--- gnucash/branches/gda-dev/src/gnome/dialog-sx-since-last-run.c	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/src/gnome/dialog-sx-since-last-run.c	2007-04-14 00:35:53 UTC (rev 15878)
@@ -92,8 +92,6 @@
 /** @return false if the iter is not actaully an GncSxInstance's variable. **/
 gboolean gnc_sx_slr_model_get_instance_and_variable(GncSxSlrTreeModelAdapter *model, GtkTreeIter *iter, GncSxInstance **instance_loc, GncSxVariable **var_loc);
 
-void gnc_sx_slr_model_change_instance_state(GncSxSlrTreeModelAdapter *model, GncSxInstance *instance, GncSxInstanceState new_state);
-void gnc_sx_slr_model_change_variable(GncSxSlrTreeModelAdapter *model, GncSxInstance *instance, GncSxVariable *variable, gnc_numeric *new_value);
 void gnc_sx_slr_model_effect_change(GncSxSlrTreeModelAdapter *model, gboolean auto_create_only, GList **created_transaction_guids, GList **creation_errors);
 
 GtkTreeModel* gnc_sx_get_slr_state_model(void);
@@ -471,7 +469,7 @@
             char instance_date_buf[MAX_DATE_LENGTH+1];
             int instance_index = -1;
 
-            for (inst_iter = instances->list; inst_iter != NULL; inst_iter = inst_iter->next)
+            for (inst_iter = instances->instance_list; inst_iter != NULL; inst_iter = inst_iter->next)
             {
                 GncSxInstance *inst = (GncSxInstance*)inst_iter->data;
                 qof_print_gdate(instance_date_buf, MAX_DATE_LENGTH, &inst->date);
@@ -596,12 +594,12 @@
     gtk_tree_path_free(path);
 
     instances = (GncSxInstances*)g_list_nth_data(model->instances->sx_instance_list, instances_index);
-    if (instance_index < 0 || instance_index >= g_list_length(instances->list))
+    if (instance_index < 0 || instance_index >= g_list_length(instances->instance_list))
     {
         return NULL;
     }
 
-    return (GncSxInstance*)g_list_nth_data(instances->list, instance_index);
+    return (GncSxInstance*)g_list_nth_data(instances->instance_list, instance_index);
 }
 
 gboolean
@@ -661,13 +659,6 @@
     return TRUE;
 }
 
-void
-gnc_sx_slr_model_change_instance_state(GncSxSlrTreeModelAdapter *model, GncSxInstance *instance, GncSxInstanceState new_state)
-{
-    // @fixme: pop this out a level.
-    gnc_sx_instance_model_change_instance_state(model->instances, instance, new_state);
-}
-
 /**
  * Special-case list indexing that only refers to "editable" variables. :(
  **/
@@ -697,7 +688,7 @@
     indices[0] = g_list_index(model->instances->sx_instance_list, instance->parent);
     if (indices[0] == -1)
         return NULL;
-    indices[1] = g_list_index(instance->parent->list, instance);
+    indices[1] = g_list_index(instance->parent->instance_list, instance);
     if (indices[1] == -1)
         return NULL;
     variables = gnc_sx_instance_get_variables(instance);
@@ -709,12 +700,6 @@
     return path;
 }
 
-void
-gnc_sx_slr_model_change_variable(GncSxSlrTreeModelAdapter *model, GncSxInstance *instance, GncSxVariable *variable, gnc_numeric *new_value)
-{
-    gnc_sx_instance_model_set_variable(model->instances, instance, variable, new_value);
-}
-
 static void
 gsslrtma_added_cb(GncSxInstanceModel *instances, SchedXaction *added_sx, gpointer user_data)
 {
@@ -867,7 +852,7 @@
         return;
     }
 
-    gnc_sx_slr_model_change_instance_state(dialog->editing_model, inst, new_state);
+    gnc_sx_instance_model_change_instance_state(dialog->editing_model->instances, inst, new_state);
 }
 
 static void
@@ -903,8 +888,7 @@
         if (strlen(g_strstrip(value_copy)) == 0)
         {
             gnc_numeric invalid_num = gnc_numeric_error(GNC_ERROR_ARG);
-            // @fixme? Change to gnc_sx_slr_model_clear_variable(...)?
-            gnc_sx_slr_model_change_variable(dialog->editing_model, inst, var, &invalid_num);
+            gnc_sx_instance_model_set_variable(dialog->editing_model->instances, inst, var, &invalid_num);
         }
         else
         {
@@ -913,7 +897,7 @@
         g_free(value_copy);
         return;
     }
-    gnc_sx_slr_model_change_variable(dialog->editing_model, inst, var, &parsed_num);
+    gnc_sx_instance_model_set_variable(dialog->editing_model->instances, inst, var, &parsed_num);
 }
 
 GncSxSinceLastRunDialog*
@@ -1024,12 +1008,6 @@
     xaccFreeQuery(guid_query);
 }
 
-static GList*
-gnc_sx_slr_model_check_variables(GncSxSlrTreeModelAdapter *editing_model)
-{
-    return gnc_sx_instance_model_check_variables(editing_model->instances);
-}
-
 static void
 dialog_response_cb(GtkDialog *dialog, gint response_id, GncSxSinceLastRunDialog *app_dialog)
 {
@@ -1037,12 +1015,12 @@
     {
     case GTK_RESPONSE_OK:
         // @@fixme validate current state(GError *errs);
-        // - instance state constraints
-        // - required variable binding
-        // - ability to create transactions
+        // - [ ] instance state constraints
+        // - [x] required variable binding
+        // - [?] ability to create transactions
     {
         GList *unbound_variables;
-        unbound_variables = gnc_sx_slr_model_check_variables(app_dialog->editing_model);
+        unbound_variables = gnc_sx_instance_model_check_variables(app_dialog->editing_model->instances);
         g_message("%d variables unbound", g_list_length(unbound_variables));
         if (g_list_length(unbound_variables) > 0)
         {

Modified: gnucash/branches/gda-dev/src/gnome/druid-hierarchy.c
===================================================================
--- gnucash/branches/gda-dev/src/gnome/druid-hierarchy.c	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/src/gnome/druid-hierarchy.c	2007-04-14 00:35:53 UTC (rev 15878)
@@ -744,8 +744,8 @@
 
 	account = gnc_tree_view_account_get_selected_account(data->final_account_tree);
 	if (account == NULL) {
-	  printf("Account is null\n");
-	  return;
+      g_critical("account is null");
+      return;
 	}
 
 	error_loc = NULL;
@@ -753,8 +753,17 @@
 	  amount = gnc_numeric_zero();
 	  g_object_set (G_OBJECT(cell), "text", "", NULL);
 	}
+    /* Bug#348364: Emulating price-cell, we need to ensure the denominator of
+     * the amount is in the SCU of the account's commodity (so
+     * gnc-ui-util.c:is_decimal_fraction() on the remainder denom for
+     * fractional values will be a "decimal").
+     */
+    {
+        int account_cmdty_fraction = xaccAccountGetCommoditySCU(account);
+        amount = gnc_numeric_convert(amount, account_cmdty_fraction, GNC_RND_ROUND);
+    }
 	set_final_balance (data->balance_hash, account, amount);
-	qof_event_gen ((QofEntity*)account, QOF_EVENT_MODIFY, NULL);
+	qof_event_gen (QOF_INSTANCE(account), QOF_EVENT_MODIFY, NULL);
 }
 
 static void

Modified: gnucash/branches/gda-dev/src/gnome/druid-loan.c
===================================================================
--- gnucash/branches/gda-dev/src/gnome/druid-loan.c	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/src/gnome/druid-loan.c	2007-04-14 00:35:53 UTC (rev 15878)
@@ -2631,7 +2631,7 @@
          * row-of-gnc_numeric[N] data, where N is the number of columns as
          * determined by the _prep function, and stored in
          * LoanData::revNumPmts. */
-        repayment_schedule = g_hash_table_new( g_date_hash, g_date_equals );
+        repayment_schedule = g_hash_table_new(gnc_gdate_hash, gnc_gdate_equal);
 
         /* Do the master repayment */
         {

Modified: gnucash/branches/gda-dev/src/gnome/druid-merge.c
===================================================================
--- gnucash/branches/gda-dev/src/gnome/druid-merge.c	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/src/gnome/druid-merge.c	2007-04-14 00:35:53 UTC (rev 15878)
@@ -188,7 +188,7 @@
 	gnc_resume_gui_refresh ();
 }
 
-void currency_transfer_cb ( QofEntity* ent, gpointer user_data)
+void currency_transfer_cb ( QofInstance* ent, gpointer user_data)
 {
 	if(!ent) return;
 	if(xaccAccountGetCommodity((Account*)ent) == NULL) {
@@ -197,7 +197,7 @@
 }
 
 /* If the account has no parent, shove it into the top level under the root. */
-void reference_parent_cb ( QofEntity* ent, gpointer user_data)
+void reference_parent_cb ( QofInstance* ent, gpointer user_data)
 {
 	Account *root;
 

Modified: gnucash/branches/gda-dev/src/gnome/druid-merge.h
===================================================================
--- gnucash/branches/gda-dev/src/gnome/druid-merge.h	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/src/gnome/druid-merge.h	2007-04-14 00:35:53 UTC (rev 15878)
@@ -79,10 +79,10 @@
 #define GNC_QSF_IMPORT "gnc-qsf-import-druid"
 
 /** \brief 	gncCommodity is not QOF enabled, need to set a default commodity before the merge */
-void currency_transfer_cb ( QofEntity* ent, gpointer user_data);
+void currency_transfer_cb ( QofInstance* ent, gpointer user_data);
 
 /** \brief workaround for AccountGroup not being fully QOF enabled. Eh? */
-void reference_parent_cb ( QofEntity* ent, gpointer user_data);
+void reference_parent_cb ( QofInstance* ent, gpointer user_data);
 
 /** @} */
 /** @} */

Modified: gnucash/branches/gda-dev/src/gnome/druid-stock-split.c
===================================================================
--- gnucash/branches/gda-dev/src/gnome/druid-stock-split.c	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/src/gnome/druid-stock-split.c	2007-04-14 00:35:53 UTC (rev 15878)
@@ -474,7 +474,7 @@
     gnc_price_set_currency (price, gnc_currency_edit_get_currency (ce));
     gnc_price_set_time (price, ts);
     gnc_price_set_source (price, "user:stock-split");
-    gnc_price_set_type (price, "unknown");
+    gnc_price_set_typestr (price, "unknown");
     gnc_price_set_value (price, amount);
     gnc_price_commit_edit (price);
 

Modified: gnucash/branches/gda-dev/src/gnome/glade/sched-xact.glade
===================================================================
--- gnucash/branches/gda-dev/src/gnome/glade/sched-xact.glade	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/src/gnome/glade/sched-xact.glade	2007-04-14 00:35:53 UTC (rev 15878)
@@ -16,6 +16,8 @@
   <property name="skip_pager_hint">False</property>
   <property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
   <property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
+  <property name="focus_on_map">True</property>
+  <property name="urgency_hint">False</property>
   <property name="has_separator">True</property>
 
   <child internal-child="vbox">
@@ -83,88 +85,96 @@
 	  <property name="spacing">0</property>
 
 	  <child>
-	    <widget class="GtkHBox" id="hbox95">
+	    <widget class="GtkHBox" id="hbox96">
 	      <property name="visible">True</property>
 	      <property name="homogeneous">False</property>
-	      <property name="spacing">12</property>
+	      <property name="spacing">0</property>
 
 	      <child>
-		<widget class="GtkVBox" id="vbox106">
+		<widget class="GtkLabel" id="label847707">
 		  <property name="visible">True</property>
-		  <property name="homogeneous">False</property>
-		  <property name="spacing">0</property>
+		  <property name="label" translatable="yes">&lt;b&gt;Name&lt;/b&gt;</property>
+		  <property name="use_underline">True</property>
+		  <property name="use_markup">True</property>
+		  <property name="justify">GTK_JUSTIFY_CENTER</property>
+		  <property name="wrap">False</property>
+		  <property name="selectable">False</property>
+		  <property name="xalign">1</property>
+		  <property name="yalign">0.5</property>
+		  <property name="xpad">5</property>
+		  <property name="ypad">0</property>
+		  <property name="mnemonic_widget">sxe_name</property>
+		  <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+		  <property name="width_chars">-1</property>
+		  <property name="single_line_mode">False</property>
+		  <property name="angle">0</property>
+		</widget>
+		<packing>
+		  <property name="padding">0</property>
+		  <property name="expand">False</property>
+		  <property name="fill">False</property>
+		</packing>
+	      </child>
 
-		  <child>
-		    <widget class="GtkHBox" id="hbox96">
-		      <property name="visible">True</property>
-		      <property name="homogeneous">False</property>
-		      <property name="spacing">0</property>
+	      <child>
+		<placeholder/>
+	      </child>
+	    </widget>
+	    <packing>
+	      <property name="padding">0</property>
+	      <property name="expand">False</property>
+	      <property name="fill">False</property>
+	    </packing>
+	  </child>
 
-		      <child>
-			<widget class="GtkLabel" id="label847707">
-			  <property name="visible">True</property>
-			  <property name="label" translatable="yes">&lt;b&gt;Name&lt;/b&gt;</property>
-			  <property name="use_underline">True</property>
-			  <property name="use_markup">True</property>
-			  <property name="justify">GTK_JUSTIFY_CENTER</property>
-			  <property name="wrap">False</property>
-			  <property name="selectable">False</property>
-			  <property name="xalign">1</property>
-			  <property name="yalign">0.5</property>
-			  <property name="xpad">5</property>
-			  <property name="ypad">0</property>
-			  <property name="mnemonic_widget">sxe_name</property>
-			</widget>
-			<packing>
-			  <property name="padding">0</property>
-			  <property name="expand">False</property>
-			  <property name="fill">False</property>
-			</packing>
-		      </child>
+	  <child>
+	    <widget class="GtkAlignment" id="alignment31">
+	      <property name="visible">True</property>
+	      <property name="xalign">0.5</property>
+	      <property name="yalign">0.5</property>
+	      <property name="xscale">1</property>
+	      <property name="yscale">1</property>
+	      <property name="top_padding">0</property>
+	      <property name="bottom_padding">0</property>
+	      <property name="left_padding">12</property>
+	      <property name="right_padding">0</property>
 
-		      <child>
-			<placeholder/>
-		      </child>
-		    </widget>
-		    <packing>
-		      <property name="padding">2</property>
-		      <property name="expand">False</property>
-		      <property name="fill">False</property>
-		    </packing>
-		  </child>
+	      <child>
+		<widget class="GtkEntry" id="sxe_name">
+		  <property name="visible">True</property>
+		  <property name="can_focus">True</property>
+		  <property name="editable">True</property>
+		  <property name="visibility">True</property>
+		  <property name="max_length">0</property>
+		  <property name="text" translatable="yes"></property>
+		  <property name="has_frame">True</property>
+		  <property name="invisible_char">*</property>
+		  <property name="activates_default">False</property>
+		</widget>
+	      </child>
+	    </widget>
+	    <packing>
+	      <property name="padding">0</property>
+	      <property name="expand">False</property>
+	      <property name="fill">True</property>
+	    </packing>
+	  </child>
 
-		  <child>
-		    <widget class="GtkAlignment" id="alignment31">
-		      <property name="visible">True</property>
-		      <property name="xalign">0.5</property>
-		      <property name="yalign">0.5</property>
-		      <property name="xscale">1</property>
-		      <property name="yscale">1</property>
-		      <property name="top_padding">0</property>
-		      <property name="bottom_padding">0</property>
-		      <property name="left_padding">12</property>
-		      <property name="right_padding">0</property>
+	  <child>
+	    <widget class="GtkNotebook" id="editor_notebook">
+	      <property name="visible">True</property>
+	      <property name="can_focus">True</property>
+	      <property name="show_tabs">True</property>
+	      <property name="show_border">True</property>
+	      <property name="tab_pos">GTK_POS_TOP</property>
+	      <property name="scrollable">False</property>
+	      <property name="enable_popup">False</property>
 
-		      <child>
-			<widget class="GtkEntry" id="sxe_name">
-			  <property name="visible">True</property>
-			  <property name="can_focus">True</property>
-			  <property name="editable">True</property>
-			  <property name="visibility">True</property>
-			  <property name="max_length">0</property>
-			  <property name="text" translatable="yes"></property>
-			  <property name="has_frame">True</property>
-			  <property name="invisible_char">*</property>
-			  <property name="activates_default">False</property>
-			</widget>
-		      </child>
-		    </widget>
-		    <packing>
-		      <property name="padding">0</property>
-		      <property name="expand">False</property>
-		      <property name="fill">True</property>
-		    </packing>
-		  </child>
+	      <child>
+		<widget class="GtkVBox" id="vbox106">
+		  <property name="visible">True</property>
+		  <property name="homogeneous">False</property>
+		  <property name="spacing">0</property>
 
 		  <child>
 		    <widget class="GtkLabel" id="label847991">
@@ -179,6 +189,10 @@
 		      <property name="yalign">0.5</property>
 		      <property name="xpad">0</property>
 		      <property name="ypad">0</property>
+		      <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+		      <property name="width_chars">-1</property>
+		      <property name="single_line_mode">False</property>
+		      <property name="angle">0</property>
 		    </widget>
 		    <packing>
 		      <property name="padding">0</property>
@@ -200,9 +214,13 @@
 		      <property name="yalign">0.5</property>
 		      <property name="xpad">0</property>
 		      <property name="ypad">0</property>
+		      <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+		      <property name="width_chars">-1</property>
+		      <property name="single_line_mode">False</property>
+		      <property name="angle">0</property>
 		    </widget>
 		    <packing>
-		      <property name="padding">0</property>
+		      <property name="padding">4</property>
 		      <property name="expand">False</property>
 		      <property name="fill">False</property>
 		    </packing>
@@ -311,6 +329,10 @@
 				  <property name="yalign">0.5</property>
 				  <property name="xpad">0</property>
 				  <property name="ypad">0</property>
+				  <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+				  <property name="width_chars">-1</property>
+				  <property name="single_line_mode">False</property>
+				  <property name="angle">0</property>
 				</widget>
 				<packing>
 				  <property name="padding">0</property>
@@ -390,6 +412,10 @@
 				  <property name="yalign">0.5</property>
 				  <property name="xpad">0</property>
 				  <property name="ypad">0</property>
+				  <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+				  <property name="width_chars">-1</property>
+				  <property name="single_line_mode">False</property>
+				  <property name="angle">0</property>
 				</widget>
 				<packing>
 				  <property name="padding">0</property>
@@ -490,6 +516,10 @@
 		      <property name="yalign">0.5</property>
 		      <property name="xpad">0</property>
 		      <property name="ypad">0</property>
+		      <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+		      <property name="width_chars">-1</property>
+		      <property name="single_line_mode">False</property>
+		      <property name="angle">0</property>
 		    </widget>
 		    <packing>
 		      <property name="padding">0</property>
@@ -511,9 +541,13 @@
 		      <property name="yalign">0.5</property>
 		      <property name="xpad">0</property>
 		      <property name="ypad">0</property>
+		      <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+		      <property name="width_chars">-1</property>
+		      <property name="single_line_mode">False</property>
+		      <property name="angle">0</property>
 		    </widget>
 		    <packing>
-		      <property name="padding">0</property>
+		      <property name="padding">4</property>
 		      <property name="expand">False</property>
 		      <property name="fill">False</property>
 		    </packing>
@@ -556,6 +590,10 @@
 				  <property name="yalign">0.5</property>
 				  <property name="xpad">0</property>
 				  <property name="ypad">0</property>
+				  <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+				  <property name="width_chars">-1</property>
+				  <property name="single_line_mode">False</property>
+				  <property name="angle">0</property>
 				</widget>
 				<packing>
 				  <property name="padding">0</property>
@@ -577,6 +615,10 @@
 				  <property name="yalign">0.5</property>
 				  <property name="xpad">0</property>
 				  <property name="ypad">0</property>
+				  <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+				  <property name="width_chars">-1</property>
+				  <property name="single_line_mode">False</property>
+				  <property name="angle">0</property>
 				</widget>
 				<packing>
 				  <property name="padding">0</property>
@@ -605,6 +647,10 @@
 			      <property name="yalign">0.5</property>
 			      <property name="xpad">0</property>
 			      <property name="ypad">0</property>
+			      <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+			      <property name="width_chars">-1</property>
+			      <property name="single_line_mode">False</property>
+			      <property name="angle">0</property>
 			    </widget>
 			    <packing>
 			      <property name="padding">0</property>
@@ -715,6 +761,10 @@
 				      <property name="yalign">0.5</property>
 				      <property name="xpad">3</property>
 				      <property name="ypad">0</property>
+				      <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+				      <property name="width_chars">-1</property>
+				      <property name="single_line_mode">False</property>
+				      <property name="angle">0</property>
 				    </widget>
 				    <packing>
 				      <property name="left_attach">2</property>
@@ -739,6 +789,10 @@
 				      <property name="yalign">0.5</property>
 				      <property name="xpad">3</property>
 				      <property name="ypad">0</property>
+				      <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+				      <property name="width_chars">-1</property>
+				      <property name="single_line_mode">False</property>
+				      <property name="angle">0</property>
 				    </widget>
 				    <packing>
 				      <property name="left_attach">2</property>
@@ -787,6 +841,7 @@
 				      <property name="right_attach">2</property>
 				      <property name="top_attach">2</property>
 				      <property name="bottom_attach">3</property>
+				      <property name="x_options">fill</property>
 				      <property name="y_options"></property>
 				    </packing>
 				  </child>
@@ -808,6 +863,7 @@
 				      <property name="right_attach">2</property>
 				      <property name="top_attach">3</property>
 				      <property name="bottom_attach">4</property>
+				      <property name="x_options">fill</property>
 				      <property name="y_options"></property>
 				    </packing>
 				  </child>
@@ -829,98 +885,67 @@
 		      <property name="fill">True</property>
 		    </packing>
 		  </child>
+		</widget>
+		<packing>
+		  <property name="tab_expand">False</property>
+		  <property name="tab_fill">True</property>
+		</packing>
+	      </child>
 
-		  <child>
-		    <placeholder/>
-		  </child>
+	      <child>
+		<widget class="GtkLabel" id="label847995">
+		  <property name="visible">True</property>
+		  <property name="label" translatable="yes">Overview</property>
+		  <property name="use_underline">False</property>
+		  <property name="use_markup">False</property>
+		  <property name="justify">GTK_JUSTIFY_LEFT</property>
+		  <property name="wrap">False</property>
+		  <property name="selectable">False</property>
+		  <property name="xalign">0.5</property>
+		  <property name="yalign">0.5</property>
+		  <property name="xpad">0</property>
+		  <property name="ypad">0</property>
+		  <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+		  <property name="width_chars">-1</property>
+		  <property name="single_line_mode">False</property>
+		  <property name="angle">0</property>
 		</widget>
 		<packing>
-		  <property name="padding">0</property>
-		  <property name="expand">False</property>
-		  <property name="fill">False</property>
+		  <property name="type">tab</property>
 		</packing>
 	      </child>
 
 	      <child>
-		<widget class="GtkVBox" id="vbox180">
+		<widget class="GtkVBox" id="vbox184">
 		  <property name="visible">True</property>
 		  <property name="homogeneous">False</property>
 		  <property name="spacing">0</property>
 
 		  <child>
-		    <widget class="GtkLabel" id="label847967">
+		    <widget class="GtkHBox" id="gncfreq_hbox">
 		      <property name="visible">True</property>
-		      <property name="label" translatable="yes">&lt;b&gt;Recurrence Frequency&lt;/b&gt;</property>
-		      <property name="use_underline">True</property>
-		      <property name="use_markup">True</property>
-		      <property name="justify">GTK_JUSTIFY_LEFT</property>
-		      <property name="wrap">False</property>
-		      <property name="selectable">False</property>
-		      <property name="xalign">0</property>
-		      <property name="yalign">0.5</property>
-		      <property name="xpad">0</property>
-		      <property name="ypad">0</property>
-		    </widget>
-		    <packing>
-		      <property name="padding">0</property>
-		      <property name="expand">False</property>
-		      <property name="fill">False</property>
-		    </packing>
-		  </child>
+		      <property name="homogeneous">False</property>
+		      <property name="spacing">0</property>
 
-		  <child>
-		    <widget class="GtkAlignment" id="alignment32">
-		      <property name="visible">True</property>
-		      <property name="xalign">0.5</property>
-		      <property name="yalign">0.5</property>
-		      <property name="xscale">1</property>
-		      <property name="yscale">1</property>
-		      <property name="top_padding">0</property>
-		      <property name="bottom_padding">0</property>
-		      <property name="left_padding">12</property>
-		      <property name="right_padding">0</property>
-
 		      <child>
-			<widget class="GtkHBox" id="gncfreq_hbox">
-			  <property name="visible">True</property>
-			  <property name="homogeneous">False</property>
-			  <property name="spacing">0</property>
-
-			  <child>
-			    <placeholder/>
-			  </child>
-			</widget>
+			<placeholder/>
 		      </child>
 		    </widget>
 		    <packing>
 		      <property name="padding">0</property>
-		      <property name="expand">False</property>
+		      <property name="expand">True</property>
 		      <property name="fill">True</property>
 		    </packing>
 		  </child>
 
 		  <child>
-		    <widget class="GtkAlignment" id="alignment33">
+		    <widget class="GtkHBox" id="example_cal_hbox">
 		      <property name="visible">True</property>
-		      <property name="xalign">0.5</property>
-		      <property name="yalign">0.5</property>
-		      <property name="xscale">1</property>
-		      <property name="yscale">1</property>
-		      <property name="top_padding">0</property>
-		      <property name="bottom_padding">0</property>
-		      <property name="left_padding">12</property>
-		      <property name="right_padding">0</property>
+		      <property name="homogeneous">False</property>
+		      <property name="spacing">0</property>
 
 		      <child>
-			<widget class="GtkHBox" id="example_cal_hbox">
-			  <property name="visible">True</property>
-			  <property name="homogeneous">False</property>
-			  <property name="spacing">0</property>
-
-			  <child>
-			    <placeholder/>
-			  </child>
-			</widget>
+			<placeholder/>
 		      </child>
 		    </widget>
 		    <packing>
@@ -931,70 +956,72 @@
 		  </child>
 		</widget>
 		<packing>
-		  <property name="padding">2</property>
-		  <property name="expand">True</property>
-		  <property name="fill">True</property>
+		  <property name="tab_expand">False</property>
+		  <property name="tab_fill">True</property>
 		</packing>
 	      </child>
-	    </widget>
-	    <packing>
-	      <property name="padding">0</property>
-	      <property name="expand">False</property>
-	      <property name="fill">False</property>
-	    </packing>
-	  </child>
 
-	  <child>
-	    <widget class="GtkLabel" id="label847990">
-	      <property name="visible">True</property>
-	      <property name="label" translatable="yes"></property>
-	      <property name="use_underline">False</property>
-	      <property name="use_markup">False</property>
-	      <property name="justify">GTK_JUSTIFY_LEFT</property>
-	      <property name="wrap">False</property>
-	      <property name="selectable">False</property>
-	      <property name="xalign">0.5</property>
-	      <property name="yalign">0.5</property>
-	      <property name="xpad">0</property>
-	      <property name="ypad">0</property>
-	    </widget>
-	    <packing>
-	      <property name="padding">0</property>
-	      <property name="expand">False</property>
-	      <property name="fill">False</property>
-	    </packing>
-	  </child>
+	      <child>
+		<widget class="GtkLabel" id="label847996">
+		  <property name="visible">True</property>
+		  <property name="label" translatable="yes">Frequency</property>
+		  <property name="use_underline">False</property>
+		  <property name="use_markup">False</property>
+		  <property name="justify">GTK_JUSTIFY_LEFT</property>
+		  <property name="wrap">False</property>
+		  <property name="selectable">False</property>
+		  <property name="xalign">0.5</property>
+		  <property name="yalign">0.5</property>
+		  <property name="xpad">0</property>
+		  <property name="ypad">0</property>
+		  <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+		  <property name="width_chars">-1</property>
+		  <property name="single_line_mode">False</property>
+		  <property name="angle">0</property>
+		</widget>
+		<packing>
+		  <property name="type">tab</property>
+		</packing>
+	      </child>
 
-	  <child>
-	    <widget class="GtkLabel" id="label847968">
-	      <property name="visible">True</property>
-	      <property name="label" translatable="yes">&lt;b&gt;Template Transaction&lt;/b&gt;</property>
-	      <property name="use_underline">True</property>
-	      <property name="use_markup">True</property>
-	      <property name="justify">GTK_JUSTIFY_LEFT</property>
-	      <property name="wrap">False</property>
-	      <property name="selectable">False</property>
-	      <property name="xalign">0</property>
-	      <property name="yalign">0.5</property>
-	      <property name="xpad">0</property>
-	      <property name="ypad">0</property>
-	    </widget>
-	    <packing>
-	      <property name="padding">0</property>
-	      <property name="expand">False</property>
-	      <property name="fill">False</property>
-	    </packing>
-	  </child>
+	      <child>
+		<widget class="GtkVBox" id="register_vbox">
+		  <property name="border_width">1</property>
+		  <property name="visible">True</property>
+		  <property name="homogeneous">False</property>
+		  <property name="spacing">0</property>
 
-	  <child>
-	    <widget class="GtkVBox" id="register_vbox">
-	      <property name="border_width">5</property>
-	      <property name="visible">True</property>
-	      <property name="homogeneous">False</property>
-	      <property name="spacing">0</property>
+		  <child>
+		    <placeholder/>
+		  </child>
+		</widget>
+		<packing>
+		  <property name="tab_expand">False</property>
+		  <property name="tab_fill">True</property>
+		</packing>
+	      </child>
 
 	      <child>
-		<placeholder/>
+		<widget class="GtkLabel" id="label847997">
+		  <property name="visible">True</property>
+		  <property name="label" translatable="yes">Template Transaction</property>
+		  <property name="use_underline">False</property>
+		  <property name="use_markup">False</property>
+		  <property name="justify">GTK_JUSTIFY_LEFT</property>
+		  <property name="wrap">False</property>
+		  <property name="selectable">False</property>
+		  <property name="xalign">0.5</property>
+		  <property name="yalign">0.5</property>
+		  <property name="xpad">0</property>
+		  <property name="ypad">0</property>
+		  <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+		  <property name="width_chars">-1</property>
+		  <property name="single_line_mode">False</property>
+		  <property name="angle">0</property>
+		</widget>
+		<packing>
+		  <property name="type">tab</property>
+		</packing>
 	      </child>
 	    </widget>
 	    <packing>
@@ -1026,6 +1053,8 @@
   <property name="skip_pager_hint">False</property>
   <property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property>
   <property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
+  <property name="focus_on_map">True</property>
+  <property name="urgency_hint">False</property>
 
   <child>
     <widget class="GtkEventBox" id="eventbox2">
@@ -1061,6 +1090,10 @@
 		  <property name="yalign">0.5</property>
 		  <property name="xpad">5</property>
 		  <property name="ypad">0</property>
+		  <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+		  <property name="width_chars">-1</property>
+		  <property name="single_line_mode">False</property>
+		  <property name="angle">0</property>
 		</widget>
 		<packing>
 		  <property name="left_attach">0</property>
@@ -1085,6 +1118,10 @@
 		  <property name="yalign">0.5</property>
 		  <property name="xpad">5</property>
 		  <property name="ypad">0</property>
+		  <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+		  <property name="width_chars">-1</property>
+		  <property name="single_line_mode">False</property>
+		  <property name="angle">0</property>
 		</widget>
 		<packing>
 		  <property name="left_attach">0</property>
@@ -1105,6 +1142,8 @@
 Weekly
 Semi-Monthly
 Monthly</property>
+		  <property name="add_tearoffs">False</property>
+		  <property name="focus_on_click">True</property>
 		</widget>
 		<packing>
 		  <property name="left_attach">1</property>
@@ -1144,6 +1183,10 @@
 		  <property name="yalign">0.5</property>
 		  <property name="xpad">0</property>
 		  <property name="ypad">0</property>
+		  <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+		  <property name="width_chars">-1</property>
+		  <property name="single_line_mode">False</property>
+		  <property name="angle">0</property>
 		</widget>
 		<packing>
 		  <property name="tab_expand">False</property>
@@ -1164,6 +1207,10 @@
 		  <property name="yalign">0.5</property>
 		  <property name="xpad">0</property>
 		  <property name="ypad">0</property>
+		  <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+		  <property name="width_chars">-1</property>
+		  <property name="single_line_mode">False</property>
+		  <property name="angle">0</property>
 		</widget>
 		<packing>
 		  <property name="type">tab</property>
@@ -1189,6 +1236,10 @@
 		      <property name="yalign">0.5</property>
 		      <property name="xpad">0</property>
 		      <property name="ypad">0</property>
+		      <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+		      <property name="width_chars">-1</property>
+		      <property name="single_line_mode">False</property>
+		      <property name="angle">0</property>
 		    </widget>
 		    <packing>
 		      <property name="padding">0</property>
@@ -1216,6 +1267,10 @@
 		  <property name="yalign">0.5</property>
 		  <property name="xpad">0</property>
 		  <property name="ypad">0</property>
+		  <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+		  <property name="width_chars">-1</property>
+		  <property name="single_line_mode">False</property>
+		  <property name="angle">0</property>
 		</widget>
 		<packing>
 		  <property name="type">tab</property>
@@ -1247,6 +1302,10 @@
 			  <property name="yalign">0.5</property>
 			  <property name="xpad">4</property>
 			  <property name="ypad">0</property>
+			  <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+			  <property name="width_chars">-1</property>
+			  <property name="single_line_mode">False</property>
+			  <property name="angle">0</property>
 			</widget>
 			<packing>
 			  <property name="padding">0</property>
@@ -1287,6 +1346,10 @@
 			  <property name="yalign">0.5</property>
 			  <property name="xpad">5</property>
 			  <property name="ypad">0</property>
+			  <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+			  <property name="width_chars">-1</property>
+			  <property name="single_line_mode">False</property>
+			  <property name="angle">0</property>
 			</widget>
 			<packing>
 			  <property name="padding">0</property>
@@ -1321,6 +1384,10 @@
 		  <property name="yalign">0.5</property>
 		  <property name="xpad">0</property>
 		  <property name="ypad">0</property>
+		  <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+		  <property name="width_chars">-1</property>
+		  <property name="single_line_mode">False</property>
+		  <property name="angle">0</property>
 		</widget>
 		<packing>
 		  <property name="type">tab</property>
@@ -1352,6 +1419,10 @@
 			  <property name="yalign">0.5</property>
 			  <property name="xpad">0</property>
 			  <property name="ypad">0</property>
+			  <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+			  <property name="width_chars">-1</property>
+			  <property name="single_line_mode">False</property>
+			  <property name="angle">0</property>
 			</widget>
 			<packing>
 			  <property name="padding">0</property>
@@ -1392,6 +1463,10 @@
 			  <property name="yalign">0.5</property>
 			  <property name="xpad">0</property>
 			  <property name="ypad">0</property>
+			  <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+			  <property name="width_chars">-1</property>
+			  <property name="single_line_mode">False</property>
+			  <property name="angle">0</property>
 			</widget>
 			<packing>
 			  <property name="padding">0</property>
@@ -1608,6 +1683,10 @@
 			  <property name="yalign">0.5</property>
 			  <property name="xpad">0</property>
 			  <property name="ypad">0</property>
+			  <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+			  <property name="width_chars">-1</property>
+			  <property name="single_line_mode">False</property>
+			  <property name="angle">0</property>
 			</widget>
 			<packing>
 			  <property name="type">label_item</property>
@@ -1640,6 +1719,10 @@
 		  <property name="yalign">0.5</property>
 		  <property name="xpad">0</property>
 		  <property name="ypad">0</property>
+		  <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+		  <property name="width_chars">-1</property>
+		  <property name="single_line_mode">False</property>
+		  <property name="angle">0</property>
 		</widget>
 		<packing>
 		  <property name="type">tab</property>
@@ -1678,6 +1761,10 @@
 			      <property name="yalign">0.5</property>
 			      <property name="xpad">0</property>
 			      <property name="ypad">0</property>
+			      <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+			      <property name="width_chars">-1</property>
+			      <property name="single_line_mode">False</property>
+			      <property name="angle">0</property>
 			    </widget>
 			    <packing>
 			      <property name="padding">0</property>
@@ -1718,6 +1805,10 @@
 			      <property name="yalign">0.5</property>
 			      <property name="xpad">0</property>
 			      <property name="ypad">0</property>
+			      <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+			      <property name="width_chars">-1</property>
+			      <property name="single_line_mode">False</property>
+			      <property name="angle">0</property>
 			    </widget>
 			    <packing>
 			      <property name="padding">0</property>
@@ -1752,6 +1843,10 @@
 			      <property name="yalign">0.5</property>
 			      <property name="xpad">0</property>
 			      <property name="ypad">0</property>
+			      <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+			      <property name="width_chars">-1</property>
+			      <property name="single_line_mode">False</property>
+			      <property name="angle">0</property>
 			    </widget>
 			    <packing>
 			      <property name="padding">0</property>
@@ -1801,6 +1896,8 @@
 Last Friday
 Last Saturday
 Last Sunday</property>
+			      <property name="add_tearoffs">False</property>
+			      <property name="focus_on_click">True</property>
 			    </widget>
 			    <packing>
 			      <property name="padding">0</property>
@@ -1835,6 +1932,10 @@
 			      <property name="yalign">0.5</property>
 			      <property name="xpad">0</property>
 			      <property name="ypad">0</property>
+			      <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+			      <property name="width_chars">-1</property>
+			      <property name="single_line_mode">False</property>
+			      <property name="angle">0</property>
 			    </widget>
 			    <packing>
 			      <property name="padding">0</property>
@@ -1884,6 +1985,8 @@
 Last Friday
 Last Saturday
 Last Sunday</property>
+			      <property name="add_tearoffs">False</property>
+			      <property name="focus_on_click">True</property>
 			    </widget>
 			    <packing>
 			      <property name="padding">0</property>
@@ -1925,6 +2028,10 @@
 		  <property name="yalign">0.5</property>
 		  <property name="xpad">0</property>
 		  <property name="ypad">0</property>
+		  <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+		  <property name="width_chars">-1</property>
+		  <property name="single_line_mode">False</property>
+		  <property name="angle">0</property>
 		</widget>
 		<packing>
 		  <property name="type">tab</property>
@@ -1962,6 +2069,10 @@
 			      <property name="yalign">0.5</property>
 			      <property name="xpad">0</property>
 			      <property name="ypad">0</property>
+			      <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+			      <property name="width_chars">-1</property>
+			      <property name="single_line_mode">False</property>
+			      <property name="angle">0</property>
 			    </widget>
 			    <packing>
 			      <property name="padding">0</property>
@@ -2002,6 +2113,10 @@
 			      <property name="yalign">0.5</property>
 			      <property name="xpad">0</property>
 			      <property name="ypad">0</property>
+			      <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+			      <property name="width_chars">-1</property>
+			      <property name="single_line_mode">False</property>
+			      <property name="angle">0</property>
 			    </widget>
 			    <packing>
 			      <property name="padding">0</property>
@@ -2036,6 +2151,10 @@
 			      <property name="yalign">0.5</property>
 			      <property name="xpad">0</property>
 			      <property name="ypad">0</property>
+			      <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+			      <property name="width_chars">-1</property>
+			      <property name="single_line_mode">False</property>
+			      <property name="angle">0</property>
 			    </widget>
 			    <packing>
 			      <property name="padding">2</property>
@@ -2085,6 +2204,8 @@
 Last Friday
 Last Saturday
 Last Sunday</property>
+			      <property name="add_tearoffs">False</property>
+			      <property name="focus_on_click">True</property>
 			    </widget>
 			    <packing>
 			      <property name="padding">0</property>
@@ -2126,6 +2247,10 @@
 		  <property name="yalign">0.5</property>
 		  <property name="xpad">0</property>
 		  <property name="ypad">0</property>
+		  <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+		  <property name="width_chars">-1</property>
+		  <property name="single_line_mode">False</property>
+		  <property name="angle">0</property>
 		</widget>
 		<packing>
 		  <property name="type">tab</property>
@@ -2157,6 +2282,8 @@
   <property name="skip_pager_hint">False</property>
   <property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
   <property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
+  <property name="focus_on_map">True</property>
+  <property name="urgency_hint">False</property>
   <property name="has_separator">True</property>
 
   <child internal-child="vbox">
@@ -2251,6 +2378,10 @@
 		      <property name="yalign">0.5</property>
 		      <property name="xpad">3</property>
 		      <property name="ypad">0</property>
+		      <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+		      <property name="width_chars">-1</property>
+		      <property name="single_line_mode">False</property>
+		      <property name="angle">0</property>
 		    </widget>
 		    <packing>
 		      <property name="left_attach">0</property>
@@ -2275,6 +2406,10 @@
 		      <property name="yalign">0.5</property>
 		      <property name="xpad">3</property>
 		      <property name="ypad">0</property>
+		      <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+		      <property name="width_chars">-1</property>
+		      <property name="single_line_mode">False</property>
+		      <property name="angle">0</property>
 		    </widget>
 		    <packing>
 		      <property name="left_attach">0</property>
@@ -2299,6 +2434,10 @@
 		      <property name="yalign">0.5</property>
 		      <property name="xpad">3</property>
 		      <property name="ypad">0</property>
+		      <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+		      <property name="width_chars">-1</property>
+		      <property name="single_line_mode">False</property>
+		      <property name="angle">0</property>
 		    </widget>
 		    <packing>
 		      <property name="left_attach">0</property>
@@ -2340,6 +2479,8 @@
 Monthly
 Quarterly
 Yearly</property>
+		      <property name="add_tearoffs">False</property>
+		      <property name="focus_on_click">True</property>
 		    </widget>
 		    <packing>
 		      <property name="left_attach">1</property>
@@ -2516,6 +2657,10 @@
 		      <property name="yalign">0.5</property>
 		      <property name="xpad">0</property>
 		      <property name="ypad">0</property>
+		      <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+		      <property name="width_chars">-1</property>
+		      <property name="single_line_mode">False</property>
+		      <property name="angle">0</property>
 		    </widget>
 		    <packing>
 		      <property name="type">label_item</property>
@@ -2577,6 +2722,8 @@
   <property name="skip_pager_hint">False</property>
   <property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property>
   <property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
+  <property name="focus_on_map">True</property>
+  <property name="urgency_hint">False</property>
 
   <child>
     <widget class="GnomeDruid" id="sincelast_druid">
@@ -2623,6 +2770,7 @@
 		      <property name="orientation">GTK_PROGRESS_LEFT_TO_RIGHT</property>
 		      <property name="fraction">0</property>
 		      <property name="pulse_step">0.10000000149</property>
+		      <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
 		    </widget>
 		  </child>
 
@@ -2639,6 +2787,10 @@
 		      <property name="yalign">0.5</property>
 		      <property name="xpad">0</property>
 		      <property name="ypad">0</property>
+		      <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+		      <property name="width_chars">-1</property>
+		      <property name="single_line_mode">False</property>
+		      <property name="angle">0</property>
 		    </widget>
 		    <packing>
 		      <property name="type">label_item</property>
@@ -2684,6 +2836,10 @@
 		  <property name="yalign">0.5</property>
 		  <property name="xpad">0</property>
 		  <property name="ypad">11</property>
+		  <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+		  <property name="width_chars">-1</property>
+		  <property name="single_line_mode">False</property>
+		  <property name="angle">0</property>
 		</widget>
 		<packing>
 		  <property name="padding">0</property>
@@ -2722,6 +2878,10 @@
 			  <property name="yalign">0.5</property>
 			  <property name="xpad">0</property>
 			  <property name="ypad">0</property>
+			  <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+			  <property name="width_chars">-1</property>
+			  <property name="single_line_mode">False</property>
+			  <property name="angle">0</property>
 			</widget>
 		      </child>
 
@@ -2737,6 +2897,10 @@
 			  <property name="yalign">0.5</property>
 			  <property name="xpad">0</property>
 			  <property name="ypad">0</property>
+			  <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+			  <property name="width_chars">-1</property>
+			  <property name="single_line_mode">False</property>
+			  <property name="angle">0</property>
 			</widget>
 		      </child>
 
@@ -2752,6 +2916,10 @@
 			  <property name="yalign">0.5</property>
 			  <property name="xpad">0</property>
 			  <property name="ypad">0</property>
+			  <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+			  <property name="width_chars">-1</property>
+			  <property name="single_line_mode">False</property>
+			  <property name="angle">0</property>
 			</widget>
 		      </child>
 		    </widget>
@@ -2845,6 +3013,10 @@
 			      <property name="yalign">0.5</property>
 			      <property name="xpad">0</property>
 			      <property name="ypad">0</property>
+			      <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+			      <property name="width_chars">-1</property>
+			      <property name="single_line_mode">False</property>
+			      <property name="angle">0</property>
 			    </widget>
 			  </child>
 
@@ -2860,6 +3032,10 @@
 			      <property name="yalign">0.5</property>
 			      <property name="xpad">0</property>
 			      <property name="ypad">0</property>
+			      <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+			      <property name="width_chars">-1</property>
+			      <property name="single_line_mode">False</property>
+			      <property name="angle">0</property>
 			    </widget>
 			  </child>
 			</widget>
@@ -2896,6 +3072,10 @@
 			      <property name="yalign">0.5</property>
 			      <property name="xpad">3</property>
 			      <property name="ypad">0</property>
+			      <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+			      <property name="width_chars">-1</property>
+			      <property name="single_line_mode">False</property>
+			      <property name="angle">0</property>
 			    </widget>
 			    <packing>
 			      <property name="padding">0</property>
@@ -3005,6 +3185,10 @@
 					      <property name="yalign">0.5</property>
 					      <property name="xpad">0</property>
 					      <property name="ypad">0</property>
+					      <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+					      <property name="width_chars">-1</property>
+					      <property name="single_line_mode">False</property>
+					      <property name="angle">0</property>
 					    </widget>
 					    <packing>
 					      <property name="left_attach">1</property>
@@ -3028,6 +3212,10 @@
 					      <property name="yalign">0.5</property>
 					      <property name="xpad">0</property>
 					      <property name="ypad">0</property>
+					      <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+					      <property name="width_chars">-1</property>
+					      <property name="single_line_mode">False</property>
+					      <property name="angle">0</property>
 					    </widget>
 					    <packing>
 					      <property name="left_attach">0</property>
@@ -3068,6 +3256,10 @@
 				      <property name="yalign">0.5</property>
 				      <property name="xpad">3</property>
 				      <property name="ypad">3</property>
+				      <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+				      <property name="width_chars">-1</property>
+				      <property name="single_line_mode">False</property>
+				      <property name="angle">0</property>
 				    </widget>
 				    <packing>
 				      <property name="padding">0</property>
@@ -3111,6 +3303,10 @@
 			      <property name="yalign">0.5</property>
 			      <property name="xpad">0</property>
 			      <property name="ypad">0</property>
+			      <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+			      <property name="width_chars">-1</property>
+			      <property name="single_line_mode">False</property>
+			      <property name="angle">0</property>
 			    </widget>
 			    <packing>
 			      <property name="type">label_item</property>
@@ -3169,6 +3365,10 @@
 		      <property name="yalign">0.5</property>
 		      <property name="xpad">0</property>
 		      <property name="ypad">0</property>
+		      <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+		      <property name="width_chars">-1</property>
+		      <property name="single_line_mode">False</property>
+		      <property name="angle">0</property>
 		    </widget>
 		    <packing>
 		      <property name="type">label_item</property>
@@ -3241,6 +3441,10 @@
 		  <property name="yalign">0.5</property>
 		  <property name="xpad">0</property>
 		  <property name="ypad">11</property>
+		  <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+		  <property name="width_chars">-1</property>
+		  <property name="single_line_mode">False</property>
+		  <property name="angle">0</property>
 		</widget>
 		<packing>
 		  <property name="padding">0</property>
@@ -3280,6 +3484,10 @@
 			  <property name="yalign">0.5</property>
 			  <property name="xpad">0</property>
 			  <property name="ypad">0</property>
+			  <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+			  <property name="width_chars">-1</property>
+			  <property name="single_line_mode">False</property>
+			  <property name="angle">0</property>
 			</widget>
 		      </child>
 
@@ -3295,6 +3503,10 @@
 			  <property name="yalign">0.5</property>
 			  <property name="xpad">0</property>
 			  <property name="ypad">0</property>
+			  <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+			  <property name="width_chars">-1</property>
+			  <property name="single_line_mode">False</property>
+			  <property name="angle">0</property>
 			</widget>
 		      </child>
 
@@ -3310,6 +3522,10 @@
 			  <property name="yalign">0.5</property>
 			  <property name="xpad">0</property>
 			  <property name="ypad">0</property>
+			  <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+			  <property name="width_chars">-1</property>
+			  <property name="single_line_mode">False</property>
+			  <property name="angle">0</property>
 			</widget>
 		      </child>
 		    </widget>
@@ -3390,6 +3606,8 @@
   <property name="skip_pager_hint">False</property>
   <property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property>
   <property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
+  <property name="focus_on_map">True</property>
+  <property name="urgency_hint">False</property>
 
   <child>
     <widget class="GnomeDruid" id="loan_druid">
@@ -3451,6 +3669,10 @@
 		      <property name="yalign">0.5</property>
 		      <property name="xpad">0</property>
 		      <property name="ypad">0</property>
+		      <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+		      <property name="width_chars">-1</property>
+		      <property name="single_line_mode">False</property>
+		      <property name="angle">0</property>
 		    </widget>
 		    <packing>
 		      <property name="left_attach">0</property>
@@ -3475,6 +3697,10 @@
 		      <property name="yalign">0.5</property>
 		      <property name="xpad">0</property>
 		      <property name="ypad">0</property>
+		      <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+		      <property name="width_chars">-1</property>
+		      <property name="single_line_mode">False</property>
+		      <property name="angle">0</property>
 		    </widget>
 		    <packing>
 		      <property name="left_attach">0</property>
@@ -3499,6 +3725,10 @@
 		      <property name="yalign">0.5</property>
 		      <property name="xpad">0</property>
 		      <property name="ypad">0</property>
+		      <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+		      <property name="width_chars">-1</property>
+		      <property name="single_line_mode">False</property>
+		      <property name="angle">0</property>
 		    </widget>
 		    <packing>
 		      <property name="left_attach">0</property>
@@ -3523,6 +3753,10 @@
 		      <property name="yalign">0.5</property>
 		      <property name="xpad">0</property>
 		      <property name="ypad">0</property>
+		      <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+		      <property name="width_chars">-1</property>
+		      <property name="single_line_mode">False</property>
+		      <property name="angle">0</property>
 		    </widget>
 		    <packing>
 		      <property name="left_attach">0</property>
@@ -3547,6 +3781,10 @@
 		      <property name="yalign">0.5</property>
 		      <property name="xpad">0</property>
 		      <property name="ypad">0</property>
+		      <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+		      <property name="width_chars">-1</property>
+		      <property name="single_line_mode">False</property>
+		      <property name="angle">0</property>
 		    </widget>
 		    <packing>
 		      <property name="left_attach">0</property>
@@ -3609,6 +3847,8 @@
 			  <property name="visible">True</property>
 			  <property name="items" translatable="yes">months
 years</property>
+			  <property name="add_tearoffs">False</property>
+			  <property name="focus_on_click">True</property>
 			</widget>
 			<packing>
 			  <property name="padding">0</property>
@@ -3701,6 +3941,10 @@
 			      <property name="yalign">0.5</property>
 			      <property name="xpad">0</property>
 			      <property name="ypad">0</property>
+			      <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+			      <property name="width_chars">-1</property>
+			      <property name="single_line_mode">False</property>
+			      <property name="angle">0</property>
 			    </widget>
 			    <packing>
 			      <property name="padding">0</property>
@@ -3733,6 +3977,10 @@
 		      <property name="yalign">0</property>
 		      <property name="xpad">0</property>
 		      <property name="ypad">0</property>
+		      <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+		      <property name="width_chars">-1</property>
+		      <property name="single_line_mode">False</property>
+		      <property name="angle">0</property>
 		    </widget>
 		    <packing>
 		      <property name="left_attach">2</property>
@@ -3756,6 +4004,10 @@
 		      <property name="yalign">0.5</property>
 		      <property name="xpad">0</property>
 		      <property name="ypad">0</property>
+		      <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+		      <property name="width_chars">-1</property>
+		      <property name="single_line_mode">False</property>
+		      <property name="angle">0</property>
 		    </widget>
 		    <packing>
 		      <property name="left_attach">2</property>
@@ -3803,6 +4055,10 @@
 			      <property name="yalign">0.5</property>
 			      <property name="xpad">0</property>
 			      <property name="ypad">0</property>
+			      <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+			      <property name="width_chars">-1</property>
+			      <property name="single_line_mode">False</property>
+			      <property name="angle">0</property>
 			    </widget>
 			    <packing>
 			      <property name="type">label_item</property>
@@ -3829,6 +4085,8 @@
 5/1 Year ARM
 7/1 Year ARM
 10/1 Year ARM</property>
+		      <property name="add_tearoffs">False</property>
+		      <property name="focus_on_click">True</property>
 		    </widget>
 		    <packing>
 		      <property name="left_attach">3</property>
@@ -3879,6 +4137,10 @@
 		  <property name="yalign">0.5</property>
 		  <property name="xpad">0</property>
 		  <property name="ypad">10</property>
+		  <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+		  <property name="width_chars">-1</property>
+		  <property name="single_line_mode">False</property>
+		  <property name="angle">0</property>
 		</widget>
 		<packing>
 		  <property name="padding">0</property>
@@ -3955,6 +4217,10 @@
 				  <property name="yalign">0.5</property>
 				  <property name="xpad">0</property>
 				  <property name="ypad">0</property>
+				  <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+				  <property name="width_chars">-1</property>
+				  <property name="single_line_mode">False</property>
+				  <property name="angle">0</property>
 				</widget>
 				<packing>
 				  <property name="padding">0</property>
@@ -4052,6 +4318,10 @@
 		      <property name="yalign">0.5</property>
 		      <property name="xpad">0</property>
 		      <property name="ypad">0</property>
+		      <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+		      <property name="width_chars">-1</property>
+		      <property name="single_line_mode">False</property>
+		      <property name="angle">0</property>
 		    </widget>
 		    <packing>
 		      <property name="left_attach">0</property>
@@ -4076,6 +4346,10 @@
 		      <property name="yalign">0.5</property>
 		      <property name="xpad">0</property>
 		      <property name="ypad">0</property>
+		      <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+		      <property name="width_chars">-1</property>
+		      <property name="single_line_mode">False</property>
+		      <property name="angle">0</property>
 		    </widget>
 		    <packing>
 		      <property name="left_attach">0</property>
@@ -4100,6 +4374,10 @@
 		      <property name="yalign">0.5</property>
 		      <property name="xpad">0</property>
 		      <property name="ypad">0</property>
+		      <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+		      <property name="width_chars">-1</property>
+		      <property name="single_line_mode">False</property>
+		      <property name="angle">0</property>
 		    </widget>
 		    <packing>
 		      <property name="left_attach">0</property>
@@ -4124,6 +4402,10 @@
 		      <property name="yalign">0.5</property>
 		      <property name="xpad">0</property>
 		      <property name="ypad">0</property>
+		      <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+		      <property name="width_chars">-1</property>
+		      <property name="single_line_mode">False</property>
+		      <property name="angle">0</property>
 		    </widget>
 		    <packing>
 		      <property name="left_attach">0</property>
@@ -4148,6 +4430,10 @@
 		      <property name="yalign">0.5</property>
 		      <property name="xpad">0</property>
 		      <property name="ypad">0</property>
+		      <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+		      <property name="width_chars">-1</property>
+		      <property name="single_line_mode">False</property>
+		      <property name="angle">0</property>
 		    </widget>
 		    <packing>
 		      <property name="left_attach">2</property>
@@ -4267,6 +4553,10 @@
 			      <property name="yalign">0.5</property>
 			      <property name="xpad">0</property>
 			      <property name="ypad">0</property>
+			      <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+			      <property name="width_chars">-1</property>
+			      <property name="single_line_mode">False</property>
+			      <property name="angle">0</property>
 			    </widget>
 			    <packing>
 			      <property name="type">label_item</property>
@@ -4346,6 +4636,10 @@
 			      <property name="yalign">0.5</property>
 			      <property name="xpad">0</property>
 			      <property name="ypad">0</property>
+			      <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+			      <property name="width_chars">-1</property>
+			      <property name="single_line_mode">False</property>
+			      <property name="angle">0</property>
 			    </widget>
 			    <packing>
 			      <property name="left_attach">0</property>
@@ -4370,6 +4664,10 @@
 			      <property name="yalign">0.5</property>
 			      <property name="xpad">0</property>
 			      <property name="ypad">0</property>
+			      <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+			      <property name="width_chars">-1</property>
+			      <property name="single_line_mode">False</property>
+			      <property name="angle">0</property>
 			    </widget>
 			    <packing>
 			      <property name="left_attach">0</property>
@@ -4394,6 +4692,10 @@
 			      <property name="yalign">0.5</property>
 			      <property name="xpad">0</property>
 			      <property name="ypad">0</property>
+			      <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+			      <property name="width_chars">-1</property>
+			      <property name="single_line_mode">False</property>
+			      <property name="angle">0</property>
 			    </widget>
 			    <packing>
 			      <property name="left_attach">0</property>
@@ -4418,6 +4720,10 @@
 			      <property name="yalign">0.5</property>
 			      <property name="xpad">0</property>
 			      <property name="ypad">0</property>
+			      <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+			      <property name="width_chars">-1</property>
+			      <property name="single_line_mode">False</property>
+			      <property name="angle">0</property>
 			    </widget>
 			    <packing>
 			      <property name="left_attach">2</property>
@@ -4512,6 +4818,10 @@
 			      <property name="yalign">0.5</property>
 			      <property name="xpad">0</property>
 			      <property name="ypad">0</property>
+			      <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+			      <property name="width_chars">-1</property>
+			      <property name="single_line_mode">False</property>
+			      <property name="angle">0</property>
 			    </widget>
 			    <packing>
 			      <property name="left_attach">0</property>
@@ -4536,6 +4846,10 @@
 			      <property name="yalign">0.5</property>
 			      <property name="xpad">0</property>
 			      <property name="ypad">0</property>
+			      <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+			      <property name="width_chars">-1</property>
+			      <property name="single_line_mode">False</property>
+			      <property name="angle">0</property>
 			    </widget>
 			    <packing>
 			      <property name="left_attach">2</property>
@@ -4714,6 +5028,10 @@
 				  <property name="yalign">0.5</property>
 				  <property name="xpad">0</property>
 				  <property name="ypad">0</property>
+				  <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+				  <property name="width_chars">-1</property>
+				  <property name="single_line_mode">False</property>
+				  <property name="angle">0</property>
 				</widget>
 				<packing>
 				  <property name="type">label_item</property>
@@ -4788,6 +5106,10 @@
 			      <property name="yalign">0.5</property>
 			      <property name="xpad">5</property>
 			      <property name="ypad">5</property>
+			      <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+			      <property name="width_chars">-1</property>
+			      <property name="single_line_mode">False</property>
+			      <property name="angle">0</property>
 			    </widget>
 			    <packing>
 			      <property name="padding">0</property>
@@ -4809,6 +5131,8 @@
 Now + 1 Year
 Whole Loan
 Custom</property>
+				  <property name="add_tearoffs">False</property>
+				  <property name="focus_on_click">True</property>
 				</widget>
 				<packing>
 				  <property name="padding">0</property>
@@ -4862,6 +5186,10 @@
 				  <property name="yalign">0.5</property>
 				  <property name="xpad">5</property>
 				  <property name="ypad">5</property>
+				  <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+				  <property name="width_chars">-1</property>
+				  <property name="single_line_mode">False</property>
+				  <property name="angle">0</property>
 				</widget>
 				<packing>
 				  <property name="left_attach">0</property>
@@ -4886,6 +5214,10 @@
 				  <property name="yalign">0.5</property>
 				  <property name="xpad">5</property>
 				  <property name="ypad">5</property>
+				  <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+				  <property name="width_chars">-1</property>
+				  <property name="single_line_mode">False</property>
+				  <property name="angle">0</property>
 				</widget>
 				<packing>
 				  <property name="left_attach">0</property>
@@ -4912,6 +5244,10 @@
 			      <property name="yalign">0.5</property>
 			      <property name="xpad">0</property>
 			      <property name="ypad">0</property>
+			      <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+			      <property name="width_chars">-1</property>
+			      <property name="single_line_mode">False</property>
+			      <property name="angle">0</property>
 			    </widget>
 			    <packing>
 			      <property name="type">label_item</property>
@@ -5069,6 +5405,8 @@
   <property name="skip_pager_hint">False</property>
   <property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property>
   <property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
+  <property name="focus_on_map">True</property>
+  <property name="urgency_hint">False</property>
 
   <child>
     <widget class="GtkTable" id="sx_prefs">
@@ -5093,6 +5431,10 @@
 	  <property name="yalign">0.5</property>
 	  <property name="xpad">0</property>
 	  <property name="ypad">0</property>
+	  <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+	  <property name="width_chars">-1</property>
+	  <property name="single_line_mode">False</property>
+	  <property name="angle">0</property>
 	</widget>
 	<packing>
 	  <property name="left_attach">0</property>
@@ -5117,6 +5459,10 @@
 	  <property name="yalign">0.5</property>
 	  <property name="xpad">0</property>
 	  <property name="ypad">0</property>
+	  <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+	  <property name="width_chars">-1</property>
+	  <property name="single_line_mode">False</property>
+	  <property name="angle">0</property>
 	</widget>
 	<packing>
 	  <property name="left_attach">0</property>
@@ -5141,6 +5487,10 @@
 	  <property name="yalign">0.5</property>
 	  <property name="xpad">0</property>
 	  <property name="ypad">0</property>
+	  <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+	  <property name="width_chars">-1</property>
+	  <property name="single_line_mode">False</property>
+	  <property name="angle">0</property>
 	</widget>
 	<packing>
 	  <property name="left_attach">0</property>
@@ -5227,6 +5577,10 @@
 	      <property name="xpad">0</property>
 	      <property name="ypad">0</property>
 	      <property name="mnemonic_widget">gconf/dialogs/scheduled_trans/transaction_editor/create_days</property>
+	      <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+	      <property name="width_chars">-1</property>
+	      <property name="single_line_mode">False</property>
+	      <property name="angle">0</property>
 	    </widget>
 	  </child>
 	</widget>
@@ -5265,6 +5619,10 @@
 	      <property name="yalign">0.5</property>
 	      <property name="xpad">0</property>
 	      <property name="ypad">0</property>
+	      <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+	      <property name="width_chars">-1</property>
+	      <property name="single_line_mode">False</property>
+	      <property name="angle">0</property>
 	    </widget>
 	  </child>
 	</widget>
@@ -5317,6 +5675,10 @@
 	      <property name="yalign">0.5</property>
 	      <property name="xpad">0</property>
 	      <property name="ypad">0</property>
+	      <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+	      <property name="width_chars">-1</property>
+	      <property name="single_line_mode">False</property>
+	      <property name="angle">0</property>
 	    </widget>
 	    <packing>
 	      <property name="padding">0</property>
@@ -5374,6 +5736,10 @@
 	      <property name="yalign">0.5</property>
 	      <property name="xpad">0</property>
 	      <property name="ypad">0</property>
+	      <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+	      <property name="width_chars">-1</property>
+	      <property name="single_line_mode">False</property>
+	      <property name="angle">0</property>
 	    </widget>
 	    <packing>
 	      <property name="padding">0</property>
@@ -5436,6 +5802,8 @@
   <property name="skip_pager_hint">False</property>
   <property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
   <property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
+  <property name="focus_on_map">True</property>
+  <property name="urgency_hint">False</property>
   <property name="has_separator">True</property>
 
   <child internal-child="vbox">
@@ -5489,6 +5857,10 @@
 	      <property name="yalign">0.5</property>
 	      <property name="xpad">0</property>
 	      <property name="ypad">0</property>
+	      <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+	      <property name="width_chars">-1</property>
+	      <property name="single_line_mode">False</property>
+	      <property name="angle">0</property>
 	    </widget>
 	    <packing>
 	      <property name="padding">0</property>
@@ -5513,6 +5885,9 @@
 		  <property name="rules_hint">False</property>
 		  <property name="reorderable">False</property>
 		  <property name="enable_search">False</property>
+		  <property name="fixed_height_mode">False</property>
+		  <property name="hover_selection">False</property>
+		  <property name="hover_expand">False</property>
 		</widget>
 	      </child>
 	    </widget>
@@ -5546,6 +5921,8 @@
   <property name="skip_pager_hint">False</property>
   <property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property>
   <property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
+  <property name="focus_on_map">True</property>
+  <property name="urgency_hint">False</property>
 
   <child>
     <widget class="GtkVPaned" id="sx-list-vbox">
@@ -5572,6 +5949,10 @@
 	      <property name="yalign">0.5</property>
 	      <property name="xpad">0</property>
 	      <property name="ypad">0</property>
+	      <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+	      <property name="width_chars">-1</property>
+	      <property name="single_line_mode">False</property>
+	      <property name="angle">0</property>
 	    </widget>
 	    <packing>
 	      <property name="padding">0</property>
@@ -5651,6 +6032,10 @@
 	      <property name="yalign">0.5</property>
 	      <property name="xpad">0</property>
 	      <property name="ypad">0</property>
+	      <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+	      <property name="width_chars">-1</property>
+	      <property name="single_line_mode">False</property>
+	      <property name="angle">0</property>
 	    </widget>
 	    <packing>
 	      <property name="padding">0</property>
@@ -5672,6 +6057,10 @@
 	      <property name="yalign">0.5</property>
 	      <property name="xpad">0</property>
 	      <property name="ypad">0</property>
+	      <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+	      <property name="width_chars">-1</property>
+	      <property name="single_line_mode">False</property>
+	      <property name="angle">0</property>
 	    </widget>
 	    <packing>
 	      <property name="padding">0</property>
@@ -5735,6 +6124,8 @@
   <property name="skip_pager_hint">False</property>
   <property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
   <property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
+  <property name="focus_on_map">True</property>
+  <property name="urgency_hint">False</property>
   <property name="has_separator">True</property>
 
   <child internal-child="vbox">
@@ -5807,6 +6198,9 @@
 		  <property name="rules_hint">False</property>
 		  <property name="reorderable">False</property>
 		  <property name="enable_search">True</property>
+		  <property name="fixed_height_mode">False</property>
+		  <property name="hover_selection">False</property>
+		  <property name="hover_expand">False</property>
 		</widget>
 	      </child>
 	    </widget>

Modified: gnucash/branches/gda-dev/src/gnome/gnc-plugin-page-register.c
===================================================================
--- gnucash/branches/gda-dev/src/gnome/gnc-plugin-page-register.c	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/src/gnome/gnc-plugin-page-register.c	2007-04-14 00:35:53 UTC (rev 15878)
@@ -150,7 +150,7 @@
 
 static void gnc_plugin_page_register_ui_update (gpointer various, GncPluginPageRegister *page);
 static void gppr_account_destroy_cb (Account *account);
-static void gnc_plugin_page_register_event_handler (QofEntity *entity,
+static void gnc_plugin_page_register_event_handler (QofInstance *entity,
 						    QofEventId event_type,
 						    GncPluginPageRegister *page,
 						    GncEventData *ed);
@@ -2873,7 +2873,7 @@
  *  @param ed
  */
 static void
-gnc_plugin_page_register_event_handler (QofEntity *entity,
+gnc_plugin_page_register_event_handler (QofInstance *entity,
 					QofEventId event_type,
 					GncPluginPageRegister *page,
 					GncEventData *ed)

Modified: gnucash/branches/gda-dev/src/gnome/gnc-plugin-page-sx-list.c
===================================================================
--- gnucash/branches/gda-dev/src/gnome/gnc-plugin-page-sx-list.c	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/src/gnome/gnc-plugin-page-sx-list.c	2007-04-14 00:35:53 UTC (rev 15878)
@@ -343,9 +343,12 @@
 
         priv->dense_cal_model = gnc_sx_instance_dense_cal_adapter_new(GNC_SX_INSTANCE_MODEL(priv->instances));
         priv->gdcal = GNC_DENSE_CAL(gnc_dense_cal_new_with_model(GNC_DENSE_CAL_MODEL(priv->dense_cal_model)));
-        // gobject-2.10: g_object_ref_sink(G_OBJECT(priv->gdcal));
+#ifdef HAVE_GTK_2_10
+        g_object_ref_sink(priv->gdcal);
+#else
         g_object_ref(G_OBJECT(priv->gdcal));
         gtk_object_sink(GTK_OBJECT(priv->gdcal));
+#endif
 
         gnc_dense_cal_set_months_per_col(priv->gdcal, 4);
         gnc_dense_cal_set_num_months(priv->gdcal, 12);
@@ -541,7 +544,6 @@
     GList *selected_paths, *to_delete = NULL;
     GtkTreeModel *model;
 
-    /* @@fixme -- add (suppressible?) confirmation dialog */
     selection = gtk_tree_view_get_selection(priv->tree_view);
     selected_paths = gtk_tree_selection_get_selected_rows(selection, &model);
     if (g_list_length(selected_paths) == 0)

Modified: gnucash/branches/gda-dev/src/gnome/top-level.c
===================================================================
--- gnucash/branches/gda-dev/src/gnome/top-level.c	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/src/gnome/top-level.c	2007-04-14 00:35:53 UTC (rev 15878)
@@ -83,7 +83,7 @@
   {                                                                         \
     GUID guid;                                                              \
     QofCollection *col;                                                     \
-    QofEntity *entity;                                                      \
+    QofInstance *entity;                                                      \
     if (!string_to_guid (location + strlen(URL_TYPE_STR), &guid))           \
     {                                                                       \
       result->error_message = g_strdup_printf (_("Bad URL: %s"), location); \
@@ -230,7 +230,7 @@
     
     /* Get the book GUID */
     book = qof_session_get_book(session);
-    guid = qof_entity_get_guid(QOF_ENTITY(book));
+    guid = qof_instance_get_guid(QOF_INSTANCE(book));
     guid_string = guid_to_string(guid);
     
     keyfile = gnc_find_state_file(url, guid_string, &filename);
@@ -317,7 +317,7 @@
 
     /* Get the book GUID */
     book = qof_session_get_book(session);
-    guid = qof_entity_get_guid(QOF_ENTITY(book));
+    guid = qof_instance_get_guid(QOF_INSTANCE(book));
     guid_string = guid_to_string(guid);
 
     /* Find the filename to use.  This returns the data from the

Modified: gnucash/branches/gda-dev/src/gnome-utils/account-quickfill.c
===================================================================
--- gnucash/branches/gda-dev/src/gnome-utils/account-quickfill.c	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/src/gnome-utils/account-quickfill.c	2007-04-14 00:35:53 UTC (rev 15878)
@@ -31,7 +31,7 @@
 static QofLogModule log_module = GNC_MOD_REGISTER;
 
 static void shared_quickfill_gconf_changed (GConfEntry *entry, gpointer qfb);
-static void listen_for_account_events  (QofEntity *entity,  QofEventId event_type,
+static void listen_for_account_events  (QofInstance *entity,  QofEventId event_type,
 					gpointer user_data, gpointer event_data);
 
 /* Column indices for the list store */
@@ -219,7 +219,7 @@
  * for account modification events, and add new accounts.
  */
 static void
-listen_for_account_events  (QofEntity *entity,  QofEventId event_type,
+listen_for_account_events  (QofInstance *entity,  QofEventId event_type,
 			    gpointer user_data, gpointer event_data)
 {
   QFB *qfb = user_data;

Modified: gnucash/branches/gda-dev/src/gnome-utils/dialog-options.c
===================================================================
--- gnucash/branches/gda-dev/src/gnome-utils/dialog-options.c	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/src/gnome-utils/dialog-options.c	2007-04-14 00:35:53 UTC (rev 15878)
@@ -732,8 +732,12 @@
 
   /* Create the tooltips */
   tooltips = gtk_tooltips_new ();
+#ifdef HAVE_GTK_2_10
+  g_object_ref_sink(tooltips);
+#else
   g_object_ref (tooltips);
   gtk_object_sink (GTK_OBJECT (tooltips));
+#endif
 
   /* Iterate over the options and create a radio button for each one */
   for (i = 0; i < num_values; i++)
@@ -1229,8 +1233,12 @@
   propertybox->tips = gtk_tooltips_new();
   propertybox->option_db = odb;
 
+#ifdef HAVE_GTK_2_10
+  g_object_ref_sink(propertybox->tips);
+#else
   g_object_ref (propertybox->tips);
   gtk_object_sink (GTK_OBJECT (propertybox->tips));
+#endif
 
   num_sections = gnc_option_db_num_sections(odb);
   default_section_name = gnc_option_db_get_default_section(odb);

Modified: gnucash/branches/gda-dev/src/gnome-utils/dialog-preferences.c
===================================================================
--- gnucash/branches/gda-dev/src/gnome-utils/dialog-preferences.c	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/src/gnome-utils/dialog-preferences.c	2007-04-14 00:35:53 UTC (rev 15878)
@@ -515,7 +515,11 @@
   gtk_container_foreach(GTK_CONTAINER(new_content), gnc_prefs_move_table_entry,
 			&copydata);
 
+#ifdef HAVE_GTK_2_10
+  g_object_ref_sink(new_content);
+#else
   gtk_object_sink(GTK_OBJECT(new_content));
+#endif
   LEAVE("added content to page");
 }
 

Modified: gnucash/branches/gda-dev/src/gnome-utils/dialog-transfer.c
===================================================================
--- gnucash/branches/gda-dev/src/gnome-utils/dialog-transfer.c	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/src/gnome-utils/dialog-transfer.c	2007-04-14 00:35:53 UTC (rev 15878)
@@ -1653,8 +1653,12 @@
 
   xferData->tips = gtk_tooltips_new();
 
+#ifdef HAVE_GTK_2_10
+  g_object_ref_sink(xferData->tips);
+#else
   g_object_ref (xferData->tips);
   gtk_object_sink (GTK_OBJECT (xferData->tips));
+#endif
 
   /* default to quickfilling off of the "From" account. */
   xferData->quickfill = XFER_DIALOG_FROM;

Modified: gnucash/branches/gda-dev/src/gnome-utils/dialog-utils.c
===================================================================
--- gnucash/branches/gda-dev/src/gnome-utils/dialog-utils.c	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/src/gnome-utils/dialog-utils.c	2007-04-14 00:35:53 UTC (rev 15878)
@@ -99,8 +99,12 @@
 
   tooltips = gtk_tooltips_new();
 
+#ifdef HAVE_GTK_2_10
+  g_object_ref_sink(tooltips);
+#else
   g_object_ref (tooltips);
   gtk_object_sink (GTK_OBJECT (tooltips));
+#endif
 
   for (i = 0; i < num_options; i++)
   {
@@ -612,17 +616,15 @@
   GList *list;
   GList *node;
   GdkGC *gc;
-  GdkFont *font;
+  PangoLayout *layout;
 
   if (check_info->mask)
     return;
 
-  style = gtk_widget_get_style (widget);
-  font = gdk_font_from_description(style->font_desc);
+  layout = gtk_widget_create_pango_layout(widget, "sample");
+  pango_layout_get_pixel_size(layout, NULL,  &font_height);
+  check_size = (font_height > 0) ? font_height - 6 : 9;
 
-  font_height = font->ascent + font->descent;
-  check_size = (font_height > 0) ? font_height - 3 : 9;
-
   check_info->mask = gdk_pixmap_new (NULL, check_size, check_size, 1);
 
   check_info->on_pixmap = gdk_pixmap_new (widget->window,
@@ -631,6 +633,7 @@
   check_info->off_pixmap = gdk_pixmap_new (widget->window,
                                            check_size, check_size, -1);
 
+  style = gtk_widget_get_style (widget);
   gc_values.foreground = style->white;
   gc = gtk_gc_get (1, gtk_widget_get_colormap (widget),
                    &gc_values, GDK_GC_FOREGROUND);

Modified: gnucash/branches/gda-dev/src/gnome-utils/gnc-account-sel.c
===================================================================
--- gnucash/branches/gda-dev/src/gnome-utils/gnc-account-sel.c	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/src/gnome-utils/gnc-account-sel.c	2007-04-14 00:35:53 UTC (rev 15878)
@@ -94,7 +94,7 @@
 
 static
 void
-gnc_account_sel_event_cb( QofEntity *entity,
+gnc_account_sel_event_cb( QofInstance *entity,
                           QofEventId event_type,
                           gpointer user_data,
 			  gpointer event_data )

Modified: gnucash/branches/gda-dev/src/gnome-utils/gnc-date-edit.c
===================================================================
--- gnucash/branches/gda-dev/src/gnome-utils/gnc-date-edit.c	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/src/gnome-utils/gnc-date-edit.c	2007-04-14 00:35:53 UTC (rev 15878)
@@ -713,7 +713,7 @@
 	gtk_widget_show (GTK_WIDGET(frame));
 
 	gde->calendar = gtk_calendar_new ();
-	gtk_calendar_display_options
+	gtk_calendar_set_display_options
                 (GTK_CALENDAR (gde->calendar),
                  (GTK_CALENDAR_SHOW_DAY_NAMES
                   | GTK_CALENDAR_SHOW_HEADING

Modified: gnucash/branches/gda-dev/src/gnome-utils/gnc-dense-cal-model.h
===================================================================
--- gnucash/branches/gda-dev/src/gnome-utils/gnc-dense-cal-model.h	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/src/gnome-utils/gnc-dense-cal-model.h	2007-04-14 00:35:53 UTC (rev 15878)
@@ -54,7 +54,7 @@
 
 GType gnc_dense_cal_model_get_type(void);
 
-/* @fixme: glist mem alloc policy... ? */
+/** @return Caller-owned GList (but not elements).  The Model-user will free. **/
 GList* gnc_dense_cal_model_get_contained(GncDenseCalModel *model);
 gchar* gnc_dense_cal_model_get_name(GncDenseCalModel *model, guint tag);
 gchar* gnc_dense_cal_model_get_info(GncDenseCalModel *model, guint tag);

Modified: gnucash/branches/gda-dev/src/gnome-utils/gnc-dense-cal-store.c
===================================================================
--- gnucash/branches/gda-dev/src/gnome-utils/gnc-dense-cal-store.c	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/src/gnome-utils/gnc-dense-cal-store.c	2007-04-14 00:35:53 UTC (rev 15878)
@@ -289,7 +289,7 @@
 {
     GncDenseCalStore *mdl = GNC_DENSE_CAL_STORE(model);
     // assert(tag == 1)
-    return mdl->info;
+    return g_strdup(mdl->info);
 }
 
 static gint

Modified: gnucash/branches/gda-dev/src/gnome-utils/gnc-dense-cal.c
===================================================================
--- gnucash/branches/gda-dev/src/gnome-utils/gnc-dense-cal.c	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/src/gnome-utils/gnc-dense-cal.c	2007-04-14 00:35:53 UTC (rev 15878)
@@ -145,10 +145,12 @@
 static GObject *parent_class = NULL;
 
 #define MONTH_NAME_BUFSIZE 5
+
 /* Takes the number of months since January, in the range 0 to
  * 11. Returns the abbreviated month name according to the current
  * locale.*/
-static const gchar *month_name(int mon) 
+static const gchar*
+month_name(int mon) 
 {
     static gchar buf[MONTH_NAME_BUFSIZE];
     GDate date;
@@ -165,21 +167,15 @@
      
     return buf;
 }
+
 /* Takes the number of days since Sunday, in the range 0 to 6. Returns
  * the abbreviated weekday name according to the current locale. */
-static const gchar *day_label(int wday)
+static void
+day_label(gchar *buf, int buf_len, int dow)
 {
-    static gchar buf[MONTH_NAME_BUFSIZE];
-    struct tm my_tm;
-    int i;
-    
-    memset(buf, 0, MONTH_NAME_BUFSIZE);
-    memset(&my_tm, 0, sizeof(struct tm));
-    my_tm.tm_wday = wday;
-    i = qof_strftime (buf, MONTH_NAME_BUFSIZE-1, "%a", &my_tm);
+    gnc_dow_abbrev(buf, buf_len, dow);
     /* Wild hack to use only the first two letters */
     buf[2]='\0';
-    return buf;
 }
 
 GType
@@ -430,6 +426,22 @@
 
     dcal->initialized = TRUE;
 
+
+    dcal->week_starts_monday = 0;
+    {
+        gchar **parts;
+        parts = g_strsplit(dgettext("gtk20", "calendar:week_start:0"),
+                           ":", 3);
+        if (parts[0] != NULL
+            && parts[1] != NULL
+            && parts[2] != NULL)
+        {
+            if (strcmp("1", parts[2]) == 0)
+                dcal->week_starts_monday = 1;
+        }
+        g_strfreev(parts);
+    }
+
     gtk_widget_pop_composite_child();
 
     gtk_widget_show_all(GTK_WIDGET(dcal));
@@ -769,11 +781,19 @@
 
     g_date_clear(&date, 1);
     g_date_set_dmy(&date, 1, dcal->month, dcal->year);
-    start_week = g_date_get_sunday_week_of_year(&date);
+    start_week = (dcal->week_starts_monday
+                  ? g_date_get_monday_week_of_year(&date)
+                  : g_date_get_sunday_week_of_year(&date));
     g_date_add_months(&date, dcal->numMonths);
-    end_week = g_date_get_sunday_week_of_year(&date);
+    end_week = (dcal->week_starts_monday
+                ? g_date_get_monday_week_of_year(&date)
+                : g_date_get_sunday_week_of_year(&date));
     if (g_date_get_year(&date) != dcal->year)
-        end_week += g_date_get_sunday_weeks_in_year(dcal->year);
+    {
+        end_week += (dcal->week_starts_monday
+                     ? g_date_get_monday_weeks_in_year(dcal->year)
+                     : g_date_get_sunday_weeks_in_year(dcal->year));
+    }
     dcal->num_weeks = end_week - start_week + 1;
 }
 
@@ -867,7 +887,7 @@
             g_list_free(mcList);
         }
 
-        gdk_gc_destroy(gc);
+        g_object_unref(gc);
     }
 
     /* Hilight the marked days. */
@@ -968,15 +988,18 @@
             {
                 int day_label_width;
                 gint label_x_offset, label_y_offset;
+                gint day_label_str_len = 3;
+                gchar day_label_str[day_label_str_len+1];
 
-                pango_layout_set_text(layout, day_label(j), -1);
+                day_label(day_label_str, day_label_str_len, (j + dcal->week_starts_monday) % 7);
+                pango_layout_set_text(layout, day_label_str, -1);
                 pango_layout_get_pixel_size(layout, &day_label_width, NULL);
                 label_x_offset = x
                     + (j * day_width(dcal))
                     + (day_width(dcal)/2)
                     - (day_label_width / 2);
                 label_y_offset = y - dcal->dayLabelHeight;
-                pango_layout_set_text(layout, day_label(j), -1);
+                pango_layout_set_text(layout, day_label_str, -1);
                 gdk_draw_layout(GDK_DRAWABLE(dcal->drawbuf), widget->style->fg_gc[widget->state],
                                 label_x_offset, label_y_offset,
                                 layout);
@@ -1282,11 +1305,17 @@
                                        - ((i-1)
                                           * dcal->monthsPerCol))));
         g_date_subtract_days(end, 1);
-        startWeek = g_date_get_sunday_week_of_year(start);
-        endWeek = g_date_get_sunday_week_of_year(end);
+        startWeek = (dcal->week_starts_monday
+                     ? g_date_get_monday_week_of_year(start)
+                     : g_date_get_sunday_week_of_year(start));
+        endWeek = (dcal->week_starts_monday
+                   ? g_date_get_monday_week_of_year(end)
+                   : g_date_get_sunday_week_of_year(end));
         if (endWeek < startWeek)
         {
-            endWeek += g_date_get_sunday_weeks_in_year(g_date_get_year(start));
+            endWeek += (dcal->week_starts_monday
+                        ? g_date_get_monday_weeks_in_year(g_date_get_year(start))
+                        : g_date_get_sunday_weeks_in_year(g_date_get_year(start)));
         }
         num_weeks_toRet = MAX(num_weeks_toRet, (endWeek - startWeek)+1);
     }
@@ -1327,20 +1356,26 @@
                        ((dcal->month - 1 + monthOffset) % 12) + 1,
                        dcal->year + floor((dcal->month-1+monthOffset)/12));
         /* get the week of the top of the column */
-        startWk = g_date_get_sunday_week_of_year(startD);
+        startWk = (dcal->week_starts_monday
+                   ? g_date_get_monday_week_of_year(startD)
+                   : g_date_get_sunday_week_of_year(startD));
         /* get the week of the end of the previous months */
         *endD = *startD;
         g_date_add_months(endD, previousMonthsInCol);
         g_date_subtract_days(endD, 1);
-        endWk = g_date_get_sunday_week_of_year(endD);
+        endWk = (dcal->week_starts_monday
+                 ? g_date_get_monday_week_of_year(endD)
+                 : g_date_get_sunday_week_of_year(endD));
         if (endWk < startWk)
         {
-            endWk += g_date_get_sunday_weeks_in_year(g_date_get_year(startD));
+            endWk += (dcal->week_starts_monday
+                      ? g_date_get_monday_weeks_in_year(g_date_get_year(startD))
+                      : g_date_get_sunday_weeks_in_year(g_date_get_year(startD)));
         }
         /* determine how many weeks are before the month we're
          * interested in. */
         weekRow = endWk - startWk;
-        if (g_date_get_weekday(endD) == G_DATE_SATURDAY)
+        if (g_date_get_weekday(endD) == (dcal->week_starts_monday ? G_DATE_SUNDAY : G_DATE_SATURDAY))
         {
             weekRow++;
         }
@@ -1354,7 +1389,7 @@
     g_date_subtract_days(endD, 1);
     /* Get the first week. */
     {
-        start = g_date_get_weekday(startD) % 7;
+        start = (g_date_get_weekday(startD) - dcal->week_starts_monday) % 7;
         rect = g_new0(GdkRectangle, 1);
         rect->x = dcal->leftPadding
             + MINOR_BORDER_SIZE
@@ -1375,8 +1410,12 @@
     {
         gint i, weekStart, weekEnd;
 
-        weekStart = g_date_get_sunday_week_of_year(startD)+1;
-        weekEnd = g_date_get_sunday_week_of_year(endD);
+        weekStart = (dcal->week_starts_monday
+                     ? g_date_get_monday_week_of_year(startD)
+                     : g_date_get_sunday_week_of_year(startD))+1;
+        weekEnd = (dcal->week_starts_monday
+                   ? g_date_get_monday_week_of_year(endD)
+                   : g_date_get_sunday_week_of_year(endD));
         for (i=weekStart; i<weekEnd; i++) {
             rect = g_new0(GdkRectangle, 1);
             rect->x = dcal->leftPadding
@@ -1397,6 +1436,14 @@
         
     /* Get the last week. */
     {
+        gint end_week_of_year = g_date_get_sunday_week_of_year(endD);
+        gint start_week_of_year = g_date_get_sunday_week_of_year(startD);
+        if (dcal->week_starts_monday == 1)
+        {
+            end_week_of_year = g_date_get_monday_week_of_year(endD);
+            start_week_of_year = g_date_get_monday_week_of_year(startD);
+        }
+
         rect = g_new0(GdkRectangle, 1);
         rect->x = dcal->leftPadding
             + MINOR_BORDER_SIZE
@@ -1406,10 +1453,9 @@
             + MINOR_BORDER_SIZE
             + dcal->dayLabelHeight
             + ((weekRow
-                + (g_date_get_sunday_week_of_year(endD)
-                   - g_date_get_sunday_week_of_year(startD)))
+                + (end_week_of_year - start_week_of_year))
                * week_height(dcal));
-        rect->width = ((g_date_get_weekday(endD) % 7)+1) * day_width(dcal);
+        rect->width = (((g_date_get_weekday(endD) - dcal->week_starts_monday) % 7)+1) * day_width(dcal);
         rect->height = week_height(dcal);
 
         *outList = g_list_append(*outList, (gpointer)rect);
@@ -1439,14 +1485,26 @@
         docMonth += 12;
     }
     colNum  = floor((float)(docMonth - dcal->month) / (float)dcal->monthsPerCol);
-    dayCol  = g_date_get_weekday(&d) % 7;
+    dayCol  = (g_date_get_weekday(&d) - dcal->week_starts_monday) % 7;
     d_week_of_cal = g_date_get_sunday_week_of_year(&d);
+    if (dcal->week_starts_monday == 1)
+    {
+        d_week_of_cal = g_date_get_monday_week_of_year(&d);
+    }
     g_date_set_dmy(&d, 1, dcal->month, dcal->year);
     g_date_add_months(&d, (colNum * dcal->monthsPerCol));
-    top_of_col_week_of_cal = g_date_get_sunday_week_of_year(&d);
+    top_of_col_week_of_cal = (dcal->week_starts_monday
+                              ? g_date_get_monday_week_of_year(&d)
+                              : g_date_get_sunday_week_of_year(&d));
     if (d_week_of_cal < top_of_col_week_of_cal)
     {
-        d_week_of_cal += g_date_get_sunday_weeks_in_year(dcal->year);
+        gint week_offset;
+        week_offset = g_date_get_sunday_weeks_in_year(dcal->year);
+        if (dcal->week_starts_monday == 1)
+        {
+            week_offset = g_date_get_monday_weeks_in_year(dcal->year);
+        }
+        d_week_of_cal += week_offset;
     }
     weekRow = d_week_of_cal - top_of_col_week_of_cal;
 
@@ -1528,7 +1586,7 @@
     g_date_set_dmy(&startD, 1, dcal->month, dcal->year);
     d = startD;
     g_date_add_months(&d, (colNum * dcal->monthsPerCol));
-    dayCol -= (g_date_get_weekday(&d) % 7);
+    dayCol -= ((g_date_get_weekday(&d) - dcal->week_starts_monday) % 7);
     if (weekRow == 0)
     {
         if (dayCol < 0)
@@ -1599,7 +1657,7 @@
     num_marks = gnc_dense_cal_model_get_instance_count(cal->model, tag);
 
     if (num_marks == 0)
-        return;
+        goto cleanup;
 
     dates = g_new0(GDate*, num_marks);
     for (idx = 0; idx < num_marks; idx++)
@@ -1615,6 +1673,9 @@
         g_date_free(dates[idx]);
     }
     g_free(dates);
+
+cleanup:
+    g_free(info);
 }
 
 static void
@@ -1627,6 +1688,7 @@
         guint tag = GPOINTER_TO_UINT(tags->data);
         gdc_add_tag_markings(cal, tag);
     }
+    g_list_free(tags);
 }
 
 static void
@@ -1639,6 +1701,7 @@
         guint tag = GPOINTER_TO_UINT(tags->data);
         gdc_mark_remove(cal, tag);
     }
+    g_list_free(tags);
 }
 
 static void

Modified: gnucash/branches/gda-dev/src/gnome-utils/gnc-dense-cal.h
===================================================================
--- gnucash/branches/gda-dev/src/gnome-utils/gnc-dense-cal.h	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/src/gnome-utils/gnc-dense-cal.h	2007-04-14 00:35:53 UTC (rev 15878)
@@ -94,6 +94,8 @@
 
     guint lastMarkTag;
 
+    gint week_starts_monday;
+
     /**
      * A GList of gdc_mark_data structs, one for each active/valid markTag.
      **/

Modified: gnucash/branches/gda-dev/src/gnome-utils/gnc-file.c
===================================================================
--- gnucash/branches/gda-dev/src/gnome-utils/gnc-file.c	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/src/gnome-utils/gnc-file.c	2007-04-14 00:35:53 UTC (rev 15878)
@@ -831,16 +831,21 @@
 gnc_file_open (void)
 {
   const char * newfile;
-  char *lastfile;
+  char *lastfile = NULL;
+  gchar *last_file_dir = NULL;
   gboolean result;
 
   if (!gnc_file_query_save (TRUE))
     return FALSE;
 
   lastfile = gnc_history_get_last();
-  newfile = gnc_file_dialog (_("Open"), NULL, lastfile, GNC_FILE_DIALOG_OPEN);
   if (lastfile)
+    last_file_dir = g_path_get_dirname(lastfile);
+  newfile = gnc_file_dialog (_("Open"), NULL, last_file_dir, GNC_FILE_DIALOG_OPEN);
+  if (lastfile != NULL)
     g_free(lastfile);
+  if (last_file_dir != NULL)
+    g_free(last_file_dir);
   result = gnc_post_file_open (newfile);
 
   /* This dialogue can show up early in the startup process. If the

Modified: gnucash/branches/gda-dev/src/gnome-utils/gnc-html.c
===================================================================
--- gnucash/branches/gda-dev/src/gnome-utils/gnc-html.c	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/src/gnome-utils/gnc-html.c	2007-04-14 00:35:53 UTC (rev 15878)
@@ -1044,8 +1044,12 @@
   //retval->http         = gnc_http_new();
   retval->history      = gnc_html_history_new();
 
+#ifdef HAVE_GTK_2_10
+  g_object_ref_sink(retval->container);
+#else
   g_object_ref (retval->container);
   gtk_object_sink (GTK_OBJECT (retval->container));
+#endif
 
   /* signals */
   g_signal_connect(retval->html, "url_requested",

Modified: gnucash/branches/gda-dev/src/gnome-utils/gnc-icons.c
===================================================================
--- gnucash/branches/gda-dev/src/gnome-utils/gnc-icons.c	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/src/gnome-utils/gnc-icons.c	2007-04-14 00:35:53 UTC (rev 15878)
@@ -87,8 +87,8 @@
 	gtk_icon_factory_add (factory, stock, set);
 
 	/* Cleanup */
-	gdk_pixbuf_unref (pixbuf2);
-	gdk_pixbuf_unref (pixbuf1);
+	g_object_unref (pixbuf2);
+	g_object_unref (pixbuf1);
 	g_free(fullname2);
 	g_free(fullname1);
 	gtk_icon_set_unref (set);

Modified: gnucash/branches/gda-dev/src/gnome-utils/gnc-main-window.c
===================================================================
--- gnucash/branches/gda-dev/src/gnome-utils/gnc-main-window.c	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/src/gnome-utils/gnc-main-window.c	2007-04-14 00:35:53 UTC (rev 15878)
@@ -1157,7 +1157,7 @@
  *  @param user_data  A pointer to the window data structure.
  */
 static void
-gnc_main_window_event_handler (QofEntity *entity,  QofEventId event_type,
+gnc_main_window_event_handler (QofInstance *entity,  QofEventId event_type,
                                gpointer user_data, gpointer event_data)
 {
 	GncMainWindow *window;
@@ -3454,7 +3454,7 @@
 {
 	const gchar *fixed_message = _("The GnuCash personal finance manager. "
 				       "The GNU way to manage your money!");
-	const gchar *copyright = "© 1997-2006 Contributors";
+	const gchar *copyright = "© 1997-2006 Contributors";
 	gchar **authors, **documenters, *license, *message;
 	GdkPixbuf *logo;
 

Modified: gnucash/branches/gda-dev/src/gnome-utils/gnc-plugin-file-history.c
===================================================================
--- gnucash/branches/gda-dev/src/gnome-utils/gnc-plugin-file-history.c	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/src/gnome-utils/gnc-plugin-file-history.c	2007-04-14 00:35:53 UTC (rev 15878)
@@ -297,7 +297,8 @@
 	gchar *action_name, *label_name, *old_filename;
 	gint limit;
 
-	ENTER("window %p, index %d, filename %s", window, index, filename);
+	ENTER("window %p, index %d, filename %s", window, index,
+	      filename ? filename : "(null)");
 	/* Get the action group */
 	action_group =
 	  gnc_main_window_get_action_group(window, PLUGIN_ACTIONS_NAME);

Modified: gnucash/branches/gda-dev/src/gnome-utils/gnc-sx-instance-dense-cal-adapter.c
===================================================================
--- gnucash/branches/gda-dev/src/gnome-utils/gnc-sx-instance-dense-cal-adapter.c	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/src/gnome-utils/gnc-sx-instance-dense-cal-adapter.c	2007-04-14 00:35:53 UTC (rev 15878)
@@ -170,7 +170,6 @@
     return (GUINT_TO_POINTER(GPOINTER_TO_UINT(sx_instances->sx)) == find_data ? 0 : 1);
 }
 
-// @@ fixme this list is leaked.
 static GList*
 gsidca_get_contained(GncDenseCalModel *model)
 {
@@ -206,7 +205,6 @@
     // g_list_find(instances->sxes, {sx_to_tag, tag}).get_freq_spec().get_freq_str();
     FreqSpec *spec;
     GString *info;
-    gchar *info_str;
     GncSxInstances *insts
         = (GncSxInstances*)g_list_find_custom(adapter->instances->sx_instance_list, GUINT_TO_POINTER(tag), gsidca_find_sx_with_tag)->data;
     if (insts == NULL)
@@ -214,9 +212,7 @@
     spec = xaccSchedXactionGetFreqSpec(insts->sx);
     info = g_string_sized_new(16);
     xaccFreqSpecGetFreqStr(spec, info);
-    info_str = info->str; // @fixme leaked... :/
-    g_string_free(info, FALSE);
-    return info_str;
+    return g_string_free(info, FALSE);
 }
 
 static gint
@@ -228,7 +224,7 @@
         = (GncSxInstances*)g_list_find_custom(adapter->instances->sx_instance_list, GUINT_TO_POINTER(tag), gsidca_find_sx_with_tag)->data;
     if (insts == NULL)
         return 0;
-    return g_list_length(insts->list);
+    return g_list_length(insts->instance_list);
 }
 
 static void
@@ -240,7 +236,7 @@
         = (GncSxInstances*)g_list_find_custom(adapter->instances->sx_instance_list, GUINT_TO_POINTER(tag), gsidca_find_sx_with_tag)->data;
     if (insts == NULL)
         return;
-    inst = (GncSxInstance*)g_list_nth_data(insts->list, instance_index);
+    inst = (GncSxInstance*)g_list_nth_data(insts->instance_list, instance_index);
     g_date_valid(&inst->date);
     *date = inst->date;
     g_date_valid(date);

Modified: gnucash/branches/gda-dev/src/gnome-utils/gnc-tree-model-account.c
===================================================================
--- gnucash/branches/gda-dev/src/gnome-utils/gnc-tree-model-account.c	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/src/gnome-utils/gnc-tree-model-account.c	2007-04-14 00:35:53 UTC (rev 15878)
@@ -84,7 +84,7 @@
     						    GtkTreeIter *child);
 
 /** Component Manager Callback ******************************************/
-static void gnc_tree_model_account_event_handler (QofEntity *entity,
+static void gnc_tree_model_account_event_handler (QofInstance *entity,
 						  QofEventId event_type,
 						  GncTreeModelAccount *model,
 						  GncEventData *ed);
@@ -1220,7 +1220,7 @@
  *  @param user_data A pointer to the account tree model.
  */
 static void
-gnc_tree_model_account_event_handler (QofEntity *entity,
+gnc_tree_model_account_event_handler (QofInstance *entity,
 				      QofEventId event_type,
 				      GncTreeModelAccount *model,
 				      GncEventData *ed)

Modified: gnucash/branches/gda-dev/src/gnome-utils/gnc-tree-model-budget.c
===================================================================
--- gnucash/branches/gda-dev/src/gnome-utils/gnc-tree-model-budget.c	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/src/gnome-utils/gnc-tree-model-budget.c	2007-04-14 00:35:53 UTC (rev 15878)
@@ -31,7 +31,7 @@
 #include "gnc-ui-util.h"
 
 /* Add the new budget object to the tree model.  */
-static void add_budget_to_model(QofEntity* data, gpointer user_data )
+static void add_budget_to_model(QofInstance* data, gpointer user_data )
 {
     GtkTreeIter iter;
     GncBudget* budget = GNC_BUDGET(data);

Modified: gnucash/branches/gda-dev/src/gnome-utils/gnc-tree-model-commodity.c
===================================================================
--- gnucash/branches/gda-dev/src/gnome-utils/gnc-tree-model-commodity.c	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/src/gnome-utils/gnc-tree-model-commodity.c	2007-04-14 00:35:53 UTC (rev 15878)
@@ -82,7 +82,7 @@
 static gboolean	gnc_tree_model_commodity_iter_parent (GtkTreeModel *tree_model,
 						      GtkTreeIter *iter,
     						      GtkTreeIter *child);
-static void gnc_tree_model_commodity_event_handler (QofEntity *entity,
+static void gnc_tree_model_commodity_event_handler (QofInstance *entity,
 						    QofEventId event_type,
 						    gpointer user_data,
 						    gpointer event_data);
@@ -1220,7 +1220,7 @@
  *  @param event_data A pointer to additional data about this event.
  */
 static void
-gnc_tree_model_commodity_event_handler (QofEntity *entity,
+gnc_tree_model_commodity_event_handler (QofInstance *entity,
 					QofEventId event_type,
 					gpointer user_data,
 					gpointer event_data)

Modified: gnucash/branches/gda-dev/src/gnome-utils/gnc-tree-model-price.c
===================================================================
--- gnucash/branches/gda-dev/src/gnome-utils/gnc-tree-model-price.c	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/src/gnome-utils/gnc-tree-model-price.c	2007-04-14 00:35:53 UTC (rev 15878)
@@ -101,7 +101,7 @@
 static gboolean	gnc_tree_model_price_iter_parent (GtkTreeModel *tree_model,
 						  GtkTreeIter *iter,
 						  GtkTreeIter *child);
-static void gnc_tree_model_price_event_handler (QofEntity *entity,
+static void gnc_tree_model_price_event_handler (QofInstance *entity,
 						QofEventId event_type,
 						gpointer user_data,
 						gpointer event_data);
@@ -712,7 +712,7 @@
 			break;
 		case GNC_TREE_MODEL_PRICE_COL_TYPE:
 			g_value_init (value, G_TYPE_STRING);
-			g_value_set_string (value, gnc_price_get_type (price));
+			g_value_set_string (value, gnc_price_get_typestr (price));
 			break;
 		case GNC_TREE_MODEL_PRICE_COL_VALUE:
 			g_value_init (value, G_TYPE_STRING);
@@ -1443,7 +1443,7 @@
  *  @param event_data A pointer to additional data about this event.
  */
 static void
-gnc_tree_model_price_event_handler (QofEntity *entity,
+gnc_tree_model_price_event_handler (QofInstance *entity,
 				    QofEventId event_type,
 				    gpointer user_data,
 				    gpointer event_data)

Modified: gnucash/branches/gda-dev/src/gnome-utils/gnc-tree-view-account.c
===================================================================
--- gnucash/branches/gda-dev/src/gnome-utils/gnc-tree-view-account.c	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/src/gnome-utils/gnc-tree-view-account.c	2007-04-14 00:35:53 UTC (rev 15878)
@@ -1002,6 +1002,8 @@
   g_return_val_if_fail (GTK_IS_TREE_MODEL_SORT(s_model), NULL);
   g_return_val_if_fail (s_iter != NULL, NULL);
 
+  ENTER("model %p, iter %p", s_model, s_iter);
+
   gtk_tree_model_sort_convert_iter_to_child_iter (GTK_TREE_MODEL_SORT(s_model),
 						  &f_iter,
 						  s_iter);

Modified: gnucash/branches/gda-dev/src/gnome-utils/gnc-tree-view-price.c
===================================================================
--- gnucash/branches/gda-dev/src/gnome-utils/gnc-tree-view-price.c	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/src/gnome-utils/gnc-tree-view-price.c	2007-04-14 00:35:53 UTC (rev 15878)
@@ -329,8 +329,8 @@
     return sort_ns_or_cm (f_model, f_iter_a, f_iter_b);
 
   /* sort by source first */
-  result = safe_utf8_collate (gnc_price_get_type (price_a),
-			      gnc_price_get_type (price_b));
+  result = safe_utf8_collate (gnc_price_get_typestr (price_a),
+			      gnc_price_get_typestr (price_b));
   if (result != 0)
     return result;
 

Modified: gnucash/branches/gda-dev/src/gnome-utils/gnc-tree-view.c
===================================================================
--- gnucash/branches/gda-dev/src/gnome-utils/gnc-tree-view.c	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/src/gnome-utils/gnc-tree-view.c	2007-04-14 00:35:53 UTC (rev 15878)
@@ -1363,8 +1363,12 @@
   /* Create the menu if we don't have one already */
   if (!priv->column_menu) {
     priv->column_menu = gtk_menu_new();
+#ifdef HAVE_GTK_2_10
+    g_object_ref_sink(priv->column_menu);
+#else
     g_object_ref(priv->column_menu);
     gtk_object_sink(GTK_OBJECT(priv->column_menu));
+#endif
   }
 
   /* Create the check menu item */

Modified: gnucash/branches/gda-dev/src/import-export/hbci/gnc-hbci-gettrans.c
===================================================================
--- gnucash/branches/gda-dev/src/import-export/hbci/gnc-hbci-gettrans.c	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/src/import-export/hbci/gnc-hbci-gettrans.c	2007-04-14 00:35:53 UTC (rev 15878)
@@ -39,6 +39,7 @@
 #include "dialog-hbcitrans.h"
 #include "gnc-hbci-kvp.h"
 #include "dialog-daterange.h"
+#include "import-utilities.h"
 
 /* static short module = MOD_IMPORT; */
 
@@ -261,11 +262,14 @@
   /* Create new gnucash transaction for the given hbci one */
   gnc_trans = xaccMallocTransaction(book);
   xaccTransBeginEdit(gnc_trans);
+    
+  {
+    /* OFX unique transaction ID */
+    const char *fitid = AB_Transaction_GetFiId(h_trans);
+    if (fitid && (strlen (fitid) > 0))
+      gnc_import_set_trans_online_id(gnc_trans, fitid);
+  }
 
-  /*if(data.fi_id_valid==true){
-    gnc_import_set_trans_online_id(gnc_trans, data.fi_id);
-    }*/
-
   normalDate = AB_Transaction_GetDate(h_trans);
   valutaDate = AB_Transaction_GetValutaDate(h_trans);
   if (normalDate && !valutaDate)

Modified: gnucash/branches/gda-dev/src/register/ledger-core/split-register.c
===================================================================
--- gnucash/branches/gda-dev/src/register/ledger-core/split-register.c	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/src/register/ledger-core/split-register.c	2007-04-14 00:35:53 UTC (rev 15878)
@@ -1353,7 +1353,7 @@
      return TRUE;
    }
 
-   ENTER ("save split is %p \n", split);
+   DEBUG ("save split is %p \n", split);
 
    if (!gnc_split_register_auto_calc (reg, split))
      return FALSE;

Modified: gnucash/branches/gda-dev/src/register/register-gnome/combocell-gnome.c
===================================================================
--- gnucash/branches/gda-dev/src/register/register-gnome/combocell-gnome.c	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/src/register/register-gnome/combocell-gnome.c	2007-04-14 00:35:53 UTC (rev 15878)
@@ -753,8 +753,12 @@
 		box->item_list = gnc_item_edit_new_list(box->item_edit, cell->shared_store);
 	else
 		box->item_list = gnc_item_edit_new_list(box->item_edit, box->tmp_store);
+#ifdef HAVE_GTK_2_10
+        g_object_ref_sink(box->item_list);
+#else
 	g_object_ref (box->item_list);
 	gtk_object_sink (GTK_OBJECT(box->item_list));
+#endif
 
 	/* to mark cell as realized, remove the realize method */
 	cell->cell.gui_realize = NULL;

Modified: gnucash/branches/gda-dev/src/register/register-gnome/datecell-gnome.c
===================================================================
--- gnucash/branches/gda-dev/src/register/register-gnome/datecell-gnome.c	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/src/register/register-gnome/datecell-gnome.c	2007-04-14 00:35:53 UTC (rev 15878)
@@ -549,8 +549,12 @@
   box->sheet = sheet;
   box->item_edit = item_edit;
   box->date_picker = gnc_item_edit_new_date_picker (box->item_edit);
+#ifdef HAVE_GTK_2_10
+  g_object_ref_sink(box->date_picker);
+#else
   g_object_ref (box->date_picker);
   gtk_object_sink (GTK_OBJECT(box->date_picker));
+#endif
 
   /* to mark cell as realized, remove the realize method */
   cell->cell.gui_realize = NULL;

Modified: gnucash/branches/gda-dev/src/register/register-gnome/gnucash-sheet.c
===================================================================
--- gnucash/branches/gda-dev/src/register/register-gnome/gnucash-sheet.c	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/src/register/register-gnome/gnucash-sheet.c	2007-04-14 00:35:53 UTC (rev 15878)
@@ -2408,8 +2408,12 @@
 
         /* The entry widget */
         sheet->entry = gtk_entry_new ();
+#ifdef HAVE_GTK_2_10
+        g_object_ref_sink(sheet->entry);
+#else
         g_object_ref(sheet->entry);
         gtk_object_sink(GTK_OBJECT(sheet->entry));
+#endif
 	/*gtk_layout_put (GTK_LAYOUT (sheet), sheet->entry, 0, 0);*/
 
         /* set up the editor */

Modified: gnucash/branches/gda-dev/src/scm/price-quotes.scm
===================================================================
--- gnucash/branches/gda-dev/src/scm/price-quotes.scm	2007-04-11 22:00:35 UTC (rev 15877)
+++ gnucash/branches/gda-dev/src/scm/price-quotes.scm	2007-04-14 00:35:53 UTC (rev 15878)
@@ -586,7 +586,7 @@
                   (gnc-price-set-currency gnc-price currency)
                   (gnc-price-set-time gnc-price gnc-time)
                   (gnc-price-set-source gnc-price "Finance::Quote")
-                  (gnc-price-set-type gnc-price price-type)
+                  (gnc-price-set-typestr gnc-price price-type)
                   (gnc-price-set-value gnc-price price)
 				  (gnc-price-commit-edit gnc-price)
                   gnc-price))))))



More information about the gnucash-changes mailing list