r15819 - gnucash/branches/gobject-engine-dev-warlord - convert GncEmployee to GObject initialzation.
Derek Atkins
warlord at cvs.gnucash.org
Wed Apr 4 22:43:39 EDT 2007
Author: warlord
Date: 2007-04-04 22:43:38 -0400 (Wed, 04 Apr 2007)
New Revision: 15819
Trac: http://svn.gnucash.org/trac/changeset/15819
Modified:
gnucash/branches/gobject-engine-dev-warlord/
gnucash/branches/gobject-engine-dev-warlord/src/business/business-core/gncEmployee.c
gnucash/branches/gobject-engine-dev-warlord/src/business/business-core/gncEmployee.h
Log:
convert GncEmployee to GObject initialzation.
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:14423
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:14424
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/gncEmployee.c
===================================================================
--- gnucash/branches/gobject-engine-dev-warlord/src/business/business-core/gncEmployee.c 2007-04-05 02:43:31 UTC (rev 15818)
+++ gnucash/branches/gobject-engine-dev-warlord/src/business/business-core/gncEmployee.c 2007-04-05 02:43:38 UTC (rev 15819)
@@ -54,6 +54,11 @@
Account * ccard_acc;
};
+struct _gncEmployeeClass
+{
+ QofInstanceClass parent_class;
+};
+
static QofLogModule log_module = GNC_MOD_BUSINESS;
#define _GNC_MOD_NAME GNC_ID_EMPLOYEE
@@ -66,16 +71,28 @@
}
/* ============================================================== */
+/* GObject Initialization */
+QOF_GOBJECT_IMPL(gnc_employee, GncEmployee, QOF_TYPE_INSTANCE);
+
+static void
+gnc_employee_init(GncEmployee* emp)
+{
+}
+
+static void
+gnc_employee_finalize_real(GObject* empp)
+{
+}
+
/* Create/Destroy Functions */
-
GncEmployee *gncEmployeeCreate (QofBook *book)
{
GncEmployee *employee;
if (!book) return NULL;
- employee = g_new0 (GncEmployee, 1);
- qof_instance_init (&employee->inst, _GNC_MOD_NAME, book);
+ employee = g_object_new (GNC_TYPE_EMPLOYEE, NULL);
+ qof_instance_init_data (&employee->inst, _GNC_MOD_NAME, book);
employee->id = CACHE_INSERT ("");
employee->username = CACHE_INSERT ("");
@@ -110,8 +127,8 @@
CACHE_REMOVE (employee->acl);
gncAddressDestroy (employee->addr);
- qof_instance_release (&employee->inst);
- g_free (employee);
+ /* qof_instance_release (&employee->inst); */
+ g_object_unref (employee);
}
GncEmployee *
@@ -120,8 +137,8 @@
GncEmployee *employee;
if (!book || !from) return NULL;
- employee = g_new0 (GncEmployee, 1);
- qof_instance_init(&employee->inst, _GNC_MOD_NAME, book);
+ employee = g_object_new (GNC_TYPE_EMPLOYEE, NULL);
+ qof_instance_init_data(&employee->inst, _GNC_MOD_NAME, book);
qof_instance_gemini (&employee->inst, &from->inst);
employee->id = CACHE_INSERT (from->id);
Modified: gnucash/branches/gobject-engine-dev-warlord/src/business/business-core/gncEmployee.h
===================================================================
--- gnucash/branches/gobject-engine-dev-warlord/src/business/business-core/gncEmployee.h 2007-04-05 02:43:31 UTC (rev 15818)
+++ gnucash/branches/gobject-engine-dev-warlord/src/business/business-core/gncEmployee.h 2007-04-05 02:43:38 UTC (rev 15819)
@@ -32,14 +32,27 @@
#define GNC_EMPLOYEE_H_
typedef struct _gncEmployee GncEmployee;
+typedef struct _gncEmployeeClass GncEmployeeClass;
#include "gncAddress.h"
#include "Account.h"
#define GNC_ID_EMPLOYEE "gncEmployee"
-#define GNC_IS_EMPLOYEE(obj) (QOF_CHECK_TYPE((obj), GNC_ID_EMPLOYEE))
-#define GNC_EMPLOYEE(obj) (QOF_CHECK_CAST((obj), GNC_ID_EMPLOYEE, GncEmployee))
+/* --- type macros --- */
+#define GNC_TYPE_EMPLOYEE (gnc_employee_get_type ())
+#define GNC_EMPLOYEE(o) \
+ (G_TYPE_CHECK_INSTANCE_CAST ((o), GNC_TYPE_EMPLOYEE, GncEmployee))
+#define GNC_EMPLOYEE_CLASS(k) \
+ (G_TYPE_CHECK_CLASS_CAST((k), GNC_TYPE_EMPLOYEE, GncEmployeeClass))
+#define GNC_IS_EMPLOYEE(o) \
+ (G_TYPE_CHECK_INSTANCE_TYPE ((o), GNC_TYPE_EMPLOYEE))
+#define GNC_IS_EMPLOYEE_CLASS(k) \
+ (G_TYPE_CHECK_CLASS_TYPE ((k), GNC_TYPE_EMPLOYEE))
+#define GNC_EMPLOYEE_GET_CLASS(o) \
+ (G_TYPE_INSTANCE_GET_CLASS ((o), GNC_TYPE_EMPLOYEE, GncEmployeeClass))
+GType gnc_employee_get_type(void);
+
/** @name Create/Destroy Functions
@{ */
GncEmployee *gncEmployeeCreate (QofBook *book);
More information about the gnucash-changes
mailing list