r15817 - gnucash/branches/gobject-engine-dev-warlord - convert billterm to gobject initialization.

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


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

Modified:
   gnucash/branches/gobject-engine-dev-warlord/
   gnucash/branches/gobject-engine-dev-warlord/src/business/business-core/gncAddress.c
   gnucash/branches/gobject-engine-dev-warlord/src/business/business-core/gncBillTerm.c
   gnucash/branches/gobject-engine-dev-warlord/src/business/business-core/gncBillTerm.h
Log:
convert billterm 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:14421
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:14422
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/gncAddress.c
===================================================================
--- gnucash/branches/gobject-engine-dev-warlord/src/business/business-core/gncAddress.c	2007-04-05 02:43:18 UTC (rev 15816)
+++ gnucash/branches/gobject-engine-dev-warlord/src/business/business-core/gncAddress.c	2007-04-05 02:43:26 UTC (rev 15817)
@@ -137,6 +137,7 @@
   if (!book) return NULL;
 
   addr = g_object_new (GNC_TYPE_ADDRESS, NULL);
+  qof_instance_init_data(&addr->inst, GNC_ID_ADDRESS, book);
   addr->book = book;
   addr->dirty = TRUE;
   addr->parent = new_parent;

Modified: gnucash/branches/gobject-engine-dev-warlord/src/business/business-core/gncBillTerm.c
===================================================================
--- gnucash/branches/gobject-engine-dev-warlord/src/business/business-core/gncBillTerm.c	2007-04-05 02:43:18 UTC (rev 15816)
+++ gnucash/branches/gobject-engine-dev-warlord/src/business/business-core/gncBillTerm.c	2007-04-05 02:43:26 UTC (rev 15817)
@@ -56,6 +56,11 @@
   GList *         children;    /* list of children for disconnection */
 };
 
+struct _gncBillTermClass
+{
+  QofInstanceClass parent_class;
+};
+
 struct _book_info 
 {
   GList *         terms;        /* visible terms */
@@ -128,14 +133,27 @@
 
 /* ============================================================== */
 
+/* GObject Initialization */
+QOF_GOBJECT_IMPL(gnc_billterm, GncBillTerm, QOF_TYPE_INSTANCE);
+
+static void
+gnc_billterm_init(GncBillTerm* bt)
+{
+}
+
+static void
+gnc_billterm_finalize_real(GObject* btp)
+{
+}
+
 /* Create/Destroy Functions */
 GncBillTerm * gncBillTermCreate (QofBook *book)
 {
   GncBillTerm *term;
   if (!book) return NULL;
 
-  term = g_new0 (GncBillTerm, 1);
-  qof_instance_init(&term->inst, _GNC_MOD_NAME, book);
+  term = g_object_new (GNC_TYPE_BILLTERM, NULL);
+  qof_instance_init_data(&term->inst, _GNC_MOD_NAME, book);
   term->name = CACHE_INSERT ("");
   term->desc = CACHE_INSERT ("");
   term->discount = gnc_numeric_zero ();
@@ -180,8 +198,8 @@
   }
   g_list_free(term->children);
 
-  qof_instance_release(&term->inst);
-  g_free (term);
+  /* qof_instance_release(&term->inst); */
+  g_object_unref (term);
 }
 
 GncBillTerm *
@@ -192,8 +210,8 @@
 
   if (!book || !from) return NULL;
 
-  term = g_new0 (GncBillTerm, 1);
-  qof_instance_init(&term->inst, _GNC_MOD_NAME, book);
+  term = g_object_new (GNC_TYPE_BILLTERM, NULL);
+  qof_instance_init_data(&term->inst, _GNC_MOD_NAME, book);
   qof_instance_gemini (&term->inst, &from->inst);
 
   term->name = CACHE_INSERT (from->name);

Modified: gnucash/branches/gobject-engine-dev-warlord/src/business/business-core/gncBillTerm.h
===================================================================
--- gnucash/branches/gobject-engine-dev-warlord/src/business/business-core/gncBillTerm.h	2007-04-05 02:43:18 UTC (rev 15816)
+++ gnucash/branches/gobject-engine-dev-warlord/src/business/business-core/gncBillTerm.h	2007-04-05 02:43:26 UTC (rev 15817)
@@ -32,15 +32,28 @@
 #define GNC_BILLTERM_H_
 
 typedef struct _gncBillTerm GncBillTerm;
+typedef struct _gncBillTermClass GncBillTermClass;
 
 #include "qof.h"
 #ifdef GNUCASH_MAJOR_VERSION
 #include "gncBusiness.h"
 #endif
 #define GNC_ID_BILLTERM       "gncBillTerm"
-#define GNC_IS_BILLTERM(obj)  (QOF_CHECK_TYPE((obj), GNC_ID_BILLTERM))
-#define GNC_BILLTERM(obj)     (QOF_CHECK_CAST((obj), GNC_ID_BILLTERM, GncBillTerm))
 
+/* --- type macros --- */
+#define GNC_TYPE_BILLTERM            (gnc_billterm_get_type ())
+#define GNC_BILLTERM(o)              \
+     (G_TYPE_CHECK_INSTANCE_CAST ((o), GNC_TYPE_BILLTERM, GncBillTerm))
+#define GNC_BILLTERM_CLASS(k)        \
+     (G_TYPE_CHECK_CLASS_CAST((k), GNC_TYPE_BILLTERM, GncBillTermClass))
+#define GNC_IS_BILLTERM(o)           \
+     (G_TYPE_CHECK_INSTANCE_TYPE ((o), GNC_TYPE_BILLTERM))
+#define GNC_IS_BILLTERM_CLASS(k)     \
+     (G_TYPE_CHECK_CLASS_TYPE ((k), GNC_TYPE_BILLTERM))
+#define GNC_BILLTERM_GET_CLASS(o)    \
+     (G_TYPE_INSTANCE_GET_CLASS ((o), GNC_TYPE_BILLTERM, GncBillTermClass))
+GType gnc_billterm_get_type(void);
+
 /** @name BillTerm parameter names
  @{ */
 #define GNC_BILLTERM_NAME 		"name"



More information about the gnucash-changes mailing list