r15726 - gnucash/branches/gobject-engine-dev - Work around compile to get first milestone: Use GType as type system and Get Qof and engine depends on GObject

Daniel Espinosa esodan at cvs.gnucash.org
Thu Mar 15 17:33:11 EDT 2007


Author: esodan
Date: 2007-03-15 17:33:03 -0400 (Thu, 15 Mar 2007)
New Revision: 15726
Trac: http://svn.gnucash.org/trac/changeset/15726

Modified:
   gnucash/branches/gobject-engine-dev/ChangeLog
   gnucash/branches/gobject-engine-dev/ChangeLog.2005
   gnucash/branches/gobject-engine-dev/lib/libqof/backend/file/qof-backend-qsf.h
   gnucash/branches/gobject-engine-dev/lib/libqof/qof/qofbook.h
   gnucash/branches/gobject-engine-dev/lib/libqof/qof/qofbookmerge.c
   gnucash/branches/gobject-engine-dev/lib/libqof/qof/qofid.h
   gnucash/branches/gobject-engine-dev/lib/libqof/qof/qofinstance.c
   gnucash/branches/gobject-engine-dev/lib/libqof/qof/qofinstance.h
   gnucash/branches/gobject-engine-dev/lib/libqof/qof/qofobject.c
   gnucash/branches/gobject-engine-dev/lib/libqof/qof/qofobject.h
   gnucash/branches/gobject-engine-dev/lib/libqof/qof/qofquery.h
   gnucash/branches/gobject-engine-dev/lib/libqof/qof/qofsession.c
   gnucash/branches/gobject-engine-dev/lib/libqof/qof/qofsession.h
   gnucash/branches/gobject-engine-dev/lib/libqof/qof/qofsql.c
   gnucash/branches/gobject-engine-dev/lib/libqof/qof/qofsql.h
   gnucash/branches/gobject-engine-dev/src/app-utils/gnc-component-manager.c
   gnucash/branches/gobject-engine-dev/src/app-utils/gnc-component-manager.h
   gnucash/branches/gobject-engine-dev/src/app-utils/gnc-sx-instance-model.c
   gnucash/branches/gobject-engine-dev/src/app-utils/option-util.c
   gnucash/branches/gobject-engine-dev/src/backend/dwi/qofmap.c
   gnucash/branches/gobject-engine-dev/src/backend/file/gnc-backend-file.c
   gnucash/branches/gobject-engine-dev/src/backend/file/gnc-book-xml-v2.c
   gnucash/branches/gobject-engine-dev/src/backend/file/gnc-budget-xml-v2.c
   gnucash/branches/gobject-engine-dev/src/backend/file/gnc-freqspec-xml-v2.c
   gnucash/branches/gobject-engine-dev/src/backend/file/io-gncxml-v1.c
   gnucash/branches/gobject-engine-dev/src/backend/file/io-gncxml-v2.c
   gnucash/branches/gobject-engine-dev/src/backend/postgres/book.c
   gnucash/branches/gobject-engine-dev/src/backend/postgres/putil.h
   gnucash/branches/gobject-engine-dev/src/backend/postgres/table.m4
   gnucash/branches/gobject-engine-dev/src/business/business-core/gncAddress.c
   gnucash/branches/gobject-engine-dev/src/business/business-core/gncBillTermP.h
   gnucash/branches/gobject-engine-dev/src/business/business-core/gncCustomer.c
   gnucash/branches/gobject-engine-dev/src/business/business-core/gncCustomerP.h
   gnucash/branches/gobject-engine-dev/src/business/business-core/gncEmployee.c
   gnucash/branches/gobject-engine-dev/src/business/business-core/gncEmployee.h
   gnucash/branches/gobject-engine-dev/src/business/business-core/gncEmployeeP.h
   gnucash/branches/gobject-engine-dev/src/business/business-core/gncEntryP.h
   gnucash/branches/gobject-engine-dev/src/business/business-core/gncInvoice.c
   gnucash/branches/gobject-engine-dev/src/business/business-core/gncInvoiceP.h
   gnucash/branches/gobject-engine-dev/src/business/business-core/gncJob.c
   gnucash/branches/gobject-engine-dev/src/business/business-core/gncJobP.h
   gnucash/branches/gobject-engine-dev/src/business/business-core/gncOrder.c
   gnucash/branches/gobject-engine-dev/src/business/business-core/gncOrderP.h
   gnucash/branches/gobject-engine-dev/src/business/business-core/gncTaxTableP.h
   gnucash/branches/gobject-engine-dev/src/business/business-core/gncVendor.c
   gnucash/branches/gobject-engine-dev/src/business/business-core/gncVendorP.h
   gnucash/branches/gobject-engine-dev/src/business/business-gnome/gnc-plugin-business.c
   gnucash/branches/gobject-engine-dev/src/engine/Account.c
   gnucash/branches/gobject-engine-dev/src/engine/Account.h
   gnucash/branches/gobject-engine-dev/src/engine/FreqSpec.c
   gnucash/branches/gobject-engine-dev/src/engine/GNCId.h
   gnucash/branches/gobject-engine-dev/src/engine/Group.c
   gnucash/branches/gobject-engine-dev/src/engine/Group.h
   gnucash/branches/gobject-engine-dev/src/engine/Period.c
   gnucash/branches/gobject-engine-dev/src/engine/Query.c
   gnucash/branches/gobject-engine-dev/src/engine/SX-book.c
   gnucash/branches/gobject-engine-dev/src/engine/SX-book.h
   gnucash/branches/gobject-engine-dev/src/engine/SchedXaction.c
   gnucash/branches/gobject-engine-dev/src/engine/SchedXaction.h
   gnucash/branches/gobject-engine-dev/src/engine/SchedXactionP.h
   gnucash/branches/gobject-engine-dev/src/engine/Scrub.c
   gnucash/branches/gobject-engine-dev/src/engine/Scrub2.c
   gnucash/branches/gobject-engine-dev/src/engine/Scrub3.c
   gnucash/branches/gobject-engine-dev/src/engine/Split.c
   gnucash/branches/gobject-engine-dev/src/engine/Split.h
   gnucash/branches/gobject-engine-dev/src/engine/SplitP.h
   gnucash/branches/gobject-engine-dev/src/engine/Transaction.c
   gnucash/branches/gobject-engine-dev/src/engine/Transaction.h
   gnucash/branches/gobject-engine-dev/src/engine/TransactionP.h
   gnucash/branches/gobject-engine-dev/src/engine/cap-gains.c
   gnucash/branches/gobject-engine-dev/src/engine/engine-helpers.c
   gnucash/branches/gobject-engine-dev/src/engine/gnc-associate-account.c
   gnucash/branches/gobject-engine-dev/src/engine/gnc-budget.c
   gnucash/branches/gobject-engine-dev/src/engine/gnc-budget.h
   gnucash/branches/gobject-engine-dev/src/engine/gnc-commodity.c
   gnucash/branches/gobject-engine-dev/src/engine/gnc-engine.h
   gnucash/branches/gobject-engine-dev/src/engine/gnc-lot-p.h
   gnucash/branches/gobject-engine-dev/src/engine/gnc-lot.c
   gnucash/branches/gobject-engine-dev/src/engine/gnc-lot.h
   gnucash/branches/gobject-engine-dev/src/engine/gnc-pricedb-p.h
   gnucash/branches/gobject-engine-dev/src/engine/gnc-pricedb.c
   gnucash/branches/gobject-engine-dev/src/engine/gnc-pricedb.h
   gnucash/branches/gobject-engine-dev/src/engine/test/test-recursive.c
   gnucash/branches/gobject-engine-dev/src/engine/xlate.pl
   gnucash/branches/gobject-engine-dev/src/gnome-search/dialog-search.c
   gnucash/branches/gobject-engine-dev/src/gnome-search/gnc-general-search.c
   gnucash/branches/gobject-engine-dev/src/gnome-utils/account-quickfill.c
   gnucash/branches/gobject-engine-dev/src/gnome-utils/gnc-query-list.c
   gnucash/branches/gobject-engine-dev/src/gnome-utils/search-param.c
   gnucash/branches/gobject-engine-dev/src/gnome/dialog-chart-export.c
   gnucash/branches/gobject-engine-dev/src/gnome/dialog-chart-export.h
   gnucash/branches/gobject-engine-dev/src/gnome/top-level.c
Log:
Work around compile to get first milestone: Use GType as type system and Get Qof and engine depends on GObject

Modified: gnucash/branches/gobject-engine-dev/ChangeLog
===================================================================
--- gnucash/branches/gobject-engine-dev/ChangeLog	2007-03-15 07:30:19 UTC (rev 15725)
+++ gnucash/branches/gobject-engine-dev/ChangeLog	2007-03-15 21:33:03 UTC (rev 15726)
@@ -4868,8 +4868,8 @@
 	* qof/qof.h : Create reference group in doxygen and
 	export qofreference.h into the API.
 	* qof/qof/qofsession.c : Set QOF_TYPE_COLLECT as registered
-	type and move qof_entity_get_reference_from to new file.
-	* qof/qof/qofsession.h : Move qof_entity_get_reference_from
+	type and move qof_instanceget_reference_from to new file.
+	* qof/qof/qofsession.h : Move qof_instanceget_reference_from
 	to new file: qofreference.c|h.
 	* qof/qofreference.c : New file to handle reference related
 	code.

Modified: gnucash/branches/gobject-engine-dev/ChangeLog.2005
===================================================================
--- gnucash/branches/gobject-engine-dev/ChangeLog.2005	2007-03-15 07:30:19 UTC (rev 15725)
+++ gnucash/branches/gobject-engine-dev/ChangeLog.2005	2007-03-15 21:33:03 UTC (rev 15726)
@@ -4988,7 +4988,7 @@
 	QOF objects, whether or not any specific object exists in the book.
 	* src/engine/qofbackend.h: Adding a further QSF error code for
 	when a GUID string has been mangled and fails to convert to a GUID.
-	* src/engine/qofsession.c: Adding qof_entity_copy routines to
+	* src/engine/qofsession.c: Adding qof_instancecopy routines to
 	copy single, lists or collections of entities between session books.
 	Note: Each function creates a partial QofBook! Only certain backends
 	{QSF} can handle partial books! Use for data export.

Modified: gnucash/branches/gobject-engine-dev/lib/libqof/backend/file/qof-backend-qsf.h
===================================================================
--- gnucash/branches/gobject-engine-dev/lib/libqof/backend/file/qof-backend-qsf.h	2007-03-15 07:30:19 UTC (rev 15725)
+++ gnucash/branches/gobject-engine-dev/lib/libqof/backend/file/qof-backend-qsf.h	2007-03-15 21:33:03 UTC (rev 15726)
@@ -81,7 +81,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_instancecopy 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/gobject-engine-dev/lib/libqof/qof/qofbook.h
===================================================================
--- gnucash/branches/gobject-engine-dev/lib/libqof/qof/qofbook.h	2007-03-15 07:30:19 UTC (rev 15725)
+++ gnucash/branches/gobject-engine-dev/lib/libqof/qof/qofbook.h	2007-03-15 21:33:03 UTC (rev 15726)
@@ -223,8 +223,8 @@
 
 QofInstance* qof_book_get_element (QofBook *book, GType type, GUID *guid);
 
+#define qof_book_get_guid(b) qof_instance_get_guid(QOF_INSTANCE(b))
 
-
 #endif /* QOF_BOOK_H */
 /** @} */
 /** @} */

Modified: gnucash/branches/gobject-engine-dev/lib/libqof/qof/qofbookmerge.c
===================================================================
--- gnucash/branches/gobject-engine-dev/lib/libqof/qof/qofbookmerge.c	2007-03-15 07:30:19 UTC (rev 15725)
+++ gnucash/branches/gobject-engine-dev/lib/libqof/qof/qofbookmerge.c	2007-03-15 21:33:03 UTC (rev 15726)
@@ -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_instancerating 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.
 

Modified: gnucash/branches/gobject-engine-dev/lib/libqof/qof/qofid.h
===================================================================
--- gnucash/branches/gobject-engine-dev/lib/libqof/qof/qofid.h	2007-03-15 07:30:19 UTC (rev 15725)
+++ gnucash/branches/gobject-engine-dev/lib/libqof/qof/qofid.h	2007-03-15 21:33:03 UTC (rev 15726)
@@ -175,7 +175,7 @@
 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_instanceinsert_entity or ::qof_instanceremove_entity. 
 
 */
 gboolean qof_collection_add_element (QofCollection *coll, QofInstance *inst);
@@ -190,7 +190,7 @@
 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_instance_insert_entity
-or ::qof_entity_remove_entity.
+or ::qof_instanceremove_entity.
 
 */
 gboolean

Modified: gnucash/branches/gobject-engine-dev/lib/libqof/qof/qofinstance.c
===================================================================
--- gnucash/branches/gobject-engine-dev/lib/libqof/qof/qofinstance.c	2007-03-15 07:30:19 UTC (rev 15725)
+++ gnucash/branches/gobject-engine-dev/lib/libqof/qof/qofinstance.c	2007-03-15 21:33:03 UTC (rev 15726)
@@ -103,7 +103,8 @@
 enum
 {
         PROP_0,
-        PROP_BOOK
+        PROP_BOOK,
+        PROP_GUID
 };
 
 struct _QofInstanceSignal {
@@ -153,7 +154,10 @@
 					 g_param_spec_object ("book", NULL, _("Book"), QOF_TYPE_BOOK,
 							       								(G_PARAM_READABLE | G_PARAM_WRITABLE |
 																			G_PARAM_CONSTRUCT_ONLY)));
-
+  
+  g_object_class_install_property (object_class, PROP_GUID,
+					 g_param_spec_object ("guid", NULL, _("GUID"), QOF_TYPE_GUID,
+							       								(G_PARAM_READABLE | G_PARAM_WRITABLE)));
 	/* Create signals here:*/
 	
 	qof_instance_signals[COMMITED] =
@@ -253,6 +257,9 @@
   case PROP_BOOK:
   	g_value_set_object (value, obj->priv->book);
   	break;
+  case PROP_GUID:
+    g_value_set_boxed (value, obj->priv->guid);
+    break;
   default:
     /* We don't have any other property... */
     G_OBJECT_WARN_INVALID_PROPERTY_ID(object,property_id,pspec);
@@ -472,6 +479,18 @@
 	inst->priv->do_free = TRUE;
 }
 
+gboolean 
+qof_instance_get_do_free (QofInstance *inst)
+{
+  return inst->priv->do_free;
+}
+
+void
+qof_instance_set_do_free (QofInstance *inst, gboolean val)
+{
+  inst->priv->do_free = val;
+}
+
 /* ========================================================== */
 /* setters */
 

Modified: gnucash/branches/gobject-engine-dev/lib/libqof/qof/qofinstance.h
===================================================================
--- gnucash/branches/gobject-engine-dev/lib/libqof/qof/qofinstance.h	2007-03-15 07:30:19 UTC (rev 15725)
+++ gnucash/branches/gobject-engine-dev/lib/libqof/qof/qofinstance.h	2007-03-15 21:33:03 UTC (rev 15726)
@@ -133,13 +133,17 @@
 
 void qof_instance_mark_free(QofInstance *inst);
 
+gboolean qof_instance_get_do_free (QofInstance *inst);
+
+void     qof_instance_set_do_free (QofInstance *inst, gboolean val);
+
 QofInstance* qof_instance_create (GType type, QofBook *book);
 
 gboolean qof_instance_destroy (QofInstance *inst, GError **error);
 
 void qof_instance_release (QofInstance *instance);
 
-#define qof_entity_release(obj) qof_instance_release (QOF_INSTANCE (obj))
+#define qof_instancerelease(obj) qof_instance_release (QOF_INSTANCE (obj))
 
 /** 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

Modified: gnucash/branches/gobject-engine-dev/lib/libqof/qof/qofobject.c
===================================================================
--- gnucash/branches/gobject-engine-dev/lib/libqof/qof/qofobject.c	2007-03-15 07:30:19 UTC (rev 15725)
+++ gnucash/branches/gobject-engine-dev/lib/libqof/qof/qofobject.c	2007-03-15 21:33:03 UTC (rev 15726)
@@ -334,7 +334,7 @@
 
 static void foreach_backend (gpointer key, gpointer be_item, gpointer arg)
 {
-  GType data_type = GPOINTER_TO_INT(key);
+  const gchar *data_type =  (const gchar*) key;
   struct foreach_data *cb_data = arg;
 
   g_return_if_fail (key && be_item && arg);

Modified: gnucash/branches/gobject-engine-dev/lib/libqof/qof/qofobject.h
===================================================================
--- gnucash/branches/gobject-engine-dev/lib/libqof/qof/qofobject.h	2007-03-15 07:30:19 UTC (rev 15725)
+++ gnucash/branches/gobject-engine-dev/lib/libqof/qof/qofobject.h	2007-03-15 21:33:03 UTC (rev 15726)
@@ -64,7 +64,7 @@
 typedef struct _QofObject QofObject;
 typedef void (*QofForeachCB) (gpointer obj, gpointer user_data);
 typedef void (*QofForeachTypeCB) (QofObject *type, gpointer user_data);
-typedef void (*QofForeachBackendTypeCB) (QofIdTypeConst type,
+typedef void (*QofForeachBackendTypeCB) (const gchar *type,
                                       gpointer backend_data,
                                       gpointer user_data);
 

Modified: gnucash/branches/gobject-engine-dev/lib/libqof/qof/qofquery.h
===================================================================
--- gnucash/branches/gobject-engine-dev/lib/libqof/qof/qofquery.h	2007-03-15 07:30:19 UTC (rev 15725)
+++ gnucash/branches/gobject-engine-dev/lib/libqof/qof/qofquery.h	2007-03-15 21:33:03 UTC (rev 15726)
@@ -126,7 +126,7 @@
 /** \name Low-Level API Functions */
 // @{
 
-GSList * qof_query_build_param_list (char const *param, ...);
+GSList * qof_query_build_param_list (const gchar *param, ...);
 
 /** Create a new query.  
  *  Before running the query, a 'search-for' type must be set

Modified: gnucash/branches/gobject-engine-dev/lib/libqof/qof/qofsession.c
===================================================================
--- gnucash/branches/gobject-engine-dev/lib/libqof/qof/qofsession.c	2007-03-15 07:30:19 UTC (rev 15725)
+++ gnucash/branches/gobject-engine-dev/lib/libqof/qof/qofsession.c	2007-03-15 21:33:03 UTC (rev 15726)
@@ -306,7 +306,7 @@
 
 /* =============================================================== */
 
-typedef struct qof_entity_copy_data {
+typedef struct qof_instancecopy_data {
 	QofInstance *from;
 	QofInstance *to;
 	QofParam  *param;
@@ -342,7 +342,7 @@
 }
 
 static void
-qof_entity_param_cb(QofParam *param, gpointer data)
+qof_instanceparam_cb(QofParam *param, gpointer data)
 {
 	QofInstanceCopyData *qecd;
 
@@ -387,7 +387,7 @@
 }
 
 static void
-qof_entity_foreach_copy(gpointer data, gpointer user_data)
+qof_instanceforeach_copy(gpointer data, gpointer user_data)
 {
 	QofInstance          *importEnt, *targetEnt/*, *referenceEnt*/;
 	QofInstanceCopyData 	*context;
@@ -526,7 +526,7 @@
 }
 
 static gboolean
-qof_entity_guid_match(QofSession *new_session, QofInstance *original)
+qof_instanceguid_match(QofSession *new_session, QofInstance *original)
 {
 	QofInstance *copy;
 	const GUID *g;
@@ -547,7 +547,7 @@
 }
 
 static void
-qof_entity_list_foreach(gpointer data, gpointer user_data)
+qof_instancelist_foreach(gpointer data, gpointer user_data)
 {
 	QofInstanceCopyData *qecd;
 	QofInstance *original;
@@ -559,7 +559,7 @@
 	original = (QofInstance*)data;
 	g_return_if_fail(user_data != NULL);
 	qecd = (QofInstanceCopyData*)user_data;
-	if(qof_entity_guid_match(qecd->new_session, original)) { return; }
+	if(qof_instanceguid_match(qecd->new_session, original)) { return; }
 	qecd->from = original;
 	if(!qof_object_compliance(G_OBJECT_TYPE (G_OBJECT (original)), FALSE)) 
 	{
@@ -581,14 +581,14 @@
 		g_slist_free(qecd->param_list);
 		qecd->param_list = NULL;
 	}
-	qof_class_param_foreach(G_OBJECT_TYPE (G_OBJECT (original)), qof_entity_param_cb, qecd);
+	qof_class_param_foreach(G_OBJECT_TYPE (G_OBJECT (original)), qof_instanceparam_cb, qecd);
 	qof_begin_edit(inst);
-	g_slist_foreach(qecd->param_list, qof_entity_foreach_copy, qecd);
+	g_slist_foreach(qecd->param_list, qof_instanceforeach_copy, qecd);
 	qof_commit_edit(inst);
 }
 
 static void
-qof_entity_coll_foreach(QofInstance *original, gpointer user_data)
+qof_instancecoll_foreach(QofInstance *original, gpointer user_data)
 {
 	QofInstanceCopyData *qecd;
 	const GUID *g;
@@ -607,7 +607,7 @@
 }
 
 static void
-qof_entity_coll_copy(QofInstance *original, gpointer user_data)
+qof_instancecoll_copy(QofInstance *original, gpointer user_data)
 {
 	QofInstanceCopyData *qecd;
 	QofBook *book;
@@ -624,19 +624,19 @@
 	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_instanceforeach_copy, qecd);
 	qof_commit_edit(inst);
 }
 
 gboolean 
-qof_entity_copy_to_session(QofSession* new_session, QofInstance* original)
+qof_instancecopy_to_session(QofSession* new_session, QofInstance* original)
 {
 	QofInstanceCopyData qecd;
 	QofInstance *inst;
 	QofBook *book;
 
 	if(!new_session || !original) { return FALSE; }
-	if(qof_entity_guid_match(new_session, original)) { return FALSE; }
+	if(qof_instanceguid_match(new_session, original)) { return FALSE; }
 	if(!qof_object_compliance(G_OBJECT_TYPE (G_OBJECT (original)), TRUE)) { return FALSE; }
 	qof_event_suspend();
 	qecd.param_list = NULL;
@@ -648,16 +648,16 @@
 	qecd.from = original;
 	qof_instance_set_guid(qecd.to, qof_instance_get_guid(original));
 	qof_begin_edit(inst);
-	qof_class_param_foreach(G_OBJECT_TYPE (G_OBJECT (original)), qof_entity_param_cb, &qecd);
+	qof_class_param_foreach(G_OBJECT_TYPE (G_OBJECT (original)), qof_instanceparam_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_instanceforeach_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_instancecopy_list(QofSession *new_session, GList *entity_list)
 {
 	QofInstanceCopyData *qecd;
 
@@ -668,7 +668,7 @@
 	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_instancelist_foreach, qecd);
 	qof_event_resume();
 	if(qecd->error) 
 	{ 
@@ -680,7 +680,7 @@
 }
 
 gboolean 
-qof_entity_copy_coll(QofSession *new_session, QofCollection *entity_coll)
+qof_instancecopy_coll(QofSession *new_session, QofCollection *entity_coll)
 {
 	QofInstanceCopyData qecd;
 
@@ -690,10 +690,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_instancecoll_foreach, &qecd);
 	qof_class_param_foreach(qof_collection_get_g_type(entity_coll), 
-		qof_entity_param_cb, &qecd);
-	qof_collection_foreach(entity_coll, qof_entity_coll_copy, &qecd);
+		qof_instanceparam_cb, &qecd);
+	qof_collection_foreach(entity_coll, qof_instancecoll_copy, &qecd);
 	if(qecd.param_list != NULL) { g_slist_free(qecd.param_list); }
 	qof_event_resume();
 	return TRUE;
@@ -715,7 +715,7 @@
 	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_instancecopy_to_session(store->session, ent);
 	if(store->success) {
 	store->ent_list = g_list_append(store->ent_list, ent);
 	}
@@ -760,7 +760,7 @@
 		ref_ent = (QofInstance*)ref_param->param_getfcn(ent, ref_param);
 		if((ref_ent)&&(G_OBJECT_TYPE (G_OBJECT (ref_ent))))
 		{
-			store->success = qof_entity_copy_to_session(session, ref_ent);
+			store->success = qof_instancecopy_to_session(session, ref_ent);
 			if(store->success) { ent_list = g_list_append(ent_list, ref_ent); }
 		}
 	}
@@ -777,7 +777,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_instancecopy_to_session(session, ref_ent);
 				if(success) { child_list = g_list_append(child_list, ref_ent); }
 			}
 		}
@@ -795,14 +795,14 @@
 			child_ent = ref_param->param_getfcn(ref_ent, ref_param);
 			if(child_ent != NULL)
 			{
-				qof_entity_copy_to_session(session, child_ent);
+				qof_instancecopy_to_session(session, child_ent);
 			}
 		}
 	}
 }
 
 gboolean
-qof_entity_copy_coll_r(QofSession *new_session, QofCollection *coll)
+qof_instancecopy_coll_r(QofSession *new_session, QofCollection *coll)
 {
 	struct recurse_s store;
 	gboolean success;
@@ -813,12 +813,12 @@
 	store.success = success;
 	store.ent_list = NULL;
 	store.ref_list = qof_class_get_referenceList(qof_collection_get_g_type(coll));
-	success = qof_entity_copy_coll(new_session, coll);
+	success = qof_instancecopy_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, QofInstance *ent)
+gboolean qof_instancecopy_one_r(QofSession *new_session, QofInstance *ent)
 {
 	struct recurse_s store;
 	QofCollection *coll;
@@ -829,7 +829,7 @@
 	success = TRUE;
 	store.success = success;
 	store.ref_list = qof_class_get_referenceList(G_OBJECT_TYPE (G_OBJECT (ent)));
-	success = qof_entity_copy_to_session(new_session, ent);
+	success = qof_instancecopy_to_session(new_session, ent);
 	if(success == TRUE) {
 		coll = qof_book_get_collection(qof_session_get_book(new_session), G_OBJECT_TYPE (G_OBJECT (ent)));
 		if(coll) { qof_collection_foreach(coll, recurse_ent_cb, &store); }

Modified: gnucash/branches/gobject-engine-dev/lib/libqof/qof/qofsession.h
===================================================================
--- gnucash/branches/gobject-engine-dev/lib/libqof/qof/qofsession.h	2007-03-15 07:30:19 UTC (rev 15725)
+++ gnucash/branches/gobject-engine-dev/lib/libqof/qof/qofsession.h	2007-03-15 21:33:03 UTC (rev 15726)
@@ -292,7 +292,7 @@
 with the same GUID already, otherwise TRUE.
 */
 
-gboolean qof_entity_copy_to_session(QofSession* new_session, QofInstance* original);
+gboolean qof_instancecopy_to_session(QofSession* new_session, QofInstance* original);
 
 /** @brief Copy a GList of entities to another session
 
@@ -312,7 +312,7 @@
 with the same GUID. Otherwise TRUE.
 
 */
-gboolean qof_entity_copy_list(QofSession *new_session, GList *entity_list);
+gboolean qof_instancecopy_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_instancecopy_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_instancecopy_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
@@ -358,7 +358,7 @@
 
 */
 gboolean
-qof_entity_copy_coll_r(QofSession *new_session, QofCollection *coll);
+qof_instancecopy_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_instancecopy_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, QofInstance *ent);
+qof_instancecopy_one_r(QofSession *new_session, QofInstance *ent);
 
 /** @} 
 */

Modified: gnucash/branches/gobject-engine-dev/lib/libqof/qof/qofsql.c
===================================================================
--- gnucash/branches/gobject-engine-dev/lib/libqof/qof/qofsql.c	2007-03-15 07:30:19 UTC (rev 15725)
+++ gnucash/branches/gobject-engine-dev/lib/libqof/qof/qofsql.c	2007-03-15 21:33:03 UTC (rev 15726)
@@ -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_instanceget_reference_from(qsf_ent, cm_param);
 			if(reference) {
 				params->referenceList = g_list_append(params->referenceList, reference);
 			}

Modified: gnucash/branches/gobject-engine-dev/lib/libqof/qof/qofsql.h
===================================================================
--- gnucash/branches/gobject-engine-dev/lib/libqof/qof/qofsql.h	2007-03-15 07:30:19 UTC (rev 15725)
+++ gnucash/branches/gobject-engine-dev/lib/libqof/qof/qofsql.h	2007-03-15 21:33:03 UTC (rev 15726)
@@ -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_instancecopy_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.

Modified: gnucash/branches/gobject-engine-dev/src/app-utils/gnc-component-manager.c
===================================================================
--- gnucash/branches/gobject-engine-dev/src/app-utils/gnc-component-manager.c	2007-03-15 07:30:19 UTC (rev 15725)
+++ gnucash/branches/gobject-engine-dev/src/app-utils/gnc-component-manager.c	2007-03-15 21:33:03 UTC (rev 15726)
@@ -230,7 +230,7 @@
 }
 
 static void
-add_event_type (ComponentEventInfo *cei, GNCIdTypeConst entity_type,
+add_event_type (ComponentEventInfo *cei, QofIdTypeConst entity_type,
                 QofEventId event_mask, gboolean or_in)
 {
   QofEventId *mask;
@@ -239,11 +239,11 @@
   g_return_if_fail (cei->event_masks);
   g_return_if_fail (entity_type);
 
-  mask = g_hash_table_lookup (cei->event_masks, entity_type);
+  mask = g_hash_table_lookup (cei->event_masks, GINT_TO_POINTER (entity_type));
   if (!mask)
   {
     mask = g_new0 (QofEventId, 1);
-    g_hash_table_insert (cei->event_masks, entity_type, mask);
+    g_hash_table_insert (cei->event_masks, GINT_TO_POINTER (entity_type), mask);
   }
 
   if (or_in)
@@ -265,7 +265,7 @@
 #endif
   add_event (&changes, guid, event_type, TRUE);
 
-  if (QOF_CHECK_TYPE(entity, GNC_ID_SPLIT))
+  if (G_OBJECT_TYPE (entity ) == GNC_ID_SPLIT)
   {
     /* split events are never generated by the engine, but might
      * be generated by a backend (viz. the postgres backend.)
@@ -476,7 +476,7 @@
 
 void
 gnc_gui_component_watch_entity_type (gint component_id,
-                                     GNCIdTypeConst entity_type,
+                                     QofIdTypeConst entity_type,
                                      QofEventId event_mask)
 {
   ComponentInfo *ci;
@@ -606,11 +606,11 @@
 match_type_helper (gpointer key, gpointer value, gpointer user_data)
 {
   ComponentEventInfo *cei = user_data;
-  GNCIdType id_type = key;
+  QofIdType id_type = GPOINTER_TO_INT (key);
   QofEventId * et = value;
   QofEventId * et_2;
 
-  et_2 = g_hash_table_lookup (cei->event_masks, id_type);
+  et_2 = g_hash_table_lookup (cei->event_masks, GINT_TO_POINTER (id_type));
   if (!et_2)
     return;
 

Modified: gnucash/branches/gobject-engine-dev/src/app-utils/gnc-component-manager.h
===================================================================
--- gnucash/branches/gobject-engine-dev/src/app-utils/gnc-component-manager.h	2007-03-15 07:30:19 UTC (rev 15725)
+++ gnucash/branches/gobject-engine-dev/src/app-utils/gnc-component-manager.h	2007-03-15 21:33:03 UTC (rev 15726)
@@ -196,7 +196,7 @@
  *               setting the mask to 0 turns off watching for the entity type
  */
 void gnc_gui_component_watch_entity_type (gint component_id,
-                                          GNCIdTypeConst entity_type,
+                                          QofIdTypeConst entity_type,
                                           QofEventId event_mask);
 
 /* gnc_gui_get_entity_events

Modified: gnucash/branches/gobject-engine-dev/src/app-utils/gnc-sx-instance-model.c
===================================================================
--- gnucash/branches/gobject-engine-dev/src/app-utils/gnc-sx-instance-model.c	2007-03-15 07:30:19 UTC (rev 15725)
+++ gnucash/branches/gobject-engine-dev/src/app-utils/gnc-sx-instance-model.c	2007-03-15 21:33:03 UTC (rev 15726)
@@ -595,15 +595,15 @@
      //   (gnc_collection_get_schedxaction_list(book), GNC_EVENT_ITEM_REMOVED)
      //   (GNC_IS_SX(ent), QOF_EVENT_MODIFIED)
      // } */
-     if (!(GNC_IS_SX(ent) || GNC_IS_SXES(ent)))
+     if (!(GNC_IS_SCHEDULE_ACTION (ent) || GNC_IS_SCHEDULE_ACTIONS (ent)))
           return;
 
-     if (GNC_IS_SX(ent))
+     if (GNC_IS_SCHEDULE_ACTION(ent))
      {
           SchedXaction *sx;
           gboolean sx_is_in_model = FALSE;
 
-          sx = GNC_SX(ent);
+          sx = GNC_SCHEDULE_ACTION(ent);
           // only send `updated` if it's actually in the model
           sx_is_in_model = (g_list_find_custom(instances->sx_instance_list, sx, (GCompareFunc)_gnc_sx_instance_find_by_sx) != NULL);
           if (sx_is_in_model && event_type & QOF_EVENT_MODIFY)
@@ -612,10 +612,10 @@
           }
           /* else { unsupported event type; ignore } */
      }
-     else if (GNC_IS_SXES(ent))
+     else if (GNC_SCHEDULE_ACTIONS (ent))
      {
-          SchedXactions *sxes = GNC_SXES(ent);
-          SchedXaction *sx = GNC_SX(evt_data);
+          SchedXactions *sxes = GNC_SCHEDULE_ACTIONS (ent);
+          SchedXaction *sx = GNC_SCHEDULE_ACTION (evt_data);
 
           sxes = NULL;
           if (event_type & GNC_EVENT_ITEM_REMOVED)

Modified: gnucash/branches/gobject-engine-dev/src/app-utils/option-util.c
===================================================================
--- gnucash/branches/gobject-engine-dev/src/app-utils/option-util.c	2007-03-15 07:30:19 UTC (rev 15725)
+++ gnucash/branches/gobject-engine-dev/src/app-utils/option-util.c	2007-03-15 21:33:03 UTC (rev 15726)
@@ -2803,9 +2803,9 @@
 {
     GList *list;
     init_table();
-    list = g_hash_table_lookup(kvp_registry, id_type);
+    list = g_hash_table_lookup(kvp_registry, GINT_TO_POINTER (id_type));
     list = g_list_prepend(list, generator);
-    g_hash_table_insert(kvp_registry, (gpointer) id_type, list);
+    g_hash_table_insert(kvp_registry, GINT_TO_POINTER (id_type), list);
     scm_gc_protect_object(generator);
 }
 
@@ -2819,7 +2819,7 @@
     SCM options = SCM_UNDEFINED;
 
     init_table();
-    list = g_hash_table_lookup(kvp_registry, id_type);
+    list = g_hash_table_lookup(kvp_registry, GINT_TO_POINTER (id_type));
     gnc_new_options = scm_c_eval_string("gnc:new-options");
     options = scm_call_0(gnc_new_options);
 

Modified: gnucash/branches/gobject-engine-dev/src/backend/dwi/qofmap.c
===================================================================
--- gnucash/branches/gobject-engine-dev/src/backend/dwi/qofmap.c	2007-03-15 07:30:19 UTC (rev 15725)
+++ gnucash/branches/gobject-engine-dev/src/backend/dwi/qofmap.c	2007-03-15 21:33:03 UTC (rev 15726)
@@ -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,7 +376,7 @@
 
 	/* See if we got something back from the DB */
 	QofCollection *col;
-	col = qof_book_get_collection (qm->tmp_book, QOF_ENTITY(inst)->e_type);
+	col = qof_book_get_collection (qm->tmp_book, QOF_INSTANCE(inst)->e_type);
 	QofEntity * db_ent = qof_collection_lookup_entity (col, guid);
 	QofInstance *db_inst = QOF_INSTANCE(db_ent);
 

Modified: gnucash/branches/gobject-engine-dev/src/backend/file/gnc-backend-file.c
===================================================================
--- gnucash/branches/gobject-engine-dev/src/backend/file/gnc-backend-file.c	2007-03-15 07:30:19 UTC (rev 15725)
+++ gnucash/branches/gobject-engine-dev/src/backend/file/gnc-backend-file.c	2007-03-15 21:33:03 UTC (rev 15726)
@@ -804,7 +804,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/gobject-engine-dev/src/backend/file/gnc-book-xml-v2.c
===================================================================
--- gnucash/branches/gobject-engine-dev/src/backend/file/gnc-book-xml-v2.c	2007-03-15 07:30:19 UTC (rev 15725)
+++ gnucash/branches/gobject-engine-dev/src/backend/file/gnc-book-xml-v2.c	2007-03-15 21:33:03 UTC (rev 15726)
@@ -181,7 +181,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/gobject-engine-dev/src/backend/file/gnc-budget-xml-v2.c
===================================================================
--- gnucash/branches/gobject-engine-dev/src/backend/file/gnc-budget-xml-v2.c	2007-03-15 07:30:19 UTC (rev 15725)
+++ gnucash/branches/gobject-engine-dev/src/backend/file/gnc-budget-xml-v2.c	2007-03-15 21:33:03 UTC (rev 15726)
@@ -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/gobject-engine-dev/src/backend/file/gnc-freqspec-xml-v2.c
===================================================================
--- gnucash/branches/gobject-engine-dev/src/backend/file/gnc-freqspec-xml-v2.c	2007-03-15 07:30:19 UTC (rev 15725)
+++ gnucash/branches/gobject-engine-dev/src/backend/file/gnc-freqspec-xml-v2.c	2007-03-15 21:33:03 UTC (rev 15726)
@@ -157,7 +157,7 @@
         ret = xmlNewNode( NULL, BAD_CAST "gnc:freqspec" );
         xmlSetProp( ret, BAD_CAST "version", BAD_CAST freqspec_version_string );
 
-        xmlAddChild( ret, guid_to_dom_tree( "fs:id", &fs->entity.guid ) );
+        xmlAddChild( ret, guid_to_dom_tree( "fs:id", qof_instance_get_guid (QOF_INSTANCE (fs))));
 
         xmlSub = text_to_dom_tree( "fs:ui_type",
                                    uiFreqTypeStrs[ xaccFreqSpecGetUIType(fs) ].str );
@@ -527,7 +527,7 @@
         fsParseData *fspd = data;
         GUID        *guid;
         guid = dom_tree_to_guid( node );
-        fspd->fs->entity.guid = *guid;
+        qof_instance_set_guid (QOF_INSTANCE (fspd), guid);
         return TRUE;
 }
 

Modified: gnucash/branches/gobject-engine-dev/src/backend/file/io-gncxml-v1.c
===================================================================
--- gnucash/branches/gobject-engine-dev/src/backend/file/io-gncxml-v1.c	2007-03-15 07:30:19 UTC (rev 15725)
+++ gnucash/branches/gobject-engine-dev/src/backend/file/io-gncxml-v1.c	2007-03-15 21:33:03 UTC (rev 15726)
@@ -1377,8 +1377,9 @@
   if(strcmp(child_result->tag, "slots") == 0) {
     kvp_frame *f = (kvp_frame *) child_result->data;
     g_return_val_if_fail(f, FALSE);
-    if(a->inst.kvp_data) kvp_frame_delete(a->inst.kvp_data);
-    a->inst.kvp_data = f;
+    if(qof_instance_get_kvp_data (QOF_INSTANCE (a))) 
+          qof_instance_delete_kvp_data (QOF_INSTANCE (a));
+    qof_instance_set_kvp_data (QOF_INSTANCE (a), f);
     child_result->should_cleanup = FALSE;
   }
   else if(strcmp(child_result->tag, "currency") == 0) {
@@ -3112,8 +3113,9 @@
   if(strcmp(child_result->tag, "slots") == 0) {
     kvp_frame *f = (kvp_frame *) child_result->data;
     g_return_val_if_fail(f, FALSE);
-    if(s->inst.kvp_data) kvp_frame_delete(s->inst.kvp_data);
-    s->inst.kvp_data = f;
+    if(qof_instance_get_kvp_data (QOF_INSTANCE (s))) 
+            qof_instance_delete_kvp_data (QOF_INSTANCE (s));
+    qof_instance_set_kvp_data (QOF_INSTANCE (s), f);
     child_result->should_cleanup = FALSE;
   }
   else if(strcmp(child_result->tag, "quantity") == 0) {

Modified: gnucash/branches/gobject-engine-dev/src/backend/file/io-gncxml-v2.c
===================================================================
--- gnucash/branches/gobject-engine-dev/src/backend/file/io-gncxml-v2.c	2007-03-15 07:30:19 UTC (rev 15725)
+++ gnucash/branches/gobject-engine-dev/src/backend/file/io-gncxml-v2.c	2007-03-15 21:33:03 UTC (rev 15726)
@@ -305,12 +305,12 @@
 }
 
 static void
-do_counter_cb (const char *type, gpointer data_p, gpointer be_data_p)
+do_counter_cb (const gchar *type, gpointer data_p, gpointer be_data_p)
 {
   GncXmlDataType_t *data = data_p;
   struct file_backend *be_data = be_data_p;
 
-  g_return_if_fail (type && data && be_data);
+  g_return_if_fail (type != G_TYPE_INVALID && data && be_data);
   g_return_if_fail (data->version == GNC_FILE_BACKEND_VERS);
 
   if (be_data->ok == TRUE)

Modified: gnucash/branches/gobject-engine-dev/src/backend/postgres/book.c
===================================================================
--- gnucash/branches/gobject-engine-dev/src/backend/postgres/book.c	2007-03-15 07:30:19 UTC (rev 15725)
+++ gnucash/branches/gobject-engine-dev/src/backend/postgres/book.c	2007-03-15 21:33:03 UTC (rev 15726)
@@ -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 ((QofInstance*)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 ((QofInstance*)book, &guid);
    }
 
    if((DB_GET_VAL("book_open",j))[0] == 'n')

Modified: gnucash/branches/gobject-engine-dev/src/backend/postgres/putil.h
===================================================================
--- gnucash/branches/gobject-engine-dev/src/backend/postgres/putil.h	2007-03-15 07:30:19 UTC (rev 15725)
+++ gnucash/branches/gobject-engine-dev/src/backend/postgres/putil.h	2007-03-15 21:33:03 UTC (rev 15726)
@@ -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(QOF_INSTANCE (book)), &book_guid)) break; \
          book = NULL;                                            \
       }                                                          \
       if (!book) return data;                                    \

Modified: gnucash/branches/gobject-engine-dev/src/backend/postgres/table.m4
===================================================================
--- gnucash/branches/gobject-engine-dev/src/backend/postgres/table.m4	2007-03-15 07:30:19 UTC (rev 15725)
+++ gnucash/branches/gobject-engine-dev/src/backend/postgres/table.m4	2007-03-15 21:33:03 UTC (rev 15726)
@@ -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*)xaccAccountGetBook(ptr)),
+       bookGUID,       , GUID *, qof_instance_get_guid(QOF_INSTANCE (xaccAccountGetBook(ptr))),
        parentGUID,     , GUID *, xaccAccountGetGUID(xaccAccountGetParentAccount(ptr)),
        accountGUID, KEY, GUID *, xaccAccountGetGUID(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/gobject-engine-dev/src/business/business-core/gncAddress.c
===================================================================
--- gnucash/branches/gobject-engine-dev/src/business/business-core/gncAddress.c	2007-03-15 07:30:19 UTC (rev 15725)
+++ gnucash/branches/gobject-engine-dev/src/business/business-core/gncAddress.c	2007-03-15 21:33:03 UTC (rev 15726)
@@ -267,7 +267,7 @@
 {
   if (!addr) return;
 
-  qof_event_gen (QOF_ENTITY (addr), QOF_EVENT_DESTROY, NULL);
+  qof_event_gen (QOF_INSTANCE (addr), QOF_EVENT_DESTROY, NULL);
 
   CACHE_REMOVE (addr->priv->name);
   CACHE_REMOVE (addr->priv->addr1);

Modified: gnucash/branches/gobject-engine-dev/src/business/business-core/gncBillTermP.h
===================================================================
--- gnucash/branches/gobject-engine-dev/src/business/business-core/gncBillTermP.h	2007-03-15 07:30:19 UTC (rev 15725)
+++ gnucash/branches/gobject-engine-dev/src/business/business-core/gncBillTermP.h	2007-03-15 21:33:03 UTC (rev 15726)
@@ -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/gobject-engine-dev/src/business/business-core/gncCustomer.c
===================================================================
--- gnucash/branches/gobject-engine-dev/src/business/business-core/gncCustomer.c	2007-03-15 07:30:19 UTC (rev 15725)
+++ gnucash/branches/gobject-engine-dev/src/business/business-core/gncCustomer.c	2007-03-15 21:33:03 UTC (rev 15726)
@@ -240,16 +240,16 @@
   cust->priv->id = CACHE_INSERT ("");
   cust->priv->name = CACHE_INSERT ("");
   cust->priv->notes = CACHE_INSERT ("");
-  cust->priv->addr = gncAddressCreate (book, QOF_ENTITY (cust));
+  cust->priv->addr = gncAddressCreate (book, QOF_INSTANCE (cust));
   cust->priv->taxincluded = GNC_TAXINCLUDED_USEGLOBAL;
   cust->priv->active = TRUE;
   cust->priv->jobs = NULL;
 
   cust->priv->discount = gnc_numeric_zero();
   cust->priv->credit = gnc_numeric_zero();
-  cust->priv->shipaddr = gncAddressCreate (book, QOF_ENTITY (cust));
+  cust->priv->shipaddr = gncAddressCreate (book, QOF_INSTANCE (cust));
 
-  qof_event_gen (QOF_ENTITY (cust), QOF_EVENT_CREATE, NULL);
+  qof_event_gen (QOF_INSTANCE (cust), QOF_EVENT_CREATE, NULL);
 
   return cust;
 }
@@ -275,8 +275,8 @@
   cust->priv->active = from->active;
   cust->priv->taxtable_override = from->taxtable_override;
 
-  cust->priv->addr = gncCloneAddress (from->addr, QOF_ENTITY (cust), book);
-  cust->priv->shipaddr = gncCloneAddress (from->shipaddr, QOF_ENTITY (cust), book);
+  cust->priv->addr = gncCloneAddress (from->addr, QOF_INSTANCE (cust), book);
+  cust->priv->shipaddr = gncCloneAddress (from->shipaddr, QOF_INSTANCE (cust), book);
 
   /* Find the matching currency in the new book, assumes
    * currency has already been copied into new book. */
@@ -293,7 +293,7 @@
     cust->priv->jobs = g_list_prepend(cust->priv->jobs, job);
   }
 
-  qof_event_gen (QOF_ENTITY (cust), QOF_EVENT_CREATE, NULL);
+  qof_event_gen (QOF_INSTANCE (cust), QOF_EVENT_CREATE, NULL);
 
   return cust;
 }
@@ -310,7 +310,7 @@
 {
   if (!cust) return;
 
-  qof_event_gen (QOF_ENTITY (cust), QOF_EVENT_DESTROY, NULL);
+  qof_event_gen (QOF_INSTANCE (cust), QOF_EVENT_DESTROY, NULL);
 
   CACHE_REMOVE (cust->priv->id);
   CACHE_REMOVE (cust->priv->name);
@@ -483,7 +483,7 @@
     cust->priv->jobs = g_list_insert_sorted (cust->priv->jobs, job,
                                        (GCompareFunc)gncJobCompare);
 
-  qof_event_gen (QOF_ENTITY (cust), QOF_EVENT_MODIFY, NULL);
+  qof_event_gen (QOF_INSTANCE (cust), QOF_EVENT_MODIFY, NULL);
 }
 
 void gncCustomerRemoveJob (GncCustomer *cust, GncJob *job)
@@ -500,7 +500,7 @@
     cust->priv->jobs = g_list_remove_link (cust->priv->jobs, node);
     g_list_free_1 (node);
   }
-  qof_event_gen (QOF_ENTITY (cust), QOF_EVENT_MODIFY, NULL);
+  qof_event_gen (QOF_INSTANCE (cust), QOF_EVENT_MODIFY, NULL);
 }
 
 void gncCustomerBeginEdit (GncCustomer *cust)

Modified: gnucash/branches/gobject-engine-dev/src/business/business-core/gncCustomerP.h
===================================================================
--- gnucash/branches/gobject-engine-dev/src/business/business-core/gncCustomerP.h	2007-03-15 07:30:19 UTC (rev 15725)
+++ gnucash/branches/gobject-engine-dev/src/business/business-core/gncCustomerP.h	2007-03-15 21:33:03 UTC (rev 15726)
@@ -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/gobject-engine-dev/src/business/business-core/gncEmployee.c
===================================================================
--- gnucash/branches/gobject-engine-dev/src/business/business-core/gncEmployee.c	2007-03-15 07:30:19 UTC (rev 15725)
+++ gnucash/branches/gobject-engine-dev/src/business/business-core/gncEmployee.c	2007-03-15 21:33:03 UTC (rev 15726)
@@ -183,7 +183,7 @@
 void mark_employee (GncEmployee *employee)
 {
   qof_instance_set_dirty(QOF_INSTANCE (employee));
-  qof_event_gen (QOF_ENTITY (employee), QOF_EVENT_MODIFY, NULL);
+  qof_event_gen (QOF_INSTANCE (employee), QOF_EVENT_MODIFY, NULL);
 }
 
 /* ============================================================== */
@@ -204,12 +204,12 @@
   employee->priv->username = CACHE_INSERT ("");
   employee->priv->language = CACHE_INSERT ("");
   employee->priv->acl = CACHE_INSERT ("");
-  employee->priv->addr = gncAddressCreate (book, QOF_ENTITY (employee));
+  employee->priv->addr = gncAddressCreate (book, QOF_INSTANCE (employee));
   employee->priv->workday = gnc_numeric_zero();
   employee->priv->rate = gnc_numeric_zero();
   employee->priv->active = TRUE;
   
-  qof_event_gen (QOF_ENTITY (employee), QOF_EVENT_CREATE, NULL);
+  qof_event_gen (QOF_INSTANCE (employee), QOF_EVENT_CREATE, NULL);
 
   return employee;
 }
@@ -225,7 +225,7 @@
 {
   if (!employee) return;
 
-  qof_event_gen (QOF_ENTITY (employee), QOF_EVENT_DESTROY, NULL);
+  qof_event_gen (QOF_INSTANCE (employee), QOF_EVENT_DESTROY, NULL);
 
   CACHE_REMOVE (employee->priv->id);
   CACHE_REMOVE (employee->priv->username);
@@ -250,7 +250,7 @@
   employee->priv->username = CACHE_INSERT (from->username);
   employee->priv->language = CACHE_INSERT (from->language);
   employee->priv->acl = CACHE_INSERT (from->acl);
-  employee->priv->addr = gncCloneAddress (from->addr, QOF_ENTITY (employee), book);
+  employee->priv->addr = gncCloneAddress (from->addr, QOF_INSTANCE (employee), book);
   employee->priv->workday = from->workday;
   employee->priv->rate = from->rate;
   employee->priv->active = from->active;
@@ -258,7 +258,7 @@
   employee->priv->ccard_acc = 
      GNC_ACCOUNT(qof_instance_lookup_twin(QOF_INSTANCE(from->ccard_acc), book));
   
-  qof_event_gen (QOF_ENTITY (employee), QOF_EVENT_CREATE, NULL);
+  qof_event_gen (QOF_INSTANCE (employee), QOF_EVENT_CREATE, NULL);
 
   return employee;
 }

Modified: gnucash/branches/gobject-engine-dev/src/business/business-core/gncEmployee.h
===================================================================
--- gnucash/branches/gobject-engine-dev/src/business/business-core/gncEmployee.h	2007-03-15 07:30:19 UTC (rev 15725)
+++ gnucash/branches/gobject-engine-dev/src/business/business-core/gncEmployee.h	2007-03-15 21:33:03 UTC (rev 15726)
@@ -127,9 +127,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/gobject-engine-dev/src/business/business-core/gncEmployeeP.h
===================================================================
--- gnucash/branches/gobject-engine-dev/src/business/business-core/gncEmployeeP.h	2007-03-15 07:30:19 UTC (rev 15725)
+++ gnucash/branches/gobject-engine-dev/src/business/business-core/gncEmployeeP.h	2007-03-15 21:33:03 UTC (rev 15726)
@@ -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/gobject-engine-dev/src/business/business-core/gncEntryP.h
===================================================================
--- gnucash/branches/gobject-engine-dev/src/business/business-core/gncEntryP.h	2007-03-15 07:30:19 UTC (rev 15725)
+++ gnucash/branches/gobject-engine-dev/src/business/business-core/gncEntryP.h	2007-03-15 21:33:03 UTC (rev 15726)
@@ -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/gobject-engine-dev/src/business/business-core/gncInvoice.c
===================================================================
--- gnucash/branches/gobject-engine-dev/src/business/business-core/gncInvoice.c	2007-03-15 07:30:19 UTC (rev 15725)
+++ gnucash/branches/gobject-engine-dev/src/business/business-core/gncInvoice.c	2007-03-15 21:33:03 UTC (rev 15726)
@@ -207,7 +207,7 @@
 mark_invoice (GncInvoice *invoice)
 {
   qof_instance_set_dirty(QOF_INSTANCE (invoice));
-  qof_event_gen (QOF_ENTITY (invoice), QOF_EVENT_MODIFY, NULL);
+  qof_event_gen (QOF_INSTANCE (invoice), QOF_EVENT_MODIFY, NULL);
 }
 
 QofBook * gncInvoiceGetBook(GncInvoice *x)
@@ -236,7 +236,7 @@
 
   invoice->priv->to_charge_amount = gnc_numeric_zero();
 
-  qof_event_gen (QOF_ENTITY (invoice), QOF_EVENT_CREATE, NULL);
+  qof_event_gen (QOF_INSTANCE (invoice), QOF_EVENT_CREATE, NULL);
 
   return invoice;
 }
@@ -252,7 +252,7 @@
 {
   if (!invoice) return;
 
-  qof_event_gen (QOF_ENTITY (invoice), QOF_EVENT_DESTROY, NULL);
+  qof_event_gen (QOF_INSTANCE (invoice), QOF_EVENT_DESTROY, NULL);
 
   CACHE_REMOVE (invoice->priv->id);
   CACHE_REMOVE (invoice->priv->notes);
@@ -317,7 +317,7 @@
   GNCLot *	posted_lot;
 #endif
 
-  qof_event_gen (QOF_ENTITY (invoice), QOF_EVENT_CREATE, NULL);
+  qof_event_gen (QOF_INSTANCE (invoice), QOF_EVENT_CREATE, NULL);
 
   return invoice;
 }

Modified: gnucash/branches/gobject-engine-dev/src/business/business-core/gncInvoiceP.h
===================================================================
--- gnucash/branches/gobject-engine-dev/src/business/business-core/gncInvoiceP.h	2007-03-15 07:30:19 UTC (rev 15725)
+++ gnucash/branches/gobject-engine-dev/src/business/business-core/gncInvoiceP.h	2007-03-15 21:33:03 UTC (rev 15726)
@@ -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/gobject-engine-dev/src/business/business-core/gncJob.c
===================================================================
--- gnucash/branches/gobject-engine-dev/src/business/business-core/gncJob.c	2007-03-15 07:30:19 UTC (rev 15725)
+++ gnucash/branches/gobject-engine-dev/src/business/business-core/gncJob.c	2007-03-15 21:33:03 UTC (rev 15726)
@@ -173,7 +173,7 @@
 void mark_job (GncJob *job)
 {
   qof_instance_set_dirty(QOF_INSTANCE (job));
-  qof_event_gen (QOF_ENTITY (job), QOF_EVENT_MODIFY, NULL);
+  qof_event_gen (QOF_INSTANCE (job), QOF_EVENT_MODIFY, NULL);
 }
 
 /* ================================================================== */
@@ -196,7 +196,7 @@
   job->priv->active = TRUE;
 
   /* GncOwner not initialized */
-  qof_event_gen (QOF_ENTITY (job), QOF_EVENT_CREATE, NULL);
+  qof_event_gen (QOF_INSTANCE (job), QOF_EVENT_CREATE, NULL);
 
   return job;
 }
@@ -219,7 +219,7 @@
 
   job->priv->owner = gncCloneOwner(&from->owner, book);
 
-  qof_event_gen (QOF_ENTITY (job), QOF_EVENT_CREATE, NULL);
+  qof_event_gen (QOF_INSTANCE (job), QOF_EVENT_CREATE, NULL);
                                                                                 
   return job;
 }
@@ -235,7 +235,7 @@
 {
   if (!job) return;
 
-  qof_event_gen (QOF_ENTITY (job), QOF_EVENT_DESTROY, NULL);
+  qof_event_gen (QOF_INSTANCE (job), QOF_EVENT_DESTROY, NULL);
 
   CACHE_REMOVE (job->priv->id);
   CACHE_REMOVE (job->priv->name);

Modified: gnucash/branches/gobject-engine-dev/src/business/business-core/gncJobP.h
===================================================================
--- gnucash/branches/gobject-engine-dev/src/business/business-core/gncJobP.h	2007-03-15 07:30:19 UTC (rev 15725)
+++ gnucash/branches/gobject-engine-dev/src/business/business-core/gncJobP.h	2007-03-15 21:33:03 UTC (rev 15726)
@@ -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/gobject-engine-dev/src/business/business-core/gncOrder.c
===================================================================
--- gnucash/branches/gobject-engine-dev/src/business/business-core/gncOrder.c	2007-03-15 07:30:19 UTC (rev 15725)
+++ gnucash/branches/gobject-engine-dev/src/business/business-core/gncOrder.c	2007-03-15 21:33:03 UTC (rev 15726)
@@ -187,7 +187,7 @@
 void mark_order (GncOrder *order)
 {
   qof_instance_set_dirty(QOF_INSTANCE (order));
-  qof_event_gen (QOF_ENTITY (order), QOF_EVENT_MODIFY, NULL);
+  qof_event_gen (QOF_INSTANCE (order), QOF_EVENT_MODIFY, NULL);
 }
 
 /* =============================================================== */
@@ -210,7 +210,7 @@
 
   order->priv->active = TRUE;
 
-  qof_event_gen (QOF_ENTITY (order), QOF_EVENT_CREATE, NULL);
+  qof_event_gen (QOF_INSTANCE (order), QOF_EVENT_CREATE, NULL);
 
   return order;
 }
@@ -226,7 +226,7 @@
 {
   if (!order) return;
 
-  qof_event_gen (QOF_ENTITY (order), QOF_EVENT_DESTROY, NULL);
+  qof_event_gen (QOF_INSTANCE (order), QOF_EVENT_DESTROY, NULL);
 
   g_list_free (order->priv->entries);
   CACHE_REMOVE (order->priv->id);
@@ -270,7 +270,7 @@
     order->priv->entries = g_list_prepend (order->priv->entries, entry);
   }
 
-  qof_event_gen (QOF_ENTITY (order), QOF_EVENT_CREATE, NULL);
+  qof_event_gen (QOF_INSTANCE (order), QOF_EVENT_CREATE, NULL);
 
   return order;
 }

Modified: gnucash/branches/gobject-engine-dev/src/business/business-core/gncOrderP.h
===================================================================
--- gnucash/branches/gobject-engine-dev/src/business/business-core/gncOrderP.h	2007-03-15 07:30:19 UTC (rev 15725)
+++ gnucash/branches/gobject-engine-dev/src/business/business-core/gncOrderP.h	2007-03-15 21:33:03 UTC (rev 15726)
@@ -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/gobject-engine-dev/src/business/business-core/gncTaxTableP.h
===================================================================
--- gnucash/branches/gobject-engine-dev/src/business/business-core/gncTaxTableP.h	2007-03-15 07:30:19 UTC (rev 15725)
+++ gnucash/branches/gobject-engine-dev/src/business/business-core/gncTaxTableP.h	2007-03-15 21:33:03 UTC (rev 15726)
@@ -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/gobject-engine-dev/src/business/business-core/gncVendor.c
===================================================================
--- gnucash/branches/gobject-engine-dev/src/business/business-core/gncVendor.c	2007-03-15 07:30:19 UTC (rev 15725)
+++ gnucash/branches/gobject-engine-dev/src/business/business-core/gncVendor.c	2007-03-15 21:33:03 UTC (rev 15726)
@@ -186,8 +186,8 @@
 G_INLINE_FUNC void mark_vendor (GncVendor *vendor);
 void mark_vendor (GncVendor *vendor)
 {
-  qof_instance_set_dirty(QOF_ENTITY (vendor));
-  qof_event_gen (QOF_ENTITY (vendor), QOF_EVENT_MODIFY, NULL);
+  qof_instance_set_dirty(QOF_INSTANCE (vendor));
+  qof_event_gen (QOF_INSTANCE (vendor), QOF_EVENT_MODIFY, NULL);
 }
 
 /* ============================================================== */
@@ -200,17 +200,17 @@
   if (!book) return NULL;
 
   vendor = g_new0 (GncVendor, 1);
-  qof_instance_init (QOF_ENTITY (vendor), _GNC_MOD_NAME, book);
+  qof_instance_init (QOF_INSTANCE (vendor), _GNC_MOD_NAME, book);
   
   vendor->priv->id = CACHE_INSERT ("");
   vendor->priv->name = CACHE_INSERT ("");
   vendor->priv->notes = CACHE_INSERT ("");
-  vendor->priv->addr = gncAddressCreate (book, QOF_ENTITY (vendor));
+  vendor->priv->addr = gncAddressCreate (book, QOF_INSTANCE (vendor));
   vendor->priv->taxincluded = GNC_TAXINCLUDED_USEGLOBAL;
   vendor->priv->active = TRUE;
   vendor->priv->jobs = NULL;
 
-  qof_event_gen (QOF_ENTITY (vendor), QOF_EVENT_CREATE, NULL);
+  qof_event_gen (QOF_INSTANCE (vendor), QOF_EVENT_CREATE, NULL);
 
   return vendor;
 }
@@ -226,7 +226,7 @@
 {
   if (!vendor) return;
 
-  qof_event_gen (QOF_ENTITY (vendor), QOF_EVENT_DESTROY, NULL);
+  qof_event_gen (QOF_INSTANCE (vendor), QOF_EVENT_DESTROY, NULL);
 
   CACHE_REMOVE (vendor->priv->id);
   CACHE_REMOVE (vendor->priv->name);
@@ -239,7 +239,7 @@
   if (vendor->priv->taxtable)
     gncTaxTableDecRef (vendor->priv->taxtable);
 
-  qof_instance_release (QOF_ENTITY (vendor));
+  qof_instance_release (QOF_INSTANCE (vendor));
 
 }
 
@@ -254,13 +254,13 @@
   vendor = GNC_VENDOR ( g_object_new (GNC_TYPE_VENDOR, NULL));
   vendor->priv = g_new0 (GncVendorPrivate, 1);
   
-  qof_instance_init (QOF_ENTITY (vendor), _GNC_MOD_NAME, book);
-  qof_instance_gemini (QOF_ENTITY (vendor), &from->inst);
+  qof_instance_init (QOF_INSTANCE (vendor), _GNC_MOD_NAME, book);
+  qof_instance_gemini (QOF_INSTANCE (vendor), &from->inst);
   
   vendor->priv->id = CACHE_INSERT (from->id);
   vendor->priv->name = CACHE_INSERT (from->name);
   vendor->priv->notes = CACHE_INSERT (from->notes);
-  vendor->priv->addr = gncCloneAddress (from->addr, QOF_ENTITY (vendor), book);
+  vendor->priv->addr = gncCloneAddress (from->addr, QOF_INSTANCE (vendor), book);
   vendor->priv->taxincluded = from->taxincluded;
   vendor->priv->taxtable_override = from->taxtable_override;
   vendor->priv->active = from->active;
@@ -281,7 +281,7 @@
     vendor->priv->jobs = g_list_prepend(vendor->priv->jobs, job);
   }
 
-  qof_event_gen (QOF_ENTITY (vendor), QOF_EVENT_CREATE, NULL);
+  qof_event_gen (QOF_INSTANCE (vendor), QOF_EVENT_CREATE, NULL);
 
   return vendor;
 }
@@ -516,7 +516,7 @@
     vendor->priv->jobs = g_list_insert_sorted (vendor->priv->jobs, job,
                                          (GCompareFunc)gncJobCompare);
 
-  qof_event_gen (QOF_ENTITY (vendor), QOF_EVENT_MODIFY, NULL);
+  qof_event_gen (QOF_INSTANCE (vendor), QOF_EVENT_MODIFY, NULL);
 }
 
 void gncVendorRemoveJob (GncVendor *vendor, GncJob *job)
@@ -534,12 +534,12 @@
     g_list_free_1 (node);
   }
 
-  qof_event_gen (QOF_ENTITY (vendor), QOF_EVENT_MODIFY, NULL);
+  qof_event_gen (QOF_INSTANCE (vendor), QOF_EVENT_MODIFY, NULL);
 }
 
 void gncVendorBeginEdit (GncVendor *vendor)
 {
-  QOF_BEGIN_EDIT (QOF_ENTITY (vendor));
+  QOF_BEGIN_EDIT (QOF_INSTANCE (vendor));
 }
 
 static void gncVendorOnError (QofInstance *vendor, QofBackendError errcode)
@@ -562,7 +562,7 @@
 void gncVendorCommitEdit (GncVendor *vendor)
 {
   if (!qof_commit_edit (QOF_INSTANCE(vendor))) return;
-  qof_commit_edit_part2 (QOF_ENTITY (vendor), gncVendorOnError,
+  qof_commit_edit_part2 (QOF_INSTANCE (vendor), gncVendorOnError,
                          gncVendorOnDone, vendor_free);
 }
 

Modified: gnucash/branches/gobject-engine-dev/src/business/business-core/gncVendorP.h
===================================================================
--- gnucash/branches/gobject-engine-dev/src/business/business-core/gncVendorP.h	2007-03-15 07:30:19 UTC (rev 15725)
+++ gnucash/branches/gobject-engine-dev/src/business/business-core/gncVendorP.h	2007-03-15 21:33:03 UTC (rev 15726)
@@ -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/gobject-engine-dev/src/business/business-gnome/gnc-plugin-business.c
===================================================================
--- gnucash/branches/gobject-engine-dev/src/business/business-gnome/gnc-plugin-business.c	2007-03-15 07:30:19 UTC (rev 15725)
+++ gnucash/branches/gobject-engine-dev/src/business/business-gnome/gnc-plugin-business.c	2007-03-15 21:33:03 UTC (rev 15726)
@@ -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_instancecopy_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_instancecopy_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_instancecopy_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_instancecopy_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_instancecopy_coll_r(chart_session, coll);
 		if(success) 
 		{ 
 			qof_session_save(chart_session, NULL);

Modified: gnucash/branches/gobject-engine-dev/src/engine/Account.c
===================================================================
--- gnucash/branches/gobject-engine-dev/src/engine/Account.c	2007-03-15 07:30:19 UTC (rev 15725)
+++ gnucash/branches/gobject-engine-dev/src/engine/Account.c	2007-03-15 21:33:03 UTC (rev 15726)
@@ -486,15 +486,83 @@
 AccountGroup* 
 gnc_account_get_children (GncAccount* acc)
 {
+  g_return_val_if_fail (GNC_IS_ACCOUNT (acc), NULL);
   return acc->priv->children;
 }
 
-AccountGroup* 
+void 
 gnc_account_set_children (GncAccount* acc, AccountGroup *grp)
 {
+  g_return_if_fail (GNC_IS_ACCOUNT (acc));
   acc->priv->children = grp;
 }
 
+AccountGroup* 
+gnc_account_get_parent (GncAccount* acc)
+{
+  g_return_val_if_fail (GNC_IS_ACCOUNT (acc), NULL);
+  return acc->priv->parent;
+}
+
+void 
+gnc_account_set_parent (GncAccount* acc, AccountGroup *grp)
+{
+  g_return_if_fail (GNC_IS_ACCOUNT (acc));
+  acc->priv->parent = grp;
+}
+
+void
+gnc_account_set_sort_dirty (GncAccount *acc, gboolean val)
+{
+  g_return_if_fail (GNC_IS_ACCOUNT (acc));
+  acc->priv->sort_dirty = val;
+}
+
+gboolean
+gnc_account_get_sort_dirty (GncAccount *acc)
+{
+  g_return_val_if_fail (GNC_IS_ACCOUNT (acc), FALSE);
+  return acc->priv->sort_dirty;
+}
+
+
+void
+gnc_account_set_balance_dirty (GncAccount *acc, gboolean val)
+{
+  g_return_if_fail (GNC_IS_ACCOUNT (acc));
+  acc->priv->balance_dirty = val;
+}
+
+gboolean
+gnc_account_get_balance_dirty (GncAccount *acc)
+{
+  g_return_val_if_fail (GNC_IS_ACCOUNT (acc), FALSE);
+  return acc->priv->balance_dirty;
+}
+
+void
+gnc_account_set_policy (GncAccount *acc, GNCPolicy *policy)
+{
+  acc->priv->policy = policy;
+}
+
+GNCPolicy*
+gnc_account_get_policy (GncAccount *acc)
+{
+  return acc->priv->policy;
+}
+
+void
+gnc_account_set_commodity (GncAccount *acc, gnc_commodity *commodity)
+{
+  acc->priv->commodity = commodity;
+}
+gnc_commodity*
+gnc_account_get_commodity (GncAccount *acc)
+{
+  return acc->priv->commodity;
+}
+
 /********************************************************************\
  * transactional routines
 \********************************************************************/
@@ -1660,7 +1728,7 @@
       gnc_commodity_equiv (balance_currency, new_currency))
     return balance;
 
-  book = xaccGroupGetBook (xaccAccountGetRoot (acc));
+  book = xaccGroupGetBook (xaccAccountGetRoot ((GncAccount*)acc));
   pdb = gnc_pricedb_get_db (book);
 
   balance = gnc_pricedb_convert_balance_latest_price(
@@ -1688,7 +1756,7 @@
       gnc_commodity_equiv (balance_currency, new_currency))
     return balance;
 
-  book = xaccGroupGetBook (xaccAccountGetRoot (acc));
+  book = xaccGroupGetBook (xaccAccountGetRoot ((GncAccount*)acc));
   pdb = gnc_book_get_pricedb (book);
 
   ts.tv_sec = date;

Modified: gnucash/branches/gobject-engine-dev/src/engine/Account.h
===================================================================
--- gnucash/branches/gobject-engine-dev/src/engine/Account.h	2007-03-15 07:30:19 UTC (rev 15725)
+++ gnucash/branches/gobject-engine-dev/src/engine/Account.h	2007-03-15 21:33:03 UTC (rev 15726)
@@ -47,6 +47,7 @@
 #define XACC_ACCOUNT_H
 #include "qof.h"
 #include "gnc-engine.h"
+#include "policy.h"
 
 
 /*************************************************************/
@@ -217,13 +218,13 @@
 
 /** @deprecated */
 #define xaccAccountGetBook(X)     qof_instance_get_book(QOF_INSTANCE(X))
-#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
  *    if there is no such account. */
-#define xaccAccountLookup (guid, book) qof_book_get_object (book, GNC_TYPE_ACCOUNT, guid)
+#define xaccAccountLookup(guid, book) GNC_ACCOUNT (qof_book_get_element (book, GNC_TYPE_ACCOUNT, guid))
 #define xaccAccountLookupDirect(g,b) xaccAccountLookup(&(g),b)
 
 /** @} */
@@ -842,6 +843,19 @@
 AccountGroup* gnc_account_get_parent (GncAccount* acc);
 void           gnc_account_set_parent (GncAccount* acc, AccountGroup *grp);
 
+void          gnc_account_set_sort_dirty (GncAccount *acc, gboolean val);
+gboolean      gnc_account_get_sort_dirty (GncAccount *acc);
+
+
+void          gnc_account_set_balance_dirty (GncAccount *acc, gboolean val);
+gboolean      gnc_account_get_balance_dirty (GncAccount *acc);
+
+void          gnc_account_set_policy (GncAccount *acc, GNCPolicy *policy);
+GNCPolicy*    gnc_account_get_policy (GncAccount *acc);
+
+void           gnc_account_set_commodity (GncAccount *acc, gnc_commodity *commodity);
+gnc_commodity* gnc_account_get_commodity (GncAccount *acc);
+
 /** @} */
 
 

Modified: gnucash/branches/gobject-engine-dev/src/engine/FreqSpec.c
===================================================================
--- gnucash/branches/gobject-engine-dev/src/engine/FreqSpec.c	2007-03-15 07:30:19 UTC (rev 15725)
+++ gnucash/branches/gobject-engine-dev/src/engine/FreqSpec.c	2007-03-15 21:33:03 UTC (rev 15726)
@@ -346,8 +346,8 @@
    qof_event_gen( QOF_INSTANCE (fs), QOF_EVENT_DESTROY , NULL);
    xaccFreqSpecCleanUp( fs );
 
-   qof_entity_release (fs);
-   // g_free( fs ); the qof_entity_realise function call g_object_unref
+   qof_instancerelease (fs);
+   // g_free( fs ); the qof_instancerealise function call g_object_unref
 }
 
 FreqType

Modified: gnucash/branches/gobject-engine-dev/src/engine/GNCId.h
===================================================================
--- gnucash/branches/gobject-engine-dev/src/engine/GNCId.h	2007-03-15 07:30:19 UTC (rev 15725)
+++ gnucash/branches/gobject-engine-dev/src/engine/GNCId.h	2007-03-15 21:33:03 UTC (rev 15726)
@@ -1,29 +1,34 @@
 
 #include "qof.h"
+#include <glib.h>
 
+#ifndef GNC_ID_H
+#define GNC_ID_H
+
 /* Equivalent function prototype:
  * void xaccGUIDNew (GUID *guid, QofBook *book)
  */
 #define xaccGUIDNew(guid,book)     \
-      qof_entity_guid_new (qof_book_get_entity_table (book), (guid))
+      qof_instanceguid_new (qof_book_get_entity_table (book), (guid))
                                                                                 
 
 		#define xaccGUIDNULL guid_null
 		#define xaccGUIDMalloc guid_malloc
 		#define xaccGUIDFree guid_free
 
-		#define GNCIdTypeConst QofIdTypeConst
-		#define GNCIdType QofIdType
+		typedef gchar* GNCIdTypeConst;
+		typedef gchar* GNCIdType;
 		#define GNCEntityTable QofEntityTable
 		#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_instancenew
+		#define xaccEntityTableDestroy qof_instancedestroy
+		#define xaccGUIDNewEntityTable qof_instanceguid_new
+		#define xaccLookupEntity qof_instancelookup
+		#define xaccStoreEntity qof_instancestore
+		#define xaccRemoveEntity qof_instanceremove
+		#define xaccForeachEntity qof_instanceforeach
 
 		#define foreachObjectCB QofEntityForeachCB
 
+#endif

Modified: gnucash/branches/gobject-engine-dev/src/engine/Group.c
===================================================================
--- gnucash/branches/gobject-engine-dev/src/engine/Group.c	2007-03-15 07:30:19 UTC (rev 15725)
+++ gnucash/branches/gobject-engine-dev/src/engine/Group.c	2007-03-15 21:33:03 UTC (rev 15726)
@@ -366,7 +366,7 @@
   for (node = grp->accounts; node; node = node->next)
   {
     Account *account = node->data;
-    qof_instace_do_free ((const QofInstance*) QOF_INSTANCE (account));
+    qof_instance_do_free ((const QofInstance*) QOF_INSTANCE (account));
     xaccGroupMarkDoFree (gnc_account_get_children (account)); 
   }
 }
@@ -436,7 +436,7 @@
 
   grp->parent   = NULL;
 
-  qof_instance_release ();
+  qof_instance_release (QOF_INSTANCE (grp));
 }
 
 /********************************************************************\
@@ -629,7 +629,7 @@
     parent_acc = grp->parent;
 
     if (parent_acc)
-      grp = parent_acc->parent;
+      grp = gnc_account_get_parent (parent_acc);
     else
       grp = NULL;
   }
@@ -638,9 +638,9 @@
 }
 
 AccountGroup *
-xaccAccountGetRoot (const Account * acc) 
+xaccAccountGetRoot (GncAccount * acc) 
 {
-  return acc ? xaccGroupGetRoot (acc->parent) : NULL;
+  return acc ? xaccGroupGetRoot (gnc_account_get_parent (acc)) : NULL;
 }
 
 /********************************************************************\
@@ -794,7 +794,7 @@
   if (!name) return NULL;
 
   /* first, find the root of the account group structure */
-  root = xaccAccountGetRoot (acc);
+  root = xaccAccountGetRoot ((GncAccount*)acc);
 
   /* now search all accounts hanging off the root */
   peer_acc = xaccGetAccountFromName (root, name);
@@ -816,7 +816,7 @@
   if (!name) return NULL;
 
   /* first, find the root of the account group structure */
-  root = xaccAccountGetRoot (acc);
+  root = xaccAccountGetRoot ((GncAccount*)acc);
 
   /* now search all acounts hanging off the root */
   peer_acc = xaccGetAccountFromFullName (root, name);
@@ -835,19 +835,19 @@
   /* if this group has no parent, it must be the topgroup */
   if (!acc) return;
 
-  grp = acc->children;
+  grp = gnc_account_get_children (acc);
 
   if (grp) grp->parent = NULL;
-  acc->children = NULL;
+  gnc_account_set_children (acc, NULL);
 
   /* make sure that the parent of the group is marked 
    * as having been modified. */
-  grp = acc->parent;
+  grp = gnc_account_get_parent (acc);
   if (!grp) return;
 
   grp->saved = 0;
 
-  qof_event_gen (&acc->inst.entity, QOF_EVENT_MODIFY, NULL);
+  qof_event_gen (QOF_INSTANCE (acc), QOF_EVENT_MODIFY, NULL);
 }
 
 /********************************************************************\
@@ -864,7 +864,7 @@
    * are not yet parented. */
   if (!grp) return;
 
-  if (acc->parent != grp)
+  if (gnc_account_get_parent (acc) != grp)
   {
     PERR ("account not in group");
     return;
@@ -877,10 +877,10 @@
   grp->accounts = g_list_remove (grp->accounts, acc);
 
   /* Now send the event. */
-  qof_event_gen(&acc->inst.entity, QOF_EVENT_REMOVE, &ed);
+  qof_event_gen(QOF_INSTANCE (acc), QOF_EVENT_REMOVE, &ed);
 
   /* clear the account's group pointer after REMOVE event generation. */
-  acc->parent = NULL;
+  gnc_account_set_parent (acc, NULL);
 
   grp->saved = 0;
 
@@ -892,30 +892,30 @@
     xaccFreeAccountGroup (grp);
   }
 
-  qof_event_gen (&acc->inst.entity, QOF_EVENT_MODIFY, NULL);
+  qof_event_gen (QOF_INSTANCE (acc), QOF_EVENT_MODIFY, NULL);
 }
 
 /********************************************************************\
 \********************************************************************/
 
 void
-xaccAccountInsertSubAccount (Account *adult, Account *child)
+xaccAccountInsertSubAccount (GncAccount *adult, GncAccount *child)
 {
   if (!adult) return;
 
   /* if a container for the children doesn't yet exist, add it */
-  if (adult->children == NULL)
-    adult->children = xaccMallocAccountGroup (adult->inst.book);
+  if (gnc_account_get_children (adult) == NULL)
+    gnc_account_set_children(adult, xaccMallocAccountGroup (qof_instance_get_book (QOF_INSTANCE (adult))));
 
   /* set back-pointer to parent */
-  adult->children->parent = adult;
+  (gnc_account_get_children (adult))->parent = adult;
 
   /* allow side-effect of creating a child-less account group */
   if (!child) return;
 
-  xaccGroupInsertAccount (adult->children, child);
+  xaccGroupInsertAccount (gnc_account_get_children (adult), child);
 
-  qof_event_gen (&adult->inst.entity, QOF_EVENT_MODIFY, NULL);
+  qof_event_gen (QOF_INSTANCE (adult), QOF_EVENT_MODIFY, NULL);
 }
 
 /********************************************************************\
@@ -932,16 +932,16 @@
    * first. Basically, we can't have accounts being in two places at
    * once. If old and new parents are the same, reinsertion causes
    * the sort order to be checked. */
-  if (acc->parent != grp)
+  if (gnc_account_get_parent (acc) != grp)
   {
     xaccAccountBeginEdit (acc);
 
-    if (acc->parent) 
+    if (gnc_account_get_parent (acc)) 
     {
-      xaccGroupRemoveAccount (acc->parent, acc);
+      xaccGroupRemoveAccount (gnc_account_get_parent (acc), acc);
 
       /* switch over between books, if needed */
-      if (qof_instance_get_book (QOF_INSTANCE (grp)) != acc->inst.book)
+      if (qof_instance_get_book (QOF_INSTANCE (grp)) != qof_instance_get_book (QOF_INSTANCE (acc)))
       {
          QofCollection *col;
 // xxxxxxxxxxxxxxxxxxxxxxx
@@ -958,28 +958,28 @@
           */
          PWARN ("reparenting accounts across books is not correctly supported\n");
 
-         qof_event_gen (&acc->inst.entity, QOF_EVENT_DESTROY, NULL);
+         qof_event_gen (QOF_INSTANCE (acc), QOF_EVENT_DESTROY, NULL);
          col = qof_book_get_collection (qof_instance_get_book (QOF_INSTANCE (grp)), GNC_ID_ACCOUNT);
-         qof_collection_insert_entity (col, &acc->inst.entity);
-         qof_event_gen (&acc->inst.entity, QOF_EVENT_CREATE, NULL);
+         qof_collection_insert_entity (col, QOF_INSTANCE (acc));
+         qof_event_gen (QOF_INSTANCE (acc), QOF_EVENT_CREATE, NULL);
       }
     }
 
     /* set back-pointer to the account's parent */
-    acc->parent = grp;
+    gnc_account_set_parent (acc, grp);
 
     grp->accounts = g_list_append (grp->accounts, acc);
 
     /* Gather event data */
-    qof_event_gen (&acc->inst.entity, QOF_EVENT_ADD, NULL);
+    qof_event_gen (QOF_INSTANCE (acc), QOF_EVENT_ADD, NULL);
 
-    qof_instance_set_dirty(&acc->inst);
+    qof_instance_set_dirty(QOF_INSTANCE (acc), TRUE);
     xaccAccountCommitEdit (acc);
   }
 
   grp->saved = 0;
 
-  qof_event_gen (&acc->inst.entity, QOF_EVENT_MODIFY, NULL);
+  qof_event_gen (QOF_INSTANCE (acc), QOF_EVENT_MODIFY, NULL);
   LEAVE(" ");
 }
 
@@ -1022,7 +1022,7 @@
    int i;
    GList *node;
    if (!to || !from) return;
-   if (!from->accounts || !to->book) return;
+   if (!from->accounts || !qof_instance_get_book (QOF_INSTANCE (to))) return;
 
    ENTER (" ");
    xaccAccountGroupBeginEdit(to);
@@ -1033,23 +1033,23 @@
 
       /* This will copy the basic data and the KVP.  It will
        * not copy any splits/transactions. It will gemini. */
-      to_acc = xaccCloneAccount (from_acc, to->book);
+      to_acc = xaccCloneAccount (from_acc, qof_instance_get_book (QOF_INSTANCE (to)));
 
       xaccAccountBeginEdit (to_acc);
       to->accounts = g_list_append (to->accounts, to_acc);
 
-      to_acc->parent = to;
-      qof_instance_set_dirty(&to_acc->inst);
+      gnc_account_set_parent (to_acc, to);
+      qof_instance_set_dirty(QOF_INSTANCE (to_acc), TRUE);
 
       /* Copy child accounts too. */
-      if (from_acc->children)
+      if (gnc_account_get_children (from_acc))
       {
-         to_acc->children = xaccMallocAccountGroup (to->book);
-         to_acc->children->parent = to_acc;
-         xaccGroupCopyGroup (to_acc->children, from_acc->children);
+         gnc_account_set_children (to_acc, xaccMallocAccountGroup (qof_instance_get_book (QOF_INSTANCE (to))));
+         (gnc_account_get_children (to_acc))->parent = to_acc;
+         xaccGroupCopyGroup (gnc_account_get_children (to_acc), gnc_account_get_children (from_acc));
       }
       xaccAccountCommitEdit (to_acc);
-      qof_event_gen (&to_acc->inst.entity, QOF_EVENT_CREATE, NULL);
+      qof_event_gen (QOF_INSTANCE (to_acc), QOF_EVENT_CREATE, NULL);
 
       /* make sure that we have a symmetric, uniform number of 
        * begin-edits, so that subsequent GroupCommitEdit's 
@@ -1057,7 +1057,7 @@
       for (i=0; i<to->editlevel; i++)
       {
          xaccAccountBeginEdit (to_acc);
-         xaccAccountGroupBeginEdit (to_acc->children);
+         xaccAccountGroupBeginEdit (gnc_account_get_children (to_acc));
       }
    }
    xaccAccountGroupCommitEdit(from);
@@ -1099,25 +1099,25 @@
         AccountGroup *ga, *gb;
 
         /* consolidate children */
-        ga = (AccountGroup *) acc_a->children;
-        gb = (AccountGroup *) acc_b->children;
+        ga = (AccountGroup *) gnc_account_get_children (acc_a);
+        gb = (AccountGroup *) gnc_account_get_children (acc_b);
 
         if (gb)
         {
           if (!ga)
           {
-            acc_a->children = gb;
+            gnc_account_set_children (acc_a, gb);
             gb->parent = acc_a;
-            acc_b->children = NULL;
+            gnc_account_set_children (acc_b, NULL);
 
-            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 (QOF_INSTANCE (acc_a), QOF_EVENT_MODIFY, NULL);
+            qof_event_gen (QOF_INSTANCE (acc_b), QOF_EVENT_MODIFY, NULL);
           }
           else
           {
             xaccGroupConcatGroup (ga, gb);
-            acc_b->children = NULL;
-            qof_event_gen (&acc_b->inst.entity, QOF_EVENT_MODIFY, NULL);
+            gnc_account_set_children (acc_b, NULL);
+            qof_event_gen (QOF_INSTANCE (acc_b), QOF_EVENT_MODIFY, NULL);
           }
         }
 
@@ -1125,8 +1125,8 @@
         xaccGroupMergeAccounts (ga);
 
         /* consolidate transactions */
-        while (acc_b->splits)
-          xaccSplitSetAccount (acc_b->splits->data, acc_a);
+        while (xaccAccountGetSplitList(acc_b))
+          xaccSplitSetAccount ((xaccAccountGetSplitList (acc_b))->data, acc_a);
 
         /* move back one before removal */
         node_b = node_b->prev;
@@ -1216,7 +1216,7 @@
 xaccAccountBeginStagedTransactionTraversals (const Account *account)
 {
   if (account)
-      xaccSplitsBeginStagedTransactionTraversals (account->splits);
+      xaccSplitsBeginStagedTransactionTraversals (xaccAccountGetSplitList(account));
 }
 
 gboolean
@@ -1256,7 +1256,7 @@
     /* recursively do sub-accounts */
     xaccGroupBeginStagedTransactionTraversals (gnc_account_get_children (account));
 
-    for (lp = account->splits; lp; lp = lp->next)
+    for (lp = xaccAccountGetSplitList(account); lp; lp = lp->next)
     {
       Split *s = lp->data;
       Transaction *trans = s->parent;
@@ -1275,7 +1275,7 @@
   GList *lp;
   if (!acc) return 0;
 
-  for(lp = acc->splits; lp; lp = lp->next)
+  for(lp = xaccAccountGetSplitList(acc); lp; lp = lp->next)
   {
     Split *s = (Split *) lp->data;
     Transaction *trans = s->parent;   

Modified: gnucash/branches/gobject-engine-dev/src/engine/Group.h
===================================================================
--- gnucash/branches/gobject-engine-dev/src/engine/Group.h	2007-03-15 07:30:19 UTC (rev 15725)
+++ gnucash/branches/gobject-engine-dev/src/engine/Group.h	2007-03-15 21:33:03 UTC (rev 15726)
@@ -165,7 +165,7 @@
 /** The xaccAccountInsertSubAccount() does the same, except that
  *    the parent is specified as an account.
  */
-void    xaccAccountInsertSubAccount (Account *parent, Account *child);
+void    xaccAccountInsertSubAccount (GncAccount *parent, GncAccount *child);
 /** @} */
 
 /** @name Counting the Size and Depth of the Account Tree
@@ -227,7 +227,7 @@
 /** The xaccGetAccountRoot() subroutine will find the topmost 
  *    (root) group to which this account belongs.
  */
-AccountGroup * xaccAccountGetRoot (const Account *account);
+AccountGroup * xaccAccountGetRoot (GncAccount *account);
 
 /** The xaccGroupGetParentAccount() subroutine returns the parent
  * account of the group, or NULL.

Modified: gnucash/branches/gobject-engine-dev/src/engine/Period.c
===================================================================
--- gnucash/branches/gobject-engine-dev/src/engine/Period.c	2007-03-15 07:30:19 UTC (rev 15725)
+++ gnucash/branches/gobject-engine-dev/src/engine/Period.c	2007-03-15 21:33:03 UTC (rev 15726)
@@ -73,7 +73,7 @@
    if (!trans || !book) return;
    
    /* If this is the same book, its a no-op. */
-   if (trans->inst.book == book) return;
+   if (qof_instance_get_book (QOF_INSTANCE (trans)) == book) return;
 
    ENTER ("trans=%p %s", trans, trans->description);
    newtrans = xaccDupeTransaction (trans);
@@ -90,8 +90,8 @@
 
    /* 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);
-   newtrans->inst.book = book;
+   qof_collection_insert_entity (col, QOF_INSTANCE (newtrans));
+   qof_instance_set_book (QOF_INSTANCE (newtrans), book);
 
    col = qof_book_get_collection (book, GNC_ID_SPLIT);
    xaccTransBeginEdit (newtrans);
@@ -101,8 +101,7 @@
       Split *s = node->data;
 
       /* move the split into the new book ... */
-      s->inst.book = book;
-      qof_collection_insert_entity(col, &s->inst.entity);
+     qof_instance_set_book (QOF_INSTANCE (s), book);
 
       /* find the twin account, and re-parent to that. */
       twin = xaccAccountLookupTwin (s->acc, book);
@@ -113,13 +112,13 @@
       else
       {
         xaccAccountInsertSplit (twin, s);
-        twin->balance_dirty = TRUE;
-        twin->sort_dirty = TRUE;
+        gnc_account_set_balance_dirty (twin, TRUE);
+        gnc_account_set_sort_dirty (twin, TRUE);
       }
    }
 
    xaccTransCommitEdit (newtrans);
-   qof_event_gen (&newtrans->inst.entity, QOF_EVENT_CREATE, NULL);
+   qof_event_gen (QOF_INSTANCE (newtrans), QOF_EVENT_CREATE, NULL);
    LEAVE ("trans=%p %s", trans, trans->description);
 }
 
@@ -137,11 +136,11 @@
    if (!trans || !book) return;
    
    /* If this is the same book, its a no-op. */
-   if (trans->inst.book == book) return;
+   if (qof_instance_get_book (QOF_INSTANCE (trans)) == book) return;
 
    /* If the old and new book don't share backends, then clobber-copy;
     * i.e. destroy it in one backend, create it in another.  */
-   if (qof_book_get_backend(book) != qof_book_get_backend(trans->inst.book))
+   if (qof_book_get_backend(book) != qof_book_get_backend(qof_instance_get_book (QOF_INSTANCE (trans))))
    {
       gnc_book_insert_trans_clobber (book, trans);
       return;
@@ -152,8 +151,8 @@
    xaccTransBeginEdit (trans);
 
    col = qof_book_get_collection (book, GNC_ID_TRANS);
-   trans->inst.book = book;
-   qof_collection_insert_entity (col, &trans->inst.entity);
+   qof_instance_set_book (QOF_INSTANCE (trans), book);
+   qof_collection_insert_entity (col, QOF_INSTANCE (trans)); // This operation isn't needed becouse set_book does this
 
    col = qof_book_get_collection (book, GNC_ID_SPLIT);
    for (node = trans->splits; node; node = node->next)
@@ -162,10 +161,10 @@
       Split *s = node->data;
 
       /* Move the splits over (only if they haven't already been moved). */
-      if (s->inst.book != book)
+      if (qof_instance_get_book (QOF_INSTANCE (s)) != book)
       {
-         s->inst.book = book;
-         qof_collection_insert_entity (col, &s->inst.entity);
+         qof_instance_set_book (QOF_INSTANCE (s), book);
+         qof_collection_insert_entity (col, QOF_INSTANCE (s));
       }
 
       /* Find the twin account, and re-parent to that. */
@@ -180,14 +179,14 @@
         if (s->acc != twin)
         {
            xaccAccountInsertSplit (twin, s);
-           twin->balance_dirty = TRUE;
-           twin->sort_dirty = TRUE;
+           gnc_account_set_balance_dirty (twin, TRUE);
+           gnc_account_set_sort_dirty (twin, TRUE);
         }
       }
    }
 
    xaccTransCommitEdit (trans);
-   qof_event_gen (&trans->inst.entity, QOF_EVENT_MODIFY, NULL);
+   qof_event_gen (QOF_INSTANCE (trans), QOF_EVENT_MODIFY, NULL);
    LEAVE ("trans=%p %s", trans, trans->description);
 }
 
@@ -228,18 +227,18 @@
    ENTER ("lot=%p", lot);
 
    col = qof_book_get_collection (book, GNC_ID_LOT);
-   lot->inst.book = book;
-   qof_collection_insert_entity (col, &lot->inst.entity);
+   qof_instance_set_book (QOF_INSTANCE (lot), book);
+   qof_collection_insert_entity (col, QOF_INSTANCE (lot)); // don't need it
 
    /* Move the splits over (only if they haven't already been moved). */
    col = qof_book_get_collection (book, GNC_ID_SPLIT);
    for (snode = lot->splits; snode; snode=snode->next)
    {
       Split *s = snode->data;
-      if (s->inst.book != book)
+      if (qof_instance_get_book (QOF_INSTANCE (s)) != book)
       {
-         s->inst.book = book;
-         qof_collection_insert_entity (col, &s->inst.entity);
+         qof_instance_set_book (QOF_INSTANCE (s), book);
+         qof_collection_insert_entity (col, QOF_INSTANCE (s));
       }
    }
 
@@ -264,11 +263,11 @@
    if (!pr || !book) return;
    
    /* If this is the same book, its a no-op. */
-   if (pr->inst.book == book) return;
+   if (qof_instance_get_book (QOF_INSTANCE (pr)) == book) return;
 
    /* If the old and new book don't share backends, then clobber-copy;
     * i.e. destroy it in one backend, create it in another.  */
-   if (qof_book_get_backend(book) != qof_book_get_backend(pr->inst.book))
+   if (qof_book_get_backend(book) != qof_book_get_backend(qof_instance_get_book (QOF_INSTANCE (pr))))
    {
       gnc_book_insert_price_clobber (book, pr);
       return;
@@ -280,8 +279,8 @@
    gnc_price_begin_edit (pr);
 
    col = qof_book_get_collection (book, GNC_ID_PRICE);
-   pr->inst.book = book;
-   qof_collection_insert_entity (col, &pr->inst.entity);
+   qof_instance_set_book (QOF_INSTANCE (pr), book);
+   qof_collection_insert_entity (col, QOF_INSTANCE (pr)); // don't need it
 
    gnc_pricedb_remove_price (pr->db, pr);
    gnc_pricedb_add_price (gnc_pricedb_get_db (book), pr);
@@ -444,9 +443,9 @@
       GList *lp;
                                                                                 
       /* recursively do sub-accounts */
-      clear_markers (account->children);
+      clear_markers (gnc_account_get_children (account));
                                                                                 
-      for (lp = account->splits; lp; lp = lp->next)
+      for (lp = xaccAccountGetSplitList(account); lp; lp = lp->next)
       {
         Split *s = lp->data;
         Transaction *trans = s->parent;
@@ -541,7 +540,7 @@
     * and it is not needed for the current usage. */
    kvp_frame_delete (qof_book_get_slots(dest_book));
    book_inst = (QofInstance*)dest_book;
-   book_inst->kvp_data = kvp_frame_copy (qof_book_get_slots(src_book));
+   qof_instance_set_kvp_data (QOF_INSTANCE (book_inst), qof_book_get_slots(src_book));
 
    /* Next, copy the commodity tables */
    src_tbl = gnc_commodity_table_get_table (src_book);
@@ -589,7 +588,7 @@
    /* Make note of the sibling books */
    now = time(0);
    gnc_kvp_bag_add (qof_book_get_slots(src_book), "gemini", now, 
-                          "book_guid", qof_book_get_guid(dest_book),
+                          "book_guid", qof_instance_get_guid(QOF_INSTANCE (dest_book)),
                            NULL);
    gnc_kvp_bag_add (qof_book_get_slots(dest_book), "gemini", now, 
                           "book_guid", qof_book_get_guid(src_book),
@@ -684,9 +683,9 @@
       xaccAccountBeginEdit (twin);
       cwd = xaccAccountGetSlots (twin);
       kvp_frame_set_guid (cwd, "/book/prev-acct", xaccAccountGetGUID (candidate));
-      kvp_frame_set_guid (cwd, "/book/prev-book", qof_book_get_guid(closed_book));
+      kvp_frame_set_guid (cwd, "/book/prev-book", qof_instance_get_guid(QOF_INSTANCE (closed_book)));
 
-      xaccAccountSetSlots_nc (twin, twin->inst.kvp_data);
+      xaccAccountSetSlots_nc (twin, qof_instance_get_kvp_data (QOF_INSTANCE (twin)));
       
       /* -------------------------------- */
       /* Add KVP to closed account, indicating where 
@@ -696,7 +695,7 @@
       kvp_frame_set_guid (cwd, "/book/next-book", qof_book_get_guid(open_book));
       kvp_frame_set_guid (cwd, "/book/next-acct", xaccAccountGetGUID (twin));
 
-      xaccAccountSetSlots_nc (candidate, candidate->inst.kvp_data);
+      xaccAccountSetSlots_nc (candidate, qof_instance_get_kvp_data (QOF_INSTANCE (candidate)));
 
       /* -------------------------------- */
       /* We need to carry a balance on any account that is not
@@ -778,7 +777,7 @@
       if (childs) 
       {
          PINFO ("add closing baln to subaccts of %s", 
-                 candidate->description);
+                 xaccAccountGetDescription((const GncAccount*) candidate));
          add_closing_balances (childs, open_book, closed_book,
                           equity_account,
                           post_date, date_entered, desc);

Modified: gnucash/branches/gobject-engine-dev/src/engine/Query.c
===================================================================
--- gnucash/branches/gobject-engine-dev/src/engine/Query.c	2007-03-15 07:30:19 UTC (rev 15725)
+++ gnucash/branches/gobject-engine-dev/src/engine/Query.c	2007-03-15 21:33:03 UTC (rev 15726)
@@ -521,14 +521,14 @@
   if (!q || !guid || !id_type)
     return;
 
-  if (!safe_strcmp (id_type, GNC_ID_SPLIT)) 
-    param_list = qof_query_build_param_list (QOF_PARAM_GUID, NULL);
-  else if (!safe_strcmp (id_type, GNC_ID_TRANS))
+  if (id_type == GNC_ID_SPLIT) 
+    param_list = qof_query_build_param_list (g_type_name (QOF_PARAM_GUID), NULL);
+  else if (id_type == GNC_ID_TRANS)
     param_list = qof_query_build_param_list (SPLIT_TRANS, QOF_PARAM_GUID, NULL);
-  else if (!safe_strcmp (id_type, GNC_ID_ACCOUNT))
+  else if (id_type == GNC_ID_ACCOUNT)
     param_list = qof_query_build_param_list (SPLIT_ACCOUNT, QOF_PARAM_GUID, NULL);
   else
-    PERR ("Invalid match type: %s", id_type);
+    PERR ("Invalid match type: %s", g_type_name (id_type));
 
   qof_query_add_guid_match (q, param_list, guid, op);
 }
@@ -548,14 +548,14 @@
   if (!pred_data)
     return;
 
-  if (!safe_strcmp (id_type, GNC_ID_SPLIT)) 
+  if (id_type == GNC_ID_SPLIT) 
     param_list = qof_query_build_param_list (SPLIT_KVP, NULL);
-  else if (!safe_strcmp (id_type, GNC_ID_TRANS))
+  else if (id_type == GNC_ID_TRANS)
     param_list = qof_query_build_param_list (SPLIT_TRANS, TRANS_KVP, NULL);
-  else if (!safe_strcmp (id_type, GNC_ID_ACCOUNT))
+  else if (id_type == GNC_ID_ACCOUNT)
     param_list = qof_query_build_param_list (SPLIT_ACCOUNT, ACCOUNT_KVP, NULL);
   else
-    PERR ("Invalid match type: %s", id_type);
+    PERR ("Invalid match type: %s", g_type_name (id_type));
 
   qof_query_add_term (q, param_list, pred_data, op);
 }

Modified: gnucash/branches/gobject-engine-dev/src/engine/SX-book.c
===================================================================
--- gnucash/branches/gobject-engine-dev/src/engine/SX-book.c	2007-03-15 07:30:19 UTC (rev 15725)
+++ gnucash/branches/gobject-engine-dev/src/engine/SX-book.c	2007-03-15 21:33:03 UTC (rev 15726)
@@ -53,6 +53,8 @@
 static void gnc_schedule_actions_class_init(GncScheduleActionsClass *klass);
 static void gnc_schedule_actions_init(GncScheduleActions *sp);
 static void gnc_schedule_actions_finalize(GObject *object);
+static void gnc_schedule_actions_set_property (GObject *object, guint param_id, const GValue *value, GParamSpec *pspec);
+static void gnc_schedule_actions_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec);
 
 struct _GncScheduleActionsPrivate
 {
@@ -64,6 +66,7 @@
 
 enum _GncScheduleActionsSignalType {
 	/* Signals */
+	FIRS_SIGNAL,
 	LAST_SIGNAL
 };
 
@@ -81,7 +84,7 @@
 static GObjectClass *parent_class = NULL;
 
 GType
-gnc_schedule_actions_get_type()
+gnc_schedule_actions_get_type(void)
 {
 	static GType type = 0;
 
@@ -98,7 +101,7 @@
 			(GInstanceInitFunc)gnc_schedule_actions_init,
 		};
 
-		type = g_type_register_static(QOF_TYPE_ENTITY, 
+		type = g_type_register_static(QOF_TYPE_INSTANCE, 
 			"GncScheduleActions", &our_info, 0);
 	}
 
@@ -153,7 +156,7 @@
 		
 		default:
    			/* We don't have any other property... */
-    		G_OBJECT_WARN_INVALID_PROPERTY_ID(object,property_id,pspec);
+    		G_OBJECT_WARN_INVALID_PROPERTY_ID(object, param_id, pspec);
     	break;
 	}
 }
@@ -221,7 +224,7 @@
   QofCollection *col;
   if (!book) return;
 
-  if (templateGroup && templateGroup->book != book)
+  if (templateGroup && qof_instance_get_book (QOF_INSTANCE (templateGroup)) != book)
   {
      PERR ("cannot mix and match books freely!");
      return;
@@ -369,6 +372,8 @@
   return FALSE;
 }
 
+/*
+BROKEN CODE
 static QofObject sxes_object_def =
 {
   interface_version: QOF_OBJECT_VERSION,
@@ -399,6 +404,7 @@
   version_cmp:       NULL,
 };
 
+
 gboolean 
 gnc_sxtt_register (void)
 {
@@ -408,6 +414,7 @@
     return FALSE;
   return qof_object_register(&sxtt_object_def);
 }
+*/
 
 GList*
 gnc_sx_get_sxes_referencing_account(QofBook *book, Account *acct)

Modified: gnucash/branches/gobject-engine-dev/src/engine/SX-book.h
===================================================================
--- gnucash/branches/gobject-engine-dev/src/engine/SX-book.h	2007-03-15 07:30:19 UTC (rev 15725)
+++ gnucash/branches/gobject-engine-dev/src/engine/SX-book.h	2007-03-15 21:33:03 UTC (rev 15726)
@@ -56,7 +56,7 @@
 typedef struct _GncScheduleActionsClass GncScheduleActionsClass;
 typedef struct _GncScheduleActionsPrivate GncScheduleActionsPrivate;
 typedef struct _GncScheduleActions GncScheduleActions;
-typedef struct GncScheduleActions SchedXactions ; /* Backward compatibility*/
+typedef GncScheduleActions SchedXactions ; /* Backward compatibility*/
 
 struct _GncScheduleActions {
 	QofInstance inst;
@@ -71,7 +71,7 @@
 	/* Add Signal Functions Here */
 };
 
-GType   gnc_schedule_actions_get_type ();
+GType   gnc_schedule_actions_get_type (void);
 
 
 #define GNC_IS_SXES(obj)  GNC_IS_SCHEDULE_ACTIONS(o)

Modified: gnucash/branches/gobject-engine-dev/src/engine/SchedXaction.c
===================================================================
--- gnucash/branches/gobject-engine-dev/src/engine/SchedXaction.c	2007-03-15 07:30:19 UTC (rev 15725)
+++ gnucash/branches/gobject-engine-dev/src/engine/SchedXaction.c	2007-03-15 21:33:03 UTC (rev 15726)
@@ -48,6 +48,8 @@
 static void gnc_schedule_action_class_init(GncScheduleActionClass *klass);
 static void gnc_schedule_action_init(GncScheduleAction *sp);
 static void gnc_schedule_action_finalize(GObject *object);
+static void gnc_schedule_action_set_property (GObject *object, guint param_id, const GValue *value, GParamSpec *pspec);
+static void gnc_schedule_action_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec);
 
 struct _GncScheduleActionPrivate {
 	/* Private Members */
@@ -56,8 +58,10 @@
 typedef struct _GncScheduleActionSignal GncScheduleActionSignal;
 typedef enum _GncScheduleActionSignalType GncScheduleActionSignalType;
 
+
 enum _GncScheduleActionSignalType {
 	/* Signals */
+	FIRST_SIGNAL,
 	LAST_SIGNAL
 };
 
@@ -75,7 +79,7 @@
 static GObjectClass *parent_class = NULL;
 
 GType
-gnc_schedule_action_get_type()
+gnc_schedule_action_get_type(void)
 {
 	static GType type = 0;
 
@@ -142,7 +146,7 @@
 	switch (param_id) {		
 		default:
    			/* We don't have any other property... */
-    		G_OBJECT_WARN_INVALID_PROPERTY_ID(object,property_id,pspec);
+    		G_OBJECT_WARN_INVALID_PROPERTY_ID(object,param_id,pspec);
     	break;
 	}
 }
@@ -175,8 +179,6 @@
 {
    AccountGroup        *ag;
 
-   qof_instance_init (&sx->inst, GNC_ID_SCHEDXACTION, book);
-
    sx->freq = xaccFreqSpecMalloc(book);
 
    g_date_clear( &sx->last_date, 1 );
@@ -195,7 +197,7 @@
    sx->template_acct = xaccMallocAccount(book);
    /* THREAD-UNSAFE */
    xaccAccountSetName( sx->template_acct,
-                       guid_to_string( QOF_INSTANCE (sx).entity.guid ));
+                       guid_to_string( qof_instance_get_guid (QOF_INSTANCE (sx)) ));
    xaccAccountSetCommodity
      (sx->template_acct,
       gnc_commodity_new( book,
@@ -209,15 +211,15 @@
 SchedXaction*
 xaccSchedXactionMalloc(QofBook *book)
 {
-   SchedXaction *sx;
+   GncScheduleAction *sx;
 
    g_return_val_if_fail (book, NULL);
 
-   sx = g_object_new (GNC_SCHEDULE_ACTION, NULL );
-   xaccSchedXactionInit( sx, book );
-   qof_event_gen( QOF_ENTITY (sx), QOF_EVENT_CREATE , NULL);
+   sx = GNC_SCHEDULE_ACTION (g_object_new (GNC_TYPE_SCHEDULE_ACTION, "book", book, NULL ));
+   xaccSchedXactionInit( (SchedXaction*) sx, book );
+   qof_event_gen( QOF_INSTANCE (sx), QOF_EVENT_CREATE , NULL);
 
-   return sx;
+   return (SchedXaction*) sx;
 }
 
 static void
@@ -269,7 +271,7 @@
   if ( sx == NULL ) return;
   
   xaccFreqSpecFree( sx->freq );
-  qof_event_gen( QOF_ENTITY (sx), QOF_EVENT_DESTROY , NULL);
+  qof_event_gen( QOF_INSTANCE (sx), QOF_EVENT_DESTROY , NULL);
   
   if ( sx->name )
     g_free( sx->name );
@@ -345,7 +347,7 @@
    gnc_sx_begin_edit(sx);
    xaccFreqSpecFree( sx->freq );
    sx->freq = fs;
-   qof_instance_set_dirty(QOF_INSTANCE (sx));
+   qof_instance_set_dirty(QOF_INSTANCE (sx), TRUE);
    gnc_sx_commit_edit(sx);
 }
 
@@ -365,7 +367,7 @@
            sx->name = NULL;
    }
    sx->name = g_strdup( newName );
-   qof_instance_set_dirty(QOF_INSTANCE (sx));
+   qof_instance_set_dirty(QOF_INSTANCE (sx), TRUE);
    gnc_sx_commit_edit(sx);
 }
 
@@ -380,7 +382,7 @@
 {
    gnc_sx_begin_edit(sx);
    sx->start_date = *newStart;
-   qof_instance_set_dirty(QOF_INSTANCE (sx));
+   qof_instance_set_dirty(QOF_INSTANCE (sx), TRUE);
    gnc_sx_commit_edit(sx);
 }
 
@@ -412,7 +414,7 @@
 
   gnc_sx_begin_edit(sx);
   sx->end_date = *newEnd;
-  qof_instance_set_dirty(QOF_INSTANCE (sx));
+  qof_instance_set_dirty(QOF_INSTANCE (sx), TRUE);
   gnc_sx_commit_edit(sx);
 }
 
@@ -427,7 +429,7 @@
 {
   gnc_sx_begin_edit(sx);
   sx->last_date = *newLastOccur;
-  qof_instance_set_dirty(QOF_INSTANCE (sx));
+  qof_instance_set_dirty(QOF_INSTANCE (sx), TRUE);
   gnc_sx_commit_edit(sx);
 }
 
@@ -448,7 +450,7 @@
 {
   gnc_sx_begin_edit(sx);
   sx->num_occurances_remain = sx->num_occurances_total = newNum;
-  qof_instance_set_dirty(QOF_INSTANCE (sx));
+  qof_instance_set_dirty(QOF_INSTANCE (sx), TRUE);
   gnc_sx_commit_edit(sx);
 }
 
@@ -471,7 +473,7 @@
   {
     gnc_sx_begin_edit(sx);
     sx->num_occurances_remain = numRemain;
-    qof_instance_set_dirty(QOF_INSTANCE (sx));
+    qof_instance_set_dirty(QOF_INSTANCE (sx), TRUE);
     gnc_sx_commit_edit(sx);
   }
 }
@@ -482,7 +484,7 @@
 {
   if (!sx) return NULL;
 
-  return kvp_frame_get_slot(sx->inst.kvp_data, slot);
+  return kvp_frame_get_slot(qof_instance_get_kvp_data (QOF_INSTANCE (sx)), slot);
 }
 
 void
@@ -493,8 +495,8 @@
   if (!sx) return;
 
   gnc_sx_begin_edit(sx);
-  kvp_frame_set_slot( sx->inst.kvp_data, slot, value );
-  qof_instance_set_dirty(QOF_INSTANCE (sx));
+  kvp_frame_set_slot( qof_instance_get_kvp_data (QOF_INSTANCE (sx)), slot, value );
+  qof_instance_set_dirty(QOF_INSTANCE (sx), TRUE);
   gnc_sx_commit_edit(sx);
 }
 
@@ -519,7 +521,7 @@
   gnc_sx_begin_edit(sx);
   sx->autoCreateOption = newAutoCreate;
   sx->autoCreateNotify = newNotify; 
-  qof_instance_set_dirty(QOF_INSTANCE (sx));
+  qof_instance_set_dirty(QOF_INSTANCE (sx), TRUE);
   gnc_sx_commit_edit(sx);
   return;
 }
@@ -535,7 +537,7 @@
 {
   gnc_sx_begin_edit(sx);
   sx->advanceCreateDays = createDays;
-  qof_instance_set_dirty(QOF_INSTANCE (sx));
+  qof_instance_set_dirty(QOF_INSTANCE (sx), TRUE);
   gnc_sx_commit_edit(sx);
 }
 
@@ -550,7 +552,7 @@
 {
   gnc_sx_begin_edit(sx);
   sx->advanceRemindDays = reminderDays;
-  qof_instance_set_dirty(QOF_INSTANCE (sx));
+  qof_instance_set_dirty(QOF_INSTANCE (sx), TRUE);
   gnc_sx_commit_edit(sx);
 }
 
@@ -835,7 +837,7 @@
    sx->last_date        = tsd->last_date;
    sx->num_occurances_remain = tsd->num_occur_rem;
    sx->instance_num     = tsd->num_inst;
-   qof_instance_set_dirty(QOF_INSTANCE (sx));
+   qof_instance_set_dirty(QOF_INSTANCE (sx), TRUE);
    gnc_sx_commit_edit(sx);
 }
 
@@ -906,6 +908,10 @@
    return sx->deferredList;
 }
 
+/*
+
+BROKEN CODE
+
 static QofObject SXDesc = 
 {
 	interface_version : QOF_OBJECT_VERSION,
@@ -944,3 +950,4 @@
 	qof_class_register(GNC_SX_ID, NULL, params);
 	return qof_object_register(&SXDesc);
 }
+*/

Modified: gnucash/branches/gobject-engine-dev/src/engine/SchedXaction.h
===================================================================
--- gnucash/branches/gobject-engine-dev/src/engine/SchedXaction.h	2007-03-15 07:30:19 UTC (rev 15725)
+++ gnucash/branches/gobject-engine-dev/src/engine/SchedXaction.h	2007-03-15 21:33:03 UTC (rev 15726)
@@ -54,7 +54,7 @@
 
 typedef struct _GncScheduleActionClass GncScheduleActionClass;
 typedef struct _GncScheduleAction GncScheduleAction;
-typedef struct GncScheduleAction ShedXaction; /*  Dummy type for backward compatilibity */
+typedef GncScheduleAction SchedXaction; /*  Dummy type for backward compatilibity */
 
 struct _GncScheduleActionClass {
 	QofInstanceClass parent_class;
@@ -63,14 +63,10 @@
 	/* Add Signal Functions Here */
 };
 
-GType   gnc_schedule_action_get_type ();
+GType   gnc_schedule_action_get_type (void);
 
 /********************************************/
 
-/**
- * The SchedXaction data.
-*/
-typedef struct gncp_SchedXaction SchedXaction;
 
 /**
  * Creates and initializes a scheduled transaction.
@@ -246,7 +242,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/gobject-engine-dev/src/engine/SchedXactionP.h
===================================================================
--- gnucash/branches/gobject-engine-dev/src/engine/SchedXactionP.h	2007-03-15 07:30:19 UTC (rev 15725)
+++ gnucash/branches/gobject-engine-dev/src/engine/SchedXactionP.h	2007-03-15 21:33:03 UTC (rev 15726)
@@ -87,6 +87,6 @@
   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))
 
 #endif /* XACC_SCHEDXACTION_P_H */

Modified: gnucash/branches/gobject-engine-dev/src/engine/Scrub.c
===================================================================
--- gnucash/branches/gobject-engine-dev/src/engine/Scrub.c	2007-03-15 07:30:19 UTC (rev 15725)
+++ gnucash/branches/gobject-engine-dev/src/engine/Scrub.c	2007-03-15 21:33:03 UTC (rev 15726)
@@ -250,12 +250,12 @@
   /* If the account doesn't have a commodity, 
    * we should attempt to fix that first. 
   */
-  if (!account->commodity)
+  if (!xaccAccountGetCommodity((const GncAccount*)account))
   {
     xaccAccountScrubCommodity (account);
   }
-  if (!account->commodity || 
-      !gnc_commodity_equiv (account->commodity, currency))
+  if (!xaccAccountGetCommodity((const GncAccount*)account) || 
+      !gnc_commodity_equiv (xaccAccountGetCommodity((const GncAccount*)account), currency))
   {
     LEAVE ("(split=%p) inequiv currency", split);
     return;
@@ -439,7 +439,7 @@
   /* Put split into account before setting split value */
   if (!balance_split)
   {
-    balance_split = xaccMallocSplit (trans->inst.book);
+    balance_split = xaccMallocSplit (qof_instance_get_book (QOF_INSTANCE (trans)));
 
     xaccTransBeginEdit (trans);
     xaccSplitSetParent(balance_split, trans);
@@ -616,7 +616,7 @@
   currency = xaccTransGetCurrency (trans);
   if (currency) return;
   
-  currency = xaccTransFindOldCommonCurrency (trans, trans->inst.book);
+  currency = xaccTransFindOldCommonCurrency (trans, qof_instance_get_book (QOF_INSTANCE (trans)));
   if (currency)
   {
     xaccTransBeginEdit (trans);
@@ -647,7 +647,8 @@
         else
         {
           PWARN (" split=\"%s\" account=\"%s\" commodity=\"%s\"", 
-              split->memo, split->acc->accountName, gnc_commodity_get_mnemonic (split->acc->commodity));
+              split->memo, xaccAccountGetName((const GncAccount*) split->acc), 
+              gnc_commodity_get_mnemonic (xaccAccountGetCommodity ((const GncAccount*) split->acc)));
         }
       }
     }
@@ -731,7 +732,7 @@
     return;
   }
 
-  PERR ("Account \"%s\" does not have a commodity!", account->accountName);
+  PERR ("Account \"%s\" does not have a commodity!", xaccAccountGetName ((const GncAccount*) account));
 }
 
 /* ================================================================ */
@@ -741,10 +742,10 @@
 {
   if (!account) return;
 
-  kvp_frame_set_slot_nc (account->inst.kvp_data, "old-currency", NULL);
-  kvp_frame_set_slot_nc (account->inst.kvp_data, "old-security", NULL);
-  kvp_frame_set_slot_nc (account->inst.kvp_data, "old-currency-scu", NULL);
-  kvp_frame_set_slot_nc (account->inst.kvp_data, "old-security-scu", NULL);
+  kvp_frame_set_slot_nc (qof_instance_get_kvp_data (QOF_INSTANCE (account)), "old-currency", NULL);
+  kvp_frame_set_slot_nc (qof_instance_get_kvp_data (QOF_INSTANCE (account)), "old-security", NULL);
+  kvp_frame_set_slot_nc (qof_instance_get_kvp_data (QOF_INSTANCE (account)), "old-currency-scu", NULL);
+  kvp_frame_set_slot_nc (qof_instance_get_kvp_data (QOF_INSTANCE (account)), "old-security-scu", NULL);
 }
 
 static int
@@ -853,21 +854,21 @@
 
   if (!account) return;
 
-  str = kvp_frame_get_string(account->inst.kvp_data, "notes");
+  str = kvp_frame_get_string(qof_instance_get_kvp_data (QOF_INSTANCE (account)), "notes");
   if (str) {
     str2 = g_strstrip(g_strdup(str));
     if (strlen(str2) == 0)
-      kvp_frame_set_slot_nc (account->inst.kvp_data, "notes", NULL);
+      kvp_frame_set_slot_nc (qof_instance_get_kvp_data (QOF_INSTANCE (account)), "notes", NULL);
     g_free(str2);
   }
 
-  str = kvp_frame_get_string(account->inst.kvp_data, "placeholder");
+  str = kvp_frame_get_string(qof_instance_get_kvp_data (QOF_INSTANCE (account)), "placeholder");
   if (str && strcmp(str, "false") == 0)
-    kvp_frame_set_slot_nc (account->inst.kvp_data, "placeholder", NULL);
+    kvp_frame_set_slot_nc (qof_instance_get_kvp_data (QOF_INSTANCE (account)), "placeholder", NULL);
 
-  frame = kvp_frame_get_frame(account->inst.kvp_data, "hbci");
+  frame = kvp_frame_get_frame(qof_instance_get_kvp_data (QOF_INSTANCE (account)), "hbci");
   if (frame && kvp_frame_is_empty(frame)) {
-    kvp_frame_set_frame_nc(account->inst.kvp_data, "hbci", NULL);
+    kvp_frame_set_frame_nc(qof_instance_get_kvp_data (QOF_INSTANCE (account)), "hbci", NULL);
   }
 }
 
@@ -898,7 +899,7 @@
   if (acc == NULL)
   {
     /* Guess not. We'll have to build one. */
-    acc = xaccMallocAccount (root->book);
+    acc = xaccMallocAccount (qof_instance_get_book (QOF_INSTANCE (root)));
     xaccAccountBeginEdit (acc);
     xaccAccountSetName (acc, accname);
     xaccAccountSetCommodity (acc, currency);

Modified: gnucash/branches/gobject-engine-dev/src/engine/Scrub2.c
===================================================================
--- gnucash/branches/gobject-engine-dev/src/engine/Scrub2.c	2007-03-15 07:30:19 UTC (rev 15725)
+++ gnucash/branches/gobject-engine-dev/src/engine/Scrub2.c	2007-03-15 21:33:03 UTC (rev 15726)
@@ -63,11 +63,11 @@
 
    if (!acc) return;
 
-   ENTER ("acc=%s", acc->accountName);
+   ENTER ("acc=%s", xaccAccountGetName(acc));
    xaccAccountBeginEdit (acc);
 
 restart_loop:
-   for (node=acc->splits; node; node=node->next)
+   for (node=xaccAccountGetSplitList (acc); node; node=node->next)
    {
       Split * split = node->data;
 
@@ -81,7 +81,7 @@
       if (xaccSplitAssign (split)) goto restart_loop;
    }
    xaccAccountCommitEdit (acc);
-   LEAVE ("acc=%s", acc->accountName);
+   LEAVE ("acc=%s", xaccAccountGetName (acc));
 }
 
 /* ============================================================== */
@@ -102,9 +102,9 @@
 
    if (!lot) return;
    acc = lot->account;
-   pcy = acc->policy;
+   pcy = gnc_account_get_policy (acc);
 
-   ENTER ("(lot=%s, acc=%s)", gnc_lot_get_title(lot), acc->accountName);
+   ENTER ("(lot=%s, acc=%s)", gnc_lot_get_title(lot), xaccAccountGetName (acc));
 
    /* If balance already zero, we have nothing to do. */
    if (gnc_lot_is_closed (lot)) return;
@@ -142,7 +142,7 @@
       if (!split) break;
    }
    xaccAccountCommitEdit (acc);
-   LEAVE ("(lot=%s, acc=%s)", gnc_lot_get_title(lot), acc->accountName);
+   LEAVE ("(lot=%s, acc=%s)", gnc_lot_get_title(lot), xaccAccountGetName (acc));
 }
 
 /* ============================================================== */
@@ -232,7 +232,7 @@
    g_return_val_if_fail (split->parent, FALSE);
 
    /* If there are no sub-splits, then there's nothing to do. */
-   kval = kvp_frame_get_slot (split->inst.kvp_data, "lot-split");
+   kval = kvp_frame_get_slot (qof_instance_get_kvp_data (QOF_INSTANCE (split)), "lot-split");
    if (!kval) return FALSE;  
 
    return TRUE;
@@ -320,27 +320,27 @@
    KvpFrame *ksub;
 
    /* 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);
+   ksub = (KvpFrame*)gnc_kvp_bag_find_by_guid (qof_instance_get_kvp_data (QOF_INSTANCE (sa)), "lot-split",
+                    "peer_guid", qof_instance_get_guid (QOF_INSTANCE (sb)));
    if (ksub) 
    {
-      gnc_kvp_bag_remove_frame (sa->inst.kvp_data, "lot-split", ksub);
+      gnc_kvp_bag_remove_frame (qof_instance_get_kvp_data (QOF_INSTANCE (sa)), "lot-split", ksub);
       kvp_frame_delete (ksub);
    }
 
    /* 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);
+   ksub = (KvpFrame*)gnc_kvp_bag_find_by_guid (qof_instance_get_kvp_data (QOF_INSTANCE (sb)), "lot-split",
+                    "peer_guid", qof_instance_get_guid (QOF_INSTANCE (sa)));
    if (ksub) 
    {
-      gnc_kvp_bag_remove_frame (sb->inst.kvp_data, "lot-split", ksub);
+      gnc_kvp_bag_remove_frame (qof_instance_get_kvp_data (QOF_INSTANCE (sb)), "lot-split", ksub);
       kvp_frame_delete (ksub);
    }
 
    /* Finally, merge b's lot-splits, if any, into a's */
    /* This is an important step, if it got busted into many pieces. */
-   gnc_kvp_bag_merge (sa->inst.kvp_data, "lot-split",
-                      sb->inst.kvp_data, "lot-split");
+   gnc_kvp_bag_merge (qof_instance_get_kvp_data (QOF_INSTANCE (sa)), "lot-split",
+                      qof_instance_get_kvp_data (QOF_INSTANCE (sb)), "lot-split");
 }
 
 /* The merge_splits() routine causes the amount & value of sb 
@@ -413,7 +413,7 @@
       Split *s = node->data;
       if (xaccSplitGetLot (s) != lot) continue;
       if (s == split) continue;
-      if (s->inst.do_free) continue;
+      if (qof_instance_do_free (QOF_INSTANCE (s))) continue;
 
       /* OK, this split is in the same lot (and thus same account)
        * as the indicated split.  Make sure it is really a subsplit
@@ -423,8 +423,8 @@
        * example.  Only worry about adjacent sub-splits.  By 
        * 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)
+      if (gnc_kvp_bag_find_by_guid (qof_instance_get_kvp_data (QOF_INSTANCE (split)), "lot-split",
+                                    "peer_guid", qof_instance_get_guid (QOF_INSTANCE (s))) == NULL)
          continue;
          
       merge_splits (split, s);

Modified: gnucash/branches/gobject-engine-dev/src/engine/Scrub3.c
===================================================================
--- gnucash/branches/gobject-engine-dev/src/engine/Scrub3.c	2007-03-15 07:30:19 UTC (rev 15725)
+++ gnucash/branches/gobject-engine-dev/src/engine/Scrub3.c	2007-03-15 21:33:03 UTC (rev 15726)
@@ -70,7 +70,7 @@
   if (!node) return FALSE;
   split = node->data;
 
-  comeq = gnc_commodity_equiv (acc->commodity, split->parent->common_currency);
+  comeq = gnc_commodity_equiv (xaccAccountGetCommodity (acc), split->parent->common_currency);
   return (FALSE == comeq);
 }
 
@@ -93,7 +93,7 @@
   ENTER ("(lot=%p) %s", lot, gnc_lot_get_title(lot));
 
   acc = gnc_lot_get_account (lot);
-  pcy = acc->policy;
+  pcy = gnc_account_get_policy (acc);
   xaccAccountBeginEdit(acc);
   xaccScrubMergeLotSubSplits (lot);
 
@@ -161,17 +161,17 @@
   if (!acc) return;
   if (FALSE == xaccAccountHasTrades (acc)) return;
                                                                                 
-  ENTER ("(acc=%s)", acc->accountName);
+  ENTER ("(acc=%s)", xaccAccountGetName (acc));
   xaccAccountBeginEdit(acc);
   xaccAccountAssignLots (acc);
 
-  for (node = acc->lots; node; node=node->next)
+  for (node = xaccAccountGetLotList (acc); node; node=node->next)
   {
     GNCLot *lot = node->data;
     xaccScrubLot (lot);
   }
   xaccAccountCommitEdit(acc);
-  LEAVE ("(acc=%s)", acc->accountName);
+  LEAVE ("(acc=%s)", xaccAccountGetName (acc));
 }
 
 /* ============================================================== */
@@ -196,7 +196,7 @@
 {
    if (!acc) return;
 
-   xaccGroupScrubLots (acc->children);
+   xaccGroupScrubLots (gnc_account_get_children (acc));
    xaccAccountScrubLots (acc);
 }
 

Modified: gnucash/branches/gobject-engine-dev/src/engine/Split.c
===================================================================
--- gnucash/branches/gobject-engine-dev/src/engine/Split.c	2007-03-15 07:30:19 UTC (rev 15725)
+++ gnucash/branches/gobject-engine-dev/src/engine/Split.c	2007-03-15 21:33:03 UTC (rev 15726)
@@ -53,6 +53,8 @@
 static void gnc_split_class_init(GncSplitClass *klass);
 static void gnc_split_init(GncSplit *sp);
 static void gnc_split_finalize(GObject *object);
+static void gnc_split_set_property (GObject *object, guint param_id, const GValue *value, GParamSpec *pspec);
+static void gnc_split_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec);
 
 struct _GncSplitPrivate {
 	/* Private Members */
@@ -63,6 +65,7 @@
 
 enum _GncSplitSignalType {
 	/* Signals */
+	FIRST_SIGNAL,
 	LAST_SIGNAL
 };
 
@@ -80,7 +83,7 @@
 static GObjectClass *parent_class = NULL;
 
 GType
-gnc_split_get_type()
+gnc_split_get_type(void)
 {
 	static GType type = 0;
 
@@ -147,7 +150,7 @@
 	switch (param_id) {		
 		default:
    			/* We don't have any other property... */
-    		G_OBJECT_WARN_INVALID_PROPERTY_ID(object,property_id,pspec);
+    		G_OBJECT_WARN_INVALID_PROPERTY_ID(object, param_id, pspec);
     	break;
 	}
 }
@@ -211,8 +214,6 @@
 
   split->gains = GAINS_STATUS_UNKNOWN;
   split->gains_split = NULL;
-
-  qof_instance_init(QOF_INSTANCE (split), GNC_ID_SPLIT, book);
 }
 
 void
@@ -237,9 +238,9 @@
   split->cleared_balance     = gnc_numeric_zero();
   split->reconciled_balance  = gnc_numeric_zero();
 
-  if (split->inst.kvp_data)
-      kvp_frame_delete(split->inst.kvp_data);
-  split->inst.kvp_data = kvp_frame_new();
+  if (qof_instance_get_kvp_data (QOF_INSTANCE (split)))
+      qof_instance_delete_kvp_data (QOF_INSTANCE (split));
+  qof_instance_set_kvp_data (QOF_INSTANCE (split), kvp_frame_new());
   split->idata = 0;
 
   split->gains = GAINS_STATUS_UNKNOWN;
@@ -279,10 +280,8 @@
    * 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.book = s->inst.book;
+  qof_instance_set_guid (QOF_INSTANCE (split), qof_instance_get_guid (QOF_INSTANCE (s)));
+  qof_instance_set_book (QOF_INSTANCE (split), qof_instance_get_book (QOF_INSTANCE (s)));
 
   split->parent = s->parent;
   split->acc = s->acc;
@@ -292,7 +291,7 @@
   split->memo = CACHE_INSERT(s->memo);
   split->action = CACHE_INSERT(s->action);
 
-  split->inst.kvp_data = kvp_frame_copy (s->inst.kvp_data);
+  qof_instance_set_kvp_data (QOF_INSTANCE (split), qof_instance_get_kvp_data (QOF_INSTANCE (s)));
 
   split->reconciled = s->reconciled;
   split->date_reconciled = s->date_reconciled;
@@ -329,9 +328,8 @@
   split->gains = GAINS_STATUS_UNKNOWN;
   split->gains_split = NULL;
 
-  qof_instance_init(QOF_INSTANCE (split), GNC_ID_SPLIT, s->inst.book);
-  kvp_frame_delete(split->inst.kvp_data);
-  split->inst.kvp_data = kvp_frame_copy(s->inst.kvp_data);
+  qof_instance_delete_kvp_data (QOF_INSTANCE (split));
+  qof_instance_set_kvp_data (QOF_INSTANCE(split), qof_instance_get_kvp_data (QOF_INSTANCE (s)));
 
   xaccAccountInsertSplit(s->acc, split);
   if (s->lot) {
@@ -404,9 +402,9 @@
 
 static void mark_acc(Account *acc)
 {
-    if (acc && !acc->inst.do_free) {
-        acc->balance_dirty = TRUE;
-        acc->sort_dirty = TRUE;
+    if (acc && !qof_instance_get_do_free (QOF_INSTANCE (acc))) {
+        gnc_account_set_balance_dirty (acc, TRUE);
+        gnc_account_set_sort_dirty (acc, TRUE);
     }
 }
 
@@ -460,7 +458,7 @@
   if (sa == sb) return TRUE;
 
   if (check_guids) {
-    if (!guid_equal(&(sa->inst.entity.guid), &(sb->inst.entity.guid)))
+    if (!guid_equal(qof_instance_get_guid (QOF_INSTANCE (sa)), qof_instance_get_guid (QOF_INSTANCE (sb))))
     {
       PWARN ("GUIDs differ");
       return FALSE;
@@ -481,13 +479,13 @@
     return FALSE;
   }
 
-  if (kvp_frame_compare(sa->inst.kvp_data, sb->inst.kvp_data) != 0)
+  if (kvp_frame_compare(qof_instance_get_kvp_data (QOF_INSTANCE (sa)), qof_instance_get_kvp_data (QOF_INSTANCE (sb))) != 0)
   {
     char *frame_a;
     char *frame_b;
 
-    frame_a = kvp_frame_to_string (sa->inst.kvp_data);
-    frame_b = kvp_frame_to_string (sb->inst.kvp_data);
+    frame_a = kvp_frame_to_string (qof_instance_get_kvp_data (QOF_INSTANCE (sa)));
+    frame_b = kvp_frame_to_string (qof_instance_get_kvp_data (QOF_INSTANCE (sb)));
 
     PWARN ("kvp frames differ:\n%s\n\nvs\n\n%s", frame_a, frame_b);
 
@@ -600,14 +598,14 @@
     Transaction *trans;
 
     g_return_if_fail(s && acc);
-    g_return_if_fail(acc->inst.book == s->inst.book);
+    g_return_if_fail(qof_instance_get_book (QOF_INSTANCE (acc)) == qof_instance_get_book (QOF_INSTANCE (s)));
 
     trans = s->parent;
     if (trans)
         xaccTransBeginEdit(trans);
 
     s->acc = acc;
-    qof_instance_set_dirty(QOF_INSTANCE(s));
+    qof_instance_set_dirty(QOF_INSTANCE(s), TRUE);
 
     if (trans)
         xaccTransCommitEdit(trans);
@@ -618,6 +616,7 @@
 xaccSplitCommitEdit(Split *s)
 {
     Account *acc, *orig_acc;
+    SplitList *l;
 
     g_return_if_fail(s);
     if (!qof_instance_is_dirty(QOF_INSTANCE(s)))
@@ -627,32 +626,35 @@
     acc = s->acc;
     /* Remove from lot (but only if it hasn't been moved to
        new lot already) */
-    if (s->lot && (s->lot->account != acc || s->inst.do_free))
+    if (s->lot && (s->lot->account != acc || qof_instance_get_do_free (QOF_INSTANCE (s))))
         gnc_lot_remove_split (s->lot, s);
 
     /* Possibly remove the split from the original account... */
-    if (orig_acc && (orig_acc != acc || s->inst.do_free)) {
-        GList *node = g_list_find (orig_acc->splits, s);
+    if (orig_acc && (orig_acc != acc || qof_instance_get_do_free (QOF_INSTANCE (s)))) {
+        GList *node = g_list_find (xaccAccountGetSplitList (orig_acc), s);
         if (node) {
-            orig_acc->splits = g_list_delete_link (orig_acc->splits, node);
+            l = xaccAccountGetSplitList (orig_acc);
+            l = g_list_delete_link (xaccAccountGetSplitList (orig_acc), node);
             //FIXME: find better event type
-            qof_event_gen (&orig_acc->inst.entity, QOF_EVENT_MODIFY, NULL);
+            qof_event_gen (QOF_INSTANCE (orig_acc), 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(QOF_INSTANCE (orig_acc), GNC_EVENT_ITEM_REMOVED, s);
         } else PERR("Account lost track of moved or deleted split.");
-        orig_acc->balance_dirty = TRUE;
+        gnc_account_set_balance_dirty (orig_acc, TRUE);
         xaccAccountRecomputeBalance(orig_acc);
     }
 
     /* ... and insert it into the new account if needed */
-    if (orig_acc != s->acc && !s->inst.do_free) {
-        if (!g_list_find(acc->splits, s)) {
-            if (acc->inst.editlevel == 0) {
-                acc->splits = g_list_insert_sorted(
-                    acc->splits, s, (GCompareFunc)xaccSplitDateOrder);
+    if (orig_acc != s->acc && !qof_instance_get_do_free (QOF_INSTANCE (s))) {
+        if (!g_list_find(xaccAccountGetSplitList (acc), s)) {
+            if (qof_instance_get_edit_level (QOF_INSTANCE (acc)) == 0) {
+                l = xaccAccountGetSplitList (acc);
+                l = g_list_insert_sorted(
+                    xaccAccountGetSplitList (acc), s, (GCompareFunc)xaccSplitDateOrder);
             } else {
-                acc->splits = g_list_prepend(acc->splits, s);
-                acc->sort_dirty = TRUE;
+                l = xaccAccountGetSplitList (acc);
+                l = g_list_prepend(xaccAccountGetSplitList(acc), s);
+                gnc_account_set_sort_dirty (acc, TRUE);
             }
 
             /* If the split's lot belonged to some other account, we
@@ -661,24 +663,24 @@
                 xaccAccountInsertLot (acc, s->lot);
 
             //FIXME: find better event
-            qof_event_gen (&acc->inst.entity, QOF_EVENT_MODIFY, NULL);
+            qof_event_gen (QOF_INSTANCE (acc), 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(QOF_INSTANCE (acc), GNC_EVENT_ITEM_ADDED, s);
         } else PERR("Account grabbed split prematurely.");
-        acc->balance_dirty = TRUE;
+        gnc_account_set_balance_dirty(acc, TRUE);
         xaccSplitSetAmount(s, xaccSplitGetAmount(s));
     }
 
     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(QOF_INSTANCE (s->orig_parent), 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 (QOF_INSTANCE (s->lot), QOF_EVENT_MODIFY, NULL);
     }
 
     /* Important: we save off the original parent transaction and account
@@ -689,11 +691,11 @@
     qof_instance_mark_clean (QOF_INSTANCE(s));
 
     /* This is because Splits don't call qof_commit_edit(). */
-    qof_instance_set_dirty(QOF_INSTANCE(s->parent));
+    qof_instance_set_dirty(QOF_INSTANCE(s->parent), TRUE);
 
     mark_acc(acc);
     xaccAccountRecomputeBalance(acc);
-    if (s->inst.do_free)
+    if (qof_instance_do_free (QOF_INSTANCE (s)))
         xaccFreeSplit(s);
 }
 
@@ -709,12 +711,12 @@
         s->acc = s->orig_acc;  
 
     /* Undestroy if needed */
-    if (s->inst.do_free && s->parent) {
+    if (qof_instance_do_free (QOF_INSTANCE (s)) && s->parent) {
         GncEventData ed;
-        s->inst.do_free = FALSE;
+        qof_instance_set_do_free (QOF_INSTANCE (s), FALSE);
         ed.node = s;
         ed.idx = -1; /* unused */
-        qof_event_gen(&s->parent->inst.entity, GNC_EVENT_ITEM_ADDED, &ed);
+        qof_event_gen(QOF_INSTANCE (s), GNC_EVENT_ITEM_ADDED, &ed);
     }
 
     /* But for the parent trans, we want the intermediate events, so
@@ -731,7 +733,7 @@
   QofCollection *col;
   if (!guid || !book) return NULL;
   col = qof_book_get_collection (book, GNC_ID_SPLIT);
-  return (Split *) qof_collection_lookup_entity (col, guid);
+  return (Split *) qof_collection_lookup_element (col, guid);
 }
 
 /********************************************************************\
@@ -760,16 +762,16 @@
       return;
    }
 
-   val = kvp_frame_get_slot (split->inst.kvp_data, "gains-source");
+   val = kvp_frame_get_slot (qof_instance_get_kvp_data (QOF_INSTANCE (split)), "gains-source");
    if (!val)
    {  
        // CHECKME: We leave split->gains_split alone.  Is that correct?
       split->gains = GAINS_STATUS_A_VDIRTY | GAINS_STATUS_DATE_DIRTY;
    } else {
       QofCollection *col;
-      col = qof_book_get_collection (split->inst.book, GNC_ID_SPLIT);
+      col = qof_book_get_collection (qof_instance_get_book (QOF_INSTANCE (split)), GNC_ID_SPLIT);
       split->gains = GAINS_STATUS_GAINS;
-      other = (Split *) qof_collection_lookup_entity (col, 
+      other = (Split *) qof_collection_lookup_element (col, 
                   kvp_value_get_guid (val));
       split->gains_split = other;
    }
@@ -849,7 +851,7 @@
 
   SET_GAINS_A_VDIRTY(s);
   mark_split (s);
-  qof_instance_set_dirty(QOF_INSTANCE(s));
+  qof_instance_set_dirty(QOF_INSTANCE(s), TRUE);
   xaccTransCommitEdit(s->parent);
 
 }
@@ -868,7 +870,7 @@
 
   SET_GAINS_A_VDIRTY(s);
   mark_split (s);
-  qof_instance_set_dirty(QOF_INSTANCE(s));
+  qof_instance_set_dirty(QOF_INSTANCE(s), TRUE);
   xaccTransCommitEdit(s->parent);
 }
 
@@ -894,7 +896,7 @@
 
   SET_GAINS_VDIRTY(s);
   mark_split (s);
-  qof_instance_set_dirty(QOF_INSTANCE(s));
+  qof_instance_set_dirty(QOF_INSTANCE(s), TRUE);
   xaccTransCommitEdit(s->parent);
 }
 
@@ -927,7 +929,7 @@
 
   SET_GAINS_A_VDIRTY(s);
   mark_split (s);
-  qof_instance_set_dirty(QOF_INSTANCE(s));
+  qof_instance_set_dirty(QOF_INSTANCE(s), TRUE);
   xaccTransCommitEdit(s->parent);
 }
 
@@ -962,7 +964,7 @@
 
   SET_GAINS_ADIRTY(s);
   mark_split (s);
-  qof_instance_set_dirty(QOF_INSTANCE(s));
+  qof_instance_set_dirty(QOF_INSTANCE(s), TRUE);
   xaccTransCommitEdit(s->parent);
   LEAVE("");
 }
@@ -996,7 +998,7 @@
 
   SET_GAINS_VDIRTY(s);
   mark_split (s);
-  qof_instance_set_dirty(QOF_INSTANCE(s));
+  qof_instance_set_dirty(QOF_INSTANCE(s), TRUE);
   xaccTransCommitEdit(s->parent);
   LEAVE ("");
 }
@@ -1069,7 +1071,7 @@
 
   SET_GAINS_A_VDIRTY(s);
   mark_split (s);
-  qof_instance_set_dirty(QOF_INSTANCE(s));
+  qof_instance_set_dirty(QOF_INSTANCE(s), TRUE);
   xaccTransCommitEdit(s->parent);
 }
 
@@ -1233,15 +1235,15 @@
 
    acc = split->acc;
    trans = split->parent;
-   if (acc && !acc->inst.do_free && xaccTransGetReadOnly (trans))
+   if (acc && !qof_instance_get_do_free (QOF_INSTANCE (acc)) && xaccTransGetReadOnly (trans))
        return FALSE;
 
    xaccTransBeginEdit(trans);
    ed.node = split;
    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_instance_set_dirty(QOF_INSTANCE(split), TRUE);
+   qof_instance_set_do_free (QOF_INSTANCE (split), TRUE);
+   qof_event_gen(QOF_INSTANCE (trans), GNC_EVENT_ITEM_REMOVED, &ed);
    xaccTransCommitEdit(trans);
 
    return TRUE;
@@ -1296,7 +1298,7 @@
   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(qof_instance_get_guid (QOF_INSTANCE (sa)), qof_instance_get_guid (QOF_INSTANCE(sb)));
   if (retval) return retval;
 
   return 0;
@@ -1473,7 +1475,7 @@
    xaccTransBeginEdit (split->parent);
 
    CACHE_REPLACE(split->memo, memo);
-   qof_instance_set_dirty(QOF_INSTANCE(split));
+   qof_instance_set_dirty(QOF_INSTANCE(split), TRUE);
    xaccTransCommitEdit(split->parent);
 
 }
@@ -1492,7 +1494,7 @@
    xaccTransBeginEdit (split->parent);
 
    CACHE_REPLACE(split->action, actn);
-   qof_instance_set_dirty(QOF_INSTANCE(split));
+   qof_instance_set_dirty(QOF_INSTANCE(split), TRUE);
    xaccTransCommitEdit(split->parent);
 
 }
@@ -1532,7 +1534,7 @@
    case VREC: 
      split->reconciled = recn;
      mark_split (split);
-     qof_instance_set_dirty(QOF_INSTANCE(split));
+     qof_instance_set_dirty(QOF_INSTANCE(split), TRUE);
      xaccAccountRecomputeBalance (split->acc);
      break;
    default:
@@ -1550,7 +1552,7 @@
 
    split->date_reconciled.tv_sec = secs;
    split->date_reconciled.tv_nsec = 0;
-   qof_instance_set_dirty(QOF_INSTANCE(split));
+   qof_instance_set_dirty(QOF_INSTANCE(split), TRUE);
    xaccTransCommitEdit(split->parent);
 
 }
@@ -1562,7 +1564,7 @@
    xaccTransBeginEdit (split->parent);
 
    split->date_reconciled = *ts;
-   qof_instance_set_dirty(QOF_INSTANCE(split));
+   qof_instance_set_dirty(QOF_INSTANCE(split), TRUE);
    xaccTransCommitEdit(split->parent);
 
 }
@@ -1611,12 +1613,12 @@
     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(QOF_INSTANCE (old_trans), GNC_EVENT_ITEM_REMOVED, &ed);
     }
     s->parent = t;
 
     xaccTransCommitEdit(old_trans);
-    qof_instance_set_dirty(QOF_INSTANCE(s));
+    qof_instance_set_dirty(QOF_INSTANCE(s), TRUE);
 
     if (t) {
         /* Convert split to new transaction's commodity denominator */
@@ -1627,7 +1629,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(QOF_INSTANCE (t), GNC_EVENT_ITEM_ADDED, &ed);
     }
     xaccTransCommitEdit(t);
 }
@@ -1725,7 +1727,7 @@
   const char *split_type;
 
   if (!s) return NULL;
-  split_type = kvp_frame_get_string(s->inst.kvp_data, "split-type");
+  split_type = kvp_frame_get_string(qof_instance_get_kvp_data (QOF_INSTANCE (s)), "split-type");
   return split_type ? split_type : "normal";
 }
 
@@ -1737,10 +1739,10 @@
   xaccTransBeginEdit (s->parent);
 
   s->value = gnc_numeric_zero();
-  kvp_frame_set_str(s->inst.kvp_data, "split-type", "stock-split");
+  kvp_frame_set_str(qof_instance_get_kvp_data (QOF_INSTANCE (s)), "split-type", "stock-split");
   SET_GAINS_VDIRTY(s);
   mark_split(s);
-  qof_instance_set_dirty(QOF_INSTANCE(s));
+  qof_instance_set_dirty(QOF_INSTANCE(s), TRUE);
   xaccTransCommitEdit(s->parent);
 }
 
@@ -1783,13 +1785,13 @@
 
   num_splits = xaccTransCountSplits(trans);
   count = num_splits;
-  sva = kvp_frame_get_slot (split->inst.kvp_data, "lot-split");
+  sva = kvp_frame_get_slot (qof_instance_get_kvp_data (QOF_INSTANCE (split)), "lot-split");
   if (!sva && (2 != count)) return NULL;
 
   for (i = 0; i < num_splits; i++) {
       Split *s = xaccTransGetSplit(trans, i);
       if (s == split) { --count; continue; }
-      if (kvp_frame_get_slot (s->inst.kvp_data, "lot-split")) 
+      if (kvp_frame_get_slot (qof_instance_get_kvp_data (QOF_INSTANCE (s)), "lot-split")) 
           { --count; continue; }
       other = s;
   }
@@ -1809,21 +1811,21 @@
 xaccSplitVoidFormerAmount(const Split *split)
 {
   g_return_val_if_fail(split, gnc_numeric_zero());
-  return kvp_frame_get_numeric(split->inst.kvp_data, void_former_amt_str);
+  return kvp_frame_get_numeric(qof_instance_get_kvp_data (QOF_INSTANCE (split)), void_former_amt_str);
 }
 
 gnc_numeric
 xaccSplitVoidFormerValue(const Split *split)
 {
   g_return_val_if_fail(split, gnc_numeric_zero());
-  return kvp_frame_get_numeric(split->inst.kvp_data, void_former_val_str);
+  return kvp_frame_get_numeric(qof_instance_get_kvp_data (QOF_INSTANCE (split)), void_former_val_str);
 }
 
 void
 xaccSplitVoid(Split *split)
 {
     gnc_numeric zero = gnc_numeric_zero();
-    KvpFrame *frame = split->inst.kvp_data;
+    KvpFrame *frame = qof_instance_get_kvp_data (QOF_INSTANCE (split));
 
     kvp_frame_set_gnc_numeric(frame, void_former_amt_str, 
                               xaccSplitGetAmount(split));
@@ -1839,7 +1841,7 @@
 void
 xaccSplitUnvoid(Split *split)
 {
-    KvpFrame *frame = split->inst.kvp_data;
+    KvpFrame *frame = qof_instance_get_kvp_data (QOF_INSTANCE (split));
     
     xaccSplitSetAmount (split, xaccSplitVoidFormerAmount(split));
     xaccSplitSetValue (split, xaccSplitVoidFormerValue(split));
@@ -1853,7 +1855,10 @@
 /* QofObject function implementation */
 
 /* Hook into the QofObject registry */
+/*
 
+BROKEN CODE
+
 static QofObject split_object_def = {
   interface_version: QOF_OBJECT_VERSION,
   e_type:            GNC_ID_SPLIT,
@@ -1867,6 +1872,7 @@
   printable:         (const char* (*)(gpointer)) xaccSplitGetMemo,
   version_cmp:       (int (*)(gpointer, gpointer)) qof_instance_version_cmp,
 };
+*/
 
 static gpointer 
 split_account_guid_getter (gpointer obj, const QofParam *p)
@@ -1910,6 +1916,7 @@
     xaccSplitSetAccount(s, acc);
 }
 
+/*
 gboolean xaccSplitRegister (void)
 {
   static const QofParam params[] = {
@@ -1917,12 +1924,13 @@
       (QofAccessFunc)xaccSplitRetDateReconciledTS, 	
       (QofSetterFunc)xaccSplitSetDateReconciledTS },
 
-    /* d-* are deprecated query params, should not be used in new
+     d-* are deprecated query params, should not be used in new
      * queries, should be removed from old queries. */
+     /*
     { "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,
@@ -1955,15 +1963,17 @@
     { SPLIT_ACCOUNT, GNC_ID_ACCOUNT,
       (QofAccessFunc)xaccSplitGetAccount, (QofSetterFunc)qofSplitSetAccount },
     { SPLIT_ACCOUNT_GUID, QOF_TYPE_GUID, split_account_guid_getter, NULL },
+    */
 /*  these are no-ops to register the parameter names (for sorting) but
     they return an allocated object which getters cannot do.  */
+    /*
     { SPLIT_ACCT_FULLNAME, SPLIT_ACCT_FULLNAME, no_op, NULL },
     { SPLIT_CORR_ACCT_NAME, SPLIT_CORR_ACCT_NAME, no_op, NULL },
     { SPLIT_CORR_ACCT_CODE, SPLIT_CORR_ACCT_CODE, no_op, NULL },
     { 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 },
   };
 
@@ -1978,6 +1988,7 @@
 
   return qof_object_register (&split_object_def);
 }
+*/
 
 /************************ END OF ************************************\
 \************************* FILE *************************************/

Modified: gnucash/branches/gobject-engine-dev/src/engine/Split.h
===================================================================
--- gnucash/branches/gobject-engine-dev/src/engine/Split.h	2007-03-15 07:30:19 UTC (rev 15725)
+++ gnucash/branches/gobject-engine-dev/src/engine/Split.h	2007-03-15 21:33:03 UTC (rev 15726)
@@ -485,9 +485,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/gobject-engine-dev/src/engine/SplitP.h
===================================================================
--- gnucash/branches/gobject-engine-dev/src/engine/SplitP.h	2007-03-15 07:30:19 UTC (rev 15725)
+++ gnucash/branches/gobject-engine-dev/src/engine/SplitP.h	2007-03-15 21:33:03 UTC (rev 15726)
@@ -135,7 +135,7 @@
 /* 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/gobject-engine-dev/src/engine/Transaction.c
===================================================================
--- gnucash/branches/gobject-engine-dev/src/engine/Transaction.c	2007-03-15 07:30:19 UTC (rev 15725)
+++ gnucash/branches/gobject-engine-dev/src/engine/Transaction.c	2007-03-15 21:33:03 UTC (rev 15726)
@@ -1,5 +1,5 @@
 /********************************************************************\
- * Transaction.c -- transaction implementation                      *
+ * GncTransaction.c -- transaction implementation                      *
  * Copyright (C) 1997 Robin D. Clark                                *
  * Copyright (C) 1997-2003 Linas Vepstas <linas at linas.org>          *
  * Copyright (C) 2000 Bill Gribble <grib at billgribble.com>           *
@@ -38,6 +38,7 @@
 #include "Group.h"
 #include "Scrub.h"
 #include "Scrub3.h"
+#include "Transaction.h"
 #include "TransactionP.h"
 #include "SplitP.h"
 #include "TransLog.h"
@@ -53,25 +54,27 @@
 static gulong begin_commit_event_handler = 0;
 static gulong begin_edit_event_handler = 0;
 
-static void gnc_transaction_on_begin_commit_edit (GncTransaction *trans);
-static void gnc_transaction_on_begin_edit (GncAccount *acc)
+static void xaccFreeTransaction (GncTransaction *trans);
 
+static void gnc_transaction_on_begin_commit (GncTransaction *trans, gpointer user_data);
+static void gnc_transaction_on_begin_edit (GncTransaction *trans, gpointer user_data);
 
+
 /* GObject declarations */
 
 static void gnc_transaction_class_init(GncTransactionClass *klass);
-static void gnc_transaction_init(GncTransaction *sp);
+static void gnc_transaction_init(GncTransaction *trans);
 static void gnc_transaction_finalize(GObject *object);
+static void gnc_transaction_set_property (GObject *object, guint param_id, const GValue *value, GParamSpec *pspec);
+static void gnc_transaction_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec);
 
-struct _GncTransactionPrivate {
-	/* Private Members */
-};
 
 typedef struct _GncTransactionSignal GncTransactionSignal;
 typedef enum _GncTransactionSignalType GncTransactionSignalType;
 
 enum _GncTransactionSignalType {
 	/* Signals */
+	FIRST_SIGNAL,
 	LAST_SIGNAL
 };
 
@@ -130,10 +133,10 @@
 }
 
 static void
-gnc_transaction_init(GncTransaction *obj)
+gnc_transaction_init(GncTransaction *trans)
 {
 	/* Initialize private members, etc. */
-	ENTER ("trans=%p", trans);
+
   /* Fill in some sane defaults */
   trans->num         = CACHE_INSERT("");
   trans->description = CACHE_INSERT("");
@@ -154,10 +157,9 @@
 
   trans->idata = 0;
   
-  begin_commit_event_handler = g_signal_connect (obj, "commit:beginning", G_CALLBACK (gnc_transaction_on_begin_commit), obj, NULL);
-  begin_edit_event_handler = g_signal_connect (obj, "begin-edit", G_CALLBACK (gnc_transaction_on_begin_edit), obj, NULL);
+  begin_commit_event_handler = g_signal_connect (trans, "commit:beginning", G_CALLBACK (gnc_transaction_on_begin_commit), trans);
+  begin_edit_event_handler = g_signal_connect (trans, "begin-edit", G_CALLBACK (gnc_transaction_on_begin_edit), trans);
   
-  LEAVE (" ");
 }
 
 static void
@@ -166,12 +168,13 @@
 	
 	/* Free private members, etc. */
 	GList *node;
+	GncTransaction *trans;
+	
+	trans = GNC_TRANSACTION (object);
 
-  ENTER ("(addr=%p)", trans);
   if (((char *) 1) == trans->num)
   {
-    PERR ("double-free %p", trans);
-    LEAVE (" ");
+    g_message ("double-free %p", trans);
     return;
   }
 
@@ -197,11 +200,11 @@
 
   if (trans->orig)
   {
-    xaccFreeTransaction (trans->orig);
+    g_object_unref (trans->orig);
     trans->orig = NULL;
   }
 
-  LEAVE ("(addr=%p)", trans);
+  g_message ("(addr=%p)", trans);
 	
 	g_signal_handler_disconnect (object, begin_commit_event_handler);
 	g_signal_handler_disconnect (object, begin_edit_event_handler);
@@ -221,7 +224,7 @@
 	switch (param_id) {		
 		default:
    			/* We don't have any other property... */
-    		G_OBJECT_WARN_INVALID_PROPERTY_ID(object,property_id,pspec);
+    		G_OBJECT_WARN_INVALID_PROPERTY_ID(object,param_id,pspec);
     	break;
 	}
 }
@@ -309,7 +312,7 @@
  *   xaccSplitGetAccount(), but both Accounts' split lists won't be
  *   updated until the CommitEdit.  Correspondingly, no signals
  *   (events) will be generated for those "foreign" objects, or the
- *   Transaction, until the CommitEdit.
+ *   GncTransaction, until the CommitEdit.
  *
  *   This behavior is important because, when we're finally ready to
  *   commit to the backend, we can't be 100% sure that the backend
@@ -320,7 +323,7 @@
  *   If the backend commit succeeds, and *only* after it succeeds, we
  *   can advertise the new state to the rest of the engine (and gui).
  *
- *  Q: Who owns the ref of an added split if the Transaction is rolled
+ *  Q: Who owns the ref of an added split if the GncTransaction is rolled
  *  back?
  *
  *  A: This is a design decision.  If the answer is 'the user',
@@ -372,7 +375,7 @@
 /* This static indicates the debugging module that this .o belongs to.  */
 static QofLogModule log_module = GNC_MOD_ENGINE;
 
-void check_open (const Transaction *trans)
+void check_open (const GncTransaction *trans)
 {
   if (trans && 0 >= qof_instance_get_edit_level (QOF_INSTANCE (trans)))
     PERR ("transaction %p not open for editing", trans);
@@ -380,9 +383,9 @@
 /********************************************************************\
 \********************************************************************/
 gboolean
-xaccTransStillHasSplit(const Transaction *trans, const Split *s)
+xaccTransStillHasSplit(const GncTransaction *trans, const Split *s)
 {
-    return (s->parent == trans && !s->inst.do_free);
+    return (s->parent == trans && !qof_instance_get_do_free (QOF_INSTANCE (s)));
 }
 
 /* Executes 'cmd_block' for each split currently in the transaction,
@@ -397,14 +400,14 @@
         }                                                               \
     } while (0)
 
-G_INLINE_FUNC void mark_trans (Transaction *trans);
-void mark_trans (Transaction *trans)
+G_INLINE_FUNC void mark_trans (GncTransaction *trans);
+void mark_trans (GncTransaction *trans)
 {
   FOR_EACH_SPLIT(trans, mark_split(s));
 }
 
-G_INLINE_FUNC void gen_event_trans (Transaction *trans);
-void gen_event_trans (Transaction *trans)
+G_INLINE_FUNC void gen_event_trans (GncTransaction *trans);
+void gen_event_trans (GncTransaction *trans)
 {
 #ifndef REGISTER_STILL_DEPENDS_ON_ACCOUNT_EVENTS
   GList *node;
@@ -412,15 +415,15 @@
   for (node = trans->splits; node; node = node->next)
   {
     Split *s = node->data;
-    Account *account = s->acc;
+    GncAccount *account = s->acc;
     GNCLot *lot = s->lot;
     if (account)
-      qof_event_gen (&account->inst.entity, GNC_EVENT_ITEM_CHANGED, s);
+      qof_event_gen (QOF_INSTANCE (account), 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 (QOF_INSTANCE (lot), QOF_EVENT_MODIFY, NULL);
     }
   }
 #endif
@@ -432,7 +435,7 @@
 \********************************************************************/
 
 static void
-xaccInitTransaction (Transaction * trans, QofBook *book)
+xaccInitTransaction (GncTransaction * trans, QofBook *book)
 {
   
 }
@@ -440,23 +443,23 @@
 /********************************************************************\
 \********************************************************************/
 
-Transaction *
+GncTransaction *
 xaccMallocTransaction (QofBook *book)
 {
-  Transaction *trans;
+  GncTransaction *trans;
 
   g_return_val_if_fail (book, NULL);
 
   trans = GNC_TRANSACTION (g_object_new (GNC_TYPE_TRANSACTION, NULL));
   
-  qof_event_gen (QOF_ENTITY (trans), QOF_EVENT_CREATE, NULL);
+  qof_event_gen (QOF_INSTANCE (trans), QOF_EVENT_CREATE, NULL);
 
   return trans;
 }
 
 #ifdef DUMP_FUNCTIONS
 void
-xaccTransDump (const Transaction *trans, const char *tag)
+xaccTransDump (const GncTransaction *trans, const char *tag)
 {
   GList *node;
 
@@ -488,7 +491,7 @@
 #endif
 
 void
-xaccTransSortSplits (Transaction *trans)
+xaccTransSortSplits (GncTransaction *trans)
 {
   GList *node, *new_list = NULL;
   Split *split;
@@ -523,13 +526,13 @@
  * It is used only by the edit-rollback code.
  */
 /* Actually, it *is* public, and used by Period.c */
-Transaction *
-xaccDupeTransaction (const Transaction *t)
+GncTransaction *
+xaccDupeTransaction (const GncTransaction *t)
 {
-  Transaction *trans;
+  GncTransaction *trans;
   GList *node;
   
-  /* This will create a Transaction object  with a guid set to NULL */
+  /* This will create a GncTransaction object  with a guid set to NULL */
   trans = g_object_new (GNC_TYPE_TRANSACTION, NULL);
 
   trans->num         = CACHE_INSERT (t->num);
@@ -558,10 +561,10 @@
  * Use this routine to externally duplicate a transaction.  It creates
  * a full fledged transaction with unique guid, splits, etc.
  */
-Transaction *
-xaccTransClone (const Transaction *t)
+GncTransaction *
+xaccTransClone (const GncTransaction *t)
 {
-  Transaction *trans;
+  GncTransaction *trans;
   Split *split;
   GList *node;
 
@@ -579,9 +582,9 @@
   trans->orig            = NULL;
   trans->idata           = 0;
 
-  qof_instance_set_kvp_data (QOF_INSTANCE (trans), qof_instance_get_kvp_data (t));
+  qof_instance_set_kvp_data (QOF_INSTANCE (trans), qof_instance_get_kvp_data (QOF_INSTANCE (t)));
 
-  qof_instance_begin_edit (QOF_INSTANCE (trans));
+  qof_instance_begin_edit (QOF_INSTANCE (trans), NULL);
   
   for (node = t->splits; node; node = node->next)
   {
@@ -589,9 +592,9 @@
     split->parent = trans;
     trans->splits = g_list_append (trans->splits, split);
   }
-  qof_instance_set_dirty(QOF_INSTANCE(trans));
+  qof_instance_set_dirty(QOF_INSTANCE(trans), TRUE);
   
-  qof_instance_commi_edit (QOF_INSTANCE (trans));
+  qof_instance_commit_edit (QOF_INSTANCE (trans), NULL);
   xaccTransCommitEdit(trans);
   qof_event_resume();
 
@@ -603,7 +606,7 @@
 \********************************************************************/
 
 static void
-xaccFreeTransaction (Transaction *trans)
+xaccFreeTransaction (GncTransaction *trans)
 {
   g_object_unref (G_OBJECT (trans));
 }
@@ -632,7 +635,7 @@
 }
 
 gboolean
-xaccTransEqual(const Transaction *ta, const Transaction *tb,
+xaccTransEqual(const GncTransaction *ta, const GncTransaction *tb,
                gboolean check_guids,
                gboolean check_splits,
                gboolean check_balances,
@@ -649,7 +652,7 @@
   if (ta == tb) return TRUE;
 
   if (check_guids) {
-    if (!guid_equal(&(ta->inst.entity.guid), &(tb->inst.entity.guid)))
+    if (!guid_equal(qof_instance_get_guid (QOF_INSTANCE(ta)), qof_instance_get_guid (QOF_INSTANCE (tb))))
     {
       PWARN ("GUIDs differ");
       return FALSE;
@@ -691,13 +694,13 @@
     return FALSE;
   }
 
-  if (kvp_frame_compare(ta->inst.kvp_data, tb->inst.kvp_data) != 0)
+  if (kvp_frame_compare(qof_instance_get_kvp_data (QOF_INSTANCE (ta)), qof_instance_get_kvp_data (QOF_INSTANCE(tb))) != 0)
   {
     char *frame_a;
     char *frame_b;
 
-    frame_a = kvp_frame_to_string (ta->inst.kvp_data);
-    frame_b = kvp_frame_to_string (tb->inst.kvp_data);
+    frame_a = kvp_frame_to_string (qof_instance_get_kvp_data (QOF_INSTANCE (ta)));
+    frame_b = kvp_frame_to_string (qof_instance_get_kvp_data (QOF_INSTANCE (tb)));
 
     PWARN ("kvp frames differ:\n%s\n\nvs\n\n%s", frame_a, frame_b);
 
@@ -768,19 +771,19 @@
 /********************************************************************\
 \********************************************************************/
 
-Transaction *
+GncTransaction *
 xaccTransLookup (const GUID *guid, QofBook *book)
 {
-  g_return_if_fail (!guid || QOF_IS_BOOK (book));
+  g_return_val_if_fail (!guid || QOF_IS_BOOK (book), NULL);
   
-  return GNC_TRANSACTION (qof_book_get_object (book, GNC_TYPE_TRANSACTION, guid));
+  return GNC_TRANSACTION (qof_book_get_element (book, GNC_TYPE_TRANSACTION, (GUID*) guid));
 }
 
 /********************************************************************\
 \********************************************************************/
 
 gnc_numeric
-xaccTransGetImbalance (const Transaction * trans)
+xaccTransGetImbalance (const GncTransaction * trans)
 {
   gnc_numeric imbal = gnc_numeric_zero();
   if (!trans) return imbal;
@@ -796,8 +799,8 @@
 }
 
 gnc_numeric
-xaccTransGetAccountValue (const Transaction *trans, 
-                          const Account *acc)
+xaccTransGetAccountValue (const GncTransaction *trans, 
+                          const GncAccount *acc)
 {
   gnc_numeric total = gnc_numeric_zero ();
   if (!trans || !acc) return total;
@@ -811,7 +814,7 @@
 }
 
 gnc_numeric
-xaccTransGetAccountAmount (const Transaction *trans, const Account *acc)
+xaccTransGetAccountAmount (const GncTransaction *trans, const GncAccount *acc)
 {
   gnc_numeric total = gnc_numeric_zero ();
   if (!trans || !acc) return total;
@@ -825,7 +828,7 @@
 }
 
 gnc_numeric
-xaccTransGetAccountConvRate(Transaction *txn, Account *acc)
+xaccTransGetAccountConvRate(GncTransaction *txn, GncAccount *acc)
 {
   gnc_numeric amount, value, convrate;
   GList *splits;
@@ -877,8 +880,8 @@
 }
 
 gnc_numeric
-xaccTransGetAccountBalance (const Transaction *trans,
-                            const Account *account)
+xaccTransGetAccountBalance (const GncTransaction *trans,
+                            const GncAccount *account)
 {
   GList *node;
   Split *last_split = NULL;
@@ -915,13 +918,13 @@
 /* The new routine for setting the common currency */
 
 gnc_commodity *
-xaccTransGetCurrency (const Transaction *trans)
+xaccTransGetCurrency (const GncTransaction *trans)
 {
   return trans ? trans->common_currency : NULL;
 }
 
 void
-xaccTransSetCurrency (Transaction *trans, gnc_commodity *curr)
+xaccTransSetCurrency (GncTransaction *trans, gnc_commodity *curr)
 {
   gint fraction, old_fraction;
 
@@ -937,7 +940,7 @@
       FOR_EACH_SPLIT(trans, xaccSplitSetValue(s, xaccSplitGetValue(s)));
   }
 
-  qof_instance_set_dirty(QOF_INSTANCE(trans));
+  qof_instance_set_dirty(QOF_INSTANCE(trans), TRUE);
   mark_trans(trans);  /* Dirty balance of every account in trans */
   xaccTransCommitEdit(trans);
 }
@@ -946,15 +949,15 @@
 \********************************************************************/
 
 void
-xaccTransBeginEdit (Transaction *trans)
+xaccTransBeginEdit (GncTransaction *trans)
 {
-   return qof_instance_begin_edit (QOF_INSTANCE (trans));   
+   qof_instance_begin_edit (QOF_INSTANCE (trans), NULL);   
 }
 
 static void
-gnc_transaction_on_begin_edit (GncAccount *acc, gpointer user_data) 
+gnc_transaction_on_begin_edit (GncTransaction *trans, gpointer user_data) 
 {
-  g_return_if_fail (GNC_IS_TRANSACTION (acc));
+  g_return_if_fail (GNC_IS_TRANSACTION (trans));
 
   xaccOpenLog ();
   xaccTransWriteLog (trans, 'B');
@@ -968,7 +971,7 @@
 \********************************************************************/
 
 void
-xaccTransDestroy (Transaction *trans)
+xaccTransDestroy (GncTransaction *trans)
 {
   g_return_if_fail (GNC_IS_TRANSACTION (trans));
  
@@ -982,7 +985,7 @@
 }
 
 static void
-destroy_gains (Transaction *trans)
+destroy_gains (GncTransaction *trans)
 {
   SplitList *node;
   for (node = trans->splits; node; node = node->next)
@@ -994,7 +997,7 @@
     if (GAINS_STATUS_UNKNOWN == s->gains) xaccSplitDetermineGainStatus(s);
     if (s->gains_split && (GAINS_STATUS_GAINS & s->gains_split->gains))
     {
-      Transaction *t = s->gains_split->parent;
+      GncTransaction *t = s->gains_split->parent;
       xaccTransDestroy (t);
       s->gains_split = NULL;
     }
@@ -1002,7 +1005,7 @@
 }
 
 static void
-do_destroy (Transaction *trans)
+do_destroy (GncTransaction *trans)
 {
   SplitList *node;
   gboolean shutting_down = qof_book_shutting_down(qof_instance_get_book (QOF_INSTANCE (trans)));
@@ -1015,7 +1018,7 @@
   if (!shutting_down)
     xaccTransWriteLog (trans, 'D');
 
-  qof_event_gen (QOF_ENTITY (trans), QOF_EVENT_DESTROY, NULL);
+  qof_event_gen (QOF_INSTANCE (trans), QOF_EVENT_DESTROY, NULL);
 
   /* We only own the splits that still think they belong to us. */
   trans->splits = g_list_copy(trans->splits);
@@ -1040,13 +1043,13 @@
 void xaccDisableDataScrubbing(void) { scrub_data = 0; }
 
 /* Check for an implicitly deleted transaction */
-static gboolean was_trans_emptied(Transaction *trans)
+static gboolean was_trans_emptied(GncTransaction *trans)
 {
     FOR_EACH_SPLIT(trans, return FALSE);
     return TRUE;
 }
 
-static void trans_on_error(Transaction *trans, QofBackendError errcode)
+static void trans_on_error(GncTransaction *trans, QofBackendError errcode)
 {
     /* If the backend puked, then we must roll-back
      * at this point, and let the user know that we failed.
@@ -1061,7 +1064,7 @@
     xaccTransRollbackEdit(trans);
 }
 
-static void trans_cleanup_commit(Transaction *trans)
+static void trans_cleanup_commit(GncTransaction *trans)
 {
     GList *slist, *node;
     gint editlevel;
@@ -1077,21 +1080,25 @@
         if (!qof_instance_is_dirty(QOF_INSTANCE(s)))
             continue;
 
-        if ((s->parent != trans) || s->inst.do_free) {
+        if ((s->parent != trans) || qof_instance_get_do_free (QOF_INSTANCE (s))) {
             /* Existing split either moved to another transaction or
                was destroyed, drop from list */
             GncEventData ed;
             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(QOF_INSTANCE (s), 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);
+            if (qof_instance_get_do_free (QOF_INSTANCE (s)))
+              
+              qof_event_gen(QOF_INSTANCE (s), QOF_EVENT_DESTROY, NULL);
+            
+            else 
+              qof_event_gen(QOF_INSTANCE (s), QOF_EVENT_MODIFY, NULL);
+              
             xaccSplitCommitEdit(s);
         }
     }
@@ -1115,14 +1122,14 @@
     qof_instance_set_edit_level (QOF_INSTANCE (trans), editlevel);
 
     gen_event_trans (trans); //TODO: could be conditional
-    qof_event_gen (QOF_ENTITY (trans), QOF_EVENT_MODIFY, NULL);
+    qof_event_gen (QOF_INSTANCE (trans), QOF_EVENT_MODIFY, NULL);
 }
 
 /* Callback for the "commited" event */
 static void
 gnc_transaction_on_begin_commit (GncTransaction *trans, gpointer user_data)
 {
-	 if (was_trans_emptied(trans)) qof_instance_mark_free (QOF_INSTANCE (trans), TRUE);
+	 if (was_trans_emptied(trans)) qof_instance_set_do_free (QOF_INSTANCE (trans), TRUE);
 	 
 	 /* Before commiting the transaction, we're gonna enforce certain
     * constraints.  In particular, we want to enforce the cap-gains
@@ -1167,11 +1174,11 @@
 }
 
 void
-xaccTransCommitEdit (Transaction *trans)
+xaccTransCommitEdit (GncTransaction *trans)
 {
    g_return_if_fail (GNC_IS_TRANSACTION (trans));
    
-   qof_instance_commit_edit (QOF_INSTANCE (trans));
+   qof_instance_commit_edit (QOF_INSTANCE (trans), NULL);
    
 }
 
@@ -1186,13 +1193,15 @@
  * also adds complexity.
  */
 void
-xaccTransRollbackEdit (Transaction *trans)
+xaccTransRollbackEdit (GncTransaction *trans)
 {
    GList *node, *onode;
    QofBackend *be;
-   Transaction *orig;
+   GncTransaction *orig;
    GList *slist;
-   int num_preexist, i;
+   gint num_preexist, i;
+   gint editlevel;
+   
    ENTER ("trans addr=%p\n", trans);
 
    check_open(trans);
@@ -1204,7 +1213,7 @@
    trans->date_entered = orig->date_entered;
    trans->date_posted = orig->date_posted;
    SWAP(trans->common_currency, orig->common_currency);
-   SWAP(qof_instance_get_kvp_data (QOF_INSTANCE (trans)), qof_instance_get_kvp_data (QOF_INSTANCE (orig)));
+//   SWAP(qof_instance_get_kvp_data (QOF_INSTANCE (trans)), qof_instance_get_kvp_data (QOF_INSTANCE (orig)));
 
    /* The splits at the front of trans->splits are exactly the same
       splits as in the original, but some of them may have changed, so
@@ -1224,7 +1233,7 @@
            xaccSplitRollbackEdit(s);
            SWAP(s->action, so->action);
            SWAP(s->memo, so->memo);
-           SWAP(s->inst.kvp_data, so->inst.kvp_data);
+//           SWAP(qof_instance_get_kvp_data (QOF_INSTANCE (s)), qof_instance_get_kvp_data (QOF_INSTANCE (so)));
            s->reconciled = so->reconciled;
            s->amount = so->amount;
            s->value = so->value;
@@ -1270,12 +1279,12 @@
 
       /* clear errors */
       do {
-        errcode = qof_backend_get_error (be);
+        errcode = qof_backend_get_error_code (be);
       } while (ERR_BACKEND_NO_ERR != errcode);
 
-      (be->rollback) (be, &(trans->inst));
+      (be->rollback) (be, QOF_INSTANCE (trans), NULL);
 
-      errcode = qof_backend_get_error (be);
+      errcode = qof_backend_get_error_code (be);
       if (ERR_BACKEND_MOD_DESTROY == errcode)
       {
          /* The backend is asking us to delete this transaction.
@@ -1304,10 +1313,13 @@
    xaccFreeTransaction (trans->orig);
 
    trans->orig = NULL;
-   trans->inst.do_free = FALSE;
+   qof_instance_set_do_free (QOF_INSTANCE (trans), FALSE);
 
    /* Put back to zero. */
-   trans->inst.editlevel--;
+   
+   editlevel = qof_instance_get_edit_level (QOF_INSTANCE (trans));
+   editlevel--;
+   qof_instance_set_edit_level (QOF_INSTANCE (trans), editlevel);
    /* FIXME: The register code seems to depend on the engine to
       generate an event during rollback, even though the state is just
       reverting to what it was. */
@@ -1317,21 +1329,21 @@
 }
 
 gboolean
-xaccTransIsOpen (const Transaction *trans)
+xaccTransIsOpen (const GncTransaction *trans)
 {
-  return trans ? (0 < trans->inst.editlevel) : FALSE;
+  return trans ? (0 < qof_instance_get_edit_level (QOF_INSTANCE (trans))) : FALSE;
 }
 
 /* Only used by postgres backend. Not sure if it should dirty the trans. */
 void
-xaccTransSetVersion (Transaction *trans, gint32 vers)
+xaccTransSetVersion (GncTransaction *trans, gint32 vers)
 {
   if (trans) 
       trans->version = vers;
 }
 
 gint32
-xaccTransGetVersion (const Transaction *trans)
+xaccTransGetVersion (const GncTransaction *trans)
 {
   return trans ? trans->version : 0;
 }
@@ -1339,7 +1351,7 @@
 #define SECS_PER_DAY 86400
 
 int
-xaccTransOrder (const Transaction *ta, const Transaction *tb)
+xaccTransOrder (const GncTransaction *ta, const GncTransaction *tb)
 {
   char *da, *db;
   int na, nb, retval;
@@ -1368,14 +1380,14 @@
     return retval;
 
   /* else, sort on guid - keeps sort stable. */
-  return guid_compare(&(ta->inst.entity.guid), &(tb->inst.entity.guid));
+  return guid_compare(qof_instance_get_guid (QOF_INSTANCE (ta)), qof_instance_get_guid (QOF_INSTANCE (tb)));
 }
 
 /********************************************************************\
 \********************************************************************/
 
 static inline void
-xaccTransSetDateInternal(Transaction *trans, Timespec *dadate, Timespec val)
+xaccTransSetDateInternal(GncTransaction *trans, Timespec *dadate, Timespec val)
 {
     xaccTransBeginEdit(trans);
 
@@ -1384,7 +1396,7 @@
            ctime (({time_t secs = (time_t) val.tv_sec; &secs;})));
     
     *dadate = val;
-    qof_instance_set_dirty(QOF_INSTANCE(trans));
+    qof_instance_set_dirty(QOF_INSTANCE(trans), TRUE);
     mark_trans(trans);
     xaccTransCommitEdit(trans);
 
@@ -1398,13 +1410,13 @@
 }
 
 static inline void
-set_gains_date_dirty (Transaction *trans)
+set_gains_date_dirty (GncTransaction *trans)
 {
     FOR_EACH_SPLIT(trans, s->gains |= GAINS_STATUS_DATE_DIRTY);
 }
 
 void
-xaccTransSetDatePostedSecs (Transaction *trans, time_t secs)
+xaccTransSetDatePostedSecs (GncTransaction *trans, time_t secs)
 {
    Timespec ts = {secs, 0};
    if (!trans) return;
@@ -1413,7 +1425,7 @@
 }
 
 void
-xaccTransSetDateEnteredSecs (Transaction *trans, time_t secs)
+xaccTransSetDateEnteredSecs (GncTransaction *trans, time_t secs)
 {
    Timespec ts = {secs, 0};
    if (!trans) return;
@@ -1421,7 +1433,7 @@
 }
 
 static void
-qofTransSetDatePosted (Transaction *trans, Timespec ts)
+qofTransSetDatePosted (GncTransaction *trans, Timespec ts)
 {
    if (!trans) return;
    if ((ts.tv_nsec == 0) && (ts.tv_sec == 0)) return;
@@ -1432,7 +1444,7 @@
 }
 
 void
-xaccTransSetDatePostedTS (Transaction *trans, const Timespec *ts)
+xaccTransSetDatePostedTS (GncTransaction *trans, const Timespec *ts)
 {
    if (!trans || !ts) return;
    xaccTransSetDateInternal(trans, &trans->date_posted, *ts);
@@ -1440,7 +1452,7 @@
 }
 
 static void
-qofTransSetDateEntered (Transaction *trans, Timespec ts)
+qofTransSetDateEntered (GncTransaction *trans, Timespec ts)
 {
    if (!trans) return;
    if ((ts.tv_nsec == 0) && (ts.tv_sec == 0)) return;
@@ -1450,14 +1462,14 @@
 }
 
 void
-xaccTransSetDateEnteredTS (Transaction *trans, const Timespec *ts)
+xaccTransSetDateEnteredTS (GncTransaction *trans, const Timespec *ts)
 {
    if (!trans || !ts) return;
    xaccTransSetDateInternal(trans, &trans->date_entered, *ts);
 }
 
 void
-xaccTransSetDate (Transaction *trans, int day, int mon, int year) 
+xaccTransSetDate (GncTransaction *trans, int day, int mon, int year) 
 {
    Timespec ts;
    if (!trans) return;
@@ -1467,45 +1479,45 @@
 }
 
 void
-xaccTransSetDateDueTS (Transaction *trans, const Timespec *ts)
+xaccTransSetDateDueTS (GncTransaction *trans, const Timespec *ts)
 {
    if (!trans || !ts) return;
    xaccTransBeginEdit(trans);
-   kvp_frame_set_timespec (trans->inst.kvp_data, TRANS_DATE_DUE_KVP, *ts);
-   qof_instance_set_dirty(QOF_INSTANCE(trans));
+   kvp_frame_set_timespec (qof_instance_get_kvp_data (QOF_INSTANCE (trans)), TRANS_DATE_DUE_KVP, *ts);
+   qof_instance_set_dirty(QOF_INSTANCE(trans), TRUE);
    xaccTransCommitEdit(trans);
 }
 
 void
-xaccTransSetTxnType (Transaction *trans, char type)
+xaccTransSetTxnType (GncTransaction *trans, char type)
 {
   char s[2] = {type, '\0'};
   g_return_if_fail(trans);
   xaccTransBeginEdit(trans);
-  kvp_frame_set_str (trans->inst.kvp_data, TRANS_TXN_TYPE_KVP, s);
-  qof_instance_set_dirty(QOF_INSTANCE(trans));
+  kvp_frame_set_str (qof_instance_get_kvp_data (QOF_INSTANCE (trans)), TRANS_TXN_TYPE_KVP, s);
+  qof_instance_set_dirty(QOF_INSTANCE(trans), TRUE);
   xaccTransCommitEdit(trans);
 }
 
-void xaccTransClearReadOnly (Transaction *trans)
+void xaccTransClearReadOnly (GncTransaction *trans)
 {
     if (trans) {
         xaccTransBeginEdit(trans);
-        kvp_frame_set_slot_path (trans->inst.kvp_data, NULL, 
+        kvp_frame_set_slot_path (qof_instance_get_kvp_data (QOF_INSTANCE (trans)), NULL, 
                                  TRANS_READ_ONLY_REASON, NULL);
-        qof_instance_set_dirty(QOF_INSTANCE(trans));
+        qof_instance_set_dirty(QOF_INSTANCE(trans), TRUE);
         xaccTransCommitEdit(trans);
     }
 }
 
 void
-xaccTransSetReadOnly (Transaction *trans, const char *reason)
+xaccTransSetReadOnly (GncTransaction *trans, const char *reason)
 {
     if (trans && reason) {
         xaccTransBeginEdit(trans);
-        kvp_frame_set_str (trans->inst.kvp_data, 
+        kvp_frame_set_str (qof_instance_get_kvp_data (QOF_INSTANCE (trans)), 
                            TRANS_READ_ONLY_REASON, reason);
-        qof_instance_set_dirty(QOF_INSTANCE(trans));
+        qof_instance_set_dirty(QOF_INSTANCE(trans), TRUE);
         xaccTransCommitEdit(trans);
     }
 }
@@ -1516,59 +1528,59 @@
 /* QOF does not open the trans before setting a parameter,
 but the call uses check_open so we cannot use the call directly. */
 static void
-qofTransSetNum (Transaction *trans, const char *xnum)
+qofTransSetNum (GncTransaction *trans, const char *xnum)
 {
-	if (!qof_begin_edit(&trans->inst)) return;
+	if (!qof_begin_edit(QOF_INSTANCE (trans))) return;
 	xaccTransSetNum(trans, xnum);
-	qof_commit_edit(&trans->inst);
+	qof_commit_edit(QOF_INSTANCE (trans));
 }
 
 void
-xaccTransSetNum (Transaction *trans, const char *xnum)
+xaccTransSetNum (GncTransaction *trans, const char *xnum)
 {
    if (!trans || !xnum) return;
    xaccTransBeginEdit(trans);
 
    CACHE_REPLACE(trans->num, xnum);
-   qof_instance_set_dirty(QOF_INSTANCE(trans));
+   qof_instance_set_dirty(QOF_INSTANCE(trans), TRUE);
    xaccTransCommitEdit(trans);
 }
 
 static void
-qofTransSetDescription (Transaction *trans, const char *desc)
+qofTransSetDescription (GncTransaction *trans, const char *desc)
 {
-	if (!qof_begin_edit(&trans->inst)) return;
+	if (!qof_begin_edit(QOF_INSTANCE (trans))) return;
 	xaccTransSetDescription(trans, desc);
-	qof_commit_edit(&trans->inst);
+	qof_commit_edit(QOF_INSTANCE (trans));
 }
 
 void
-xaccTransSetDescription (Transaction *trans, const char *desc)
+xaccTransSetDescription (GncTransaction *trans, const char *desc)
 {
    if (!trans || !desc) return;
    xaccTransBeginEdit(trans);
 
    CACHE_REPLACE(trans->description, desc);
-   qof_instance_set_dirty(QOF_INSTANCE(trans));
+   qof_instance_set_dirty(QOF_INSTANCE(trans), TRUE);
    xaccTransCommitEdit(trans);
 }
 
 static void
-qofTransSetNotes (Transaction *trans, const char *notes)
+qofTransSetNotes (GncTransaction *trans, const char *notes)
 {
-	if (!qof_begin_edit(&trans->inst)) return;
+	if (!qof_begin_edit(QOF_INSTANCE (trans))) return;
 	xaccTransSetNotes(trans, notes);
-	qof_commit_edit(&trans->inst);
+	qof_commit_edit(QOF_INSTANCE (trans));
 }
 
 void
-xaccTransSetNotes (Transaction *trans, const char *notes)
+xaccTransSetNotes (GncTransaction *trans, const char *notes)
 {
   if (!trans || !notes) return;
   xaccTransBeginEdit(trans);
 
-  kvp_frame_set_str (trans->inst.kvp_data, trans_notes_str, notes);
-  qof_instance_set_dirty(QOF_INSTANCE(trans));
+  kvp_frame_set_str (qof_instance_get_kvp_data (QOF_INSTANCE (trans)), trans_notes_str, notes);
+  qof_instance_set_dirty(QOF_INSTANCE(trans), TRUE);
   xaccTransCommitEdit(trans);
 }
 
@@ -1576,7 +1588,7 @@
 \********************************************************************/
 
 Split *
-xaccTransGetSplit (const Transaction *trans, int i) 
+xaccTransGetSplit (const GncTransaction *trans, int i) 
 {
     int j = 0;
     if (!trans || i < 0) return NULL;
@@ -1586,7 +1598,7 @@
 }
 
 int
-xaccTransGetSplitIndex(const Transaction *trans, const Split *split) 
+xaccTransGetSplitIndex(const GncTransaction *trans, const Split *split) 
 {
     int j = 0;
     g_return_val_if_fail(trans && split, -1);
@@ -1596,13 +1608,13 @@
 }
 
 SplitList *
-xaccTransGetSplitList (const Transaction *trans)
+xaccTransGetSplitList (const GncTransaction *trans)
 {
   return trans ? trans->splits : NULL;
 }
 
 int
-xaccTransCountSplits (const Transaction *trans)
+xaccTransCountSplits (const GncTransaction *trans)
 {
     gint i = 0;
     FOR_EACH_SPLIT(trans, i++);
@@ -1610,69 +1622,69 @@
 }
 
 const char *
-xaccTransGetNum (const Transaction *trans)
+xaccTransGetNum (const GncTransaction *trans)
 {
    return trans ? trans->num : NULL;
 }
 
 const char * 
-xaccTransGetDescription (const Transaction *trans)
+xaccTransGetDescription (const GncTransaction *trans)
 {
    return trans ? trans->description : NULL;
 }
 
 const char * 
-xaccTransGetNotes (const Transaction *trans)
+xaccTransGetNotes (const GncTransaction *trans)
 {
   return trans ? 
-      kvp_frame_get_string (trans->inst.kvp_data, trans_notes_str) : NULL;
+      kvp_frame_get_string (qof_instance_get_kvp_data (QOF_INSTANCE (trans)), trans_notes_str) : NULL;
 }
 
 /********************************************************************\
 \********************************************************************/
 
 time_t
-xaccTransGetDate (const Transaction *trans)
+xaccTransGetDate (const GncTransaction *trans)
 {
    return trans ? trans->date_posted.tv_sec : 0;
 }
 
 void
-xaccTransGetDatePostedTS (const Transaction *trans, Timespec *ts)
+xaccTransGetDatePostedTS (const GncTransaction *trans, Timespec *ts)
 {
    if (trans && ts)
        *ts = trans->date_posted;
 }
 
 void
-xaccTransGetDateEnteredTS (const Transaction *trans, Timespec *ts)
+xaccTransGetDateEnteredTS (const GncTransaction *trans, Timespec *ts)
 {
    if (trans && ts)
        *ts = trans->date_entered;
 }
 
 Timespec
-xaccTransRetDatePostedTS (const Transaction *trans)
+xaccTransRetDatePostedTS (const GncTransaction *trans)
 {
    Timespec ts = {0,0};
    return trans ? trans->date_posted : ts;
 }
 
 Timespec
-xaccTransRetDateEnteredTS (const Transaction *trans)
+xaccTransRetDateEnteredTS (const GncTransaction *trans)
 {
    Timespec ts = {0,0};
    return trans ? trans->date_entered : ts;
 }
 
 void
-xaccTransGetDateDueTS (const Transaction *trans, Timespec *ts)
+xaccTransGetDateDueTS (const GncTransaction *trans, Timespec *ts)
 {
   KvpValue *value;
 
   if (!trans || !ts) return;
 
-  value = kvp_frame_get_slot (trans->inst.kvp_data, TRANS_DATE_DUE_KVP);
+  value = kvp_frame_get_slot (qof_instance_get_kvp_data (QOF_INSTANCE (trans)), TRANS_DATE_DUE_KVP);
   if (value)
     *ts = kvp_value_get_timespec (value);
   else
@@ -1680,7 +1692,7 @@
 }
 
 Timespec
-xaccTransRetDateDueTS (const Transaction *trans)
+xaccTransRetDateDueTS (const GncTransaction *trans)
 {
   Timespec ts = {0, 0};
   if (trans) xaccTransGetDateDueTS (trans, &ts);
@@ -1688,29 +1700,29 @@
 }
 
 char
-xaccTransGetTxnType (const Transaction *trans)
+xaccTransGetTxnType (const GncTransaction *trans)
 {
   const char *s;
   if (!trans) return TXN_TYPE_NONE;
-  s = kvp_frame_get_string (trans->inst.kvp_data, TRANS_TXN_TYPE_KVP);
+  s = kvp_frame_get_string (qof_instance_get_kvp_data (QOF_INSTANCE (trans)), TRANS_TXN_TYPE_KVP);
   if (s) return *s;
 
   return TXN_TYPE_NONE;
 }
 
 const char * 
-xaccTransGetReadOnly (const Transaction *trans)
+xaccTransGetReadOnly (const GncTransaction *trans)
 {
   /* XXX This flag should be cached in the transaction structure
    * for performance reasons, since its checked every trans commit.
    */
   return trans ? kvp_frame_get_string (
-      trans->inst.kvp_data, TRANS_READ_ONLY_REASON) : NULL;
+      qof_instance_get_kvp_data (QOF_INSTANCE (trans)), TRANS_READ_ONLY_REASON) : NULL;
 }
 
 gboolean
-xaccTransHasReconciledSplitsByAccount (const Transaction *trans, 
-                                       const Account *account)
+xaccTransHasReconciledSplitsByAccount (const GncTransaction *trans, 
+                                       const GncAccount *account)
 {
   GList *node;
 
@@ -1738,16 +1750,16 @@
 }
 
 gboolean
-xaccTransHasReconciledSplits (const Transaction *trans)
+xaccTransHasReconciledSplits (const GncTransaction *trans)
 {
   return xaccTransHasReconciledSplitsByAccount (trans, NULL);
 }
 
 
 gboolean
-xaccTransHasSplitsInStateByAccount (const Transaction *trans,
+xaccTransHasSplitsInStateByAccount (const GncTransaction *trans,
                                     const char state,
-                                    const Account *account)
+                                    const GncAccount *account)
 {
   GList *node;
 
@@ -1768,7 +1780,7 @@
 }
 
 gboolean
-xaccTransHasSplitsInState (const Transaction *trans, const char state)
+xaccTransHasSplitsInState (const GncTransaction *trans, const char state)
 {
   return xaccTransHasSplitsInStateByAccount (trans, state, NULL);
 }
@@ -1781,7 +1793,7 @@
 /* ====================================================================== */
 
 static int
-counter_thunk(Transaction *t, void *data)
+counter_thunk(GncTransaction *t, void *data)
 {
     (*((guint*)data))++;
     return 0;
@@ -1799,8 +1811,8 @@
 /********************************************************************\
 \********************************************************************/
 /* walk through the splits, looking for any account */
-static Account * 
-get_any_account(const Transaction *trans)
+static GncAccount * 
+get_any_account(const GncTransaction *trans)
 {
     GList *node;
     if (!trans) return NULL;
@@ -1809,10 +1821,10 @@
             return ((Split *)node->data)->acc;
     return NULL;
 }
-Account *
-xaccGetAccountByName (const Transaction *trans, const char * name)
+GncAccount *
+xaccGetAccountByName (const GncTransaction *trans, const char * name)
 {
-   Account *acc;
+   GncAccount *acc;
    if (!trans || !name) return NULL;
 
    acc = get_any_account(trans);
@@ -1822,10 +1834,10 @@
 /********************************************************************\
 \********************************************************************/
 
-Account *
-xaccGetAccountByFullName (const Transaction *trans, const char * name)
+GncAccount *
+xaccGetAccountByFullName (const GncTransaction *trans, const char * name)
 {
-   Account *acc;
+   GncAccount *acc;
    if (!trans || !name) return NULL;
 
    acc = get_any_account(trans);
@@ -1836,7 +1848,7 @@
 \********************************************************************/
 
 void
-xaccTransVoid(Transaction *trans, const char *reason)
+xaccTransVoid(GncTransaction *trans, const char *reason)
 {
   KvpFrame *frame;
   KvpValue *val;
@@ -1846,7 +1858,7 @@
   g_return_if_fail(trans && reason);
 
   xaccTransBeginEdit(trans);
-  frame = trans->inst.kvp_data;
+  frame = qof_instance_get_kvp_data (QOF_INSTANCE (trans));
 
   val = kvp_frame_get_slot(frame, trans_notes_str);
   kvp_frame_set_slot(frame, void_former_notes_str, val);
@@ -1862,47 +1874,47 @@
   FOR_EACH_SPLIT(trans, xaccSplitVoid(s));
 
   /* Dirtying taken care of by SetReadOnly */
-  xaccTransSetReadOnly(trans, _("Transaction Voided"));
+  xaccTransSetReadOnly(trans, _("GncTransaction Voided"));
   xaccTransCommitEdit(trans);
 }
 
 gboolean 
-xaccTransGetVoidStatus(const Transaction *trans)
+xaccTransGetVoidStatus(const GncTransaction *trans)
 {
   g_return_val_if_fail(trans, FALSE);
-  return (kvp_frame_get_slot(trans->inst.kvp_data, void_reason_str) != NULL);
+  return (kvp_frame_get_slot(qof_instance_get_kvp_data (QOF_INSTANCE (trans)), void_reason_str) != NULL);
 }
 
 const char *
-xaccTransGetVoidReason(const Transaction *trans)
+xaccTransGetVoidReason(const GncTransaction *trans)
 {
   g_return_val_if_fail(trans, NULL);
-  return kvp_frame_get_string(trans->inst.kvp_data, void_reason_str);
+  return kvp_frame_get_string(qof_instance_get_kvp_data (QOF_INSTANCE (trans)), void_reason_str);
 }
 
 Timespec
-xaccTransGetVoidTime(const Transaction *tr)
+xaccTransGetVoidTime(const GncTransaction *tr)
 {
   const char *val;
   Timespec void_time = {0,0};
 
   g_return_val_if_fail(tr, void_time);
 
-  val = kvp_frame_get_string(tr->inst.kvp_data, void_time_str);
+  val = kvp_frame_get_string(qof_instance_get_kvp_data (QOF_INSTANCE (tr)), void_time_str);
   return val ? gnc_iso8601_to_timespec_gmt(val) : void_time;
 }
 
 void
-xaccTransUnvoid (Transaction *trans)
+xaccTransUnvoid (GncTransaction *trans)
 {
   KvpFrame *frame;
   KvpValue *val;
 
   g_return_if_fail(trans);
 
-  frame = trans->inst.kvp_data;
+  frame = qof_instance_get_kvp_data (QOF_INSTANCE (trans));
   val = kvp_frame_get_slot(frame, void_reason_str);
-  if (!val) return; /* Transaction isn't voided. Bail. */
+  if (!val) return; /* GncTransaction isn't voided. Bail. */
 
   xaccTransBeginEdit(trans);
 
@@ -1919,10 +1931,10 @@
   xaccTransCommitEdit(trans);
 }
 
-Transaction *
-xaccTransReverse (Transaction *orig)
+GncTransaction *
+xaccTransReverse (GncTransaction *orig)
 {
-  Transaction *trans;
+  GncTransaction *trans;
   kvp_value *kvp_val;
   g_return_val_if_fail(orig, NULL);
 
@@ -1934,29 +1946,29 @@
           xaccSplitSetAmount(s, gnc_numeric_neg(xaccSplitGetAmount(s)));
           xaccSplitSetValue(s, gnc_numeric_neg(xaccSplitGetValue(s)));
           xaccSplitSetReconcile(s, NREC);
-          qof_instance_set_dirty(QOF_INSTANCE(trans));
+          qof_instance_set_dirty(QOF_INSTANCE(trans), TRUE);
       });
 
   /* Now update the original with a pointer to the new one */
   kvp_val = kvp_value_new_guid(xaccTransGetGUID(trans));
-  kvp_frame_set_slot_nc(orig->inst.kvp_data, TRANS_REVERSED_BY, kvp_val);
+  kvp_frame_set_slot_nc(qof_instance_get_kvp_data (QOF_INSTANCE (orig)), TRANS_REVERSED_BY, kvp_val);
 
   xaccTransCommitEdit(trans);
   return trans;
 }
 
-Transaction *
-xaccTransGetReversedBy(const Transaction *trans)
+GncTransaction *
+xaccTransGetReversedBy(const GncTransaction *trans)
 {
     GUID *guid;
 
     g_return_val_if_fail(trans, NULL);
-    guid = kvp_frame_get_guid(trans->inst.kvp_data, TRANS_REVERSED_BY);
-    return xaccTransLookup(guid, trans->inst.book);
+    guid = kvp_frame_get_guid(qof_instance_get_kvp_data (QOF_INSTANCE (trans)), TRANS_REVERSED_BY);
+    return xaccTransLookup(guid, qof_instance_get_book (QOF_INSTANCE (trans)));
 }
 
 void
-xaccTransScrubSplits (Transaction *trans)
+xaccTransScrubSplits (GncTransaction *trans)
 {
     gnc_commodity *currency;
 
@@ -1966,7 +1978,7 @@
     /* The split scrub expects the transaction to have a currency! */
     currency = xaccTransGetCurrency (trans);
     if (!currency)
-        PERR ("Transaction doesn't have a currency!");
+        PERR ("GncTransaction doesn't have a currency!");
 
     FOR_EACH_SPLIT(trans, xaccSplitScrub(s));
     xaccTransCommitEdit(trans);
@@ -1986,7 +1998,7 @@
  */
 
 static void
-xaccTransScrubGainsDate (Transaction *trans)
+xaccTransScrubGainsDate (GncTransaction *trans)
 {
    SplitList *node;
    Timespec ts = {0,0};
@@ -2002,7 +2014,7 @@
           ((s->gains_split->gains & GAINS_STATUS_DATE_DIRTY) ||
            (s->gains & GAINS_STATUS_DATE_DIRTY)))
       {
-         Transaction *source_trans = s->gains_split->parent;
+         GncTransaction *source_trans = s->gains_split->parent;
          ts = source_trans->date_posted;
          s->gains &= ~GAINS_STATUS_DATE_DIRTY;
          s->gains_split->gains &= ~GAINS_STATUS_DATE_DIRTY;
@@ -2017,7 +2029,7 @@
 /* ============================================================== */
 
 void
-xaccTransScrubGains (Transaction *trans, Account *gain_acc)
+xaccTransScrubGains (GncTransaction *trans, GncAccount *gain_acc)
 {
    SplitList *node;
 
@@ -2057,7 +2069,7 @@
 }
 
 Split *
-xaccTransFindSplitByAccount(const Transaction *trans, const Account *acc)
+xaccTransFindSplitByAccount(const GncTransaction *trans, const GncAccount *acc)
 {
     if (!trans || !acc) return NULL;
     FOR_EACH_SPLIT(trans, if (xaccSplitGetAccount(s) == acc) return s);
@@ -2069,10 +2081,14 @@
 /* QofObject function implementation */
 
 /* Hook into the QofObject registry */
+/*
+
+BROKEN CODEMAKE
+
 static QofObject trans_object_def = {
   interface_version:   QOF_OBJECT_VERSION,
   e_type:              GNC_ID_TRANS,
-  type_label:          "Transaction",
+  type_label:          "GncTransaction",
   create:              (gpointer)xaccMallocTransaction,
   book_begin:          NULL,
   book_end:            NULL,
@@ -2084,7 +2100,7 @@
 };
 
 static gboolean
-trans_is_balanced_p (const Transaction *trans)
+trans_is_balanced_p (const GncTransaction *trans)
 {
   return trans ? gnc_numeric_zero_p(xaccTransGetImbalance(trans)) : FALSE;
 }
@@ -2130,7 +2146,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 },
   };
 
@@ -2138,6 +2154,6 @@
 
   return qof_object_register (&trans_object_def);
 }
-
+*/
 /************************ END OF ************************************\
 \************************* FILE *************************************/

Modified: gnucash/branches/gobject-engine-dev/src/engine/Transaction.h
===================================================================
--- gnucash/branches/gobject-engine-dev/src/engine/Transaction.h	2007-03-15 07:30:19 UTC (rev 15725)
+++ gnucash/branches/gobject-engine-dev/src/engine/Transaction.h	2007-03-15 21:33:03 UTC (rev 15726)
@@ -19,7 +19,7 @@
 \********************************************************************/
 /** @addtogroup Engine
     @{ */
-/** @addtogroup Transaction Financial Transactions
+/** @addtogroup GncTransaction Financial Transactions
     A good overview of transactions, splits and GncAccounts can be 
     found in the texinfo documentation, together with an overview of
     how to use this API.
@@ -28,12 +28,12 @@
 GncAccounting units. Each Split consists of an amount (number of dollar
 bills, number of shares, etc.), the value of that amount expressed in
 a (possibly) different currency than the amount, a Memo, a pointer to
-the parent Transaction, a pointer to the debited GncAccount, a reconciled
+the parent GncTransaction, a pointer to the debited GncAccount, a reconciled
 flag and timestamp, an "Action" field, and a key-value frame which can
 store arbitrary data.
                                                                               
 Transactions embody the notion of "double entry" GncAccounting. 
-A Transaction consists of a date, a description, an ID number, 
+A GncTransaction consists of a date, a description, an ID number, 
 a list of one or more Splits, and a key-value frame.  The transaction
 also specifies the currency with which all of the splits will be valued.
 When double-entry rules are enforced, the sum total value of the splits 
@@ -47,14 +47,14 @@
 to enable user-code to find unbalanced transactions and 'repair' them so
 that they are in balance. 
 
-Note the sum of the values of Splits in a Transaction is always computed
+Note the sum of the values of Splits in a GncTransaction is always computed
 with respect to a currency; thus splits can be balanced even when they
 are in different currencies, as long as they share a common currency.
 This feature allows currency-trading GncAccounts to be established.
                                                                               
-Every Split must point to its parent Transaction, and that Transaction
-must in turn include that Split in the Transaction's list of Splits. A
-Split can belong to at most one Transaction. These relationships are
+Every Split must point to its parent GncTransaction, and that GncTransaction
+must in turn include that Split in the GncTransaction's list of Splits. A
+Split can belong to at most one GncTransaction. These relationships are
 enforced by the engine. The engine user cannnot accidentally destroy
 this relationship as long as they stick to using the API and never
 access internal structures directly.
@@ -77,7 +77,7 @@
 Splits plus the value of all of its sub-GncAccounts.
 
     @{ */
-/** @file Transaction.h 
+/** @file GncTransaction.h 
     @brief API for Transactions and Splits (journal entries)
     @author Copyright (C) 1997 Robin D. Clark
     @author Copyright (C) 1997-2001 Linas Vepstas <linas at linas.org>
@@ -94,25 +94,25 @@
 #include "Account.h"
 
 
-/** @name Transaction Type field values
+/** @name GncTransaction Type field values
 @{
 */
 #define TXN_TYPE_NONE	 '\0' /**< No transaction type       */
-#define TXN_TYPE_INVOICE 'I'  /**< Transaction is an invoice */
-#define TXN_TYPE_PAYMENT 'P'  /**< Transaction is a payment  */
+#define TXN_TYPE_INVOICE 'I'  /**< GncTransaction is an invoice */
+#define TXN_TYPE_PAYMENT 'P'  /**< GncTransaction is a payment  */
 /** @} */
 
 /* --------------------------------------------------------------- */
 /* Transactions */
 
-/** @name Transaction creation and editing
+/** @name GncTransaction creation and editing
  @{
 */
 /** 
  The xaccMallocTransaction() will malloc memory and initialize it.
  Once created, it is usually unsafe to merely "free" this memory;
  the xaccTransDestroy() method should be called. */ 
-Transaction * xaccMallocTransaction (QofBook *book); 
+GncTransaction * xaccMallocTransaction (QofBook *book); 
 
 /**
  The xaccTransDestroy() method will remove all 
@@ -122,13 +122,13 @@
  memory will be freed, or by xaccTransRollbackEdit(), in which 
  case nothing at all is freed, and everything is put back into 
  original order. */
-void          xaccTransDestroy (Transaction *trans);
+void          xaccTransDestroy (GncTransaction *trans);
 
 /**
  The xaccTransClone() method will create a complete copy of an
  existing transaction.
  */
-Transaction * xaccTransClone (const Transaction *t);
+GncTransaction * xaccTransClone (const GncTransaction *t);
 
 /** Equality.
  *
@@ -153,8 +153,8 @@
  * up splits by GUID, and is required for checking duplicated
  * transactions because all the splits have new GUIDs.
  */
-gboolean xaccTransEqual(const Transaction *ta,
-                        const Transaction *tb,
+gboolean xaccTransEqual(const GncTransaction *ta,
+                        const GncTransaction *tb,
                         gboolean check_guids,
                         gboolean check_splits,
                         gboolean check_balances,
@@ -163,21 +163,21 @@
 /** The xaccTransBeginEdit() method must be called before any changes
     are made to a transaction or any of its component splits.  If 
     this is not done, errors will result. */
-void          xaccTransBeginEdit (Transaction *trans);
+void          xaccTransBeginEdit (GncTransaction *trans);
 
 /** The xaccTransCommitEdit() method indicates that the changes to the
     transaction and its splits are complete and should be made
     permanent. Note this routine may result in the deletion of the
     transaction, if the transaction is "empty" (has no splits), or
     of xaccTransDestroy() was called on the transaction. */
-void          xaccTransCommitEdit (Transaction *trans);
+void          xaccTransCommitEdit (GncTransaction *trans);
 
 /** The xaccTransRollbackEdit() routine rejects all edits made, and 
     sets the transaction back to where it was before the editing 
     started.  This includes restoring any deleted splits, removing
     any added splits, and undoing the effects of xaccTransDestroy,
     as well as restoring share quantities, memos, descriptions, etc. */
-void          xaccTransRollbackEdit (Transaction *trans);
+void          xaccTransRollbackEdit (GncTransaction *trans);
 
 /** The xaccTransIsOpen() method returns TRUE if the transaction
     is open for editing. Otherwise, it returns false.  
@@ -185,15 +185,15 @@
     hard to imagine legitamate uses (but it is used by
     the import/export code for reasons I can't understand.)
  */
-gboolean      xaccTransIsOpen (const Transaction *trans);
+gboolean      xaccTransIsOpen (const GncTransaction *trans);
 
 /** The xaccTransLookup() subroutine will return the
     transaction associated with the given id, or NULL
     if there is no such transaction. */
-Transaction * xaccTransLookup (const GUID *guid, QofBook *book);
+GncTransaction * xaccTransLookup (const GUID *guid, QofBook *book);
 #define xaccTransLookupDirect(g,b) xaccTransLookup(&(g),b)
 
-Split * xaccTransFindSplitByAccount(const Transaction *trans, 
+Split * xaccTransFindSplitByAccount(const GncTransaction *trans, 
                                     const GncAccount *acc);
 
 /** The xaccTransScrubGains() routine performs a number of cleanup
@@ -203,7 +203,7 @@
  *  assignments of all the splits are good, and that the lots 
  *  balance appropriately.
  */
-void xaccTransScrubGains (Transaction *trans, GncAccount *gain_acc);
+void xaccTransScrubGains (GncTransaction *trans, GncAccount *gain_acc);
 
 
 /** \warning XXX FIXME 
@@ -215,42 +215,42 @@
 /** @} */
 
 
-/** @name Transaction general getters/setters
+/** @name GncTransaction general getters/setters
  @{
 */
 
 /** Sorts the splits in a transaction, putting the debits first,
  *  followed by the credits.
  */
-void          xaccTransSortSplits (Transaction *trans);
+void          xaccTransSortSplits (GncTransaction *trans);
 
-/** Set the  Transaction Type
+/** Set the  GncTransaction Type
  *
  * See #TXN_TYPE_NONE, #TXN_TYPE_INVOICE and #TXN_TYPE_PAYMENT */
-void	      xaccTransSetTxnType (Transaction *trans, char type);
-/** Returns the  Transaction Type
+void	      xaccTransSetTxnType (GncTransaction *trans, char type);
+/** Returns the  GncTransaction Type
  *
  * See #TXN_TYPE_NONE, #TXN_TYPE_INVOICE and #TXN_TYPE_PAYMENT */
-char	      xaccTransGetTxnType (const Transaction *trans);
+char	      xaccTransGetTxnType (const GncTransaction *trans);
 
 
 /** Sets the transaction Number (or ID) field*/
-void          xaccTransSetNum (Transaction *trans, const char *num);
+void          xaccTransSetNum (GncTransaction *trans, const char *num);
 /** Sets the transaction Description */
-void          xaccTransSetDescription (Transaction *trans, const char *desc);
+void          xaccTransSetDescription (GncTransaction *trans, const char *desc);
 /** Sets the transaction Notes
  *
  The Notes field is only visible in the register in double-line mode */
-void          xaccTransSetNotes (Transaction *trans, const char *notes);
+void          xaccTransSetNotes (GncTransaction *trans, const char *notes);
 
 /** Gets the transaction Number (or ID) field*/
-const char *  xaccTransGetNum (const Transaction *trans);
+const char *  xaccTransGetNum (const GncTransaction *trans);
 /** Gets the transaction Description */
-const char *  xaccTransGetDescription (const Transaction *trans);
+const char *  xaccTransGetDescription (const GncTransaction *trans);
 /** Gets the transaction Notes
  *
  The Notes field is only visible in the register in double-line mode */
-const char *  xaccTransGetNotes (const Transaction *trans);
+const char *  xaccTransGetNotes (const GncTransaction *trans);
 
 
 /** Add a split to the transaction
@@ -269,38 +269,38 @@
     (number_of__splits-1).  An invalid value of i will cause NULL to
     be returned.  A convenient way of cycling through all splits is
     to start at zero, and keep incrementing until a null value is returned. */
-Split *       xaccTransGetSplit (const Transaction *trans, int i);
+Split *       xaccTransGetSplit (const GncTransaction *trans, int i);
 
 /** Inverse of xaccTransGetSplit() */
-int xaccTransGetSplitIndex(const Transaction *trans, const Split *split);
+int xaccTransGetSplitIndex(const GncTransaction *trans, const Split *split);
 
 /** The xaccTransGetSplitList() method returns a GList of the splits
     in a transaction.  
     @return The list of splits. This list must NOT be modified.  Do *NOT* free
     this list when you are done with it. */
-SplitList *   xaccTransGetSplitList (const Transaction *trans);
-gboolean xaccTransStillHasSplit(const Transaction *trans, const Split *s);
+SplitList *   xaccTransGetSplitList (const GncTransaction *trans);
+gboolean xaccTransStillHasSplit(const GncTransaction *trans, const Split *s);
 
 
 /** Set the transaction to be ReadOnly */
-void          xaccTransSetReadOnly (Transaction *trans, const char *reason);
-void	      xaccTransClearReadOnly (Transaction *trans);
+void          xaccTransSetReadOnly (GncTransaction *trans, const char *reason);
+void	      xaccTransClearReadOnly (GncTransaction *trans);
 /** FIXME: document me */
-const char *  xaccTransGetReadOnly (const Transaction *trans);
+const char *  xaccTransGetReadOnly (const GncTransaction *trans);
 
 /** Returns the number of splits in this transaction. */
-int           xaccTransCountSplits (const Transaction *trans);
+int           xaccTransCountSplits (const GncTransaction *trans);
 
 /** FIXME: document me */
-gboolean      xaccTransHasReconciledSplits (const Transaction *trans);
+gboolean      xaccTransHasReconciledSplits (const GncTransaction *trans);
 /** FIXME: document me */
-gboolean      xaccTransHasReconciledSplitsByGncAccount (const Transaction *trans,
+gboolean      xaccTransHasReconciledSplitsByAccount (const GncTransaction *trans,
 						     const GncAccount *GncAccount);
 
 /** FIXME: document me */
-gboolean      xaccTransHasSplitsInState (const Transaction *trans, const char state);
+gboolean      xaccTransHasSplitsInState (const GncTransaction *trans, const char state);
 /** FIXME: document me */
-gboolean      xaccTransHasSplitsInStateByGncAccount (const Transaction *trans,
+gboolean      xaccTransHasSplitsInStateByAccount (const GncTransaction *trans,
 						  const char state,
 						  const GncAccount *GncAccount);
 
@@ -312,10 +312,10 @@
  * The total value of the transaction must be zero when all splits 
  * are valued in this currency.
  * @note What happens if the Currency isn't set?  Ans: bad things.  */
-gnc_commodity * xaccTransGetCurrency (const Transaction *trans);
+gnc_commodity * xaccTransGetCurrency (const GncTransaction *trans);
 
 /** Set the commodity of this transaction. */
-void xaccTransSetCurrency (Transaction *trans, gnc_commodity *curr);
+void xaccTransSetCurrency (GncTransaction *trans, gnc_commodity *curr);
 
 /** The xaccTransGetImbalance() method returns the total value of the
  * transaction.  In a pure double-entry system, this imbalance
@@ -325,19 +325,19 @@
  * out how much things are off by.  The value returned is denominated
  * in the currency that is returned by the xaccTransFindCommonCurrency()
  * method. */
-gnc_numeric xaccTransGetImbalance (const Transaction * trans);
+gnc_numeric xaccTransGetImbalance (const GncTransaction * trans);
 
 /** The xaccTransGetGncAccountValue() method returns the total value applied
  *  to a particular GncAccount.  In some cases there may be multiple Splits
- *  in a single Transaction applied to one GncAccount (in particular when
+ *  in a single GncTransaction applied to one GncAccount (in particular when
  *  trying to balance Lots) -- this function is just a convienience to
  *  view everything at once.
  */
-gnc_numeric xaccTransGetGncAccountValue (const Transaction *trans, 
+gnc_numeric xaccTransGetAccountValue (const GncTransaction *trans, 
 				      const GncAccount *GncAccount);
 
 /** Same as xaccTransGetGncAccountValue, but uses the GncAccount's commodity. */
-gnc_numeric xaccTransGetGncAccountAmount (const Transaction *trans,
+gnc_numeric xaccTransGetAccountAmount (const GncTransaction *trans,
                                        const GncAccount *GncAccount);
 
 /* Compute the conversion rate for the transaction to this GncAccount.
@@ -347,11 +347,11 @@
  *
  * If 'acc' is NULL, return unity.
  */
-gnc_numeric xaccTransGetGncAccountConvRate(Transaction *txn, GncAccount *acc);
+gnc_numeric xaccTransGetAccountConvRate(GncTransaction *txn, GncAccount *acc);
 
 /** Get the GncAccount balance for the specified GncAccount after the last
     split in the specified transaction. */
-gnc_numeric xaccTransGetGncAccountBalance (const Transaction *trans,
+gnc_numeric xaccTransGetAccountBalance (const GncTransaction *trans,
                                         const GncAccount *GncAccount);
 
 /**
@@ -370,12 +370,12 @@
  *    Finally, it returns zero if all of the above match.
  *    Note that it does *NOT* compare its member splits.
  */
-int  xaccTransOrder     (const Transaction *ta, const Transaction *tb);
+int  xaccTransOrder     (const GncTransaction *ta, const GncTransaction *tb);
 
 /** @} */
 
 
-/** @name Transaction date setters/getters
+/** @name GncTransaction date setters/getters
 @{
 */
    
@@ -388,7 +388,7 @@
  called, the date order of each of the component splits will be
  checked, and will be restored in ascending date order.)
  */
-void          xaccTransSetDate (Transaction *trans,
+void          xaccTransSetDate (GncTransaction *trans,
                                 int day, int mon, int year);
 
 /** The xaccTransSetDatePostedSecs() method will modify the <i>posted</i>
@@ -396,51 +396,51 @@
     posted date is the date when this transaction was posted at the
     bank. */
 #define xaccTransSetDateSecs xaccTransSetDatePostedSecs
-void          xaccTransSetDatePostedSecs (Transaction *trans, time_t time);
+void          xaccTransSetDatePostedSecs (GncTransaction *trans, time_t time);
 
 /**  The xaccTransSetDatePostedTS() method does the same thing as
      xaccTransSetDatePostedSecs(), but takes a struct timespec64. */
-void          xaccTransSetDatePostedTS (Transaction *trans,
+void          xaccTransSetDatePostedTS (GncTransaction *trans,
                                         const Timespec *ts);
 
 /** Modify the date of when the transaction was entered. The entered
  * date is the date when the register entry was made. */
-void          xaccTransSetDateEnteredSecs (Transaction *trans, time_t time);
+void          xaccTransSetDateEnteredSecs (GncTransaction *trans, time_t time);
 /** Modify the date of when the transaction was entered. The entered
  * date is the date when the register entry was made. */
-void          xaccTransSetDateEnteredTS (Transaction *trans,
+void          xaccTransSetDateEnteredTS (GncTransaction *trans,
                                         const Timespec *ts);
 
 /** Dates and txn-type for A/R and A/P "invoice" postings */
-void	      xaccTransSetDateDueTS (Transaction *trans, const Timespec *ts);
+void	      xaccTransSetDateDueTS (GncTransaction *trans, const Timespec *ts);
 
 /** Retrieve the posted date of the transaction. The posted date is
     the date when this transaction was posted at the bank. (Although
     having different function names, GetDate and GetDatePosted refer
     to the same single date.)*/
-time_t        xaccTransGetDate (const Transaction *trans);
+time_t        xaccTransGetDate (const GncTransaction *trans);
 /** Retrieve the posted date of the transaction. The posted date is
     the date when this transaction was posted at the bank. (Although
     having different function names, GetDate and GetDatePosted refer
     to the same single date.)*/
-void          xaccTransGetDatePostedTS (const Transaction *trans, Timespec *ts);
+void          xaccTransGetDatePostedTS (const GncTransaction *trans, Timespec *ts);
 /** Retrieve the posted date of the transaction. The posted date is
     the date when this transaction was posted at the bank. (Although
     having different function names, GetDate and GetDatePosted refer
     to the same single date.)*/
-Timespec      xaccTransRetDatePostedTS (const Transaction *trans);
+Timespec      xaccTransRetDatePostedTS (const GncTransaction *trans);
 
 /** Retrieve the date of when the transaction was entered. The entered
  * date is the date when the register entry was made.*/
-void          xaccTransGetDateEnteredTS (const Transaction *trans, Timespec *ts);
+void          xaccTransGetDateEnteredTS (const GncTransaction *trans, Timespec *ts);
 /** Retrieve the date of when the transaction was entered. The entered
  * date is the date when the register entry was made.*/
-Timespec      xaccTransRetDateEnteredTS (const Transaction *trans);
+Timespec      xaccTransRetDateEnteredTS (const GncTransaction *trans);
 
 /** Dates and txn-type for A/R and A/P "invoice" postings */
-Timespec      xaccTransRetDateDueTS (const Transaction *trans);
+Timespec      xaccTransRetDateDueTS (const GncTransaction *trans);
 /** Dates and txn-type for A/R and A/P "invoice" postings */
-void	      xaccTransGetDateDueTS (const Transaction *trans, Timespec *ts);
+void	      xaccTransGetDateDueTS (const GncTransaction *trans, Timespec *ts);
 /** @} */
 
 
@@ -453,14 +453,14 @@
 /** The xaccGetGncAccountByName() is a convenience routine that 
  *  is essentially identical to xaccGetPeerGncAccountFromName(),
  *  except that it accepts the handy transaction as root.*/
-GncAccount * xaccGetGncAccountByName (const Transaction *trans, const char *name);
+GncAccount * xaccGetAccountByName (const GncTransaction *trans, const char *name);
 /** The xaccGetGncAccountByFullName routine is similar to xaccGetGncAccountByName, but uses
  *  full names using the given separator.*/
-GncAccount * xaccGetGncAccountByFullName (const Transaction *trans,
+GncAccount * xaccGetAccountByFullName (const GncTransaction *trans,
                                     const char *name);
 
 
-/** @name Transaction voiding
+/** @name GncTransaction voiding
 @{
 */
 /** xaccTransVoid voids a transaction.  A void transaction has no
@@ -472,7 +472,7 @@
  *  @param reason The textual reason why this transaction is being
  *  voided.
  */
-void xaccTransVoid(Transaction *transaction, 
+void xaccTransVoid(GncTransaction *transaction, 
 		   const char *reason);
 
 /** xaccTransUnvoid restores a voided transaction to its original
@@ -482,9 +482,9 @@
  *
  *  @param transaction The transaction to restore from voided state.
  */
-void xaccTransUnvoid(Transaction *transaction);
+void xaccTransUnvoid(GncTransaction *transaction);
 
-/** xaccTransReverse creates a Transaction that reverses the given
+/** xaccTransReverse creates a GncTransaction that reverses the given
  *  tranaction by inverting all the numerical values in the given
  *  transaction.  This function cancels out the effect of an earlier
  *  transaction.  This will be needed by write only GncAccounts as a way
@@ -495,16 +495,16 @@
  *
  *  @return a new transaction which reverses the given transaction
  */
-Transaction * xaccTransReverse(Transaction *transaction);
+GncTransaction * xaccTransReverse(GncTransaction *transaction);
 
 /** Returns the transaction that reversed the given transaction.
  *
- *  @param trans a Transaction that has been reversed
+ *  @param trans a GncTransaction that has been reversed
  *
  *  @param the transaction that reversed the given transaction, or
  *  NULL if the given transaction has not been reversed.
  */
-Transaction * xaccTransGetReversedBy(const Transaction *trans);
+GncTransaction * xaccTransGetReversedBy(const GncTransaction *trans);
 
 /** Retrieve information on whether or not a transaction has been voided.
  *
@@ -513,7 +513,7 @@
  *  @return TRUE if the transaction is void, FALSE otherwise. Also
  *  returns FALSE upon an error.
  */
-gboolean xaccTransGetVoidStatus(const Transaction *transaction);
+gboolean xaccTransGetVoidStatus(const GncTransaction *transaction);
 
 /** Returns the user supplied textual reason why a transaction was
  *  voided.
@@ -522,7 +522,7 @@
  *
  *  @return A pointer to the user supplied reason for voiding.
  */
-const char *xaccTransGetVoidReason(const Transaction *transaction);
+const char *xaccTransGetVoidReason(const GncTransaction *transaction);
 
 /** Returns the time that a transaction was voided.
  *
@@ -531,10 +531,10 @@
  *  @return A Timespec containing the time that this transaction was
  *  voided. Returns a time of zero upon error.
  */
-Timespec xaccTransGetVoidTime(const Transaction *tr);
+Timespec xaccTransGetVoidTime(const GncTransaction *tr);
 /** @} */
 
-/** @name Transaction Parameter names
+/** @name GncTransaction Parameter names
 @{
 */
 #define TRANS_KVP		"kvp"
@@ -558,9 +558,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/gobject-engine-dev/src/engine/TransactionP.h
===================================================================
--- gnucash/branches/gobject-engine-dev/src/engine/TransactionP.h	2007-03-15 07:30:19 UTC (rev 15725)
+++ gnucash/branches/gobject-engine-dev/src/engine/TransactionP.h	2007-03-15 21:33:03 UTC (rev 15726)
@@ -123,7 +123,7 @@
 /* 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/gobject-engine-dev/src/engine/cap-gains.c
===================================================================
--- gnucash/branches/gobject-engine-dev/src/engine/cap-gains.c	2007-03-15 07:30:19 UTC (rev 15725)
+++ gnucash/branches/gobject-engine-dev/src/engine/cap-gains.c	2007-03-15 21:33:03 UTC (rev 15726)
@@ -89,9 +89,9 @@
    if (xaccAccountIsPriced (acc))
       return TRUE;
       
-   acc_comm = acc->commodity;
+   acc_comm = gnc_account_get_commodity (acc);
 
-   for (node=acc->splits; node; node=node->next)
+   for (node=xaccAccountGetSplitList (acc); node; node=node->next)
    {
       Split *s = node->data;
       Transaction *t = s->parent;
@@ -244,7 +244,7 @@
   if (acc == NULL)
   {
     /* Guess not. We'll have to build one. */
-    acc = xaccMallocAccount (root->book);
+    acc = xaccMallocAccount (qof_instance_get_book (QOF_INSTANCE (root)));
     xaccAccountBeginEdit (acc);
     xaccAccountSetName (acc, accname);
     xaccAccountSetCommodity (acc, currency);
@@ -280,12 +280,12 @@
   cwd = kvp_frame_get_frame_slash (cwd, "/lot-mgmt/gains-act/");
 
   /* Accounts are indexed by thier unique currency name */
-  cur_name = gnc_commodity_get_unique_name (acc->commodity);
+  cur_name = gnc_commodity_get_unique_name (gnc_account_get_commodity (acc));
 
   xaccAccountBeginEdit (acc);
   vvv = kvp_value_new_guid (xaccAccountGetGUID (gain_acct));
   kvp_frame_set_slot_nc (cwd, cur_name, vvv);
-  xaccAccountSetSlots_nc (acc, acc->inst.kvp_data);
+  xaccAccountSetSlots_nc (acc, qof_instance_get_kvp_data (QOF_INSTANCE (acc)));
   xaccAccountCommitEdit (acc);
 }
 
@@ -310,7 +310,7 @@
   vvv = kvp_frame_get_slot (cwd, cur_name);
   gain_acct_guid = kvp_value_get_guid (vvv);
 
-  gain_acct = xaccAccountLookup (gain_acct_guid, acc->inst.book);
+  gain_acct = xaccAccountLookup (gain_acct_guid, qof_instance_get_book (QOF_INSTANCE (acc)));
   return gain_acct;
 }
 
@@ -338,7 +338,7 @@
   vvv = kvp_frame_get_slot (cwd, cur_name);
   gain_acct_guid = kvp_value_get_guid (vvv);
 
-  gain_acct = xaccAccountLookup (gain_acct_guid, acc->inst.book);
+  gain_acct = xaccAccountLookup (gain_acct_guid, qof_instance_get_book (QOF_INSTANCE (acc)));
 
   /* If there is no default place to put gains/losses 
    * for this account, then create such a place */
@@ -352,7 +352,7 @@
 
       vvv = kvp_value_new_guid (xaccAccountGetGUID (gain_acct));
       kvp_frame_set_slot_nc (cwd, cur_name, vvv);
-      xaccAccountSetSlots_nc (acc, acc->inst.kvp_data);
+      xaccAccountSetSlots_nc (acc, qof_instance_get_kvp_data (QOF_INSTANCE (acc)));
       xaccAccountCommitEdit (acc);
 
   }
@@ -529,7 +529,7 @@
 
       /* Put the remainder of the balance into a new split, 
        * which is in other respects just a clone of this one. */
-      new_split = xaccMallocSplit (acc->inst.book);
+      new_split = xaccMallocSplit (qof_instance_get_book (QOF_INSTANCE (acc)));
 
       /* Copy most of the split attributes */
       xaccSplitSetMemo (new_split, xaccSplitGetMemo (split));
@@ -547,11 +547,11 @@
       /* Add kvp markup to indicate that these two splits used 
        * to be one before being 'split' 
        */
-      gnc_kvp_bag_add (split->inst.kvp_data, "lot-split", now, 
+      gnc_kvp_bag_add (qof_instance_get_kvp_data (QOF_INSTANCE (split)), "lot-split", now, 
                        "peer_guid", xaccSplitGetGUID (new_split), 
                        NULL);
 
-      gnc_kvp_bag_add (new_split->inst.kvp_data, "lot-split", now, 
+      gnc_kvp_bag_add (qof_instance_get_kvp_data (QOF_INSTANCE (new_split)), "lot-split", now, 
                        "peer_guid", xaccSplitGetGUID (split), 
                        NULL);
       
@@ -578,7 +578,7 @@
    gint64 id;
    char buff[200];
 
-   lot = gnc_lot_new (acc->inst.book);
+   lot = gnc_lot_new (qof_instance_get_book (QOF_INSTANCE (acc)));
 
    /* Provide a reasonable title for the new lot */
    id = kvp_frame_get_gint64 (xaccAccountGetSlots (acc), "/lot-mgmt/next-id");
@@ -616,7 +616,7 @@
 
    ENTER ("(split=%p)", split);
 
-   pcy = acc->policy;
+   pcy = gnc_account_get_policy (acc);
    xaccAccountBeginEdit (acc);
 
    /* If we are here, this split does not belong to any lot.
@@ -655,14 +655,14 @@
    
    if (!split) return NULL;
 
-   val = kvp_frame_get_slot (split->inst.kvp_data, "gains-split");
+   val = kvp_frame_get_slot (qof_instance_get_kvp_data (QOF_INSTANCE (split)), "gains-split");
    if (!val) return NULL;
    gains_guid = kvp_value_get_guid (val);
    if (!gains_guid) return NULL;
 
    /* Both splits will be in the same collection, so search there. */
-   gains_split = (Split*) qof_collection_lookup_entity (
-       split->inst.entity.collection, gains_guid);
+   gains_split = (Split*) qof_collection_lookup_element (
+       qof_instance_get_collection (QOF_INSTANCE (split)), gains_guid);
    PINFO ("split=%p has gains-split=%p", split, gains_split);
    return gains_split;
 }
@@ -678,14 +678,14 @@
    
    if (!split) return NULL;
 
-   val = kvp_frame_get_slot (split->inst.kvp_data, "gains-source");
+   val = kvp_frame_get_slot (qof_instance_get_kvp_data (QOF_INSTANCE (split)), "gains-source");
    if (!val) return NULL;
    source_guid = kvp_value_get_guid (val);
    if (!source_guid) return NULL;
 
    /* Both splits will be in the same collection, so search there. */
-   source_split = (Split*) qof_collection_lookup_entity(
-       split->inst.entity.collection, source_guid);
+   source_split = (Split*) qof_collection_lookup_element(
+       qof_instance_get_collection (QOF_INSTANCE (split)), source_guid);
    PINFO ("split=%p has source-split=%p", split, source_split);
    return source_split;
 }
@@ -709,7 +709,7 @@
    if (!split) return;
    lot = split->lot;
    if (!lot) return;
-   pcy = lot->account->policy;
+   pcy = gnc_account_get_policy (lot->account);
    currency = split->parent->common_currency;
 
    ENTER ("(split=%p gains=%p status=0x%x lot=%s)", split, 
@@ -945,7 +945,7 @@
       if (NULL == lot_split)
       {
          Account *lot_acc = lot->account;
-         QofBook *book = lot_acc->inst.book;
+         QofBook *book = qof_instance_get_book (QOF_INSTANCE (lot_acc));
 
          new_gain_split = TRUE;
          
@@ -984,9 +984,9 @@
           * that this is the gains transaction that corresponds
           * to the gains source.
           */
-         kvp_frame_set_guid (split->inst.kvp_data, "gains-split", 
+         kvp_frame_set_guid (qof_instance_get_kvp_data (QOF_INSTANCE (split)), "gains-split", 
                      xaccSplitGetGUID (lot_split));
-         kvp_frame_set_guid (lot_split->inst.kvp_data, "gains-source", 
+         kvp_frame_set_guid (qof_instance_get_kvp_data (QOF_INSTANCE (lot_split)), "gains-source", 
                      xaccSplitGetGUID (split));
 
       }
@@ -1100,7 +1100,7 @@
     * to mark all splits dirty if the opening splits are dirty. */
 
    ENTER("(lot=%p)", lot);
-   pcy = lot->account->policy;
+   pcy = gnc_account_get_policy (lot->account);
    for (node = lot->splits; node; node = node->next)
    {
       Split *s = node->data;

Modified: gnucash/branches/gobject-engine-dev/src/engine/engine-helpers.c
===================================================================
--- gnucash/branches/gobject-engine-dev/src/engine/engine-helpers.c	2007-03-15 07:30:19 UTC (rev 15725)
+++ gnucash/branches/gobject-engine-dev/src/engine/engine-helpers.c	2007-03-15 21:33:03 UTC (rev 15726)
@@ -365,7 +365,7 @@
   const gchar *where;
 
   if (!SCM_LISTP (where_scm))
-    return NULL;
+    return G_TYPE_INVALID;
 
   where = SCM_SYMBOL_CHARS (SCM_CAR(where_scm));
 
@@ -377,7 +377,7 @@
     res = GNC_ID_ACCOUNT;
   else {
     PINFO ("Unknown kvp-match-where: %s", where);
-    res = NULL;
+    res = G_TYPE_INVALID;
   }
   return res;
 }
@@ -781,63 +781,63 @@
   qt_scm = scm_cons (SCM_BOOL (qof_query_term_is_inverted (qt)), qt_scm);
 
   pd = qof_query_term_get_pred_data (qt);
-  qt_scm = scm_cons (scm_str2symbol (pd->type_name), qt_scm);
+  qt_scm = scm_cons (scm_str2symbol (g_type_name (pd->type_name)), qt_scm);
   qt_scm = scm_cons (scm_long2num (pd->how), qt_scm);
 
-  if (!safe_strcmp (pd->type_name, QOF_TYPE_STRING)) {
+  if (pd->type_name == QOF_TYPE_STRING) {
     query_string_t pdata = (query_string_t) pd;
 
     qt_scm = scm_cons (scm_long2num (pdata->options), qt_scm);
     qt_scm = scm_cons (SCM_BOOL (pdata->is_regex), qt_scm);
     qt_scm = scm_cons (scm_makfrom0str (pdata->matchstring), qt_scm);
 
-  } else if (!safe_strcmp (pd->type_name, QOF_TYPE_DATE)) {
+  } else if (pd->type_name == QOF_TYPE_DATE) {
     query_date_t pdata = (query_date_t) pd;
 
     qt_scm = scm_cons (scm_long2num (pdata->options), qt_scm);
     qt_scm = scm_cons (gnc_timespec2timepair (pdata->date), qt_scm);
 
-  } else if (!safe_strcmp (pd->type_name, QOF_TYPE_NUMERIC)) {
+  } else if (pd->type_name == QOF_TYPE_NUMERIC) {
     query_numeric_t pdata = (query_numeric_t) pd;
 
     qt_scm = scm_cons (scm_long2num (pdata->options), qt_scm);
     qt_scm = scm_cons (gnc_query_numeric2scm (pdata->amount), qt_scm);
 
-  } else if (!safe_strcmp (pd->type_name, QOF_TYPE_GUID)) {
+  } else if (pd->type_name == QOF_TYPE_GUID) {
     query_guid_t pdata = (query_guid_t) pd;
 
     qt_scm = scm_cons (scm_long2num (pdata->options), qt_scm);
     qt_scm = scm_cons (gnc_guid_glist2scm (pdata->guids), qt_scm);
 
-  } else if (!safe_strcmp (pd->type_name, QOF_TYPE_INT64)) {
+  } else if (pd->type_name == QOF_TYPE_INT64) {
     query_int64_t pdata = (query_int64_t) pd;
 
     qt_scm = scm_cons (gnc_gint64_to_scm (pdata->val), qt_scm);
 
-  } else if (!safe_strcmp (pd->type_name, QOF_TYPE_DOUBLE)) {
+  } else if (pd->type_name == QOF_TYPE_DOUBLE) {
     query_double_t pdata = (query_double_t) pd;
 
     qt_scm = scm_cons (scm_make_real (pdata->val), qt_scm);
 
-  } else if (!safe_strcmp (pd->type_name, QOF_TYPE_BOOLEAN)) {
+  } else if (pd->type_name == QOF_TYPE_BOOLEAN) {
     query_boolean_t pdata = (query_boolean_t) pd;
 
     qt_scm = scm_cons (SCM_BOOL (pdata->val), qt_scm);
 
-  } else if (!safe_strcmp (pd->type_name, QOF_TYPE_CHAR)) {
+  } else if (pd->type_name == QOF_TYPE_CHAR) {
     query_char_t pdata = (query_char_t) pd;
 
     qt_scm = scm_cons (scm_long2num (pdata->options), qt_scm);
     qt_scm = scm_cons (scm_makfrom0str (pdata->char_list), qt_scm);
 
-  } else if (!safe_strcmp (pd->type_name, QOF_TYPE_KVP)) {
+  } else if (pd->type_name == QOF_TYPE_KVP) {
     query_kvp_t pdata = (query_kvp_t) pd;
 
     qt_scm = scm_cons (gnc_query_path2scm (pdata->path), qt_scm);
     qt_scm = scm_cons (gnc_kvp_value2scm (pdata->value), qt_scm);
 
   } else {
-    PWARN ("query core type %s not supported", pd->type_name);
+    PWARN ("query core type %s not supported", g_type_name (pd->type_name));
     return SCM_BOOL_F;
   }
 
@@ -850,7 +850,7 @@
   QofQuery *q = NULL;
   QofQueryPredData *pd = NULL;
   SCM scm;
-  const gchar *type = NULL;
+  GType type = G_TYPE_INVALID;
   GSList *path = NULL;
   gboolean inverted = FALSE;
   QofQueryCompare compare_how;
@@ -878,7 +878,7 @@
     qt_scm = SCM_CDR (qt_scm);
     if (!SCM_SYMBOLP (scm))
       break;
-    type = SCM_SYMBOL_CHARS (scm);
+    type = g_type_from_name (SCM_SYMBOL_CHARS (scm));
 
     /* QofCompareFunc */
     scm = SCM_CAR (qt_scm);
@@ -889,7 +889,7 @@
 
     /* Now compute the predicate */
 
-    if (!safe_strcmp (type, QOF_TYPE_STRING)) 
+    if (type == QOF_TYPE_STRING) 
     {
       QofStringMatch options;
       gboolean is_regex;
@@ -914,7 +914,7 @@
       pd = qof_query_string_predicate (compare_how, matchstring,
                                     options, is_regex);
     } 
-    else if (!safe_strcmp (type, QOF_TYPE_DATE)) 
+    else if (type == QOF_TYPE_DATE) 
     {
       QofDateMatch options;
       Timespec date;
@@ -933,7 +933,7 @@
 
       pd = qof_query_date_predicate (compare_how, options, date);
 
-    } else if (!safe_strcmp (type, QOF_TYPE_NUMERIC)) {
+    } else if (type == QOF_TYPE_NUMERIC) {
       QofNumericMatch options;
       gnc_numeric val;
 
@@ -951,7 +951,7 @@
 
       pd = qof_query_numeric_predicate (compare_how, options, val);
 
-    } else if (!safe_strcmp (type, QOF_TYPE_GUID)) {
+    } else if (type == QOF_TYPE_GUID) {
       QofGuidMatch options;
       GList *guids;
 
@@ -971,7 +971,7 @@
 
       gnc_guid_glist_free (guids);
 
-    } else if (!safe_strcmp (type, QOF_TYPE_INT64)) {
+    } else if (type == QOF_TYPE_INT64) {
       gint64 val;
 
       scm = SCM_CAR (qt_scm);
@@ -982,7 +982,7 @@
 
       pd = qof_query_int64_predicate (compare_how, val);
 
-    } else if (!safe_strcmp (type, QOF_TYPE_DOUBLE)) {
+    } else if (type == QOF_TYPE_DOUBLE) {
       double val;
 
       scm = SCM_CAR (qt_scm);
@@ -993,7 +993,7 @@
 
       pd = qof_query_double_predicate (compare_how, val);
 
-    } else if (!safe_strcmp (type, QOF_TYPE_BOOLEAN)) {
+    } else if (type == QOF_TYPE_BOOLEAN) {
       gboolean val;
 
       scm = SCM_CAR (qt_scm);
@@ -1004,7 +1004,7 @@
 
       pd = qof_query_boolean_predicate (compare_how, val);
 
-    } else if (!safe_strcmp (type, QOF_TYPE_CHAR)) {
+    } else if (type == QOF_TYPE_CHAR) {
       QofCharMatch options;
       const gchar *char_list;
 
@@ -1022,7 +1022,7 @@
 
       pd = qof_query_char_predicate (options, char_list);
     } 
-    else if (!safe_strcmp (type, QOF_TYPE_KVP)) 
+    else if (type == QOF_TYPE_KVP) 
     {
       GSList *kvp_path;
       KvpValue *value;
@@ -1046,7 +1046,7 @@
       kvp_value_delete (value);
       
     } else {
-      PWARN ("query core type %s not supported", type);
+      PWARN ("query core type %s not supported", g_type_name (type));
       break;
     }
 
@@ -1331,7 +1331,7 @@
       /* id type */
       scm = SCM_CAR (query_term_scm);
       query_term_scm = SCM_CDR (query_term_scm);
-      id_type = g_strdup (SCM_STRING_CHARS (scm));
+      id_type = g_type_from_name (SCM_STRING_CHARS (scm));
 
       xaccQueryAddGUIDMatch (q, &guid, id_type, QOF_QUERY_OR);
       ok = TRUE;
@@ -1616,7 +1616,7 @@
   query_scm = scm_cons (pair, query_scm);
 
   /* search-for */
-  pair = scm_cons (scm_str2symbol (qof_query_get_search_for (q)), SCM_EOL);
+  pair = scm_cons (scm_str2symbol (g_type_name (qof_query_get_search_for (q))), SCM_EOL);
   pair = scm_cons (scm_str2symbol ("search-for"), pair);
   query_scm = scm_cons (pair, query_scm);
 
@@ -1939,7 +1939,7 @@
 #endif
 
   if (ok && search_for) {
-    qof_query_search_for (q, search_for);
+    qof_query_search_for (q, g_type_from_name (search_for));
     qof_query_set_sort_order (q, sp1, sp2, sp3);
     qof_query_set_sort_options (q, so1, so2, so3);
     qof_query_set_sort_increasing (q, si1, si2, si3);

Modified: gnucash/branches/gobject-engine-dev/src/engine/gnc-associate-account.c
===================================================================
--- gnucash/branches/gobject-engine-dev/src/engine/gnc-associate-account.c	2007-03-15 07:30:19 UTC (rev 15725)
+++ gnucash/branches/gobject-engine-dev/src/engine/gnc-associate-account.c	2007-03-15 21:33:03 UTC (rev 15726)
@@ -297,7 +297,7 @@
   kvpd_on_account_list = kvp_frame_get_slot(account_frame,
 					    expense_to_key[category]);
 
-  return de_kvp_account_list(kvpd_on_account_list, stock_account->inst.book);
+  return de_kvp_account_list(kvpd_on_account_list, qof_instance_get_book (QOF_INSTANCE (stock_account)));
 }
 
 /*********************************************************************\
@@ -329,7 +329,7 @@
   kvpd_on_account_list = kvp_frame_get_slot(income_acc_frame,
 					    income_to_key[category]);
   
-  return de_kvp_account_list(kvpd_on_account_list, stock_account->inst.book);
+  return de_kvp_account_list(kvpd_on_account_list, qof_instance_get_book (QOF_INSTANCE (stock_account)));
 }
 
 /*********************************************************************\
@@ -440,7 +440,7 @@
 
   inc_or_expense_account_guid = xaccAccountGetGUID(inc_or_expense_account);
   stock_account = xaccAccountLookup
-    (stock_account_guid, inc_or_expense_account->inst.book);
+    ((GUID*) stock_account_guid, qof_instance_get_book (QOF_INSTANCE (inc_or_expense_account)));
 
   stock_account_kvpframe = xaccAccountGetSlots(stock_account);
 

Modified: gnucash/branches/gobject-engine-dev/src/engine/gnc-budget.c
===================================================================
--- gnucash/branches/gobject-engine-dev/src/engine/gnc-budget.c	2007-03-15 07:30:19 UTC (rev 15725)
+++ gnucash/branches/gobject-engine-dev/src/engine/gnc-budget.c	2007-03-15 21:33:03 UTC (rev 15726)
@@ -45,7 +45,10 @@
 static void gnc_budget_class_init(GncBudgetClass *klass);
 static void gnc_budget_init(GncBudget *sp);
 static void gnc_budget_finalize(GObject *object);
+static void gnc_budget_set_property (GObject *object, guint param_id, const GValue *value, GParamSpec *pspec);
+static void gnc_budget_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec);
 
+
 struct _GncBudgetPrivate {
     gchar* name;
     gchar* description;
@@ -59,6 +62,7 @@
 
 enum _GncBudgetSignalType {
 	/* Signals */
+	FIRST_SIGNAL,
 	LAST_SIGNAL
 };
 
@@ -76,7 +80,7 @@
 static GObjectClass *parent_class = NULL;
 
 GType
-gnc_budget_get_type()
+gnc_budget_get_type(void)
 {
 	static GType type = 0;
 
@@ -139,11 +143,11 @@
 {
 	GncBudget *obj;
 	
-	obj = QOF_INSTANCE (object);
+	obj = GNC_BUDGET (object);
 	switch (param_id) {		
 		default:
    			/* We don't have any other property... */
-    		G_OBJECT_WARN_INVALID_PROPERTY_ID(object,property_id,pspec);
+    		G_OBJECT_WARN_INVALID_PROPERTY_ID(object,param_id,pspec);
     	break;
 	}
 }
@@ -156,7 +160,7 @@
 {
   GncBudget *obj;
   
-  obj = QOF_INSTANCE(object);
+  obj = GNC_BUDGET (object);
 
   switch (property_id) {
   default:
@@ -186,10 +190,10 @@
     /* 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( QOF_ENTITY (budget), QOF_EVENT_DESTROY, NULL);
+    qof_event_gen( QOF_INSTANCE (budget), QOF_EVENT_DESTROY, NULL);
 
-    CACHE_REMOVE(budget->name);
-    CACHE_REMOVE(budget->description);
+    CACHE_REMOVE(budget->priv->name);
+    CACHE_REMOVE(budget->priv->description);
 
     qof_instance_release (QOF_INSTANCE (budget));
     //g_free(budget);
@@ -220,20 +224,19 @@
 
     ENTER(" ");
     budget = g_object_new (GNC_TYPE_BUDGET, NULL);
+    budget->priv = g_new0 (GncBudgetPrivate, 1);
     
-    qof_instance_init (QOF_INSTANCE (budget), GNC_ID_BUDGET, book);
-
     g_date_set_time_t(&date, time(NULL));
     g_date_subtract_days(&date, g_date_get_day(&date)-1);
-    recurrenceSet(budget->priv->recurrence, 1, PERIOD_MONTH, &date);
+    recurrenceSet(&budget->priv->recurrence, 1, PERIOD_MONTH, &date);
 
     gnc_budget_set_name(budget, _("Unnamed Budget"));
     gnc_budget_set_description(budget, "");
     gnc_budget_set_num_periods(budget, 12);
 
-    qof_event_gen( QOF_ENTITY (budget), QOF_EVENT_CREATE , NULL);
+    qof_event_gen( QOF_INSTANCE (budget), QOF_EVENT_CREATE , NULL);
     
-    g_signal_emit_by_name ( QOF_ENTITY (budget), "created");
+    g_signal_emit_by_name ( QOF_INSTANCE (budget), "created");
     LEAVE(" ");
     return budget;
 }
@@ -243,8 +246,8 @@
 {
     g_return_if_fail(GNC_IS_BUDGET(budget));
     gnc_budget_begin_edit(budget);
-    qof_instance_set_dirty(QOF_INSTANCE (budget));
-    budget->inst.do_free = TRUE;
+    qof_instance_set_dirty(QOF_INSTANCE (budget), TRUE);
+    qof_instance_set_do_free (QOF_INSTANCE (budget), TRUE);
     gnc_budget_commit_edit(budget);
 }
 
@@ -254,18 +257,18 @@
     g_return_if_fail(GNC_IS_BUDGET(budget) && name);
 
     gnc_budget_begin_edit(budget);
-    CACHE_REPLACE(budget->name, name);
-    qof_instance_set_dirty(QOF_INSTANCE (budget));
+    CACHE_REPLACE(budget->priv->name, name);
+    qof_instance_set_dirty(QOF_INSTANCE (budget), TRUE);
     gnc_budget_commit_edit(budget);
 
-    qof_event_gen( QOF_ENTITY (budget) , QOF_EVENT_MODIFY, NULL);
+    qof_event_gen( QOF_INSTANCE (budget) , QOF_EVENT_MODIFY, NULL);
 }
 
 const gchar*
 gnc_budget_get_name(GncBudget* budget)
 {
     g_return_val_if_fail(GNC_IS_BUDGET(budget), NULL);
-    return budget->name;
+    return budget->priv->name;
 }
 
 void
@@ -275,18 +278,18 @@
     g_return_if_fail(description);
 
     gnc_budget_begin_edit(budget);
-    CACHE_REPLACE(budget->description, description);
-    qof_instance_set_dirty(QOF_INSTANCE (budget));
+    CACHE_REPLACE(budget->priv->description, description);
+    qof_instance_set_dirty(QOF_INSTANCE (budget), TRUE);
     gnc_budget_commit_edit(budget);
 
-    qof_event_gen( QOF_ENTITY (budget), QOF_EVENT_MODIFY, NULL);
+    qof_event_gen( QOF_INSTANCE (budget), QOF_EVENT_MODIFY, NULL);
 }
 
 const gchar*
 gnc_budget_get_description(GncBudget* budget)
 {
     g_return_val_if_fail(GNC_IS_BUDGET(budget), NULL);
-    return budget->description;
+    return budget->priv->description;
 }
 
 void
@@ -294,18 +297,18 @@
 {
     g_return_if_fail(budget && r);
     gnc_budget_begin_edit(budget);
-    budget->recurrence = *r;
-    qof_instance_set_dirty(QOF_INSTANCE (budget));
+    budget->priv->recurrence = *r;
+    qof_instance_set_dirty(QOF_INSTANCE (budget), TRUE);
     gnc_budget_commit_edit(budget);
 
-    qof_event_gen(QOF_ENTITY (budget), QOF_EVENT_MODIFY, NULL);
+    qof_event_gen(QOF_INSTANCE (budget), QOF_EVENT_MODIFY, NULL);
 }
 
 const Recurrence *
 gnc_budget_get_recurrence(GncBudget *budget)
 {
     g_return_val_if_fail(budget, NULL);
-    return (budget->priv->recurrence);
+    return (&budget->priv->recurrence);
 }
 
 const GUID*
@@ -313,7 +316,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
@@ -322,18 +325,18 @@
     g_return_if_fail(GNC_IS_BUDGET(budget));
 
     gnc_budget_begin_edit(budget);
-    budget->num_periods = num_periods;
-    qof_instance_set_dirty(QOF_INSTANCE (budget));
+    budget->priv->num_periods = num_periods;
+    qof_instance_set_dirty(QOF_INSTANCE (budget), TRUE);
     gnc_budget_commit_edit(budget);
 
-    qof_event_gen( QOF_ENTITY (budget), QOF_EVENT_MODIFY, NULL);
+    qof_event_gen( QOF_INSTANCE (budget), QOF_EVENT_MODIFY, NULL);
 }
 
 guint
 gnc_budget_get_num_periods(GncBudget* budget)
 {
     g_return_val_if_fail(GNC_IS_BUDGET(budget), 0);
-    return budget->num_periods;
+    return budget->priv->num_periods;
 }
 
 #define BUF_SIZE (10 + GUID_ENCODING_LENGTH + \
@@ -357,10 +360,10 @@
     g_sprintf(bufend, "/%d", period_num);
 
     kvp_frame_set_value(frame, path, NULL);
-    qof_instance_set_dirty(QOF_INSTANCE (budget));
+    qof_instance_set_dirty(QOF_INSTANCE (budget), TRUE);
     gnc_budget_commit_edit(budget);
 
-    qof_event_gen( QOF_ENTITY (entity), QOF_EVENT_MODIFY, NULL);
+    qof_event_gen( QOF_INSTANCE (budget), QOF_EVENT_MODIFY, NULL);
 
 }
 
@@ -385,10 +388,10 @@
         kvp_frame_set_value(frame, path, NULL);
     else
         kvp_frame_set_numeric(frame, path, val);
-    qof_instance_set_dirty(QOF_INSTANCE (budget));
+    qof_instance_set_dirty(QOF_INSTANCE (budget), TRUE);
     gnc_budget_commit_edit(budget);
 
-    qof_event_gen( QOF_ENTITY (budget), QOF_EVENT_MODIFY, NULL);
+    qof_event_gen( QOF_INSTANCE (budget), QOF_EVENT_MODIFY, NULL);
 
 }
 
@@ -470,7 +473,7 @@
 {
     Timespec ts;
     timespecFromTime_t(
-        &ts,  recurrenceGetPeriodTime(budget->priv->recurrence, period_num, FALSE));
+        &ts,  recurrenceGetPeriodTime(&budget->priv->recurrence, period_num, FALSE));
     return ts;
 }
 
@@ -480,7 +483,7 @@
 {
     // FIXME: maybe zero is not best error return val.
     g_return_val_if_fail(GNC_IS_BUDGET(budget) && acc, gnc_numeric_zero());
-    return recurrenceGetAccountPeriodValue(budget->priv->recurrence, 
+    return recurrenceGetAccountPeriodValue(&budget->priv->recurrence, 
                                            acc, period_num);
 }
 
@@ -499,7 +502,7 @@
     g_return_val_if_fail(guid, NULL);
     g_return_val_if_fail(book, NULL);
     col = qof_book_get_collection (book, GNC_ID_BUDGET);
-    return GNC_BUDGET(qof_collection_lookup_entity (col, guid));
+    return GNC_BUDGET(qof_collection_lookup_element (col, guid));
 }
 
 static void just_get_one(QofEntity *ent, gpointer data)
@@ -523,6 +526,7 @@
 }
 
 /* Define the QofObject. */
+/*
 static QofObject budget_object_def =
 {
     interface_version: QOF_OBJECT_VERSION,
@@ -537,17 +541,18 @@
     printable:         (const char* (*)(gpointer)) gnc_budget_get_name,
     version_cmp:       (int (*)(gpointer, gpointer)) qof_instance_version_cmp,
 };
+*/
 
-
 /* Static wrapper getters for the recurrence params */
 static PeriodType gnc_budget_get_rec_pt(const GncBudget *bgt) 
-{ return recurrenceGetPeriodType(&(bgt->recurrence)); }
+{ return recurrenceGetPeriodType(&(bgt->priv->recurrence)); }
 static guint gnc_budget_get_rec_mult(const GncBudget *bgt) 
-{ return recurrenceGetMultiplier(&(bgt->recurrence)); }
+{ return recurrenceGetMultiplier(&(bgt->priv->recurrence)); }
 static GDate gnc_budget_get_rec_date(const GncBudget *bgt) 
-{ return recurrenceGetDate(&(bgt->recurrence)); }
+{ return recurrenceGetDate(&(bgt->priv->recurrence)); }
 
 /* Register ourselves with the engine. */
+/*
 gboolean gnc_budget_register (void)
 {
     static QofParam params[] = {
@@ -559,15 +564,19 @@
           (QofSetterFunc) gnc_budget_set_description },
         { "recurrence_period_type", QOF_TYPE_INT32,
           (QofAccessFunc) gnc_budget_get_rec_pt, NULL },
-        /* Signedness problem: Should be unsigned. */
+          
+           Signedness problem: Should be unsigned.
+        
         { "recurrence_multiplier", QOF_TYPE_INT32,
           (QofAccessFunc) gnc_budget_get_rec_mult, NULL },
-        /* This is the same way that SchedXaction.c uses QOF_TYPE_DATE
+          
+         This is the same way that SchedXaction.c uses QOF_TYPE_DATE
            but I don't think QOF actually supports a GDate, so I think
-           this is wrong. */
+           this is wrong.
+           
         { "recurrence_date", QOF_TYPE_DATE,
           (QofAccessFunc) gnc_budget_get_rec_date, NULL },
-        /* Signedness problem: Should be unsigned. */
+         Signedness problem: Should be unsigned.
         { "num_periods", QOF_TYPE_INT32, 
           (QofAccessFunc) gnc_budget_get_num_periods,
           (QofSetterFunc) gnc_budget_set_num_periods },        
@@ -581,3 +590,4 @@
     qof_class_register(GNC_ID_BUDGET, (QofSortFunc) NULL, params);
     return qof_object_register(&budget_object_def);
 }
+*/

Modified: gnucash/branches/gobject-engine-dev/src/engine/gnc-budget.h
===================================================================
--- gnucash/branches/gobject-engine-dev/src/engine/gnc-budget.h	2007-03-15 07:30:19 UTC (rev 15725)
+++ gnucash/branches/gobject-engine-dev/src/engine/gnc-budget.h	2007-03-15 21:33:03 UTC (rev 15726)
@@ -65,10 +65,6 @@
 #define __GNC_BUDGET_H__
 
 #include <glib.h>
-
-/** The budget data.*/
-typedef struct gnc_budget_private GncBudget;
-
 #include "qof.h"
 #include "Account.h"
 #include "Recurrence.h"
@@ -99,7 +95,7 @@
 	/* Add Signal Functions Here */
 };
 
-GType   gnc_budget_get_type ();
+GType   gnc_budget_get_type (void);
 
 
 #define GNC_BUDGET_MAX_NUM_PERIODS_DIGITS 3 // max num periods == 999
@@ -116,7 +112,7 @@
 
 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()))
 
 /** Set/Get the name of the Budget */
 void gnc_budget_set_name(GncBudget* budget, const gchar* name);

Modified: gnucash/branches/gobject-engine-dev/src/engine/gnc-commodity.c
===================================================================
--- gnucash/branches/gobject-engine-dev/src/engine/gnc-commodity.c	2007-03-15 07:30:19 UTC (rev 15725)
+++ gnucash/branches/gobject-engine-dev/src/engine/gnc-commodity.c	2007-03-15 21:33:03 UTC (rev 15726)
@@ -49,6 +49,8 @@
 static void gnc_commodity_class_init(GncCommodityClass *klass);
 static void gnc_commodity_init(GncCommodity *sp);
 static void gnc_commodity_finalize(GObject *object);
+static void gnc_commodity_set_property (GObject *object, guint param_id, const GValue *value, GParamSpec *pspec);
+static void gnc_commodity_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec);
 
 struct _GncCommodityPrivate {
 
@@ -72,6 +74,7 @@
 
 enum _GncCommoditySignalType {
 	/* Signals */
+	FIRST_SIGNAL,
 	LAST_SIGNAL
 };
 
@@ -89,7 +92,7 @@
 static GObjectClass *parent_class = NULL;
 
 GType
-gnc_commodity_get_type()
+gnc_commodity_get_type(void)
 {
 	static GType type = 0;
 
@@ -156,7 +159,7 @@
 	switch (param_id) {		
 		default:
    			/* We don't have any other property... */
-    		G_OBJECT_WARN_INVALID_PROPERTY_ID(object,property_id,pspec);
+    		G_OBJECT_WARN_INVALID_PROPERTY_ID(object,param_id,pspec);
     	break;
 	}
 }
@@ -182,11 +185,14 @@
 
 /* GncCommodityNamespace */
 /* GObject declarations */
-
+/* FIXME: This declarations is better in a separated file */
 static void gnc_commodity_namespace_class_init (GncCommodityNamespaceClass *klass);
 static void gnc_commodity_namespace_init (GncCommodityNamespace *sp);
 static void gnc_commodity_namespace_finalize (GObject *object);
+static void gnc_commodity_namespace_set_property (GObject *object, guint param_id, const GValue *value, GParamSpec *pspec);
+static void gnc_commodity_namespace_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec);
 
+
 struct _GncCommodityNamespacePrivate {
   gchar      * name;
   gboolean     iso4217;
@@ -199,13 +205,14 @@
 
 enum _GncCommodityNamespaceSignalType {
 	/* Signals */
-	LAST_SIGNAL
+	FIRST_SIGNAL2,
+	LAST_SIGNAL2
 };
 
 /* properties */
 enum
 {
-        PROP_0
+        PROP_0_2
 };
 
 struct _GncCommodityNamespaceSignal {
@@ -213,10 +220,10 @@
 };
 
 static guint gnc_commodity_namespace_signals[LAST_SIGNAL] = { 0 };
-static GObjectClass *parent_class = NULL;
+static GObjectClass *parent_class_2 = NULL;
 
 GType
-gnc_commodity_namespace_get_type()
+gnc_commodity_namespace_get_type(void)
 {
 	static GType type = 0;
 
@@ -245,7 +252,7 @@
 {
 	GObjectClass *object_class = G_OBJECT_CLASS(klass);
 
-	parent_class = g_type_class_peek_parent(klass);
+	parent_class_2 = g_type_class_peek_parent(klass);
 	object_class->finalize = gnc_commodity_namespace_finalize;
 	object_class->set_property = gnc_commodity_namespace_set_property;
     object_class->get_property = gnc_commodity_namespace_get_property;
@@ -283,7 +290,7 @@
 	switch (param_id) {		
 		default:
    			/* We don't have any other property... */
-    		G_OBJECT_WARN_INVALID_PROPERTY_ID(object,property_id,pspec);
+    		G_OBJECT_WARN_INVALID_PROPERTY_ID(object,param_id,pspec);
     	break;
 	}
 }
@@ -731,17 +738,17 @@
 static void
 mark_commodity_dirty (gnc_commodity *cm)
 {
-  qof_instance_set_dirty(QOF_INSTANCE (cm));
-  qof_event_gen (QOF_ENTITY (cm), QOF_EVENT_MODIFY, NULL);
+  qof_instance_set_dirty(QOF_INSTANCE (cm), TRUE);
+  qof_event_gen (QOF_INSTANCE (cm), QOF_EVENT_MODIFY, NULL);
 }
 
 static void
 reset_printname(gnc_commodity *com)
 {
-    g_free(com->printname);
-    com->printname = g_strdup_printf("%s (%s)",
-                                     com->mnemonic ? com->mnemonic : "",
-                                     com->fullname ? com->fullname : "");
+    g_free(com->priv->printname);
+    com->priv->printname = g_strdup_printf("%s (%s)",
+                                     com->priv->mnemonic ? com->priv->mnemonic : "",
+                                     com->priv->fullname ? com->priv->fullname : "");
 }
 
 static void
@@ -749,11 +756,11 @@
 {
     gnc_commodity_namespace *ns;
 
-    g_free(com->unique_name);
-    ns = com->namespace;
-    com->unique_name = g_strdup_printf("%s::%s",
-                                       ns ? ns->name : "",
-                                       com->mnemonic ? com->mnemonic : "");
+    g_free(com->priv->unique_name);
+    ns = com->priv->namespace;
+    com->priv->unique_name = g_strdup_printf("%s::%s",
+                                       ns ? ns->priv->name : "",
+                                       com->priv->mnemonic ? com->priv->mnemonic : "");
 }
 
 gnc_commodity *
@@ -761,34 +768,64 @@
                   const char * namespace, const char * mnemonic, 
                   const char * cusip, int fraction)
 {
-  gnc_commodity * retval = g_object_new (GNC_TYPE_COMMODITY, NULL);
   gnc_commodity_table *table;
+  gnc_commodity *retval;
+  gnc_commodity_table *ct;
+    
+  retval = g_object_new (GNC_TYPE_COMMODITY, NULL);
+  
+  retval->priv = g_new0 (GncCommodityPrivate, 1);
+  
 
-  qof_instance_init (&retval->inst, GNC_ID_COMMODITY, book);
   table = gnc_commodity_table_get_table(book);
+  
   if (namespace) {
-    retval->namespace = gnc_commodity_table_find_namespace(table, namespace);
-    if (!retval->namespace)
-      retval->namespace = gnc_commodity_table_add_namespace(table, namespace, book);
+    retval->priv->namespace = gnc_commodity_table_find_namespace(table, namespace);
+    if (!retval->priv->namespace)
+      retval->priv->namespace = gnc_commodity_table_add_namespace(table, namespace, book);
   } else {
-    retval->namespace = NULL;
+    retval->priv->namespace = NULL;
   }
   
-  retval->fullname = CACHE_INSERT(fullname);
-  retval->mnemonic = CACHE_INSERT(mnemonic);
-  retval->cusip = CACHE_INSERT(cusip);
-  retval->fraction = fraction;
-  retval->mark = 0;
-  retval->quote_flag = 0;
-  retval->quote_source = NULL;
-  retval->quote_tz = CACHE_INSERT("");
+  retval->priv->fullname = CACHE_INSERT(fullname);
+  retval->priv->mnemonic = CACHE_INSERT(mnemonic);
+  retval->priv->cusip = CACHE_INSERT(cusip);
+  retval->priv->fraction = fraction;
+  retval->priv->mark = 0;
+  retval->priv->quote_flag = 0;
+  retval->priv->quote_source = NULL;
+  retval->priv->quote_tz = CACHE_INSERT("");
 
   reset_printname(retval);
   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);
+    retval->priv->quote_source = gnc_quote_source_lookup_by_internal("currency");
+  
+  /*================
+   * Code moved from the begin book method, need to be reviewed to ensure correct object
+   * initialization
+  */  
 
+  ENTER ("book=%p", book);
+  
+  if (!gnc_commodity_table_get_table(book))
+  {
+    ct = gnc_commodity_table_new ();
+    qof_book_set_data (book, GNC_COMMODITY_TABLE, ct);
+
+    if(!gnc_commodity_table_add_default_data(ct, book))
+    {
+      PWARN("unable to initialize book's commodity_table");
+    }
+
+    LEAVE ("book=%p", book);
+  }   
+  
+  /*================================*/  
+    
+  
+  qof_event_gen (QOF_INSTANCE (retval), QOF_EVENT_CREATE, NULL);
+
   return retval;
 }
 
@@ -802,16 +839,18 @@
 {
   QofBook *book;
   gnc_commodity_table *table;
+  gnc_commodity_table *ct;
+  
   if(!cm) return;
 
   book = qof_instance_get_book(QOF_INSTANCE (cm));
   table = gnc_commodity_table_get_table(book);
   gnc_commodity_table_remove(table, cm);
 
-  qof_event_gen (QOF_ENTITY (cm), QOF_EVENT_DESTROY, NULL);
+  qof_event_gen (QOF_INSTANCE (cm), QOF_EVENT_DESTROY, NULL);
 
   /* Set at creation */
-  CACHE_REMOVE (cm->fullname);
+  CACHE_REMOVE (cm->priv->fullname);
   CACHE_REMOVE (cm->priv->cusip);
   CACHE_REMOVE (cm->priv->mnemonic);
   CACHE_REMOVE (cm->priv->quote_tz);
@@ -828,21 +867,31 @@
   cm->priv->unique_name = NULL;
 
   cm->priv->mark = 0;
-
-  qof_instance_release (Qcm->priv->NSTANCE (cm));
   
+  /* =================================
+   * Code moved from book end, review it to ensure correct object destruction
+  */
+  
+  ct = gnc_commodity_table_get_table (book);
+  qof_book_set_data (book, GNC_COMMODITY_TABLE, NULL);
+  gnc_commodity_table_destroy (ct);
+  
+  /*==============================*/
+  
+  qof_instance_release (QOF_INSTANCE (cm));
+  
 }
 
 void
 gnc_commodity_copy(gnc_commodity * dest, gnc_commodity *src)
 {
-  gnc_commodity_set_fullname (dest, src->fullname);
-  dest->namespace = src->namespace;
-  gnc_commodity_set_fraction (dest, src->fraction);
-  gnc_commodity_set_cusip (dest, src->cusip);
-  gnc_commodity_set_quote_flag (dest, src->quote_flag);
+  gnc_commodity_set_fullname (dest, src->priv->fullname);
+  dest->priv->namespace = src->priv->namespace;
+  gnc_commodity_set_fraction (dest, src->priv->fraction);
+  gnc_commodity_set_cusip (dest, src->priv->cusip);
+  gnc_commodity_set_quote_flag (dest, src->priv->quote_flag);
   gnc_commodity_set_quote_source (dest, gnc_commodity_get_quote_source (src));
-  gnc_commodity_set_quote_tz (dest, src->quote_tz);
+  gnc_commodity_set_quote_tz (dest, src->priv->quote_tz);
 }
 
 gnc_commodity *
@@ -850,16 +899,16 @@
 {
   gnc_commodity * dest = g_object_new (GNC_TYPE_COMMODITY, NULL);
 
-  dest->fullname = CACHE_INSERT(src->fullname);
-  dest->mnemonic = CACHE_INSERT(src->mnemonic);
-  dest->cusip = CACHE_INSERT(src->cusip);
-  dest->quote_tz = CACHE_INSERT(src->quote_tz);
+  dest->priv->fullname = CACHE_INSERT(src->priv->fullname);
+  dest->priv->mnemonic = CACHE_INSERT(src->priv->mnemonic);
+  dest->priv->cusip = CACHE_INSERT(src->priv->cusip);
+  dest->priv->quote_tz = CACHE_INSERT(src->priv->quote_tz);
 
-  dest->namespace = src->namespace;
+  dest->priv->namespace = src->priv->namespace;
 
-  dest->mark = 0;
-  dest->fraction = src->fraction;
-  dest->quote_flag = src->quote_flag;
+  dest->priv->mark = 0;
+  dest->priv->fraction = src->priv->fraction;
+  dest->priv->quote_flag = src->priv->quote_flag;
 
   gnc_commodity_set_quote_source (dest, gnc_commodity_get_quote_source (src));
 
@@ -907,7 +956,7 @@
 gnc_commodity_get_namespace_compat(const gnc_commodity * cm) 
 {
   if (!cm || !cm->priv->namespace) return NULL;
-  if (cm->priv->namespace->iso4217) {
+  if (cm->priv->namespace->priv->iso4217) {
     /* Data files are still written with ISO4217. */
     return GNC_COMMODITY_NS_ISO;
   }
@@ -1062,7 +1111,7 @@
 
   gnc_commodity_begin_edit(cm);
   cm->priv->namespace = nsp;
-  if (nsp->iso4217)
+  if (nsp->priv->iso4217)
     cm->priv->quote_source = gnc_quote_source_lookup_by_internal("currency");
   mark_commodity_dirty(cm);
   reset_printname(cm);
@@ -1199,8 +1248,8 @@
 {
   if(a == b) return TRUE;
   if(!a || !b) return FALSE;
-  if(a->namespace != b->namespace) return FALSE;
-  if(safe_strcmp(a->mnemonic, b->mnemonic) != 0) return FALSE;
+  if(a->priv->namespace != b->priv->namespace) return FALSE;
+  if(safe_strcmp(a->priv->mnemonic, b->priv->mnemonic) != 0) return FALSE;
   return TRUE;
 }
 
@@ -1215,35 +1264,35 @@
     return FALSE;
   }
 
-  if (a->namespace != b->namespace)
+  if (a->priv->namespace != b->priv->namespace)
   {
     DEBUG ("namespaces differ: %p(%s) vs %p(%s)",
-	   a->namespace, gnc_commodity_namespace_get_name(a->namespace),
-	   b->namespace, gnc_commodity_namespace_get_name(b->namespace));
+	   a->priv->namespace, gnc_commodity_namespace_get_name(a->priv->namespace),
+	   b->priv->namespace, gnc_commodity_namespace_get_name(b->priv->namespace));
     return FALSE;
   }
 
-  if (safe_strcmp(a->mnemonic, b->mnemonic) != 0)
+  if (safe_strcmp(a->priv->mnemonic, b->priv->mnemonic) != 0)
   {
-    DEBUG ("mnemonics differ: %s vs %s", a->mnemonic, b->mnemonic);
+    DEBUG ("mnemonics differ: %s vs %s", a->priv->mnemonic, b->priv->mnemonic);
     return FALSE;
   }
 
-  if (safe_strcmp(a->fullname, b->fullname) != 0)
+  if (safe_strcmp(a->priv->fullname, b->priv->fullname) != 0)
   {
-    DEBUG ("fullnames differ: %s vs %s", a->fullname, b->fullname);
+    DEBUG ("fullnames differ: %s vs %s", a->priv->fullname, b->priv->fullname);
     return FALSE;
   }
 
-  if (safe_strcmp(a->cusip, b->cusip) != 0)
+  if (safe_strcmp(a->priv->cusip, b->priv->cusip) != 0)
   {
-    DEBUG ("cusips differ: %s vs %s", a->cusip, b->cusip);
+    DEBUG ("cusips differ: %s vs %s", a->priv->cusip, b->priv->cusip);
     return FALSE;
   }
 
-  if (a->fraction != b->fraction)
+  if (a->priv->fraction != b->priv->fraction)
   {
-    DEBUG ("fractions differ: %d vs %d", a->fraction, b->fraction);
+    DEBUG ("fractions differ: %d vs %d", a->priv->fraction, b->priv->fraction);
     return FALSE;
   }
 
@@ -1259,7 +1308,7 @@
 {
   if (ns == NULL)
     return NULL;
-  return ns->name;
+  return ns->priv->name;
 }
 
 GList * 
@@ -1268,7 +1317,7 @@
   if (!namespace)
     return NULL;
 
-  return namespace->cm_list;
+  return namespace->priv->cm_list;
 }
 
 gboolean
@@ -1348,7 +1397,7 @@
 static void
 count_coms(gpointer key, gpointer value, gpointer user_data)
 {
-    GHashTable *tbl = ((gnc_commodity_namespace*)value)->cm_table;
+    GHashTable *tbl = ((gnc_commodity_namespace*)value)->priv->cm_table;
     guint *count = (guint*)user_data;
 
     if(safe_strcmp((char*)key, GNC_COMMODITY_NS_CURRENCY) == 0)
@@ -1401,7 +1450,7 @@
 	break;
       }
     }
-    return g_hash_table_lookup(nsp->cm_table, (gpointer)mnemonic);
+    return g_hash_table_lookup(nsp->priv->cm_table, (gpointer)mnemonic);
   }
   else {
     return NULL;
@@ -1491,9 +1540,9 @@
   if (!table) return NULL;
   if (!comm) return NULL;
 
-  ENTER ("(table=%p, comm=%p) %s %s", table, comm, comm->mnemonic, comm->fullname);
-  ns_name = gnc_commodity_namespace_get_name(comm->namespace);
-  c = gnc_commodity_table_lookup (table, ns_name, comm->mnemonic);
+  ENTER ("(table=%p, comm=%p) %s %s", table, comm, comm->priv->mnemonic, comm->priv->fullname);
+  ns_name = gnc_commodity_namespace_get_name(comm->priv->namespace);
+  c = gnc_commodity_table_lookup (table, ns_name, comm->priv->mnemonic);
 
   if (c) 
   {
@@ -1506,17 +1555,17 @@
     return c;
   }
 
-  book = qof_instance_get_book (&comm->inst);
+  book = qof_instance_get_book (QOF_INSTANCE (comm));
   nsp = gnc_commodity_table_add_namespace(table, ns_name, book);
 
-  PINFO ("insert %p %s into nsp=%p %s", comm->mnemonic, comm->mnemonic,
-         nsp->cm_table, nsp->name);
-  g_hash_table_insert(nsp->cm_table, 
-                      CACHE_INSERT(comm->mnemonic),
+  PINFO ("insert %p %s into nsp=%p %s", comm->priv->mnemonic, comm->priv->mnemonic,
+         nsp->priv->cm_table, nsp->priv->name);
+  g_hash_table_insert(nsp->priv->cm_table, 
+                      CACHE_INSERT(comm->priv->mnemonic),
                       (gpointer)comm);
-  nsp->cm_list = g_list_append(nsp->cm_list, comm);
+  nsp->priv->cm_list = g_list_append(nsp->priv->cm_list, comm);
 
-  qof_event_gen (&comm->inst.entity, QOF_EVENT_ADD, NULL);
+  qof_event_gen (QOF_INSTANCE (comm), QOF_EVENT_ADD, NULL);
   LEAVE ("(table=%p, comm=%p)", table, comm);
   return comm;
 }
@@ -1537,17 +1586,17 @@
   if (!table) return;
   if (!comm) return;
 
-  ns_name = gnc_commodity_namespace_get_name(comm->namespace);
-  c = gnc_commodity_table_lookup (table, ns_name, comm->mnemonic);
+  ns_name = gnc_commodity_namespace_get_name(comm->priv->namespace);
+  c = gnc_commodity_table_lookup (table, ns_name, comm->priv->mnemonic);
   if (c != comm) return;
 
-  qof_event_gen (&comm->inst.entity, QOF_EVENT_REMOVE, NULL);
+  qof_event_gen (QOF_INSTANCE (comm), QOF_EVENT_REMOVE, NULL);
 
   nsp = gnc_commodity_table_find_namespace(table, ns_name);
   if (!nsp) return;
 
-  nsp->cm_list = g_list_remove(nsp->cm_list, comm);
-  g_hash_table_remove (nsp->cm_table, comm->mnemonic);
+  nsp->priv->cm_list = g_list_remove(nsp->priv->cm_list, comm);
+  g_hash_table_remove (nsp->priv->cm_table, comm->priv->mnemonic);
   /* XXX minor mem leak, should remove the key as well */
 }
 
@@ -1604,7 +1653,7 @@
 }
 
 /********************************************************************
- * gnc_commodity_table_get_namespaces
+ * gnc_commodity_table_get_namespacesa->
  * see if any commodities in the namespace exist 
  ********************************************************************/
 
@@ -1630,7 +1679,7 @@
 gnc_commodity_is_iso(const gnc_commodity * cm)
 {
   if (!cm || !cm->priv->namespace) return FALSE;
-  return cm->priv->namespace->iso4217;
+  return cm->priv->namespace->priv->iso4217;
 }
 
 gboolean
@@ -1662,7 +1711,7 @@
   if (!ns)
     return NULL;
 
-  return g_hash_table_values(ns->cm_table);
+  return g_hash_table_values(ns->priv->cm_table);
 }
 
 /********************************************************************
@@ -1676,8 +1725,8 @@
   gnc_commodity *comm = value; 
   GList ** l = data;
 
-  if (!comm->quote_flag ||
-      !comm->quote_source || !comm->quote_source->supported)
+  if (!comm->priv->quote_flag ||
+      !comm->priv->quote_source || !comm->priv->quote_source->supported)
     return;
   *l = g_list_prepend(*l, value);
 }
@@ -1687,8 +1736,8 @@
 {
   GList ** l = data;
 
-  if (!comm->quote_flag ||
-      !comm->quote_source || !comm->quote_source->supported)
+  if (!comm->priv->quote_flag ||
+      !comm->priv->quote_source || !comm->priv->quote_source->supported)
     return TRUE;
   *l = g_list_prepend(*l, comm);
   return TRUE;
@@ -1721,7 +1770,7 @@
 	DEBUG("Running list of %s commodities", namespace);
 	ns = gnc_commodity_table_find_namespace(table, namespace);
 	if (ns) {
-	  g_hash_table_foreach(ns->cm_table, &get_quotables_helper1, (gpointer) &l);
+	  g_hash_table_foreach(ns->priv->cm_table, &get_quotables_helper1, (gpointer) &l);
 	}
       }
     }
@@ -1754,17 +1803,19 @@
   if(!ns) 
   {
     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 (QOF_INSTANCE (ns), GNC_ID_COMMODITY_NAMESPACE, book);
-    qof_event_gen (QOF_ENTITY (ns), QOF_EVENT_CREATE, NULL);
+    ns->priv = g_new0 (GncCommodityNamespacePrivate, 1);
     
+    ns->priv->cm_table = g_hash_table_new(g_str_hash, g_str_equal);
+    ns->priv->name = CACHE_INSERT((gpointer)namespace);
+    ns->priv->iso4217 = gnc_commodity_namespace_is_iso(namespace);
+
+    qof_event_gen (QOF_INSTANCE (ns), QOF_EVENT_CREATE, NULL);
+    
     g_hash_table_insert(table->ns_table,
-			(gpointer) ns->name, 
+			(gpointer) ns->priv->name, 
 			(gpointer) ns);
     table->ns_list = g_list_append(table->ns_list, ns);
-    qof_event_gen (QOF_ENTITY (ns), QOF_EVENT_ADD, NULL);
+    qof_event_gen (QOF_INSTANCE (ns), QOF_EVENT_ADD, NULL);
   }
   return ns;
 }
@@ -1788,7 +1839,7 @@
   QofCollection *col;
   if (!guid || !book) return NULL;
   col = qof_book_get_collection (book, GNC_ID_COMMODITY);
-  return (gnc_commodity *) qof_collection_lookup_entity (col, guid);
+  return (gnc_commodity *) qof_collection_lookup_element (col, guid);
 }
 
 gnc_commodity_namespace *
@@ -1797,7 +1848,7 @@
   QofCollection *col;
   if (!guid || !book) return NULL;
   col = qof_book_get_collection (book, GNC_ID_COMMODITY_NAMESPACE);
-  return (gnc_commodity_namespace *) qof_collection_lookup_entity (col, guid);
+  return (gnc_commodity_namespace *) qof_collection_lookup_element (col, guid);
 }
 
 
@@ -1828,19 +1879,19 @@
   if (!ns)
     return;
 
-  qof_event_gen (&ns->inst.entity, QOF_EVENT_REMOVE, NULL);
+  qof_event_gen (QOF_INSTANCE (ns), QOF_EVENT_REMOVE, NULL);
   g_hash_table_remove(table->ns_table, namespace);
   table->ns_list = g_list_remove(table->ns_list, ns);
 
-  g_list_free(ns->cm_list);
-  ns->cm_list = NULL;
+  g_list_free(ns->priv->cm_list);
+  ns->priv->cm_list = NULL;
 
-  g_hash_table_foreach_remove(ns->cm_table, ns_helper, NULL);
-  g_hash_table_destroy(ns->cm_table);
-  CACHE_REMOVE(ns->name);
+  g_hash_table_foreach_remove(ns->priv->cm_table, ns_helper, NULL);
+  g_hash_table_destroy(ns->priv->cm_table);
+  CACHE_REMOVE(ns->priv->name);
 
-  qof_event_gen (&ns->inst.entity, QOF_EVENT_DESTROY, NULL);
-  qof_instance_release(&ns->inst);
+  qof_event_gen (QOF_INSTANCE (ns), QOF_EVENT_DESTROY, NULL);
+  qof_instance_release(QOF_INSTANCE (ns));
 }
 
 /********************************************************************
@@ -1870,7 +1921,7 @@
 static void
 iter_namespace (gpointer key, gpointer value, gpointer user_data)
 {
-  GHashTable *namespace_hash = ((gnc_commodity_namespace *) value)->cm_table;
+  GHashTable *namespace_hash = ((gnc_commodity_namespace *) value)->priv->cm_table;
   g_hash_table_foreach (namespace_hash, iter_commodity, user_data);
 }
 
@@ -1909,7 +1960,7 @@
   for (item = t->ns_list; item; item = next) {
     next = g_list_next(item);
     ns = item->data;
-    gnc_commodity_table_delete_namespace(t, ns->name);
+    gnc_commodity_table_delete_namespace(t, ns->priv->name);
   }
 
   g_list_free(t->ns_list);
@@ -2008,7 +2059,7 @@
 /********************************************************************
  ********************************************************************/
 /* QofObject function implementation and registration */
-
+/*
 static QofObject commodity_object_def = 
 {
   interface_version: QOF_OBJECT_VERSION,
@@ -2034,37 +2085,20 @@
   foreach:           NULL,
   printable:         NULL,
 };
+*/
 
 static void 
 commodity_table_book_begin (QofBook *book)
 {
-  gnc_commodity_table *ct;
-  ENTER ("book=%p", book);
   
-  if (gnc_commodity_table_get_table(book))
-    return;
-
-  ct = gnc_commodity_table_new ();
-  qof_book_set_data (book, GNC_COMMODITY_TABLE, ct);
-
-  if(!gnc_commodity_table_add_default_data(ct, book))
-  {
-    PWARN("unable to initialize book's commodity_table");
-  }
-
-  LEAVE ("book=%p", book);
 }
 
 static void 
 commodity_table_book_end (QofBook *book)
 {
-  gnc_commodity_table *ct;
-
-  ct = gnc_commodity_table_get_table (book);
-  qof_book_set_data (book, GNC_COMMODITY_TABLE, NULL);
-  gnc_commodity_table_destroy (ct);
+  
 }
-
+/*
 static QofObject commodity_table_object_def = 
 {
   interface_version: QOF_OBJECT_VERSION,
@@ -2091,5 +2125,5 @@
     return FALSE;
   return qof_object_register (&commodity_table_object_def);
 }
-
+*/
 /* ========================= END OF FILE ============================== */

Modified: gnucash/branches/gobject-engine-dev/src/engine/gnc-engine.h
===================================================================
--- gnucash/branches/gobject-engine-dev/src/engine/gnc-engine.h	2007-03-15 07:30:19 UTC (rev 15725)
+++ gnucash/branches/gobject-engine-dev/src/engine/gnc-engine.h	2007-03-15 21:33:03 UTC (rev 15726)
@@ -37,6 +37,7 @@
 #define GNC_ENGINE_H
 
 #include <glib.h>
+#include <glib-object.h>
 #include "qof.h"
 
 /** \name QofLogModule identifiers */
@@ -237,7 +238,7 @@
 
 /* GObject declarations */
 
-#define GNC_TYPE_TRANSACTION            (qof_book_get_type ())
+#define GNC_TYPE_TRANSACTION            (gnc_transaction_get_type ())
 #define GNC_TRANSACTION(o)              (G_TYPE_CHECK_INSTANCE_CAST ((o), GNC_TYPE_TRANSACTION, GncTransaction))
 #define GNC_TRANSACTION_CLASS(k)        (G_TYPE_CHECK_CLASS_CAST((k), GNC_TYPE_TRANSACTION, GncTransactionClass))
 #define GNC_IS_TRANSACTION(o)           (G_TYPE_CHECK_INSTANCE_TYPE ((o), GNC_TYPE_TRANSACTION))
@@ -248,7 +249,7 @@
 typedef struct _GncTransactionClass GncTransactionClass;
 typedef struct _GncTransaction GncTransaction;
 typedef struct _GncTransactionPrivate GncTransactionPrivate;
-typedef struct GncTransaction Transaction; /*  Dummy type for backward compatilibity */
+typedef GncTransaction Transaction; /*  Dummy type for backward compatilibity */
 
 struct _GncTransactionClass {
 	QofInstanceClass parent_class;
@@ -278,7 +279,7 @@
 //typedef struct gnc_commodity_s       gnc_commodity;
 /* GObject declarations for GncCommodity */
 
-#define GNC_TYPE_COMMODITY            (gnc_commodity_type ())
+#define GNC_TYPE_COMMODITY            (gnc_commodity_get_type ())
 #define GNC_COMMODITY(o)              (G_TYPE_CHECK_INSTANCE_CAST ((o), GNC_TYPE_COMMODITY, GncCommodity))
 #define GNC_COMMODITY_CLASS(k)        (G_TYPE_CHECK_CLASS_CAST((k), GNC_TYPE_COMMODITY, GncCommodityClass))
 #define GNC_IS_COMMODITY(o)           (G_TYPE_CHECK_INSTANCE_TYPE ((o), GNC_TYPE_COMMODITY))
@@ -322,7 +323,7 @@
 typedef struct _GncCommodityNamespaceClass GncCommodityNamespaceClass;
 typedef struct _GncCommodityNamespace GncCommodityNamespace;
 typedef struct _GncCommodityNamespacePrivate GncCommodityNamespacePrivate;
-typedef struct GncCommodityNamespace gnc_commodity_namespace; /*  Dummy type for backward compatilibity */
+typedef GncCommodityNamespace gnc_commodity_namespace; /*  Dummy type for backward compatilibity */
 
 struct _GncCommodityNamespace {
     QofInstance instance;
@@ -365,6 +366,7 @@
 typedef struct _GncLot GncLot;
 #define  GNCLot GncLot /* Dummy type for backward compatilibity */
 
+
 struct _GncLotClass {
 	QofInstanceClass parent_class;
 	/* virtual table */

Modified: gnucash/branches/gobject-engine-dev/src/engine/gnc-lot-p.h
===================================================================
--- gnucash/branches/gobject-engine-dev/src/engine/gnc-lot-p.h	2007-03-15 07:30:19 UTC (rev 15725)
+++ gnucash/branches/gobject-engine-dev/src/engine/gnc-lot-p.h	2007-03-15 21:33:03 UTC (rev 15726)
@@ -60,7 +60,7 @@
   unsigned char marker;
 };
 
-#define gnc_lot_set_guid(L,G)  qof_entity_set_guid(QOF_ENTITY(L),&(G))
+#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/gobject-engine-dev/src/engine/gnc-lot.c
===================================================================
--- gnucash/branches/gobject-engine-dev/src/engine/gnc-lot.c	2007-03-15 07:30:19 UTC (rev 15725)
+++ gnucash/branches/gobject-engine-dev/src/engine/gnc-lot.c	2007-03-15 21:33:03 UTC (rev 15726)
@@ -55,6 +55,8 @@
 static void gnc_lot_class_init(GncLotClass *klass);
 static void gnc_lot_init(GncLot *sp);
 static void gnc_lot_finalize(GObject *object);
+static void gnc_lot_set_property (GObject *object, guint param_id, const GValue *value, GParamSpec *pspec);
+static void gnc_lot_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec);
 
 struct _GncLotPrivate {
 	/* Private Members */
@@ -65,6 +67,7 @@
 
 enum _GncLotSignalType {
 	/* Signals */
+	FIRST_SIGNAL,
 	LAST_SIGNAL
 };
 
@@ -82,7 +85,7 @@
 static GObjectClass *parent_class = NULL;
 
 GType
-gnc_lot_get_type()
+gnc_lot_get_type(void)
 {
 	static GType type = 0;
 
@@ -99,7 +102,7 @@
 			(GInstanceInitFunc)gnc_lot_init,
 		};
 
-		type = g_type_register_static(QOF_TYPE_ENTITY, 
+		type = g_type_register_static(QOF_TYPE_INSTANCE, 
 			"GncLot", &our_info, 0);
 	}
 
@@ -123,9 +126,13 @@
 }
 
 static void
-gnc_lot_init(GncLot *obj)
+gnc_lot_init(GncLot *lot)
 {
 	/* Initialize private members, etc. */
+   lot->account = NULL;
+   lot->splits = NULL;
+   lot->is_closed = -1;
+   lot->marker = 0;
 }
 
 static void
@@ -149,7 +156,7 @@
 	switch (param_id) {		
 		default:
    			/* We don't have any other property... */
-    		G_OBJECT_WARN_INVALID_PROPERTY_ID(object,property_id,pspec);
+    		G_OBJECT_WARN_INVALID_PROPERTY_ID(object,param_id,pspec);
     	break;
 	}
 }
@@ -175,18 +182,6 @@
 
 /* ============================================================= */
 
-static void
-gnc_lot_init (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);
-   LEAVE ("(lot=%p, book=%p)", lot, book);
-}
 
 GNCLot *
 gnc_lot_new (QofBook *book)
@@ -195,8 +190,8 @@
    g_return_val_if_fail (book, NULL);
 
    lot = g_object_new (GNC_TYPE_LOT, NULL);
-   gnc_lot_init (lot, book);
-   qof_event_gen (&lot->inst.entity, QOF_EVENT_CREATE, NULL);
+
+   qof_event_gen (QOF_INSTANCE (lot), QOF_EVENT_CREATE, NULL);
    return lot;
 }
 
@@ -207,7 +202,7 @@
    if (!lot) return;
    
    ENTER ("(lot=%p)", lot);
-   qof_event_gen (&lot->inst.entity, QOF_EVENT_DESTROY, NULL);
+   qof_event_gen (QOF_INSTANCE (lot), QOF_EVENT_DESTROY, NULL);
 
    
    for (node=lot->splits; node; node=node->next)
@@ -253,7 +248,7 @@
   QofCollection *col;
   if (!guid || !book) return NULL;
   col = qof_book_get_collection (book, GNC_ID_LOT);
-  return (GNCLot *) qof_collection_lookup_entity (col, guid);
+  return (GNCLot *) qof_collection_lookup_element (col, guid);
 }
 
 QofBook *
@@ -312,7 +307,7 @@
 gnc_lot_get_notes (GNCLot *lot)
 {
    if (!lot) return NULL;
-   return kvp_frame_get_string (lot->inst.kvp_data, "/notes");
+   return kvp_frame_get_string (qof_instance_get_kvp_data (QOF_INSTANCE (lot)), "/notes");
 }
 
 void
@@ -320,8 +315,8 @@
 {
    if (!lot) return;
    qof_begin_edit(QOF_INSTANCE(lot));
-   qof_instance_set_dirty(QOF_INSTANCE(lot));
-   kvp_frame_set_str (lot->inst.kvp_data, "/title", str);
+   qof_instance_set_dirty(QOF_INSTANCE(lot), TRUE);
+   kvp_frame_set_str (qof_instance_get_kvp_data (QOF_INSTANCE (lot)), "/title", str);
    gnc_lot_commit_edit(lot);
 }
 
@@ -330,8 +325,8 @@
 {
    if (!lot) return;
    gnc_lot_begin_edit(lot);
-   qof_instance_set_dirty(QOF_INSTANCE(lot));
-   kvp_frame_set_str (lot->inst.kvp_data, "/notes", str);
+   qof_instance_set_dirty(QOF_INSTANCE(lot), TRUE);
+   kvp_frame_set_str (qof_instance_get_kvp_data (QOF_INSTANCE (lot)), "/notes", str);
    gnc_lot_commit_edit(lot);
 }
 
@@ -432,7 +427,7 @@
         gnc_num_dbg_to_string (split->value));
    gnc_lot_begin_edit(lot);
    acc = xaccSplitGetAccount (split);
-   qof_instance_set_dirty(QOF_INSTANCE(lot));
+   qof_instance_set_dirty(QOF_INSTANCE(lot), TRUE);
    if (NULL == lot->account)
    {
       xaccAccountInsertLot (acc, lot);
@@ -463,7 +458,7 @@
    lot->is_closed = -1;
    gnc_lot_commit_edit(lot);
 
-   qof_event_gen (&lot->inst.entity, QOF_EVENT_MODIFY, NULL);
+   qof_event_gen (QOF_INSTANCE (lot), QOF_EVENT_MODIFY, NULL);
 }
 
 void
@@ -473,7 +468,7 @@
 
    ENTER ("(lot=%p, split=%p)", lot, split);
    gnc_lot_begin_edit(lot);
-   qof_instance_set_dirty(QOF_INSTANCE(lot));
+   qof_instance_set_dirty(QOF_INSTANCE(lot), TRUE);
    lot->splits = g_list_remove (lot->splits, split);
    split->lot = NULL;
    lot->is_closed = -1;   /* force an is-closed computation */
@@ -484,7 +479,7 @@
       lot->account = NULL;
    }
    gnc_lot_commit_edit(lot);
-   qof_event_gen (&lot->inst.entity, QOF_EVENT_MODIFY, NULL);
+   qof_event_gen (QOF_INSTANCE (lot), QOF_EVENT_MODIFY, NULL);
 }
 
 /* ============================================================== */
@@ -549,7 +544,7 @@
 }
 
 /* ============================================================= */
-
+/*
 static QofObject gncLotDesc =
 {
     interface_version:  QOF_OBJECT_VERSION,
@@ -576,7 +571,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, 
@@ -589,5 +584,5 @@
     qof_class_register (GNC_ID_LOT, NULL, params);
     return qof_object_register(&gncLotDesc);
 }
-
+*/
 /* ========================== END OF FILE ========================= */

Modified: gnucash/branches/gobject-engine-dev/src/engine/gnc-lot.h
===================================================================
--- gnucash/branches/gobject-engine-dev/src/engine/gnc-lot.h	2007-03-15 07:30:19 UTC (rev 15725)
+++ gnucash/branches/gobject-engine-dev/src/engine/gnc-lot.h	2007-03-15 21:33:03 UTC (rev 15726)
@@ -140,7 +140,7 @@
  * */
 KvpFrame * gnc_lot_get_slots (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/gobject-engine-dev/src/engine/gnc-pricedb-p.h
===================================================================
--- gnucash/branches/gobject-engine-dev/src/engine/gnc-pricedb-p.h	2007-03-15 07:30:19 UTC (rev 15725)
+++ gnucash/branches/gobject-engine-dev/src/engine/gnc-pricedb-p.h	2007-03-15 21:33:03 UTC (rev 15726)
@@ -88,7 +88,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/gobject-engine-dev/src/engine/gnc-pricedb.c
===================================================================
--- gnucash/branches/gobject-engine-dev/src/engine/gnc-pricedb.c	2007-03-15 07:30:19 UTC (rev 15725)
+++ gnucash/branches/gobject-engine-dev/src/engine/gnc-pricedb.c	2007-03-15 21:33:03 UTC (rev 15726)
@@ -40,16 +40,19 @@
 static void gnc_price_class_init(GncPriceDbClass *klass);
 static void gnc_price_init(GncPriceDb *sp);
 static void gnc_price_finalize(GObject *object);
+static void gnc_price_set_property (GObject *object, guint param_id, const GValue *value, GParamSpec *pspec);
+static void gnc_price_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec);
 
-struct _GncPriceDbPrivate {
+struct _GncPricePrivate {
 	/* Private Members */
 };
 
-typedef struct _GncPriceDbSignal GncPriceDbSignal;
-typedef enum _GncPriceDbSignalType GncPriceDbSignalType;
+typedef struct _GncPriceSignal GncPriceSignal;
+typedef enum _GncPriceSignalType GncPriceSignalType;
 
-enum _GncPriceDbSignalType {
+enum _GncPriceSignalType {
 	/* Signals */
+	FIRST_SIGNAL,
 	LAST_SIGNAL
 };
 
@@ -59,7 +62,7 @@
         PROP_0
 };
 
-struct _GncPriceDbSignal {
+struct _GncPriceSignal {
 	GncPriceDb *object;
 };
 
@@ -67,7 +70,7 @@
 static GObjectClass *parent_class = NULL;
 
 GType
-gnc_price_get_gtype()
+gnc_price_get_gtype (void)
 {
 	static GType type = 0;
 
@@ -84,7 +87,7 @@
 			(GInstanceInitFunc)gnc_price_init,
 		};
 
-		type = g_type_register_static(QOF_TYPE_ENTITY, 
+		type = g_type_register_static(QOF_TYPE_INSTANCE, 
 			"GncPriceDb", &our_info, 0);
 	}
 
@@ -134,7 +137,7 @@
 	switch (param_id) {		
 		default:
    			/* We don't have any other property... */
-    		G_OBJECT_WARN_INVALID_PROPERTY_ID(object,property_id,pspec);
+    		G_OBJECT_WARN_INVALID_PROPERTY_ID(object,param_id,pspec);
     	break;
 	}
 }
@@ -180,8 +183,7 @@
   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_event_gen (QOF_INSTANCE (p), QOF_EVENT_CREATE, NULL);
 
   return p;
 }
@@ -190,7 +192,7 @@
 gnc_price_destroy (GNCPrice *p)
 {
   ENTER(" ");
-  qof_event_gen (&p->inst.entity, QOF_EVENT_DESTROY, NULL);
+  qof_event_gen (QOF_INSTANCE (p), QOF_EVENT_DESTROY, NULL);
 
   if(p->type) CACHE_REMOVE(p->type);
   if(p->source) CACHE_REMOVE(p->source);
@@ -261,7 +263,7 @@
 void
 gnc_price_begin_edit (GNCPrice *p)
 {
-  QOF_BEGIN_EDIT (&p->inst);
+  qof_begin_edit (QOF_INSTANCE (p));
 }
 
 static void commit_err (QofInstance *inst, QofBackendError errcode)
@@ -283,14 +285,14 @@
 void
 gnc_pricedb_begin_edit (GNCPriceDB *pdb)
 {
-  QOF_BEGIN_EDIT (&pdb->inst);
+  qof_instance_begin_edit (QOF_INSTANCE (pdb), NULL);
 }
 
 void
 gnc_pricedb_commit_edit (GNCPriceDB *pdb)
 {
   if (!qof_commit_edit (QOF_INSTANCE(pdb))) return;
-  qof_commit_edit_part2 (&pdb->inst, commit_err, noop, noop);
+  qof_commit_edit_part2 (QOF_INSTANCE (pdb), commit_err, noop, noop);
 }
 
 /* ==================================================================== */
@@ -299,7 +301,7 @@
 static void
 gnc_price_set_dirty (GNCPrice *p)
 {
-  qof_instance_set_dirty(&p->inst);
+  qof_instance_set_dirty(QOF_INSTANCE (p), TRUE);
 }
 
 void
@@ -431,7 +433,7 @@
 
   if (!guid || !book) return NULL;
   col = qof_book_get_collection (book, GNC_ID_PRICE);
-  return (GNCPrice *) qof_collection_lookup_entity (col, guid);
+  return (GNCPrice *) qof_collection_lookup_element (col, guid);
 }
 
 gnc_commodity *
@@ -682,6 +684,8 @@
 static void gnc_pricedb_class_init(GncPriceDbClass *klass);
 static void gnc_pricedb_init(GncPriceDb *sp);
 static void gnc_pricedb_finalize(GObject *object);
+static void gnc_pricedb_set_property (GObject *object, guint param_id, const GValue *value, GParamSpec *pspec);
+static void gnc_pricedb_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec);
 
 struct _GncPriceDbPrivate {
 	/* Private Members */
@@ -692,13 +696,14 @@
 
 enum _GncPriceDbSignalType {
 	/* Signals */
-	LAST_SIGNAL
+	FIRST_SIGNAL2,
+	LAST_SIGNAL2
 };
 
 /* properties */
 enum
 {
-        PROP_0
+        PROP_0_2
 };
 
 struct _GncPriceDbSignal {
@@ -706,10 +711,10 @@
 };
 
 static guint gnc_pricedb_signals[LAST_SIGNAL] = { 0 };
-static GObjectClass *parent_class = NULL;
+static GObjectClass *parent_class2 = NULL;
 
 GType
-gnc_pricedb_get_type()
+gnc_pricedb_get_type(void)
 {
 	static GType type = 0;
 
@@ -726,7 +731,7 @@
 			(GInstanceInitFunc)gnc_pricedb_init,
 		};
 
-		type = g_type_register_static(QOF_TYPE_ENTITY, 
+		type = g_type_register_static(QOF_TYPE_INSTANCE, 
 			"GncPriceDb", &our_info, 0);
 	}
 
@@ -738,7 +743,7 @@
 {
 	GObjectClass *object_class = G_OBJECT_CLASS(klass);
 
-	parent_class = g_type_class_peek_parent(klass);
+	parent_class2 = g_type_class_peek_parent(klass);
 	object_class->finalize = gnc_pricedb_finalize;
 	object_class->set_property = gnc_pricedb_set_property;
     object_class->get_property = gnc_pricedb_get_property;
@@ -776,7 +781,7 @@
 	switch (param_id) {		
 		default:
    			/* We don't have any other property... */
-    		G_OBJECT_WARN_INVALID_PROPERTY_ID(object,property_id,pspec);
+    		G_OBJECT_WARN_INVALID_PROPERTY_ID(object,param_id,pspec);
     	break;
 	}
 }
@@ -821,7 +826,7 @@
   }
 
   result = g_object_new (GNC_TYPE_PRICE_DB, NULL);
-  qof_instance_init (&result->inst, GNC_ID_PRICEDB, book);
+
   qof_collection_mark_clean(col);
 
   /** \todo This leaks result when the collection is destroyed.  When
@@ -1023,9 +1028,9 @@
 
   if(!db || !p) return FALSE;
   ENTER ("db=%p, pr=%p dirty=%d do-free=%d",
-         db, p, p->inst.dirty, p->inst.do_free);
+         db, p, qof_instance_is_dirty (QOF_INSTANCE (p)), qof_instance_get_do_free (QOF_INSTANCE (p)));
 
-  if (db->inst.book != p->inst.book)
+  if (qof_instance_get_book (QOF_INSTANCE (db)) != qof_instance_get_book (QOF_INSTANCE (p)))
   {
      PERR ("attempted to mix up prices across different books");
 	 LEAVE (" ");
@@ -1065,10 +1070,10 @@
   }
   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 (QOF_INSTANCE (p), 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,
+         db, p, qof_instance_is_dirty (QOF_INSTANCE (p)), qof_instance_get_do_free (QOF_INSTANCE (p)),
          gnc_commodity_get_namespace(p->commodity),
          gnc_commodity_get_mnemonic(p->commodity),
          currency_hash);
@@ -1083,7 +1088,7 @@
   if(!db || !p) return FALSE;
 
   ENTER ("db=%p, pr=%p dirty=%d do-free=%d",
-         db, p, p->inst.dirty, p->inst.do_free);
+         db, p, qof_instance_is_dirty (QOF_INSTANCE (p)), qof_instance_get_do_free (QOF_INSTANCE (p)));
 
   if (FALSE == add_price(db, p)) 
   {
@@ -1092,11 +1097,11 @@
   }
 
   gnc_pricedb_begin_edit(db);
-  qof_instance_set_dirty(&db->inst);
+  qof_instance_set_dirty(QOF_INSTANCE (db), TRUE);
   gnc_pricedb_commit_edit(db);
 
   LEAVE ("db=%p, pr=%p dirty=%d do-free=%d",
-         db, p, p->inst.dirty, p->inst.do_free);
+         db, p, qof_instance_is_dirty (QOF_INSTANCE (p)), qof_instance_get_do_free (QOF_INSTANCE (p)));
 
   return TRUE;
 }
@@ -1115,7 +1120,7 @@
 
   if(!db || !p) return FALSE;
   ENTER ("db=%p, pr=%p dirty=%d do-free=%d",
-         db, p, p->inst.dirty, p->inst.do_free);
+         db, p, qof_instance_is_dirty (QOF_INSTANCE (p)), qof_instance_get_do_free (QOF_INSTANCE (p)));
 
   commodity = gnc_price_get_commodity(p);
   if(!commodity) { LEAVE (" no commodity"); return FALSE; }
@@ -1130,7 +1135,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 (QOF_INSTANCE (p), 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)) {
@@ -1169,17 +1174,17 @@
   gboolean rc;
   if(!db || !p) return FALSE;
   ENTER ("db=%p, pr=%p dirty=%d do-free=%d",
-         db, p, p->inst.dirty, p->inst.do_free);
+         db, p, qof_instance_is_dirty (QOF_INSTANCE (p)), qof_instance_get_do_free (QOF_INSTANCE (p)));
 
   gnc_price_ref(p);
   rc = remove_price (db, p, TRUE);
   gnc_pricedb_begin_edit(db);
-  qof_instance_set_dirty(&db->inst);
+  qof_instance_set_dirty(QOF_INSTANCE (db), TRUE);
   gnc_pricedb_commit_edit(db);
 
   /* invoke the backend to delete this price */
   gnc_price_begin_edit (p);
-  p->inst.do_free = TRUE;
+  qof_instance_set_do_free (QOF_INSTANCE (p), TRUE);
   gnc_price_commit_edit (p);
   p->db = NULL;
   gnc_price_unref(p);
@@ -2632,14 +2637,17 @@
 }
 
 /* ==================================================================== */
-
+/*
 static const char *
 price_printable(gpointer obj)
 {
   GNCPrice *pr = obj;
   gnc_commodity *commodity;
   gnc_commodity *currency;
-  static char buff[2048];  /* nasty static OK for printing */
+  
+   ******nasty static OK for printing****
+  
+  static char buff[2048];  
   char *val, *da;
 
   if(!pr) return "";
@@ -2708,5 +2716,5 @@
     return FALSE;
   return qof_object_register (&pricedb_object_def);
 }
-
+*/
 /* ========================= END OF FILE ============================== */

Modified: gnucash/branches/gobject-engine-dev/src/engine/gnc-pricedb.h
===================================================================
--- gnucash/branches/gobject-engine-dev/src/engine/gnc-pricedb.h	2007-03-15 07:30:19 UTC (rev 15725)
+++ gnucash/branches/gobject-engine-dev/src/engine/gnc-pricedb.h	2007-03-15 21:33:03 UTC (rev 15726)
@@ -41,7 +41,7 @@
 
 typedef struct _GncPriceClass GncPriceClass;
 typedef struct _GncPrice GncPrice;
-typedef struct GncPrice GNCPrice;  /* Dummy type for backward compatilibity */
+typedef GncPrice GNCPrice;  /* Dummy type for backward compatilibity */
 
 struct _GncPriceClass {
 	QofInstanceClass parent_class;
@@ -50,7 +50,7 @@
 	/* Add Signal Functions Here */
 };
 
-GType   gnc_price_get_gtype ();
+GType   gnc_price_get_gtype (void);
 
 /** @addtogroup PriceDB
     @{ */
@@ -221,8 +221,8 @@
 gint32          gnc_price_get_version(GNCPrice *p);
 gboolean        gnc_price_equal(GNCPrice *p1, 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))
 /**  @} */
 
@@ -280,7 +280,7 @@
 
 typedef struct _GncPriceDbClass GncPriceDbClass;
 typedef struct _GncPriceDb GncPriceDb;
-typedef struct GncPriceDb GNCPriceDB;  /* Dummy type for backward compatilibity */
+typedef GncPriceDb GNCPriceDB;  /* Dummy type for backward compatilibity */
 
 struct _GncPriceDbClass {
 	QofInstanceClass parent_class;
@@ -289,7 +289,7 @@
 	/* Add Signal Functions Here */
 };
 
-GType   gnc_pricedb_get_type ();
+GType   gnc_pricedb_get_type (void);
 
 /* XXX backwards-compat defines, remove these someday */
 #define gnc_book_get_pricedb  gnc_pricedb_get_db

Modified: gnucash/branches/gobject-engine-dev/src/engine/test/test-recursive.c
===================================================================
--- gnucash/branches/gobject-engine-dev/src/engine/test/test-recursive.c	2007-03-15 07:30:19 UTC (rev 15725)
+++ gnucash/branches/gobject-engine-dev/src/engine/test/test-recursive.c	2007-03-15 21:33:03 UTC (rev 15726)
@@ -968,7 +968,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_instancecopy_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/gobject-engine-dev/src/engine/xlate.pl
===================================================================
--- gnucash/branches/gobject-engine-dev/src/engine/xlate.pl	2007-03-15 07:30:19 UTC (rev 15725)
+++ gnucash/branches/gobject-engine-dev/src/engine/xlate.pl	2007-03-15 21:33:03 UTC (rev 15726)
@@ -195,13 +195,13 @@
 		s/GNCEntityTable/QofEntityTable/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_instancenew/g;
+		s/xaccEntityTableDestroy/qof_instancedestroy/g;
+		s/xaccGUIDNewEntityTable/qof_instanceguid_new/g;
+		s/xaccLookupEntity/qof_instancelookup/g;
+		s/xaccStoreEntity/qof_instancestore/g;
+		s/xaccRemoveEntity/qof_instanceremove/g;
+		s/xaccForeachEntity/qof_instanceforeach/g;
 
 		s/foreachObjectCB/QofEntityForeachCB/g;
 		s/GNC_OBJECT_VERSION/QOF_OBJECT_VERSION/g;

Modified: gnucash/branches/gobject-engine-dev/src/gnome/dialog-chart-export.c
===================================================================
--- gnucash/branches/gobject-engine-dev/src/gnome/dialog-chart-export.c	2007-03-15 07:30:19 UTC (rev 15725)
+++ gnucash/branches/gobject-engine-dev/src/gnome/dialog-chart-export.c	2007-03-15 21:33:03 UTC (rev 15726)
@@ -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_instancecopy_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);
@@ -94,7 +94,7 @@
 	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_instanceget_reference_from(ent, ref_param);
 		qof_session_update_reference_list(data->chart_session, reference);
 		data->param_ref_list = data->param_ref_list->next;
 	}
@@ -119,13 +119,13 @@
 	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_instancecopy_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_instanceget_reference_from((QofEntity*)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_instanceget_reference_from((QofEntity*)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_instanceget_reference_from((QofEntity*)split, ref->data);
 		qof_session_update_reference_list(data->chart_session, ent_ref);
 		ref = g_list_next(ref);
 	}

Modified: gnucash/branches/gobject-engine-dev/src/gnome/dialog-chart-export.h
===================================================================
--- gnucash/branches/gobject-engine-dev/src/gnome/dialog-chart-export.h	2007-03-15 07:30:19 UTC (rev 15725)
+++ gnucash/branches/gobject-engine-dev/src/gnome/dialog-chart-export.h	2007-03-15 21:33:03 UTC (rev 15726)
@@ -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_instancecopy routines
+like ::qof_instancecopy_to_session so that the QofBook is marked
 as \a partial. 
 
 \par guidelines Guidelines for partial book export

Modified: gnucash/branches/gobject-engine-dev/src/gnome/top-level.c
===================================================================
--- gnucash/branches/gobject-engine-dev/src/gnome/top-level.c	2007-03-15 07:30:19 UTC (rev 15725)
+++ gnucash/branches/gobject-engine-dev/src/gnome/top-level.c	2007-03-15 21:33:03 UTC (rev 15726)
@@ -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/gobject-engine-dev/src/gnome-search/dialog-search.c
===================================================================
--- gnucash/branches/gobject-engine-dev/src/gnome-search/dialog-search.c	2007-03-15 07:30:19 UTC (rev 15725)
+++ gnucash/branches/gobject-engine-dev/src/gnome-search/dialog-search.c	2007-03-15 21:33:03 UTC (rev 15726)
@@ -189,7 +189,7 @@
     /* Select the time */
     gnc_search_dialog_select_cb (NULL, sw);
   else if (sw->buttons)
-    /* Call the first button (usually view/edit) */
+    /* Call the first button (uSPLIT_ACCOUNT_GUIDsually view/edit) */
     gnc_search_callback_button_execute (sw->buttons, sw);
 }
 #endif
@@ -349,7 +349,7 @@
 
   /* Make sure we supply a book! */
   if (sw->start_q == NULL) {
-    sw->start_q = gncQueryCreateFor (sw->search_for);
+    sw->start_q = gncQueryCreateFor (g_type_from_name (sw->search_for));
     gncQuerySetBook (sw->start_q, gnc_get_current_book ());
   } else {
     /* We've got a query -- purge it of any "active" parameters */
@@ -357,7 +357,7 @@
   }
 
   /* Now create a new query to work from */
-  q = gncQueryCreateFor (sw->search_for);
+  q = gncQueryCreateFor (g_type_from_name (sw->search_for));
 
   /* Walk the list of criteria */
   for (node = sw->crit_list; node; node = node->next) {
@@ -488,14 +488,14 @@
 
     if (!sw->q) {
       if (!sw->start_q) {
-        sw->start_q = gncQueryCreateFor (sw->search_for);
+        sw->start_q = gncQueryCreateFor (g_type_from_name (sw->search_for));
         gncQuerySetBook (sw->start_q, gnc_get_current_book ());
       }
       sw->q = gncQueryCopy (sw->start_q);
       op = QUERY_AND;
     }
 
-    gncQueryAddGUIDMatch (sw->q, g_slist_prepend (NULL, QUERY_PARAM_GUID),
+    gncQueryAddGUIDMatch (sw->q, g_slist_prepend (NULL, GINT_TO_POINTER (QUERY_PARAM_GUID)),
 			  guid, op);
 
     /* Watch this entity so we'll refresh once it's actually changed */
@@ -791,7 +791,7 @@
   if (sw->type_label)
     type_label = sw->type_label;
   else
-    type_label = _(gncObjectGetTypeLabel (sw->search_for));
+    type_label = _(gncObjectGetTypeLabel (g_type_from_name (sw->search_for)));
   gtk_label_set_text (GTK_LABEL (label), type_label);
 
   /* Set the 'add criterion' button */
@@ -826,7 +826,7 @@
   /* Figure out if we this object-type has an "active" parameter, and
    * if not, then set the active-check button insensitive
    */
-  if (gncQueryObjectGetParameter (sw->search_for, QUERY_PARAM_ACTIVE) == NULL)
+  if (gncQueryObjectGetParameter (g_type_from_name (sw->search_for), QUERY_PARAM_ACTIVE) == NULL)
     gtk_widget_set_sensitive (sw->active_only_check, FALSE);
 
   /* Deal with the cancel button */
@@ -920,7 +920,7 @@
   GNCSearchWindow *sw = g_new0 (GNCSearchWindow, 1);
 
   g_return_val_if_fail (obj_type, NULL);
-  g_return_val_if_fail (*obj_type != '\0', NULL);
+  g_return_val_if_fail (obj_type != G_TYPE_INVALID, NULL);
   g_return_val_if_fail (param_list, NULL);
 
   /* Make sure the caller supplies callbacks xor result_callback */
@@ -942,7 +942,7 @@
   sw->type_label = type_label;
 
   /* Grab the get_guid function */
-  sw->get_guid = qof_class_get_parameter (sw->search_for, QOF_PARAM_GUID);
+  sw->get_guid = qof_class_get_parameter (g_type_from_name (sw->search_for), g_type_name (QOF_PARAM_GUID));
   if (start_query)
     sw->start_q = gncQueryCopy (start_query);
   sw->q = show_start_query;
@@ -1019,7 +1019,7 @@
 				   ACCOUNT_MATCH_ALL_TYPE,
 				   type, SPLIT_TRANS, TRANS_SPLITLIST,
 				   SPLIT_ACCOUNT_GUID, NULL);
-  list = gnc_search_param_prepend (list, "Split Account", GNC_ID_ACCOUNT,
+  list = gnc_search_param_prepend (list, "Split Account", (gchar*) g_type_name (GNC_ID_ACCOUNT),
 				   type, SPLIT_ACCOUNT, QUERY_PARAM_GUID,
 				   NULL);
   list = gnc_search_param_prepend (list, "Split->Txn->Void?", NULL, type,
@@ -1077,12 +1077,12 @@
   };
 
   if (params == NULL)
-    params = get_params_list (GNC_ID_SPLIT);
+    params = get_params_list ((gchar*) g_type_name (GNC_ID_SPLIT));
 
   if (display == NULL)
-    display = get_display_list (GNC_ID_SPLIT);
+    display = get_display_list ((gchar*) g_type_name (GNC_ID_SPLIT));
 
-  sw = gnc_search_dialog_create (GNC_ID_SPLIT, _("Find Transaction"),
+  sw = gnc_search_dialog_create ((gchar*) g_type_name (GNC_ID_SPLIT), _("Find Transaction"),
 				 params, display,
 				 NULL, NULL, buttons, NULL, NULL, NULL, NULL,
 				 NULL, NULL);

Modified: gnucash/branches/gobject-engine-dev/src/gnome-search/gnc-general-search.c
===================================================================
--- gnucash/branches/gobject-engine-dev/src/gnome-search/gnc-general-search.c	2007-03-15 07:30:19 UTC (rev 15725)
+++ gnucash/branches/gobject-engine-dev/src/gnome-search/gnc-general-search.c	2007-03-15 21:33:03 UTC (rev 15726)
@@ -289,7 +289,7 @@
 
 	g_return_val_if_fail (type && label && search_cb, NULL);
 
-	get_guid = qof_class_get_parameter (type, QOF_PARAM_GUID);
+	get_guid = qof_class_get_parameter (g_type_from_name (type), g_type_name (QOF_PARAM_GUID));
 	g_return_val_if_fail (get_guid, NULL);
 
 	gsl = g_object_new (GNC_TYPE_GENERAL_SEARCH, NULL);

Modified: gnucash/branches/gobject-engine-dev/src/gnome-utils/account-quickfill.c
===================================================================
--- gnucash/branches/gobject-engine-dev/src/gnome-utils/account-quickfill.c	2007-03-15 07:30:19 UTC (rev 15725)
+++ gnucash/branches/gobject-engine-dev/src/gnome-utils/account-quickfill.c	2007-03-15 21:33:03 UTC (rev 15726)
@@ -61,7 +61,7 @@
 } QFB;
 
 static void 
-shared_quickfill_destroy (QofBook *book, gpointer key, gpointer user_data)
+shared_quickfill_destroy (gpointer user_data)
 {
   QFB *qfb = user_data;
   gnc_gconf_general_remove_cb(KEY_ACCOUNT_SEPARATOR,

Modified: gnucash/branches/gobject-engine-dev/src/gnome-utils/gnc-query-list.c
===================================================================
--- gnucash/branches/gobject-engine-dev/src/gnome-utils/gnc-query-list.c	2007-03-15 07:30:19 UTC (rev 15725)
+++ gnucash/branches/gobject-engine-dev/src/gnome-utils/gnc-query-list.c	2007-03-15 21:33:03 UTC (rev 15726)
@@ -134,7 +134,7 @@
   /* cache the function to get the guid of this query type */
   priv = GNC_QUERY_LIST_GET_PRIVATE(list);
   priv->get_guid =
-    qof_class_get_parameter (qof_query_get_search_for(query), QOF_PARAM_GUID);
+    qof_class_get_parameter (qof_query_get_search_for(query), g_type_name (QOF_PARAM_GUID));
 
   /* Initialize the CList */
   gnc_query_list_init_clist(list);
@@ -187,10 +187,10 @@
   for (i = 0, node = list->column_params; node; node = node->next, i++)
   {
     GNCSearchParam *param = node->data;
-    const char *type = gnc_search_param_get_param_type (param);
+    QofIdType type = g_type_from_name (gnc_search_param_get_param_type (param));
 
     /* if this is a boolean, ignore it now -- we'll use a checkmark later */
-    if (safe_strcmp (type, QUERYCORE_BOOLEAN))
+    if ( type == QUERYCORE_BOOLEAN)
       continue;
 
     result = (gboolean) GPOINTER_TO_INT(gnc_search_param_compute_value(param, entry));
@@ -696,9 +696,9 @@
    * debred column, then invert the sort order.
    */
   if (list->numeric_inv_sort) {
-    const char *type = gnc_search_param_get_param_type (param);
-    if (!safe_strcmp(type, QUERYCORE_NUMERIC) ||
-	!safe_strcmp(type, QUERYCORE_DEBCRED))
+    QofIdType type = g_type_from_name (gnc_search_param_get_param_type (param));
+    if ((type == QUERYCORE_NUMERIC) ||
+	      (type == QUERYCORE_DEBCRED))
       sort_order = !sort_order;
   }
 
@@ -800,11 +800,11 @@
     {
       GNCSearchParam *param = node->data;
       GSList *converters = gnc_search_param_get_converters (param);
-      const char *type = gnc_search_param_get_param_type (param);
+      QofIdType type = g_type_from_name (gnc_search_param_get_param_type (param));
       gpointer res = item->data;
 
       /* if this is a boolean, ignore it now -- we'll use a checkmark later */
-      if (!safe_strcmp (type, QUERYCORE_BOOLEAN)) {
+      if ( type == QUERYCORE_BOOLEAN) {
         strings[i++] = g_strdup("");
         continue;
       }
@@ -820,8 +820,8 @@
       }
 
       /* Now convert this to a text value for the row */
-      if (!safe_strcmp(type, QUERYCORE_DEBCRED) ||
-          !safe_strcmp(type, QUERYCORE_NUMERIC))
+      if (type == QUERYCORE_DEBCRED ||
+          type == QUERYCORE_NUMERIC)
       {
         gnc_numeric (*nfcn)(gpointer, QofParam *) = 
                 (gnc_numeric(*)(gpointer, QofParam *))(qp->param_getfcn);

Modified: gnucash/branches/gobject-engine-dev/src/gnome-utils/search-param.c
===================================================================
--- gnucash/branches/gobject-engine-dev/src/gnome-utils/search-param.c	2007-03-15 07:30:19 UTC (rev 15725)
+++ gnucash/branches/gobject-engine-dev/src/gnome-utils/search-param.c	2007-03-15 21:33:03 UTC (rev 15726)
@@ -163,7 +163,7 @@
 				 GSList *param_path)
 {
   GNCSearchParamPrivate *priv;
-  GNCIdTypeConst type = NULL;
+  GNCIdTypeConst type = (gchar*) g_type_name (G_TYPE_INVALID);
   GSList *converters = NULL;
 
   g_return_if_fail (GNC_IS_SEARCH_PARAM (param));
@@ -178,7 +178,7 @@
   for (; param_path; param_path = param_path->next) {
     GNCIdType param_name = param_path->data;
     const QueryObjectDef *objDef =
-      gncQueryObjectGetParameter (search_type, param_name);
+      gncQueryObjectGetParameter (g_type_from_name (search_type), param_name);
 
     /* If it doesn't exist, then we've reached the end */
     if (objDef == NULL)
@@ -188,7 +188,7 @@
     converters = g_slist_prepend (converters, (gpointer) objDef);
 
     /* And reset for the next parameter */
-    type = search_type = objDef->param_type;
+    type = search_type = (gchar*) g_type_name (objDef->param_type);
   }
 
   /* Save the type */
@@ -208,7 +208,7 @@
   GNCSearchParamPrivate *priv;
 
   g_return_if_fail (GNC_IS_SEARCH_PARAM (param));
-  g_return_if_fail (param_type != NULL && *param_type != '\0');
+  g_return_if_fail (param_type != G_TYPE_INVALID);
 
   priv = GNC_SEARCH_PARAM_GET_PRIVATE(param);
   priv->type = param_type;
@@ -242,10 +242,10 @@
 {
   GNCSearchParamPrivate *priv;
 
-  g_return_val_if_fail (GNC_IS_SEARCH_PARAM (param), NULL);
+  g_return_val_if_fail (GNC_IS_SEARCH_PARAM (param), (gchar*) g_type_name (G_TYPE_INVALID));
 
   priv = GNC_SEARCH_PARAM_GET_PRIVATE(param);
-  return priv->type;
+  return (gchar*) priv->type;
 }
 
 void
@@ -291,7 +291,7 @@
   a_priv = GNC_SEARCH_PARAM_GET_PRIVATE(a);
   b_priv = GNC_SEARCH_PARAM_GET_PRIVATE(b);
   if (a_priv->type == b_priv->type || 
-      !safe_strcmp (a_priv->type, b_priv->type))
+      (a_priv->type == b_priv->type))
     return TRUE;
 
   return FALSE;
@@ -384,7 +384,7 @@
   GNCSearchParamPrivate *priv;
 
   g_return_if_fail (param);
-  g_return_if_fail (param_type && *param_type);
+  g_return_if_fail (param_type != G_TYPE_INVALID);
   g_return_if_fail (fcn);
   g_return_if_fail (GNC_IS_SEARCH_PARAM(param));
 



More information about the gnucash-changes mailing list