r15824 - gnucash/branches/gobject-engine-dev-warlord - convert GncTaxTable to gobject initialization

Derek Atkins warlord at cvs.gnucash.org
Wed Apr 4 22:44:26 EDT 2007


Author: warlord
Date: 2007-04-04 22:44:25 -0400 (Wed, 04 Apr 2007)
New Revision: 15824
Trac: http://svn.gnucash.org/trac/changeset/15824

Modified:
   gnucash/branches/gobject-engine-dev-warlord/
   gnucash/branches/gobject-engine-dev-warlord/src/business/business-core/gncTaxTable.c
   gnucash/branches/gobject-engine-dev-warlord/src/business/business-core/gncTaxTable.h
Log:
convert GncTaxTable 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:14428
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:14429
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/gncTaxTable.c
===================================================================
--- gnucash/branches/gobject-engine-dev-warlord/src/business/business-core/gncTaxTable.c	2007-04-05 02:44:17 UTC (rev 15823)
+++ gnucash/branches/gobject-engine-dev-warlord/src/business/business-core/gncTaxTable.c	2007-04-05 02:44:25 UTC (rev 15824)
@@ -48,6 +48,11 @@
   GList *         children;     /* list of children for disconnection */
 };
 
+struct _gncTaxTableClass
+{
+  QofInstanceClass parent_class;
+};
+
 struct _gncTaxTableEntry 
 {
   GncTaxTable *   table;
@@ -200,16 +205,28 @@
 }
 
 /* =============================================================== */
+/* 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 @@
   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 @@
   }
   g_list_free(table->children);
 
-  qof_instance_release (&table->inst);
-  g_free (table);
+  /* qof_instance_release (&table->inst); */
+  g_object_unref (table);
 }
 
 /* =============================================================== */

Modified: gnucash/branches/gobject-engine-dev-warlord/src/business/business-core/gncTaxTable.h
===================================================================
--- gnucash/branches/gobject-engine-dev-warlord/src/business/business-core/gncTaxTable.h	2007-04-05 02:44:17 UTC (rev 15823)
+++ gnucash/branches/gobject-engine-dev-warlord/src/business/business-core/gncTaxTable.h	2007-04-05 02:44:25 UTC (rev 15824)
@@ -49,6 +49,7 @@
 @param 	GList *         children; list of children for disconnection 
 */
 typedef struct _gncTaxTable GncTaxTable;
+typedef struct _gncTaxTableClass GncTaxTableClass;
 
 /** @struct GncTaxTableEntry
 
@@ -70,9 +71,21 @@
 #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.
  * You can interpret it as a VALUE or a PERCENT.



More information about the gnucash-changes mailing list