r15811 - gnucash/branches/gobject-engine-dev-warlord - convert gnc-lot object to GObject initialization

Derek Atkins warlord at cvs.gnucash.org
Wed Apr 4 20:24:29 EDT 2007


Author: warlord
Date: 2007-04-04 20:24:28 -0400 (Wed, 04 Apr 2007)
New Revision: 15811
Trac: http://svn.gnucash.org/trac/changeset/15811

Modified:
   gnucash/branches/gobject-engine-dev-warlord/
   gnucash/branches/gobject-engine-dev-warlord/src/engine/gnc-lot-p.h
   gnucash/branches/gobject-engine-dev-warlord/src/engine/gnc-lot.c
   gnucash/branches/gobject-engine-dev-warlord/src/engine/gnc-lot.h
Log:
convert gnc-lot object 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:14391
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:14392
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/engine/gnc-lot-p.h
===================================================================
--- gnucash/branches/gobject-engine-dev-warlord/src/engine/gnc-lot-p.h	2007-04-05 00:24:18 UTC (rev 15810)
+++ gnucash/branches/gobject-engine-dev-warlord/src/engine/gnc-lot-p.h	2007-04-05 00:24:28 UTC (rev 15811)
@@ -60,6 +60,11 @@
   unsigned char marker;
 };
 
+struct _GncLotClass
+{
+  QofInstanceClass parent_class;
+};
+
 #define gnc_lot_set_guid(L,G)  qof_instance_set_guid(QOF_INSTANCE(L),&(G))
 
 /* Register with the Query engine */

Modified: gnucash/branches/gobject-engine-dev-warlord/src/engine/gnc-lot.c
===================================================================
--- gnucash/branches/gobject-engine-dev-warlord/src/engine/gnc-lot.c	2007-04-05 00:24:18 UTC (rev 15810)
+++ gnucash/branches/gobject-engine-dev-warlord/src/engine/gnc-lot.c	2007-04-05 00:24:28 UTC (rev 15811)
@@ -52,16 +52,29 @@
 
 /* ============================================================= */
 
+/* GObject Initialization */
+QOF_GOBJECT_IMPL(gnc_lot, GNCLot, QOF_TYPE_INSTANCE);
+
 static void
-gnc_lot_init (GNCLot *lot, QofBook *book)
+gnc_lot_init(GNCLot* lot)
 {
+}
+
+static void
+gnc_lot_finalize_real(GObject* lotp)
+{
+}
+
+static void
+gnc_lot_init_data (GNCLot *lot, QofBook *book)
+{
    ENTER ("(lot=%p, book=%p)", lot, book);
    lot->account = NULL;
    lot->splits = NULL;
    lot->is_closed = -1;
    lot->marker = 0;
   
-   qof_instance_init(&lot->inst, GNC_ID_LOT, book);
+   qof_instance_init_data(&lot->inst, GNC_ID_LOT, book);
    LEAVE ("(lot=%p, book=%p)", lot, book);
 }
 
@@ -71,8 +84,8 @@
    GNCLot *lot;
    g_return_val_if_fail (book, NULL);
 
-   lot = g_new (GNCLot, 1);
-   gnc_lot_init (lot, book);
+   lot = g_object_new (GNC_TYPE_LOT, NULL);
+   gnc_lot_init_data (lot, book);
    qof_event_gen (&lot->inst, QOF_EVENT_CREATE, NULL);
    return lot;
 }
@@ -96,8 +109,8 @@
    
    lot->account = NULL;
    lot->is_closed = TRUE;
-   qof_instance_release (&lot->inst);
-   g_free (lot);
+   /* qof_instance_release (&lot->inst); */
+   g_object_unref (lot);
 }
 
 /* ============================================================= */

Modified: gnucash/branches/gobject-engine-dev-warlord/src/engine/gnc-lot.h
===================================================================
--- gnucash/branches/gobject-engine-dev-warlord/src/engine/gnc-lot.h	2007-04-05 00:24:18 UTC (rev 15810)
+++ gnucash/branches/gobject-engine-dev-warlord/src/engine/gnc-lot.h	2007-04-05 00:24:28 UTC (rev 15811)
@@ -59,9 +59,26 @@
 #ifndef GNC_LOT_H
 #define GNC_LOT_H
 
+typedef struct _GncLotClass GNCLotClass;
+
 #include "qof.h"
 #include "gnc-lot-p.h"
 
+/* --- type macros --- */
+#define GNC_TYPE_LOT            (gnc_lot_get_type ())
+#define GNC_LOT(o)              \
+     (G_TYPE_CHECK_INSTANCE_CAST ((o), GNC_TYPE_LOT, GNCLot))
+#define GNC_LOT_CLASS(k)        \
+     (G_TYPE_CHECK_CLASS_CAST((k), GNC_TYPE_LOT, GNCLotClass))
+#define GNC_IS_LOT(o)           \
+     (G_TYPE_CHECK_INSTANCE_TYPE ((o), GNC_TYPE_LOT))
+#define GNC_IS_LOT_CLASS(k)     \
+     (G_TYPE_CHECK_CLASS_TYPE ((k), GNC_TYPE_LOT))
+#define GNC_LOT_GET_CLASS(o)    \
+     (G_TYPE_INSTANCE_GET_CLASS ((o), GNC_TYPE_LOT, GNCLotClass))
+GType gnc_lot_get_type(void);
+
+
 GNCLot * gnc_lot_new (QofBook *);
 void gnc_lot_destroy (GNCLot *);
 



More information about the gnucash-changes mailing list