r15818 - gnucash/branches/gobject-engine-dev-warlord - convert GncCustomer to gobject initialization.
Derek Atkins
warlord at cvs.gnucash.org
Wed Apr 4 22:43:32 EDT 2007
Author: warlord
Date: 2007-04-04 22:43:31 -0400 (Wed, 04 Apr 2007)
New Revision: 15818
Trac: http://svn.gnucash.org/trac/changeset/15818
Modified:
gnucash/branches/gobject-engine-dev-warlord/
gnucash/branches/gobject-engine-dev-warlord/src/business/business-core/gncCustomer.c
gnucash/branches/gobject-engine-dev-warlord/src/business/business-core/gncCustomer.h
Log:
convert GncCustomer to gobject initialization.
Property changes on: gnucash/branches/gobject-engine-dev-warlord
___________________________________________________________________
Name: svk:merge
- 3889ce50-311e-0410-a464-f059747ec5d1:/local/gnucash/branches/swig-redo:802
3889ce50-311e-0410-a464-f059747ec5d1:/local/gnucash/trunk:1037
d2ab10a8-8a95-4986-baff-8d511d9f15b2:/local/gnucash/branches/gobject-engine-dev-warlord:14369
d2ab10a8-8a95-4986-baff-8d511d9f15b2:/local/gnucash/branches/gobject-engine-dev-warlord1:14422
d2ab10a8-8a95-4986-baff-8d511d9f15b2:/local/gnucash/trunk:14282
d2ab10a8-8a95-4986-baff-8d511d9f15b2:/local/gnucash/trunk2:13366
+ 3889ce50-311e-0410-a464-f059747ec5d1:/local/gnucash/branches/swig-redo:802
3889ce50-311e-0410-a464-f059747ec5d1:/local/gnucash/trunk:1037
d2ab10a8-8a95-4986-baff-8d511d9f15b2:/local/gnucash/branches/gobject-engine-dev-warlord:14369
d2ab10a8-8a95-4986-baff-8d511d9f15b2:/local/gnucash/branches/gobject-engine-dev-warlord1:14423
d2ab10a8-8a95-4986-baff-8d511d9f15b2:/local/gnucash/trunk:14282
d2ab10a8-8a95-4986-baff-8d511d9f15b2:/local/gnucash/trunk2:13366
Modified: gnucash/branches/gobject-engine-dev-warlord/src/business/business-core/gncCustomer.c
===================================================================
--- gnucash/branches/gobject-engine-dev-warlord/src/business/business-core/gncCustomer.c 2007-04-05 02:43:26 UTC (rev 15817)
+++ gnucash/branches/gobject-engine-dev-warlord/src/business/business-core/gncCustomer.c 2007-04-05 02:43:31 UTC (rev 15818)
@@ -68,6 +68,11 @@
GncAddress * shipaddr;
};
+struct _gncCustomerClass
+{
+ QofInstanceClass parent_class;
+};
+
static QofLogModule log_module = GNC_MOD_BUSINESS;
#define _GNC_MOD_NAME GNC_ID_CUSTOMER
@@ -83,16 +88,29 @@
}
/* ============================================================== */
+
+/* GObject Initialization */
+QOF_GOBJECT_IMPL(gnc_customer, GncCustomer, QOF_TYPE_INSTANCE);
+
+static void
+gnc_customer_init(GncCustomer* cust)
+{
+}
+
+static void
+gnc_customer_finalize_real(GObject* custp)
+{
+}
+
/* Create/Destroy Functions */
-
GncCustomer *gncCustomerCreate (QofBook *book)
{
GncCustomer *cust;
if (!book) return NULL;
- cust = g_new0 (GncCustomer, 1);
- qof_instance_init (&cust->inst, _GNC_MOD_NAME, book);
+ cust = g_object_new (GNC_TYPE_CUSTOMER, NULL);
+ qof_instance_init_data (&cust->inst, _GNC_MOD_NAME, book);
cust->id = CACHE_INSERT ("");
cust->name = CACHE_INSERT ("");
@@ -118,9 +136,9 @@
GList *node;
GncCustomer *cust;
- cust = g_new0 (GncCustomer, 1);
+ cust = g_object_new (GNC_TYPE_CUSTOMER, NULL);
- qof_instance_init (&cust->inst, _GNC_MOD_NAME, book);
+ qof_instance_init_data (&cust->inst, _GNC_MOD_NAME, book);
qof_instance_gemini (&cust->inst, &from->inst);
cust->id = CACHE_INSERT (from->id);
@@ -182,8 +200,8 @@
gncTaxTableDecRef (cust->taxtable);
}
- qof_instance_release (&cust->inst);
- g_free (cust);
+ /* qof_instance_release (&cust->inst); */
+ g_object_unref (cust);
}
GncCustomer *
Modified: gnucash/branches/gobject-engine-dev-warlord/src/business/business-core/gncCustomer.h
===================================================================
--- gnucash/branches/gobject-engine-dev-warlord/src/business/business-core/gncCustomer.h 2007-04-05 02:43:26 UTC (rev 15817)
+++ gnucash/branches/gobject-engine-dev-warlord/src/business/business-core/gncCustomer.h 2007-04-05 02:43:31 UTC (rev 15818)
@@ -55,6 +55,7 @@
*/
typedef struct _gncCustomer GncCustomer;
+typedef struct _gncCustomerClass GncCustomerClass;
#include "gncAddress.h"
#include "gncBillTerm.h"
@@ -62,9 +63,21 @@
#include "gncJob.h"
#define GNC_ID_CUSTOMER "gncCustomer"
-#define GNC_IS_CUSTOMER(obj) (QOF_CHECK_TYPE((obj), GNC_ID_CUSTOMER))
-#define GNC_CUSTOMER(obj) (QOF_CHECK_CAST((obj), GNC_ID_CUSTOMER, GncCustomer))
+/* --- type macros --- */
+#define GNC_TYPE_CUSTOMER (gnc_customer_get_type ())
+#define GNC_CUSTOMER(o) \
+ (G_TYPE_CHECK_INSTANCE_CAST ((o), GNC_TYPE_CUSTOMER, GncCustomer))
+#define GNC_CUSTOMER_CLASS(k) \
+ (G_TYPE_CHECK_CLASS_CAST((k), GNC_TYPE_CUSTOMER, GncCustomerClass))
+#define GNC_IS_CUSTOMER(o) \
+ (G_TYPE_CHECK_INSTANCE_TYPE ((o), GNC_TYPE_CUSTOMER))
+#define GNC_IS_CUSTOMER_CLASS(k) \
+ (G_TYPE_CHECK_CLASS_TYPE ((k), GNC_TYPE_CUSTOMER))
+#define GNC_CUSTOMER_GET_CLASS(o) \
+ (G_TYPE_INSTANCE_GET_CLASS ((o), GNC_TYPE_CUSTOMER, GncCustomerClass))
+GType gnc_customer_get_type(void);
+
/** @name Create/Destroy Functions
@{ */
GncCustomer *gncCustomerCreate (QofBook *book);
More information about the gnucash-changes
mailing list