convert GncTaxTable to gobject initialization

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

View File

@ -48,6 +48,11 @@ struct _gncTaxTable
GList * children; /* list of children for disconnection */
};
struct _gncTaxTableClass
{
QofInstanceClass parent_class;
};
struct _gncTaxTableEntry
{
GncTaxTable * table;
@ -200,16 +205,28 @@ gncTaxTableRemoveChild (GncTaxTable *table, GncTaxTable *child)
}
/* =============================================================== */
/* Create/Destroy Functions */
/* GObject Initialization */
QOF_GOBJECT_IMPL(gnc_taxtable, GncTaxTable, QOF_TYPE_INSTANCE);
static void
gnc_taxtable_init(GncTaxTable* tt)
{
}
static void
gnc_taxtable_finalize_real(GObject* ttp)
{
}
/* Create/Destroy Functions */
GncTaxTable *
gncTaxTableCreate (QofBook *book)
{
GncTaxTable *table;
if (!book) return NULL;
table = g_new0 (GncTaxTable, 1);
qof_instance_init (&table->inst, _GNC_MOD_NAME, book);
table = g_object_new (GNC_TYPE_TAXTABLE, NULL);
qof_instance_init_data (&table->inst, _GNC_MOD_NAME, book);
table->name = CACHE_INSERT ("");
addObj (table);
qof_event_gen (&table->inst, QOF_EVENT_CREATE, NULL);
@ -224,8 +241,8 @@ gncCloneTaxTable (GncTaxTable *from, QofBook *book)
GncTaxTable *table;
if (!book) return NULL;
table = g_new0 (GncTaxTable, 1);
qof_instance_init (&table->inst, _GNC_MOD_NAME, book);
table = g_object_new (GNC_TYPE_TAXTABLE, NULL);
qof_instance_init_data (&table->inst, _GNC_MOD_NAME, book);
qof_instance_gemini (&table->inst, &from->inst);
table->name = CACHE_INSERT (from->name);
@ -323,8 +340,8 @@ gncTaxTableFree (GncTaxTable *table)
}
g_list_free(table->children);
qof_instance_release (&table->inst);
g_free (table);
/* qof_instance_release (&table->inst); */
g_object_unref (table);
}
/* =============================================================== */

View File

@ -49,6 +49,7 @@ is *identical* to that in ::GncBillTerm
@param GList * children; list of children for disconnection
*/
typedef struct _gncTaxTable GncTaxTable;
typedef struct _gncTaxTableClass GncTaxTableClass;
/** @struct GncTaxTableEntry
@ -70,8 +71,20 @@ typedef struct _gncAccountValue GncAccountValue;
#endif
#define GNC_ID_TAXTABLE "gncTaxTable"
#define GNC_IS_TAXTABLE(obj) (QOF_CHECK_TYPE((obj), GNC_ID_TAXTABLE))
#define GNC_TAXTABLE(obj) (QOF_CHECK_CAST((obj), GNC_ID_TAXTABLE, GncTaxTable))
/* --- type macros --- */
#define GNC_TYPE_TAXTABLE (gnc_taxtable_get_type ())
#define GNC_TAXTABLE(o) \
(G_TYPE_CHECK_INSTANCE_CAST ((o), GNC_TYPE_TAXTABLE, GncTaxTable))
#define GNC_TAXTABLE_CLASS(k) \
(G_TYPE_CHECK_CLASS_CAST((k), GNC_TYPE_TAXTABLE, GncTaxTableClass))
#define GNC_IS_TAXTABLE(o) \
(G_TYPE_CHECK_INSTANCE_TYPE ((o), GNC_TYPE_TAXTABLE))
#define GNC_IS_TAXTABLE_CLASS(k) \
(G_TYPE_CHECK_CLASS_TYPE ((k), GNC_TYPE_TAXTABLE))
#define GNC_TAXTABLE_GET_CLASS(o) \
(G_TYPE_INSTANCE_GET_CLASS ((o), GNC_TYPE_TAXTABLE, GncTaxTableClass))
GType gnc_taxtable_get_type(void);
/**
* How to interpret the amount.