static void gnc_customer_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) { GncCustomer *cust; gchar *key; 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; case PROP_PDF_DIRNAME: key = OWNER_EXPORT_PDF_DIRNAME; qof_instance_get_kvp (QOF_INSTANCE (cust), key, value); break; case PROP_LAST_POSTED: key = LAST_POSTED_TO_ACCT; qof_instance_get_kvp (QOF_INSTANCE (cust), key, value); break; case PROP_PAYMENT_LAST_ACCT: key = GNC_PAYMENT "/" GNC_LAST_ACCOUNT; qof_instance_get_kvp (QOF_INSTANCE (cust), key, value); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec); break; } }
gboolean GNC_IS_OWNER (QofInstance *ent) { if (!ent) return FALSE; return (GNC_IS_VENDOR(ent) || GNC_IS_CUSTOMER(ent) || GNC_IS_EMPLOYEE(ent) || GNC_IS_JOB(ent)); }
/** Return display name for this object */ static gchar* impl_get_display_name(const QofInstance* inst) { GncCustomer* cust; g_return_val_if_fail(inst != NULL, FALSE); g_return_val_if_fail(GNC_IS_CUSTOMER(inst), FALSE); cust = GNC_CUSTOMER(inst); /* XXX internationalization of "Customer" */ return g_strdup_printf("Customer %s", cust->name); }
static void write_single_customer( QofInstance *term_p, gpointer data_p ) { write_customers_t* data = (write_customers_t*)data_p; g_return_if_fail( term_p != NULL ); g_return_if_fail( GNC_IS_CUSTOMER(term_p) ); g_return_if_fail( data_p != NULL ); if ( customer_should_be_saved( GNC_CUSTOMER(term_p) ) && data->is_ok ) { data->is_ok = save_customer( data->be, term_p ); } }
/** Does this object refer to a specific object */ static gboolean impl_refers_to_object(const QofInstance* inst, const QofInstance* ref) { GncCustomer* cust; g_return_val_if_fail(inst != NULL, FALSE); g_return_val_if_fail(GNC_IS_CUSTOMER(inst), FALSE); cust = GNC_CUSTOMER(inst); if (GNC_IS_BILLTERM(ref)) { return (cust->terms == GNC_BILLTERM(ref)); } else if (GNC_IS_TAXTABLE(ref)) { return (cust->taxtable == GNC_TAXTABLE(ref)); } return FALSE; }
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; } }