r15822 - gnucash/branches/gobject-engine-dev-warlord - convert GncJob to gobject initialization
Derek Atkins
warlord at cvs.gnucash.org
Wed Apr 4 22:44:09 EDT 2007
Author: warlord
Date: 2007-04-04 22:44:08 -0400 (Wed, 04 Apr 2007)
New Revision: 15822
Trac: http://svn.gnucash.org/trac/changeset/15822
Modified:
gnucash/branches/gobject-engine-dev-warlord/
gnucash/branches/gobject-engine-dev-warlord/src/business/business-core/gncJob.c
gnucash/branches/gobject-engine-dev-warlord/src/business/business-core/gncJob.h
Log:
convert GncJob 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:14426
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:14427
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/gncJob.c
===================================================================
--- gnucash/branches/gobject-engine-dev-warlord/src/business/business-core/gncJob.c 2007-04-05 02:44:01 UTC (rev 15821)
+++ gnucash/branches/gobject-engine-dev-warlord/src/business/business-core/gncJob.c 2007-04-05 02:44:08 UTC (rev 15822)
@@ -46,6 +46,11 @@
gboolean active;
};
+struct _gncJobClass
+{
+ QofInstanceClass parent_class;
+};
+
static QofLogModule log_module = GNC_MOD_BUSINESS;
#define _GNC_MOD_NAME GNC_ID_JOB
@@ -61,16 +66,28 @@
}
/* ================================================================== */
+/* GObject Initialization */
+QOF_GOBJECT_IMPL(gnc_job, GncJob, QOF_TYPE_INSTANCE);
+
+static void
+gnc_job_init(GncJob* job)
+{
+}
+
+static void
+gnc_job_finalize_real(GObject* jobp)
+{
+}
+
/* Create/Destroy Functions */
-
GncJob *gncJobCreate (QofBook *book)
{
GncJob *job;
if (!book) return NULL;
- job = g_new0 (GncJob, 1);
- qof_instance_init (&job->inst, _GNC_MOD_NAME, book);
+ job = g_object_new (GNC_TYPE_JOB, NULL);
+ qof_instance_init_data (&job->inst, _GNC_MOD_NAME, book);
job->id = CACHE_INSERT ("");
job->name = CACHE_INSERT ("");
@@ -90,8 +107,8 @@
if (!book) return NULL;
- job = g_new0 (GncJob, 1);
- qof_instance_init (&job->inst, _GNC_MOD_NAME, book);
+ job = g_object_new (GNC_TYPE_JOB, NULL);
+ qof_instance_init_data (&job->inst, _GNC_MOD_NAME, book);
qof_instance_gemini (&job->inst, &from->inst);
job->id = CACHE_INSERT (from->id);
@@ -134,8 +151,8 @@
break;
}
- qof_instance_release (&job->inst);
- g_free (job);
+ /* qof_instance_release (&job->inst); */
+ g_object_unref (job);
}
GncJob *
Modified: gnucash/branches/gobject-engine-dev-warlord/src/business/business-core/gncJob.h
===================================================================
--- gnucash/branches/gobject-engine-dev-warlord/src/business/business-core/gncJob.h 2007-04-05 02:44:01 UTC (rev 15821)
+++ gnucash/branches/gobject-engine-dev-warlord/src/business/business-core/gncJob.h 2007-04-05 02:44:08 UTC (rev 15822)
@@ -32,14 +32,27 @@
#define GNC_JOB_H_
typedef struct _gncJob GncJob;
+typedef struct _gncJobClass GncJobClass;
#include "gncAddress.h"
#include "gncOwner.h"
#define GNC_ID_JOB "gncJob"
-#define GNC_IS_JOB(obj) (QOF_CHECK_TYPE((obj), GNC_ID_JOB))
-#define GNC_JOB(obj) (QOF_CHECK_CAST((obj), GNC_ID_JOB, GncJob))
+/* --- type macros --- */
+#define GNC_TYPE_JOB (gnc_job_get_type ())
+#define GNC_JOB(o) \
+ (G_TYPE_CHECK_INSTANCE_CAST ((o), GNC_TYPE_JOB, GncJob))
+#define GNC_JOB_CLASS(k) \
+ (G_TYPE_CHECK_CLASS_CAST((k), GNC_TYPE_JOB, GncJobClass))
+#define GNC_IS_JOB(o) \
+ (G_TYPE_CHECK_INSTANCE_TYPE ((o), GNC_TYPE_JOB))
+#define GNC_IS_JOB_CLASS(k) \
+ (G_TYPE_CHECK_CLASS_TYPE ((k), GNC_TYPE_JOB))
+#define GNC_JOB_GET_CLASS(o) \
+ (G_TYPE_INSTANCE_GET_CLASS ((o), GNC_TYPE_JOB, GncJobClass))
+GType gnc_job_get_type(void);
+
/* Create/Destroy Functions */
GncJob *gncJobCreate (QofBook *book);
More information about the gnucash-changes
mailing list