r15807 - gnucash/branches/gobject-engine-dev-warlord - Convert Split objects to GObject intiialization
Derek Atkins
warlord at cvs.gnucash.org
Wed Apr 4 20:23:51 EDT 2007
Author: warlord
Date: 2007-04-04 20:23:50 -0400 (Wed, 04 Apr 2007)
New Revision: 15807
Trac: http://svn.gnucash.org/trac/changeset/15807
Modified:
gnucash/branches/gobject-engine-dev-warlord/
gnucash/branches/gobject-engine-dev-warlord/src/engine/Split.c
gnucash/branches/gobject-engine-dev-warlord/src/engine/Split.h
gnucash/branches/gobject-engine-dev-warlord/src/engine/SplitP.h
Log:
Convert Split objects to GObject intiialization
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:14387
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:14388
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/Split.c
===================================================================
--- gnucash/branches/gobject-engine-dev-warlord/src/engine/Split.c 2007-04-05 00:23:42 UTC (rev 15806)
+++ gnucash/branches/gobject-engine-dev-warlord/src/engine/Split.c 2007-04-05 00:23:50 UTC (rev 15807)
@@ -55,6 +55,19 @@
/* This static indicates the debugging module that this .o belongs to. */
static QofLogModule log_module = GNC_MOD_ENGINE;
+/* GObject Initialization */
+QOF_GOBJECT_IMPL(gnc_split, Split, QOF_TYPE_INSTANCE);
+
+static void
+gnc_split_init(Split* acc)
+{
+}
+
+static void
+gnc_split_finalize_real(GObject* acctp)
+{
+}
+
/********************************************************************\
* xaccInitSplit
* Initialize a Split structure
@@ -87,7 +100,7 @@
split->gains = GAINS_STATUS_UNKNOWN;
split->gains_split = NULL;
- qof_instance_init(&split->inst, GNC_ID_SPLIT, book);
+ qof_instance_init_data(&split->inst, GNC_ID_SPLIT, book);
}
void
@@ -130,7 +143,7 @@
Split *split;
g_return_val_if_fail (book, NULL);
- split = g_new0 (Split, 1);
+ split = g_object_new (GNC_TYPE_SPLIT, NULL);
xaccInitSplit (split, book);
return split;
@@ -148,7 +161,7 @@
Split *
xaccDupeSplit (const Split *s)
{
- Split *split = g_new0 (Split, 1);
+ Split *split = g_object_new (GNC_TYPE_SPLIT, NULL);
/* Trash the entity table. We don't want to mistake the cloned
* splits as something official. If we ever use this split, we'll
@@ -187,7 +200,7 @@
Split *
xaccSplitClone (const Split *s)
{
- Split *split = g_new0 (Split, 1);
+ Split *split = g_object_new (GNC_TYPE_SPLIT, NULL);
split->parent = NULL;
split->memo = CACHE_INSERT(s->memo);
@@ -204,7 +217,7 @@
split->gains = GAINS_STATUS_UNKNOWN;
split->gains_split = NULL;
- qof_instance_init(&split->inst, GNC_ID_SPLIT, s->inst.book);
+ qof_instance_init_data(&split->inst, GNC_ID_SPLIT, s->inst.book);
kvp_frame_delete(split->inst.kvp_data);
split->inst.kvp_data = kvp_frame_copy(s->inst.kvp_data);
@@ -274,8 +287,8 @@
// Is this right?
if (split->gains_split) split->gains_split->gains_split = NULL;
- qof_instance_release(&split->inst);
- g_free(split);
+ /* qof_instance_release(&split->inst); */
+ g_object_unref(split);
}
static void mark_acc(Account *acc)
Modified: gnucash/branches/gobject-engine-dev-warlord/src/engine/Split.h
===================================================================
--- gnucash/branches/gobject-engine-dev-warlord/src/engine/Split.h 2007-04-05 00:23:42 UTC (rev 15806)
+++ gnucash/branches/gobject-engine-dev-warlord/src/engine/Split.h 2007-04-05 00:23:50 UTC (rev 15807)
@@ -34,11 +34,28 @@
#ifndef XACC_SPLIT_H
#define XACC_SPLIT_H
+typedef struct _SplitClass SplitClass;
+
#include <time.h>
#include "gnc-commodity.h"
#include "gnc-engine.h"
+/* --- type macros --- */
+#define GNC_TYPE_SPLIT (gnc_split_get_type ())
+#define GNC_SPLIT(o) \
+ (G_TYPE_CHECK_INSTANCE_CAST ((o), GNC_TYPE_SPLIT, Split))
+#define GNC_SPLIT_CLASS(k) \
+ (G_TYPE_CHECK_CLASS_CAST((k), GNC_TYPE_SPLIT, SplitClass))
+#define GNC_IS_SPLIT(o) \
+ (G_TYPE_CHECK_INSTANCE_TYPE ((o), GNC_TYPE_SPLIT))
+#define GNC_IS_SPLIT_CLASS(k) \
+ (G_TYPE_CHECK_CLASS_TYPE ((k), GNC_TYPE_SPLIT))
+#define GNC_SPLIT_GET_CLASS(o) \
+ (G_TYPE_INSTANCE_GET_CLASS ((o), GNC_TYPE_SPLIT, SplitClass))
+GType gnc_split_get_type(void);
+
+
/** @name Split Reconciled field values
If you change these
Modified: gnucash/branches/gobject-engine-dev-warlord/src/engine/SplitP.h
===================================================================
--- gnucash/branches/gobject-engine-dev-warlord/src/engine/SplitP.h 2007-04-05 00:23:42 UTC (rev 15806)
+++ gnucash/branches/gobject-engine-dev-warlord/src/engine/SplitP.h 2007-04-05 00:23:50 UTC (rev 15807)
@@ -131,7 +131,12 @@
guint32 idata; /* used by the sql backend for kvp management */
};
+struct _SplitClass
+{
+ QofInstanceClass parent_class;
+};
+
/* Set the split's GUID. This should only be done when reading
* a split from a datafile, or some other external source. Never
* call this on an existing split! */
More information about the gnucash-changes
mailing list