Convert GncInvoice to gobject initialization.

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/branches/gobject-engine-dev-warlord@15821 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Derek Atkins 2007-04-05 02:44:01 +00:00
parent 4c1ba72597
commit 7f007696f9
2 changed files with 39 additions and 9 deletions

View File

@ -69,6 +69,11 @@ struct _gncInvoice
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 @@ QofBook * gncInvoiceGetBook(GncInvoice *x)
}
/* ================================================================== */
/* Create/Destroy Functions */
/* 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 @@ static void gncInvoiceFree (GncInvoice *invoice)
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 @@ gncCloneInvoice (GncInvoice *from, QofBook *book)
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);

View File

@ -38,6 +38,7 @@ transaction and lot for the posted invoice.
struct _gncInvoice;
typedef struct _gncInvoice GncInvoice;
typedef struct _gncInvoiceClass GncInvoiceClass;
#include "gncBillTerm.h"
#include "gncEntry.h"
@ -46,8 +47,20 @@ typedef struct _gncInvoice GncInvoice;
#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
@{ */