mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
convert GncCustomer to gobject initialization.
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/branches/gobject-engine-dev-warlord@15818 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
d93599d8f4
commit
292cf31279
@ -68,6 +68,11 @@ struct _gncCustomer
|
||||
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 @@ void mark_customer (GncCustomer *customer)
|
||||
}
|
||||
|
||||
/* ============================================================== */
|
||||
/* Create/Destroy Functions */
|
||||
|
||||
/* 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 @@ gncCloneCustomer (GncCustomer *from, QofBook *book)
|
||||
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 @@ static void gncCustomerFree (GncCustomer *cust)
|
||||
gncTaxTableDecRef (cust->taxtable);
|
||||
}
|
||||
|
||||
qof_instance_release (&cust->inst);
|
||||
g_free (cust);
|
||||
/* qof_instance_release (&cust->inst); */
|
||||
g_object_unref (cust);
|
||||
}
|
||||
|
||||
GncCustomer *
|
||||
|
@ -55,6 +55,7 @@ taxincluded, active and jobs are identical to ::GncVendor.
|
||||
|
||||
*/
|
||||
typedef struct _gncCustomer GncCustomer;
|
||||
typedef struct _gncCustomerClass GncCustomerClass;
|
||||
|
||||
#include "gncAddress.h"
|
||||
#include "gncBillTerm.h"
|
||||
@ -62,8 +63,20 @@ typedef struct _gncCustomer GncCustomer;
|
||||
#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
|
||||
@{ */
|
||||
|
Loading…
Reference in New Issue
Block a user