r15821 - gnucash/branches/gobject-engine-dev-warlord - Convert GncInvoice to gobject initialization.
Derek Atkins
warlord at cvs.gnucash.org
Wed Apr 4 22:44:02 EDT 2007
Author: warlord
Date: 2007-04-04 22:44:01 -0400 (Wed, 04 Apr 2007)
New Revision: 15821
Trac: http://svn.gnucash.org/trac/changeset/15821
Modified:
gnucash/branches/gobject-engine-dev-warlord/
gnucash/branches/gobject-engine-dev-warlord/src/business/business-core/gncInvoice.c
gnucash/branches/gobject-engine-dev-warlord/src/business/business-core/gncInvoice.h
Log:
Convert GncInvoice 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:14425
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:14426
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/gncInvoice.c
===================================================================
--- gnucash/branches/gobject-engine-dev-warlord/src/business/business-core/gncInvoice.c 2007-04-05 02:43:45 UTC (rev 15820)
+++ gnucash/branches/gobject-engine-dev-warlord/src/business/business-core/gncInvoice.c 2007-04-05 02:44:01 UTC (rev 15821)
@@ -69,6 +69,11 @@
GNCLot *posted_lot;
};
+struct _gncInvoiceClass
+{
+ QofInstanceClass parent_class;
+};
+
static QofLogModule log_module = GNC_MOD_BUSINESS;
#define _GNC_MOD_NAME GNC_ID_INVOICE
@@ -100,16 +105,28 @@
}
/* ================================================================== */
+/* GObject Initialization */
+QOF_GOBJECT_IMPL(gnc_invoice, GncInvoice, QOF_TYPE_INSTANCE);
+
+static void
+gnc_invoice_init(GncInvoice* inv)
+{
+}
+
+static void
+gnc_invoice_finalize_real(GObject* invp)
+{
+}
+
/* Create/Destroy Functions */
-
GncInvoice *gncInvoiceCreate (QofBook *book)
{
GncInvoice *invoice;
if (!book) return NULL;
- invoice = g_new0 (GncInvoice, 1);
- qof_instance_init (&invoice->inst, _GNC_MOD_NAME, book);
+ invoice = g_object_new (GNC_TYPE_INVOICE, NULL);
+ qof_instance_init_data (&invoice->inst, _GNC_MOD_NAME, book);
invoice->id = CACHE_INSERT ("");
invoice->notes = CACHE_INSERT ("");
@@ -148,8 +165,8 @@
if (invoice->terms)
gncBillTermDecRef (invoice->terms);
- qof_instance_release (&invoice->inst);
- g_free (invoice);
+ /* qof_instance_release (&invoice->inst); */
+ g_object_unref (invoice);
}
GncInvoice *
@@ -160,8 +177,8 @@
if (!book) return NULL;
- invoice = g_new0 (GncInvoice, 1);
- qof_instance_init (&invoice->inst, _GNC_MOD_NAME, book);
+ invoice = g_object_new (GNC_TYPE_INVOICE, NULL);
+ qof_instance_init_data (&invoice->inst, _GNC_MOD_NAME, book);
invoice->id = CACHE_INSERT (from->id);
invoice->notes = CACHE_INSERT (from->notes);
Modified: gnucash/branches/gobject-engine-dev-warlord/src/business/business-core/gncInvoice.h
===================================================================
--- gnucash/branches/gobject-engine-dev-warlord/src/business/business-core/gncInvoice.h 2007-04-05 02:43:45 UTC (rev 15820)
+++ gnucash/branches/gobject-engine-dev-warlord/src/business/business-core/gncInvoice.h 2007-04-05 02:44:01 UTC (rev 15821)
@@ -38,6 +38,7 @@
struct _gncInvoice;
typedef struct _gncInvoice GncInvoice;
+typedef struct _gncInvoiceClass GncInvoiceClass;
#include "gncBillTerm.h"
#include "gncEntry.h"
@@ -46,9 +47,21 @@
#include "qofbook.h"
#define GNC_ID_INVOICE "gncInvoice"
-#define GNC_IS_INVOICE(obj) (QOF_CHECK_TYPE((obj), GNC_ID_INVOICE))
-#define GNC_INVOICE(obj) (QOF_CHECK_CAST((obj), GNC_ID_INVOICE, GncInvoice))
+/* --- type macros --- */
+#define GNC_TYPE_INVOICE (gnc_invoice_get_type ())
+#define GNC_INVOICE(o) \
+ (G_TYPE_CHECK_INSTANCE_CAST ((o), GNC_TYPE_INVOICE, GncInvoice))
+#define GNC_INVOICE_CLASS(k) \
+ (G_TYPE_CHECK_CLASS_CAST((k), GNC_TYPE_INVOICE, GncInvoiceClass))
+#define GNC_IS_INVOICE(o) \
+ (G_TYPE_CHECK_INSTANCE_TYPE ((o), GNC_TYPE_INVOICE))
+#define GNC_IS_INVOICE_CLASS(k) \
+ (G_TYPE_CHECK_CLASS_TYPE ((k), GNC_TYPE_INVOICE))
+#define GNC_INVOICE_GET_CLASS(o) \
+ (G_TYPE_INSTANCE_GET_CLASS ((o), GNC_TYPE_INVOICE, GncInvoiceClass))
+GType gnc_invoice_get_type(void);
+
/** @name Create/Destroy Functions
@{ */
GncInvoice *gncInvoiceCreate (QofBook *book);
More information about the gnucash-changes
mailing list