r18764 - gnucash/trunk/src/business/business-core - Start to add properties to business objects. Currently only 1 property per object, but this infrastructure will allow more generic importing of objects.
Phil Longstaff
plongstaff at code.gnucash.org
Sun Feb 28 14:15:46 EST 2010
Author: plongstaff
Date: 2010-02-28 14:15:46 -0500 (Sun, 28 Feb 2010)
New Revision: 18764
Trac: http://svn.gnucash.org/trac/changeset/18764
Modified:
gnucash/trunk/src/business/business-core/gncAddress.c
gnucash/trunk/src/business/business-core/gncBillTerm.c
gnucash/trunk/src/business/business-core/gncCustomer.c
gnucash/trunk/src/business/business-core/gncEmployee.c
gnucash/trunk/src/business/business-core/gncEntry.c
gnucash/trunk/src/business/business-core/gncInvoice.c
gnucash/trunk/src/business/business-core/gncJob.c
gnucash/trunk/src/business/business-core/gncOrder.c
gnucash/trunk/src/business/business-core/gncTaxTable.c
gnucash/trunk/src/business/business-core/gncVendor.c
gnucash/trunk/src/business/business-core/sql/gnc-address-sql.c
gnucash/trunk/src/business/business-core/sql/gnc-bill-term-sql.c
gnucash/trunk/src/business/business-core/sql/gnc-customer-sql.c
gnucash/trunk/src/business/business-core/sql/gnc-employee-sql.c
gnucash/trunk/src/business/business-core/sql/gnc-entry-sql.c
gnucash/trunk/src/business/business-core/sql/gnc-invoice-sql.c
gnucash/trunk/src/business/business-core/sql/gnc-job-sql.c
gnucash/trunk/src/business/business-core/sql/gnc-order-sql.c
gnucash/trunk/src/business/business-core/sql/gnc-tax-table-sql.c
gnucash/trunk/src/business/business-core/sql/gnc-vendor-sql.c
Log:
Start to add properties to business objects. Currently only 1 property per object, but this infrastructure will allow more generic importing of objects.
Modified: gnucash/trunk/src/business/business-core/gncAddress.c
===================================================================
--- gnucash/trunk/src/business/business-core/gncAddress.c 2010-02-28 17:36:49 UTC (rev 18763)
+++ gnucash/trunk/src/business/business-core/gncAddress.c 2010-02-28 19:15:46 UTC (rev 18764)
@@ -68,8 +68,13 @@
qof_event_gen (address->parent, QOF_EVENT_MODIFY, NULL);
}
+enum {
+ PROP_0,
+ PROP_NAME
+};
+
/* GObject Initialization */
-QOF_GOBJECT_IMPL(gnc_address, GncAddress, QOF_TYPE_INSTANCE);
+G_DEFINE_TYPE(GncAddress, gnc_address, QOF_TYPE_INSTANCE);
static void
gnc_address_init(GncAddress* addr)
@@ -77,15 +82,81 @@
}
static void
-gnc_address_dispose_real (GObject *addrp)
+gnc_address_dispose(GObject *addrp)
{
+ G_OBJECT_CLASS(gnc_address_parent_class)->dispose(addrp);
}
static void
-gnc_address_finalize_real(GObject* addrp)
+gnc_address_finalize(GObject* addrp)
{
+ G_OBJECT_CLASS(gnc_address_parent_class)->finalize(addrp);
}
+static void
+gnc_address_get_property (GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ GncAddress *address;
+
+ g_return_if_fail(GNC_IS_ADDRESS(object));
+
+ address = GNC_ADDRESS(object);
+ switch (prop_id) {
+ case PROP_NAME:
+ g_value_set_string(value, address->name);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
+ break;
+ }
+}
+
+static void
+gnc_address_set_property (GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ GncAddress *address;
+
+ g_return_if_fail(GNC_IS_ADDRESS(object));
+
+ address = GNC_ADDRESS(object);
+ switch (prop_id) {
+ case PROP_NAME:
+ gncAddressSetName(address, g_value_get_string(value));
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
+ break;
+ }
+}
+
+static void
+gnc_address_class_init (GncAddressClass *klass)
+{
+ GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
+
+ gobject_class->dispose = gnc_address_dispose;
+ gobject_class->finalize = gnc_address_finalize;
+ gobject_class->set_property = gnc_address_set_property;
+ gobject_class->get_property = gnc_address_get_property;
+
+ g_object_class_install_property
+ (gobject_class,
+ PROP_NAME,
+ g_param_spec_string ("name",
+ "Address Name",
+ "The address name is an arbitrary string "
+ "assigned by the user. It is intended to "
+ "a short string to identify the address.",
+ NULL,
+ G_PARAM_READWRITE));
+}
+
/* Create/Destroy functions */
GncAddress *
Modified: gnucash/trunk/src/business/business-core/gncBillTerm.c
===================================================================
--- gnucash/trunk/src/business/business-core/gncBillTerm.c 2010-02-28 17:36:49 UTC (rev 18763)
+++ gnucash/trunk/src/business/business-core/gncBillTerm.c 2010-02-28 19:15:46 UTC (rev 18764)
@@ -133,8 +133,13 @@
/* ============================================================== */
+enum {
+ PROP_0,
+ PROP_NAME
+};
+
/* GObject Initialization */
-QOF_GOBJECT_IMPL(gnc_billterm, GncBillTerm, QOF_TYPE_INSTANCE);
+G_DEFINE_TYPE(GncBillTerm, gnc_billterm, QOF_TYPE_INSTANCE);
static void
gnc_billterm_init(GncBillTerm* bt)
@@ -142,15 +147,83 @@
}
static void
-gnc_billterm_dispose_real (GObject *btp)
+gnc_billterm_dispose(GObject *btp)
{
+ G_OBJECT_CLASS(gnc_billterm_parent_class)->dispose(btp);
}
static void
-gnc_billterm_finalize_real(GObject* btp)
+gnc_billterm_finalize(GObject* btp)
{
+ G_OBJECT_CLASS(gnc_billterm_parent_class)->finalize(btp);
}
+static void
+gnc_billterm_get_property (GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ GncBillTerm *bt;
+
+ g_return_if_fail(GNC_IS_BILLTERM(object));
+
+ bt = GNC_BILLTERM(object);
+ switch (prop_id) {
+ case PROP_NAME:
+ g_value_set_string(value, bt->name);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
+ break;
+ }
+}
+
+static void
+gnc_billterm_set_property (GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ GncBillTerm *bt;
+
+ g_return_if_fail(GNC_IS_BILLTERM(object));
+
+ bt = GNC_BILLTERM(object);
+ switch (prop_id) {
+ case PROP_NAME:
+ gncBillTermSetName(bt, g_value_get_string(value));
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
+ break;
+ }
+}
+
+static void
+gnc_billterm_class_init (GncBillTermClass *klass)
+{
+ GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
+
+ gobject_class->dispose = gnc_billterm_dispose;
+ gobject_class->finalize = gnc_billterm_finalize;
+ gobject_class->set_property = gnc_billterm_set_property;
+ gobject_class->get_property = gnc_billterm_get_property;
+
+ g_object_class_install_property
+ (gobject_class,
+ PROP_NAME,
+ g_param_spec_string ("name",
+ "BillTerm Name",
+ "The bill term name is an arbitrary string "
+ "assigned by the user. It is intended to "
+ "a short, 10 to 30 character long string "
+ "that is displayed by the GUI as the "
+ "billterm mnemonic.",
+ NULL,
+ G_PARAM_READWRITE));
+}
+
/* Create/Destroy Functions */
GncBillTerm * gncBillTermCreate (QofBook *book)
{
Modified: gnucash/trunk/src/business/business-core/gncCustomer.c
===================================================================
--- gnucash/trunk/src/business/business-core/gncCustomer.c 2010-02-28 17:36:49 UTC (rev 18763)
+++ gnucash/trunk/src/business/business-core/gncCustomer.c 2010-02-28 19:15:46 UTC (rev 18764)
@@ -93,8 +93,13 @@
/* ============================================================== */
+enum {
+ PROP_0,
+ PROP_NAME
+};
+
/* GObject Initialization */
-QOF_GOBJECT_IMPL(gnc_customer, GncCustomer, QOF_TYPE_INSTANCE);
+G_DEFINE_TYPE(GncCustomer, gnc_customer, QOF_TYPE_INSTANCE);
static void
gnc_customer_init(GncCustomer* cust)
@@ -102,15 +107,81 @@
}
static void
-gnc_customer_dispose_real (GObject *custp)
+gnc_customer_dispose(GObject *custp)
{
+ G_OBJECT_CLASS(gnc_customer_parent_class)->dispose(custp);
}
static void
-gnc_customer_finalize_real(GObject* custp)
+gnc_customer_finalize(GObject* custp)
{
+ G_OBJECT_CLASS(gnc_customer_parent_class)->finalize(custp);
}
+static void
+gnc_customer_get_property (GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ GncCustomer *cust;
+
+ g_return_if_fail(GNC_IS_CUSTOMER(object));
+
+ cust = GNC_CUSTOMER(object);
+ switch (prop_id) {
+ case PROP_NAME:
+ g_value_set_string(value, cust->name);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
+ break;
+ }
+}
+
+static void
+gnc_customer_set_property (GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ GncCustomer *cust;
+
+ g_return_if_fail(GNC_IS_CUSTOMER(object));
+
+ cust = GNC_CUSTOMER(object);
+ switch (prop_id) {
+ case PROP_NAME:
+ gncCustomerSetName(cust, g_value_get_string(value));
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
+ break;
+ }
+}
+
+static void
+gnc_customer_class_init (GncCustomerClass *klass)
+{
+ GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
+
+ gobject_class->dispose = gnc_customer_dispose;
+ gobject_class->finalize = gnc_customer_finalize;
+ gobject_class->set_property = gnc_customer_set_property;
+ gobject_class->get_property = gnc_customer_get_property;
+
+ g_object_class_install_property
+ (gobject_class,
+ PROP_NAME,
+ g_param_spec_string ("name",
+ "Customer Name",
+ "The customer is an arbitrary string "
+ "assigned by the user which provides the "
+ "customer name.",
+ NULL,
+ G_PARAM_READWRITE));
+}
+
/* Create/Destroy Functions */
GncCustomer *gncCustomerCreate (QofBook *book)
{
Modified: gnucash/trunk/src/business/business-core/gncEmployee.c
===================================================================
--- gnucash/trunk/src/business/business-core/gncEmployee.c 2010-02-28 17:36:49 UTC (rev 18763)
+++ gnucash/trunk/src/business/business-core/gncEmployee.c 2010-02-28 19:15:46 UTC (rev 18764)
@@ -75,8 +75,14 @@
}
/* ============================================================== */
+
+enum {
+ PROP_0,
+ PROP_USERNAME
+};
+
/* GObject Initialization */
-QOF_GOBJECT_IMPL(gnc_employee, GncEmployee, QOF_TYPE_INSTANCE);
+G_DEFINE_TYPE(GncEmployee, gnc_employee, QOF_TYPE_INSTANCE);
static void
gnc_employee_init(GncEmployee* emp)
@@ -84,15 +90,81 @@
}
static void
-gnc_employee_dispose_real (GObject *empp)
+gnc_employee_dispose(GObject *empp)
{
+ G_OBJECT_CLASS(gnc_employee_parent_class)->dispose(empp);
}
static void
-gnc_employee_finalize_real(GObject* empp)
+gnc_employee_finalize(GObject* empp)
{
+ G_OBJECT_CLASS(gnc_employee_parent_class)->finalize(empp);
}
+static void
+gnc_employee_get_property (GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ GncEmployee *emp;
+
+ g_return_if_fail(GNC_IS_EMPLOYEE(object));
+
+ emp = GNC_EMPLOYEE(object);
+ switch (prop_id) {
+ case PROP_USERNAME:
+ g_value_set_string(value, emp->username);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
+ break;
+ }
+}
+
+static void
+gnc_employee_set_property (GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ GncEmployee *emp;
+
+ g_return_if_fail(GNC_IS_EMPLOYEE(object));
+
+ emp = GNC_EMPLOYEE(object);
+ switch (prop_id) {
+ case PROP_USERNAME:
+ gncEmployeeSetUsername(emp, g_value_get_string(value));
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
+ break;
+ }
+}
+
+static void
+gnc_employee_class_init (GncEmployeeClass *klass)
+{
+ GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
+
+ gobject_class->dispose = gnc_employee_dispose;
+ gobject_class->finalize = gnc_employee_finalize;
+ gobject_class->set_property = gnc_employee_set_property;
+ gobject_class->get_property = gnc_employee_get_property;
+
+ g_object_class_install_property
+ (gobject_class,
+ PROP_USERNAME,
+ g_param_spec_string ("name",
+ "Employee Name",
+ "The employee name is an arbitrary string "
+ "assigned by the user which provides the employee "
+ "name.",
+ NULL,
+ G_PARAM_READWRITE));
+}
+
/* Create/Destroy Functions */
GncEmployee *gncEmployeeCreate (QofBook *book)
{
Modified: gnucash/trunk/src/business/business-core/gncEntry.c
===================================================================
--- gnucash/trunk/src/business/business-core/gncEntry.c 2010-02-28 17:36:49 UTC (rev 18763)
+++ gnucash/trunk/src/business/business-core/gncEntry.c 2010-02-28 19:15:46 UTC (rev 18764)
@@ -178,8 +178,14 @@
}
/* ================================================================ */
+
+enum {
+ PROP_0,
+ PROP_DESCRIPTION
+};
+
/* GObject Initialization */
-QOF_GOBJECT_IMPL(gnc_entry, GncEntry, QOF_TYPE_INSTANCE);
+G_DEFINE_TYPE(GncEntry, gnc_entry, QOF_TYPE_INSTANCE);
static void
gnc_entry_init(GncEntry* entry)
@@ -187,15 +193,81 @@
}
static void
-gnc_entry_dispose_real (GObject *entryp)
+gnc_entry_dispose(GObject *entryp)
{
+ G_OBJECT_CLASS(gnc_entry_parent_class)->dispose(entryp);
}
static void
-gnc_entry_finalize_real(GObject* entryp)
+gnc_entry_finalize(GObject* entryp)
{
+ G_OBJECT_CLASS(gnc_entry_parent_class)->finalize(entryp);
}
+static void
+gnc_entry_get_property (GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ GncEntry *entry;
+
+ g_return_if_fail(GNC_IS_ENTRY(object));
+
+ entry = GNC_ENTRY(object);
+ switch (prop_id) {
+ case PROP_DESCRIPTION:
+ g_value_set_string(value, entry->desc);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
+ break;
+ }
+}
+
+static void
+gnc_entry_set_property (GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ GncEntry *entry;
+
+ g_return_if_fail(GNC_IS_ENTRY(object));
+
+ entry = GNC_ENTRY(object);
+ switch (prop_id) {
+ case PROP_DESCRIPTION:
+ gncEntrySetDescription(entry, g_value_get_string(value));
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
+ break;
+ }
+}
+
+static void
+gnc_entry_class_init (GncEntryClass *klass)
+{
+ GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
+
+ gobject_class->dispose = gnc_entry_dispose;
+ gobject_class->finalize = gnc_entry_finalize;
+ gobject_class->set_property = gnc_entry_set_property;
+ gobject_class->get_property = gnc_entry_get_property;
+
+ g_object_class_install_property
+ (gobject_class,
+ PROP_DESCRIPTION,
+ g_param_spec_string ("description",
+ "Entry Description",
+ "The description is an arbitrary string "
+ "assigned by the user. It provides identification "
+ "for this entry.",
+ NULL,
+ G_PARAM_READWRITE));
+}
+
/* Create/Destroy Functions */
GncEntry *gncEntryCreate (QofBook *book)
{
Modified: gnucash/trunk/src/business/business-core/gncInvoice.c
===================================================================
--- gnucash/trunk/src/business/business-core/gncInvoice.c 2010-02-28 17:36:49 UTC (rev 18763)
+++ gnucash/trunk/src/business/business-core/gncInvoice.c 2010-02-28 19:15:46 UTC (rev 18764)
@@ -106,8 +106,14 @@
}
/* ================================================================== */
+
+enum {
+ PROP_0,
+ PROP_NOTES
+};
+
/* GObject Initialization */
-QOF_GOBJECT_IMPL(gnc_invoice, GncInvoice, QOF_TYPE_INSTANCE);
+G_DEFINE_TYPE(GncInvoice, gnc_invoice, QOF_TYPE_INSTANCE);
static void
gnc_invoice_init(GncInvoice* inv)
@@ -115,15 +121,81 @@
}
static void
-gnc_invoice_dispose_real (GObject *invp)
+gnc_invoice_dispose(GObject *invp)
{
+ G_OBJECT_CLASS(gnc_invoice_parent_class)->dispose(invp);
}
static void
-gnc_invoice_finalize_real(GObject* invp)
+gnc_invoice_finalize(GObject* invp)
{
+ G_OBJECT_CLASS(gnc_invoice_parent_class)->finalize(invp);
}
+static void
+gnc_invoice_get_property (GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ GncInvoice *inv;
+
+ g_return_if_fail(GNC_IS_INVOICE(object));
+
+ inv = GNC_INVOICE(object);
+ switch (prop_id) {
+ case PROP_NOTES:
+ g_value_set_string(value, inv->notes);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
+ break;
+ }
+}
+
+static void
+gnc_invoice_set_property (GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ GncInvoice *inv;
+
+ g_return_if_fail(GNC_IS_INVOICE(object));
+
+ inv = GNC_INVOICE(object);
+ switch (prop_id) {
+ case PROP_NOTES:
+ gncInvoiceSetNotes(inv, g_value_get_string(value));
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
+ break;
+ }
+}
+
+static void
+gnc_invoice_class_init (GncInvoiceClass *klass)
+{
+ GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
+
+ gobject_class->dispose = gnc_invoice_dispose;
+ gobject_class->finalize = gnc_invoice_finalize;
+ gobject_class->set_property = gnc_invoice_set_property;
+ gobject_class->get_property = gnc_invoice_get_property;
+
+ g_object_class_install_property
+ (gobject_class,
+ PROP_NOTES,
+ g_param_spec_string ("notes",
+ "Invoice Notes",
+ "The invoice notes is an arbitrary string "
+ "assigned by the user to provide notes regarding "
+ "this invoice.",
+ NULL,
+ G_PARAM_READWRITE));
+}
+
/* Create/Destroy Functions */
GncInvoice *gncInvoiceCreate (QofBook *book)
{
Modified: gnucash/trunk/src/business/business-core/gncJob.c
===================================================================
--- gnucash/trunk/src/business/business-core/gncJob.c 2010-02-28 17:36:49 UTC (rev 18763)
+++ gnucash/trunk/src/business/business-core/gncJob.c 2010-02-28 19:15:46 UTC (rev 18764)
@@ -66,8 +66,14 @@
}
/* ================================================================== */
+
+enum {
+ PROP_0,
+ PROP_NAME
+};
+
/* GObject Initialization */
-QOF_GOBJECT_IMPL(gnc_job, GncJob, QOF_TYPE_INSTANCE);
+G_DEFINE_TYPE(GncJob, gnc_job, QOF_TYPE_INSTANCE);
static void
gnc_job_init(GncJob* job)
@@ -75,15 +81,82 @@
}
static void
-gnc_job_dispose_real (GObject *jobp)
+gnc_job_dispose(GObject *jobp)
{
+ G_OBJECT_CLASS(gnc_job_parent_class)->dispose(jobp);
}
static void
-gnc_job_finalize_real(GObject* jobp)
+gnc_job_finalize(GObject* jobp)
{
+ G_OBJECT_CLASS(gnc_job_parent_class)->finalize(jobp);
}
+static void
+gnc_job_get_property (GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ GncJob *job;
+
+ g_return_if_fail(GNC_IS_JOB(object));
+
+ job = GNC_JOB(object);
+ switch (prop_id) {
+ case PROP_NAME:
+ g_value_set_string(value, job->name);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
+ break;
+ }
+}
+
+static void
+gnc_job_set_property (GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ GncJob *job;
+
+ g_return_if_fail(GNC_IS_JOB(object));
+
+ job = GNC_JOB(object);
+ switch (prop_id) {
+ case PROP_NAME:
+ gncJobSetName(job, g_value_get_string(value));
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
+ break;
+ }
+}
+
+static void
+gnc_job_class_init (GncJobClass *klass)
+{
+ GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
+
+ gobject_class->dispose = gnc_job_dispose;
+ gobject_class->finalize = gnc_job_finalize;
+ gobject_class->set_property = gnc_job_set_property;
+ gobject_class->get_property = gnc_job_get_property;
+
+ g_object_class_install_property
+ (gobject_class,
+ PROP_NAME,
+ g_param_spec_string ("name",
+ "Job Name",
+ "The job name is an arbitrary string "
+ "assigned by the user. It is intended to "
+ "a short character string that is displayed "
+ "by the GUI as the job mnemonic.",
+ NULL,
+ G_PARAM_READWRITE));
+}
+
/* Create/Destroy Functions */
GncJob *gncJobCreate (QofBook *book)
{
Modified: gnucash/trunk/src/business/business-core/gncOrder.c
===================================================================
--- gnucash/trunk/src/business/business-core/gncOrder.c 2010-02-28 17:36:49 UTC (rev 18763)
+++ gnucash/trunk/src/business/business-core/gncOrder.c 2010-02-28 19:15:46 UTC (rev 18764)
@@ -80,8 +80,14 @@
}
/* =============================================================== */
+
+enum {
+ PROP_0,
+ PROP_NOTES
+};
+
/* GObject Initialization */
-QOF_GOBJECT_IMPL(gnc_order, GncOrder, QOF_TYPE_INSTANCE);
+G_DEFINE_TYPE(GncOrder, gnc_order, QOF_TYPE_INSTANCE);
static void
gnc_order_init(GncOrder* order)
@@ -89,15 +95,81 @@
}
static void
-gnc_order_dispose_real (GObject *orderp)
+gnc_order_dispose(GObject *orderp)
{
+ G_OBJECT_CLASS(gnc_order_parent_class)->dispose(orderp);
}
static void
-gnc_order_finalize_real(GObject* orderp)
+gnc_order_finalize(GObject* orderp)
{
+ G_OBJECT_CLASS(gnc_order_parent_class)->dispose(orderp);
}
+static void
+gnc_order_get_property (GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ GncOrder *order;
+
+ g_return_if_fail(GNC_IS_ORDER(object));
+
+ order = GNC_ORDER(object);
+ switch (prop_id) {
+ case PROP_NOTES:
+ g_value_set_string(value, order->notes);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
+ break;
+ }
+}
+
+static void
+gnc_order_set_property (GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ GncOrder *order;
+
+ g_return_if_fail(GNC_IS_ORDER(object));
+
+ order = GNC_ORDER(object);
+ switch (prop_id) {
+ case PROP_NOTES:
+ gncOrderSetNotes(order, g_value_get_string(value));
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
+ break;
+ }
+}
+
+static void
+gnc_order_class_init (GncOrderClass *klass)
+{
+ GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
+
+ gobject_class->dispose = gnc_order_dispose;
+ gobject_class->finalize = gnc_order_finalize;
+ gobject_class->set_property = gnc_order_set_property;
+ gobject_class->get_property = gnc_order_get_property;
+
+ g_object_class_install_property
+ (gobject_class,
+ PROP_NOTES,
+ g_param_spec_string ("name",
+ "Order Notes",
+ "The order notes is an arbitrary string "
+ "assigned by the user to provide notes about "
+ "this order.",
+ NULL,
+ G_PARAM_READWRITE));
+}
+
/* Create/Destroy Functions */
GncOrder *gncOrderCreate (QofBook *book)
{
Modified: gnucash/trunk/src/business/business-core/gncTaxTable.c
===================================================================
--- gnucash/trunk/src/business/business-core/gncTaxTable.c 2010-02-28 17:36:49 UTC (rev 18763)
+++ gnucash/trunk/src/business/business-core/gncTaxTable.c 2010-02-28 19:15:46 UTC (rev 18764)
@@ -205,8 +205,14 @@
}
/* =============================================================== */
+
+enum {
+ PROP_0,
+ PROP_NAME
+};
+
/* GObject Initialization */
-QOF_GOBJECT_IMPL(gnc_taxtable, GncTaxTable, QOF_TYPE_INSTANCE);
+G_DEFINE_TYPE(GncTaxTable, gnc_taxtable, QOF_TYPE_INSTANCE);
static void
gnc_taxtable_init(GncTaxTable* tt)
@@ -214,15 +220,83 @@
}
static void
-gnc_taxtable_dispose_real (GObject *ttp)
+gnc_taxtable_dispose(GObject *ttp)
{
+ G_OBJECT_CLASS(gnc_taxtable_parent_class)->dispose(ttp);
}
static void
-gnc_taxtable_finalize_real(GObject* ttp)
+gnc_taxtable_finalize(GObject* ttp)
{
+ G_OBJECT_CLASS(gnc_taxtable_parent_class)->dispose(ttp);
}
+static void
+gnc_taxtable_get_property (GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ GncTaxTable *tt;
+
+ g_return_if_fail(GNC_IS_TAXTABLE(object));
+
+ tt = GNC_TAXTABLE(object);
+ switch (prop_id) {
+ case PROP_NAME:
+ g_value_set_string(value, tt->name);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
+ break;
+ }
+}
+
+static void
+gnc_taxtable_set_property (GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ GncTaxTable *tt;
+
+ g_return_if_fail(GNC_IS_TAXTABLE(object));
+
+ tt = GNC_TAXTABLE(object);
+ switch (prop_id) {
+ case PROP_NAME:
+ gncTaxTableSetName(tt, g_value_get_string(value));
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
+ break;
+ }
+}
+
+static void
+gnc_taxtable_class_init (GncTaxTableClass *klass)
+{
+ GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
+
+ gobject_class->dispose = gnc_taxtable_dispose;
+ gobject_class->finalize = gnc_taxtable_finalize;
+ gobject_class->set_property = gnc_taxtable_set_property;
+ gobject_class->get_property = gnc_taxtable_get_property;
+
+ g_object_class_install_property
+ (gobject_class,
+ PROP_NAME,
+ g_param_spec_string ("name",
+ "TaxTable Name",
+ "The accountName is an arbitrary string "
+ "assigned by the user. It is intended to "
+ "a short, 10 to 30 character long string "
+ "that is displayed by the GUI as the "
+ "tax table mnemonic.",
+ NULL,
+ G_PARAM_READWRITE));
+}
+
/* Create/Destroy Functions */
GncTaxTable *
gncTaxTableCreate (QofBook *book)
Modified: gnucash/trunk/src/business/business-core/gncVendor.c
===================================================================
--- gnucash/trunk/src/business/business-core/gncVendor.c 2010-02-28 17:36:49 UTC (rev 18763)
+++ gnucash/trunk/src/business/business-core/gncVendor.c 2010-02-28 19:15:46 UTC (rev 18764)
@@ -81,8 +81,14 @@
}
/* ============================================================== */
+
+enum {
+ PROP_0,
+ PROP_NAME
+};
+
/* GObject Initialization */
-QOF_GOBJECT_IMPL(gnc_vendor, GncVendor, QOF_TYPE_INSTANCE);
+G_DEFINE_TYPE(GncVendor, gnc_vendor, QOF_TYPE_INSTANCE);
static void
gnc_vendor_init(GncVendor* vendor)
@@ -90,15 +96,80 @@
}
static void
-gnc_vendor_dispose_real (GObject *vendorp)
+gnc_vendor_dispose(GObject *vendorp)
{
+ G_OBJECT_CLASS(gnc_vendor_parent_class)->dispose(vendorp);
}
static void
-gnc_vendor_finalize_real(GObject* vendorp)
+gnc_vendor_finalize(GObject* vendorp)
{
+ G_OBJECT_CLASS(gnc_vendor_parent_class)->finalize(vendorp);
}
+static void
+gnc_vendor_get_property (GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ GncVendor *vendor;
+
+ g_return_if_fail(GNC_IS_VENDOR(object));
+
+ vendor = GNC_VENDOR(object);
+ switch (prop_id) {
+ case PROP_NAME:
+ g_value_set_string(value, vendor->name);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
+ break;
+ }
+}
+
+static void
+gnc_vendor_set_property (GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ GncVendor *vendor;
+
+ g_return_if_fail(GNC_IS_VENDOR(object));
+
+ vendor = GNC_VENDOR(object);
+ switch (prop_id) {
+ case PROP_NAME:
+ gncVendorSetName(vendor, g_value_get_string(value));
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
+ break;
+ }
+}
+
+static void
+gnc_vendor_class_init (GncVendorClass *klass)
+{
+ GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
+
+ gobject_class->dispose = gnc_vendor_dispose;
+ gobject_class->finalize = gnc_vendor_finalize;
+ gobject_class->set_property = gnc_vendor_set_property;
+ gobject_class->get_property = gnc_vendor_get_property;
+
+ g_object_class_install_property
+ (gobject_class,
+ PROP_NAME,
+ g_param_spec_string ("name",
+ "Vendor Name",
+ "The vendor name is an arbitrary string "
+ "assigned by the user to provide the vendor name.",
+ NULL,
+ G_PARAM_READWRITE));
+}
+
/* Create/Destroy Functions */
GncVendor *gncVendorCreate (QofBook *book)
{
Modified: gnucash/trunk/src/business/business-core/sql/gnc-address-sql.c
===================================================================
--- gnucash/trunk/src/business/business-core/sql/gnc-address-sql.c 2010-02-28 17:36:49 UTC (rev 18763)
+++ gnucash/trunk/src/business/business-core/sql/gnc-address-sql.c 2010-02-28 19:15:46 UTC (rev 18764)
@@ -49,7 +49,7 @@
static GncSqlColumnTableEntry col_table[] =
{
- { "name", CT_STRING, ADDRESS_MAX_NAME_LEN, COL_NNUL, NULL, ADDRESS_NAME },
+ { "name", CT_STRING, ADDRESS_MAX_NAME_LEN, COL_NNUL, "name" },
{ "addr1", CT_STRING, ADDRESS_MAX_ADDRESS_LINE_LEN, COL_NNUL, NULL, ADDRESS_ONE },
{ "addr2", CT_STRING, ADDRESS_MAX_ADDRESS_LINE_LEN, COL_NNUL, NULL, ADDRESS_TWO },
{ "addr3", CT_STRING, ADDRESS_MAX_ADDRESS_LINE_LEN, COL_NNUL, NULL, ADDRESS_THREE },
Modified: gnucash/trunk/src/business/business-core/sql/gnc-bill-term-sql.c
===================================================================
--- gnucash/trunk/src/business/business-core/sql/gnc-bill-term-sql.c 2010-02-28 17:36:49 UTC (rev 18763)
+++ gnucash/trunk/src/business/business-core/sql/gnc-bill-term-sql.c 2010-02-28 19:15:46 UTC (rev 18764)
@@ -58,7 +58,7 @@
static GncSqlColumnTableEntry col_table[] =
{
{ "guid", CT_GUID, 0, COL_NNUL|COL_PKEY, "guid" },
- { "name", CT_STRING, MAX_NAME_LEN, COL_NNUL, NULL, GNC_BILLTERM_NAME },
+ { "name", CT_STRING, MAX_NAME_LEN, COL_NNUL, "name" },
{ "description", CT_STRING, MAX_DESCRIPTION_LEN, COL_NNUL, NULL, GNC_BILLTERM_DESC },
{ "refcount", CT_INT, 0, COL_NNUL, NULL, NULL,
(QofAccessFunc)gncBillTermGetRefcount, (QofSetterFunc)gncBillTermSetRefcount },
Modified: gnucash/trunk/src/business/business-core/sql/gnc-customer-sql.c
===================================================================
--- gnucash/trunk/src/business/business-core/sql/gnc-customer-sql.c 2010-02-28 17:36:49 UTC (rev 18763)
+++ gnucash/trunk/src/business/business-core/sql/gnc-customer-sql.c 2010-02-28 19:15:46 UTC (rev 18764)
@@ -59,7 +59,7 @@
static GncSqlColumnTableEntry col_table[] =
{
{ "guid", CT_GUID, 0, COL_NNUL|COL_PKEY, "guid" },
- { "name", CT_STRING, MAX_NAME_LEN, COL_NNUL, NULL, CUSTOMER_NAME },
+ { "name", CT_STRING, MAX_NAME_LEN, COL_NNUL, "name" },
{ "id", CT_STRING, MAX_ID_LEN, COL_NNUL, NULL, CUSTOMER_ID },
{ "notes", CT_STRING, MAX_NOTES_LEN, COL_NNUL, NULL, CUSTOMER_NOTES },
{ "active", CT_BOOLEAN, 0, COL_NNUL, NULL, QOF_PARAM_ACTIVE },
Modified: gnucash/trunk/src/business/business-core/sql/gnc-employee-sql.c
===================================================================
--- gnucash/trunk/src/business/business-core/sql/gnc-employee-sql.c 2010-02-28 17:36:49 UTC (rev 18763)
+++ gnucash/trunk/src/business/business-core/sql/gnc-employee-sql.c 2010-02-28 19:15:46 UTC (rev 18764)
@@ -59,7 +59,7 @@
static GncSqlColumnTableEntry col_table[] =
{
{ "guid", CT_GUID, 0, COL_NNUL|COL_PKEY, "guid" },
- { "username", CT_STRING, MAX_USERNAME_LEN, COL_NNUL, NULL, EMPLOYEE_USERNAME },
+ { "username", CT_STRING, MAX_USERNAME_LEN, COL_NNUL, "username" },
{ "id", CT_STRING, MAX_ID_LEN, COL_NNUL, NULL, EMPLOYEE_ID },
{ "language", CT_STRING, MAX_LANGUAGE_LEN, COL_NNUL, NULL, EMPLOYEE_LANGUAGE },
{ "acl", CT_STRING, MAX_ACL_LEN, COL_NNUL, NULL, EMPLOYEE_ACL },
Modified: gnucash/trunk/src/business/business-core/sql/gnc-entry-sql.c
===================================================================
--- gnucash/trunk/src/business/business-core/sql/gnc-entry-sql.c 2010-02-28 17:36:49 UTC (rev 18763)
+++ gnucash/trunk/src/business/business-core/sql/gnc-entry-sql.c 2010-02-28 19:15:46 UTC (rev 18764)
@@ -68,7 +68,7 @@
{ "guid", CT_GUID, 0, COL_NNUL|COL_PKEY, "guid" },
{ "date", CT_TIMESPEC, 0, COL_NNUL, NULL, ENTRY_DATE },
{ "date_entered", CT_TIMESPEC, 0, 0, NULL, ENTRY_DATE_ENTERED },
- { "description", CT_STRING, MAX_DESCRIPTION_LEN, 0, NULL, ENTRY_DESC },
+ { "description", CT_STRING, MAX_DESCRIPTION_LEN, 0, "description" },
{ "action", CT_STRING, MAX_ACTION_LEN, 0, NULL, ENTRY_ACTION },
{ "notes", CT_STRING, MAX_NOTES_LEN, 0, NULL, ENTRY_NOTES },
{ "quantity", CT_NUMERIC, 0, 0, NULL, ENTRY_QTY },
Modified: gnucash/trunk/src/business/business-core/sql/gnc-invoice-sql.c
===================================================================
--- gnucash/trunk/src/business/business-core/sql/gnc-invoice-sql.c 2010-02-28 17:36:49 UTC (rev 18763)
+++ gnucash/trunk/src/business/business-core/sql/gnc-invoice-sql.c 2010-02-28 19:15:46 UTC (rev 18764)
@@ -63,7 +63,7 @@
{ "id", CT_STRING, MAX_ID_LEN, COL_NNUL, NULL, INVOICE_ID },
{ "date_opened", CT_TIMESPEC, 0, 0, NULL, INVOICE_OPENED },
{ "date_posted", CT_TIMESPEC, 0, 0, NULL, INVOICE_POSTED },
- { "notes", CT_STRING, MAX_NOTES_LEN, COL_NNUL, NULL, INVOICE_NOTES },
+ { "notes", CT_STRING, MAX_NOTES_LEN, COL_NNUL, "notes" },
{ "active", CT_BOOLEAN, 0, COL_NNUL, NULL, QOF_PARAM_ACTIVE },
{ "currency", CT_COMMODITYREF, 0, COL_NNUL, NULL, NULL,
(QofAccessFunc)gncInvoiceGetCurrency, (QofSetterFunc)gncInvoiceSetCurrency },
Modified: gnucash/trunk/src/business/business-core/sql/gnc-job-sql.c
===================================================================
--- gnucash/trunk/src/business/business-core/sql/gnc-job-sql.c 2010-02-28 17:36:49 UTC (rev 18763)
+++ gnucash/trunk/src/business/business-core/sql/gnc-job-sql.c 2010-02-28 19:15:46 UTC (rev 18764)
@@ -56,7 +56,7 @@
{
{ "guid", CT_GUID, 0, COL_NNUL|COL_PKEY, "guid" },
{ "id", CT_STRING, MAX_ID_LEN, COL_NNUL, NULL, JOB_ID },
- { "name", CT_STRING, MAX_NAME_LEN, COL_NNUL, NULL, JOB_NAME },
+ { "name", CT_STRING, MAX_NAME_LEN, COL_NNUL, "name" },
{ "reference", CT_STRING, MAX_REFERENCE_LEN, COL_NNUL, NULL, JOB_REFERENCE },
{ "active", CT_BOOLEAN, 0, COL_NNUL, NULL, NULL,
(QofAccessFunc)gncJobGetActive, (QofSetterFunc)gncJobSetActive },
Modified: gnucash/trunk/src/business/business-core/sql/gnc-order-sql.c
===================================================================
--- gnucash/trunk/src/business/business-core/sql/gnc-order-sql.c 2010-02-28 17:36:49 UTC (rev 18763)
+++ gnucash/trunk/src/business/business-core/sql/gnc-order-sql.c 2010-02-28 19:15:46 UTC (rev 18764)
@@ -57,7 +57,7 @@
{
{ "guid", CT_GUID, 0, COL_NNUL|COL_PKEY, "guid" },
{ "id", CT_STRING, MAX_ID_LEN, COL_NNUL, NULL, ORDER_ID },
- { "notes", CT_STRING, MAX_NOTES_LEN, COL_NNUL, NULL, ORDER_NOTES },
+ { "notes", CT_STRING, MAX_NOTES_LEN, COL_NNUL, "notes" },
{ "reference", CT_STRING, MAX_REFERENCE_LEN, COL_NNUL, NULL, ORDER_REFERENCE },
{ "active", CT_BOOLEAN, 0, COL_NNUL, NULL, QOF_PARAM_ACTIVE },
{ "date_opened", CT_TIMESPEC, 0, COL_NNUL, NULL, ORDER_OPENED },
Modified: gnucash/trunk/src/business/business-core/sql/gnc-tax-table-sql.c
===================================================================
--- gnucash/trunk/src/business/business-core/sql/gnc-tax-table-sql.c 2010-02-28 17:36:49 UTC (rev 18763)
+++ gnucash/trunk/src/business/business-core/sql/gnc-tax-table-sql.c 2010-02-28 19:15:46 UTC (rev 18764)
@@ -66,7 +66,7 @@
static GncSqlColumnTableEntry tt_col_table[] =
{
{ "guid", CT_GUID, 0, COL_NNUL|COL_PKEY, "guid" },
- { "name", CT_STRING, MAX_NAME_LEN, COL_NNUL, NULL, GNC_TT_NAME },
+ { "name", CT_STRING, MAX_NAME_LEN, COL_NNUL, "name" },
{ "refcount", CT_INT64, 0, COL_NNUL, NULL, GNC_TT_REFCOUNT },
{ "invisible", CT_BOOLEAN, 0, COL_NNUL, NULL, NULL,
(QofAccessFunc)gncTaxTableGetInvisible, (QofSetterFunc)set_invisible },
Modified: gnucash/trunk/src/business/business-core/sql/gnc-vendor-sql.c
===================================================================
--- gnucash/trunk/src/business/business-core/sql/gnc-vendor-sql.c 2010-02-28 17:36:49 UTC (rev 18763)
+++ gnucash/trunk/src/business/business-core/sql/gnc-vendor-sql.c 2010-02-28 19:15:46 UTC (rev 18764)
@@ -64,7 +64,7 @@
static GncSqlColumnTableEntry col_table[] =
{
{ "guid", CT_GUID, 0, COL_NNUL|COL_PKEY, "guid" },
- { "name", CT_STRING, MAX_NAME_LEN, COL_NNUL, NULL, VENDOR_NAME },
+ { "name", CT_STRING, MAX_NAME_LEN, COL_NNUL, "name" },
{ "id", CT_STRING, MAX_ID_LEN, COL_NNUL, NULL, VENDOR_ID },
{ "notes", CT_STRING, MAX_NOTES_LEN, COL_NNUL, NULL, VENDOR_NOTES },
{ "currency", CT_COMMODITYREF, 0, COL_NNUL, NULL, NULL,
More information about the gnucash-changes
mailing list