mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Convert gnc-budget, gnc-lot, and gncJob to qof_instance_foo_kvp.
This commit is contained in:
parent
39c521512b
commit
45e41a07b1
@ -42,11 +42,11 @@ static QofLogModule log_module = GNC_MOD_ENGINE;
|
||||
enum
|
||||
{
|
||||
PROP_0,
|
||||
PROP_NAME, /* Table */
|
||||
PROP_DESCRIPTION, /* Table */
|
||||
PROP_NUM_PERIODS, /* Table */
|
||||
PROP_NAME, /* Table */
|
||||
PROP_DESCRIPTION, /* Table */
|
||||
PROP_NUM_PERIODS, /* Table */
|
||||
PROP_RUNTIME_0,
|
||||
PROP_RECURRENCE, /* Cached pointer; Recurrence table holds budget guid */
|
||||
PROP_RECURRENCE, /* Cached pointer; Recurrence table holds budget guid */
|
||||
};
|
||||
|
||||
struct budget_s
|
||||
@ -159,7 +159,7 @@ gnc_budget_set_property( GObject* object,
|
||||
|
||||
budget = GNC_BUDGET(object);
|
||||
if (prop_id < PROP_RUNTIME_0)
|
||||
g_assert (qof_instance_get_editlevel(budget));
|
||||
g_assert (qof_instance_get_editlevel(budget));
|
||||
|
||||
switch ( prop_id )
|
||||
{
|
||||
@ -476,24 +476,29 @@ gnc_budget_get_num_periods(const GncBudget* budget)
|
||||
#define BUF_SIZE (10 + GUID_ENCODING_LENGTH + \
|
||||
GNC_BUDGET_MAX_NUM_PERIODS_DIGITS)
|
||||
|
||||
static inline void
|
||||
make_period_path (const Account *account, guint period_num, char *path)
|
||||
{
|
||||
const GncGUID *guid;
|
||||
gchar *bufend;
|
||||
guid = xaccAccountGetGUID(account);
|
||||
bufend = guid_to_string_buff(guid, path);
|
||||
g_sprintf(bufend, "/%d", period_num);
|
||||
}
|
||||
/* period_num is zero-based */
|
||||
/* What happens when account is deleted, after we have an entry for it? */
|
||||
void
|
||||
gnc_budget_unset_account_period_value(GncBudget *budget, const Account *account,
|
||||
guint period_num)
|
||||
{
|
||||
const GncGUID *guid;
|
||||
KvpFrame *frame;
|
||||
gchar path[BUF_SIZE];
|
||||
gchar *bufend;
|
||||
|
||||
g_return_if_fail (budget != NULL);
|
||||
g_return_if_fail (account != NULL);
|
||||
make_period_path (account, period_num, path);
|
||||
|
||||
gnc_budget_begin_edit(budget);
|
||||
frame = qof_instance_get_slots(QOF_INSTANCE(budget));
|
||||
guid = xaccAccountGetGUID(account);
|
||||
bufend = guid_to_string_buff(guid, path);
|
||||
g_sprintf(bufend, "/%d", period_num);
|
||||
|
||||
kvp_frame_set_value(frame, path, NULL);
|
||||
qof_instance_set_kvp (QOF_INSTANCE (budget), path, NULL);
|
||||
qof_instance_set_dirty(&budget->inst);
|
||||
gnc_budget_commit_edit(budget);
|
||||
|
||||
@ -507,10 +512,7 @@ void
|
||||
gnc_budget_set_account_period_value(GncBudget *budget, const Account *account,
|
||||
guint period_num, gnc_numeric val)
|
||||
{
|
||||
const GncGUID *guid;
|
||||
KvpFrame *frame;
|
||||
gchar path[BUF_SIZE];
|
||||
gchar *bufend;
|
||||
|
||||
/* Watch out for an off-by-one error here:
|
||||
* period_num starts from 0 while num_periods starts from 1 */
|
||||
@ -520,16 +522,21 @@ gnc_budget_set_account_period_value(GncBudget *budget, const Account *account,
|
||||
return;
|
||||
}
|
||||
|
||||
gnc_budget_begin_edit(budget);
|
||||
frame = qof_instance_get_slots(QOF_INSTANCE(budget));
|
||||
guid = xaccAccountGetGUID(account);
|
||||
bufend = guid_to_string_buff(guid, path);
|
||||
g_sprintf(bufend, "/%d", period_num);
|
||||
g_return_if_fail (budget != NULL);
|
||||
g_return_if_fail (account != NULL);
|
||||
|
||||
make_period_path (account, period_num, path);
|
||||
|
||||
gnc_budget_begin_edit(budget);
|
||||
if (gnc_numeric_check(val))
|
||||
kvp_frame_set_value(frame, path, NULL);
|
||||
qof_instance_set_kvp (QOF_INSTANCE (budget), path, NULL);
|
||||
else
|
||||
kvp_frame_set_numeric(frame, path, val);
|
||||
{
|
||||
GValue v = G_VALUE_INIT;
|
||||
g_value_init (&v, GNC_TYPE_NUMERIC);
|
||||
g_value_set_boxed (&v, &val);
|
||||
qof_instance_set_kvp (QOF_INSTANCE (budget), path, &v);
|
||||
}
|
||||
qof_instance_set_dirty(&budget->inst);
|
||||
gnc_budget_commit_edit(budget);
|
||||
|
||||
@ -541,42 +548,42 @@ gnc_budget_set_account_period_value(GncBudget *budget, const Account *account,
|
||||
Maybe this should move to Account.h */
|
||||
|
||||
gboolean
|
||||
gnc_budget_is_account_period_value_set(const GncBudget *budget, const Account *account,
|
||||
gnc_budget_is_account_period_value_set(const GncBudget *budget,
|
||||
const Account *account,
|
||||
guint period_num)
|
||||
{
|
||||
GValue v = G_VALUE_INIT;
|
||||
gchar path[BUF_SIZE];
|
||||
gchar *bufend;
|
||||
KvpFrame *frame;
|
||||
|
||||
g_return_val_if_fail(GNC_IS_BUDGET(budget), FALSE);
|
||||
g_return_val_if_fail(account, FALSE);
|
||||
|
||||
frame = qof_instance_get_slots(QOF_INSTANCE(budget));
|
||||
bufend = guid_to_string_buff(xaccAccountGetGUID(account), path);
|
||||
g_sprintf(bufend, "/%d", period_num);
|
||||
return (kvp_frame_get_value(frame, path) != NULL);
|
||||
make_period_path (account, period_num, path);
|
||||
g_value_init (&v, GNC_TYPE_NUMERIC);
|
||||
qof_instance_get_kvp (QOF_INSTANCE (budget), path, &v);
|
||||
return (g_value_get_boxed (&v) != NULL);
|
||||
}
|
||||
|
||||
gnc_numeric
|
||||
gnc_budget_get_account_period_value(const GncBudget *budget, const Account *account,
|
||||
gnc_budget_get_account_period_value(const GncBudget *budget,
|
||||
const Account *account,
|
||||
guint period_num)
|
||||
{
|
||||
gnc_numeric numeric;
|
||||
gnc_numeric *numeric;
|
||||
gchar path[BUF_SIZE];
|
||||
gchar *bufend;
|
||||
KvpFrame *frame;
|
||||
GValue v = G_VALUE_INIT;
|
||||
|
||||
numeric = gnc_numeric_zero();
|
||||
g_return_val_if_fail(GNC_IS_BUDGET(budget), numeric);
|
||||
g_return_val_if_fail(account, numeric);
|
||||
g_return_val_if_fail(GNC_IS_BUDGET(budget), gnc_numeric_zero());
|
||||
g_return_val_if_fail(account, gnc_numeric_zero());
|
||||
|
||||
frame = qof_instance_get_slots(QOF_INSTANCE(budget));
|
||||
bufend = guid_to_string_buff(xaccAccountGetGUID(account), path);
|
||||
g_sprintf(bufend, "/%d", period_num);
|
||||
g_value_init (&v, GNC_TYPE_NUMERIC);
|
||||
make_period_path (account, period_num, path);
|
||||
qof_instance_get_kvp (QOF_INSTANCE (budget), path, &v);
|
||||
numeric = (gnc_numeric*)g_value_get_boxed (&v);
|
||||
|
||||
numeric = kvp_frame_get_numeric(frame, path);
|
||||
/* This still returns zero if unset, but callers can check for that. */
|
||||
return numeric;
|
||||
if (numeric)
|
||||
return *numeric;
|
||||
return gnc_numeric_zero();
|
||||
}
|
||||
|
||||
|
||||
@ -637,16 +644,14 @@ gnc_budget_get_default (QofBook *book)
|
||||
|
||||
g_return_val_if_fail(book, NULL);
|
||||
|
||||
/* See if there is a budget selected in the KVP perferences */
|
||||
|
||||
qof_instance_get (QOF_INSTANCE (book),
|
||||
"default-budget", &default_budget_guid,
|
||||
NULL);
|
||||
"default-budget", &default_budget_guid,
|
||||
NULL);
|
||||
if (default_budget_guid != NULL)
|
||||
{
|
||||
col = qof_book_get_collection(book, GNC_ID_BUDGET);
|
||||
bgt = (GncBudget *) qof_collection_lookup_entity(col,
|
||||
default_budget_guid);
|
||||
col = qof_book_get_collection(book, GNC_ID_BUDGET);
|
||||
bgt = (GncBudget *) qof_collection_lookup_entity(col,
|
||||
default_budget_guid);
|
||||
}
|
||||
|
||||
/* Revert to 2.2.x behavior if the book has no default budget. */
|
||||
|
@ -64,15 +64,15 @@ struct gnc_lot_s
|
||||
enum
|
||||
{
|
||||
PROP_0,
|
||||
// PROP_ACCOUNT, /* Table */
|
||||
PROP_IS_CLOSED, /* Table */
|
||||
// PROP_ACCOUNT, /* Table */
|
||||
PROP_IS_CLOSED, /* Table */
|
||||
|
||||
PROP_INVOICE, /* KVP */
|
||||
PROP_OWNER_TYPE, /* KVP */
|
||||
PROP_OWNER_GUID, /* KVP */
|
||||
PROP_INVOICE, /* KVP */
|
||||
PROP_OWNER_TYPE, /* KVP */
|
||||
PROP_OWNER_GUID, /* KVP */
|
||||
|
||||
PROP_RUNTIME_0,
|
||||
PROP_MARKER, /* Runtime */
|
||||
PROP_MARKER, /* Runtime */
|
||||
};
|
||||
|
||||
typedef struct LotPrivate
|
||||
@ -138,7 +138,6 @@ gnc_lot_get_property(GObject* object, guint prop_id, GValue* value, GParamSpec*
|
||||
{
|
||||
GNCLot* lot;
|
||||
LotPrivate* priv;
|
||||
KvpFrame *frame;
|
||||
gchar *key;
|
||||
GValue *temp;
|
||||
|
||||
@ -155,17 +154,17 @@ gnc_lot_get_property(GObject* object, guint prop_id, GValue* value, GParamSpec*
|
||||
g_value_set_int(value, priv->marker);
|
||||
break;
|
||||
case PROP_INVOICE:
|
||||
key = GNC_INVOICE_ID "/" GNC_INVOICE_GUID;
|
||||
qof_instance_get_kvp (QOF_INSTANCE (lot), key, value);
|
||||
break;
|
||||
key = GNC_INVOICE_ID "/" GNC_INVOICE_GUID;
|
||||
qof_instance_get_kvp (QOF_INSTANCE (lot), key, value);
|
||||
break;
|
||||
case PROP_OWNER_TYPE:
|
||||
key = GNC_OWNER_ID"/" GNC_OWNER_TYPE;
|
||||
qof_instance_get_kvp (QOF_INSTANCE (lot), key, value);
|
||||
break;
|
||||
key = GNC_OWNER_ID"/" GNC_OWNER_TYPE;
|
||||
qof_instance_get_kvp (QOF_INSTANCE (lot), key, value);
|
||||
break;
|
||||
case PROP_OWNER_GUID:
|
||||
key = GNC_OWNER_ID "/" GNC_OWNER_GUID;
|
||||
qof_instance_get_kvp (QOF_INSTANCE (lot), key, value);
|
||||
break;
|
||||
key = GNC_OWNER_ID "/" GNC_OWNER_GUID;
|
||||
qof_instance_get_kvp (QOF_INSTANCE (lot), key, value);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
|
||||
break;
|
||||
@ -174,20 +173,19 @@ gnc_lot_get_property(GObject* object, guint prop_id, GValue* value, GParamSpec*
|
||||
|
||||
static void
|
||||
gnc_lot_set_property (GObject* object,
|
||||
guint prop_id,
|
||||
const GValue* value,
|
||||
GParamSpec* pspec)
|
||||
guint prop_id,
|
||||
const GValue* value,
|
||||
GParamSpec* pspec)
|
||||
{
|
||||
GNCLot* lot;
|
||||
LotPrivate* priv;
|
||||
KvpFrame *frame;
|
||||
gchar *key = NULL;
|
||||
|
||||
g_return_if_fail(GNC_IS_LOT(object));
|
||||
|
||||
lot = GNC_LOT(object);
|
||||
if (prop_id < PROP_RUNTIME_0)
|
||||
g_assert (qof_instance_get_editlevel(lot));
|
||||
g_assert (qof_instance_get_editlevel(lot));
|
||||
|
||||
priv = GET_PRIVATE(lot);
|
||||
switch (prop_id)
|
||||
@ -199,17 +197,17 @@ gnc_lot_set_property (GObject* object,
|
||||
priv->marker = g_value_get_int(value);
|
||||
break;
|
||||
case PROP_INVOICE:
|
||||
key = GNC_INVOICE_ID"/" GNC_INVOICE_GUID;
|
||||
qof_instance_set_kvp (QOF_INSTANCE (lot), key, value);
|
||||
break;
|
||||
key = GNC_INVOICE_ID"/" GNC_INVOICE_GUID;
|
||||
qof_instance_set_kvp (QOF_INSTANCE (lot), key, value);
|
||||
break;
|
||||
case PROP_OWNER_TYPE:
|
||||
key = GNC_OWNER_ID "/" GNC_OWNER_TYPE;
|
||||
qof_instance_set_kvp (QOF_INSTANCE (lot), key, value);
|
||||
break;
|
||||
key = GNC_OWNER_ID "/" GNC_OWNER_TYPE;
|
||||
qof_instance_set_kvp (QOF_INSTANCE (lot), key, value);
|
||||
break;
|
||||
case PROP_OWNER_GUID:
|
||||
key = GNC_OWNER_ID "/" GNC_OWNER_GUID;
|
||||
qof_instance_set_kvp (QOF_INSTANCE (lot), key, value);
|
||||
break;
|
||||
key = GNC_OWNER_ID "/" GNC_OWNER_GUID;
|
||||
qof_instance_set_kvp (QOF_INSTANCE (lot), key, value);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
|
||||
break;
|
||||
@ -251,28 +249,28 @@ gnc_lot_class_init(GNCLotClass* klass)
|
||||
gobject_class,
|
||||
PROP_INVOICE,
|
||||
g_param_spec_boxed("invoice",
|
||||
"Invoice attached to lot",
|
||||
"Used by GncInvoice",
|
||||
GNC_TYPE_GUID,
|
||||
G_PARAM_READWRITE));
|
||||
"Invoice attached to lot",
|
||||
"Used by GncInvoice",
|
||||
GNC_TYPE_GUID,
|
||||
G_PARAM_READWRITE));
|
||||
|
||||
g_object_class_install_property(
|
||||
gobject_class,
|
||||
PROP_OWNER_TYPE,
|
||||
g_param_spec_int64("owner-type",
|
||||
"Owning Entity Type of lot",
|
||||
"Used by GncOwner",
|
||||
0, G_MAXINT64, 0,
|
||||
G_PARAM_READWRITE));
|
||||
"Owning Entity Type of lot",
|
||||
"Used by GncOwner",
|
||||
0, G_MAXINT64, 0,
|
||||
G_PARAM_READWRITE));
|
||||
|
||||
g_object_class_install_property(
|
||||
gobject_class,
|
||||
PROP_OWNER_GUID,
|
||||
g_param_spec_boxed("owner-guid",
|
||||
"Owner attached to lot",
|
||||
"Used by GncOwner",
|
||||
GNC_TYPE_GUID,
|
||||
G_PARAM_READWRITE));
|
||||
"Owner attached to lot",
|
||||
"Used by GncOwner",
|
||||
GNC_TYPE_GUID,
|
||||
G_PARAM_READWRITE));
|
||||
}
|
||||
|
||||
GNCLot *
|
||||
@ -436,38 +434,46 @@ gint gnc_lot_count_splits (const GNCLot *lot)
|
||||
const char *
|
||||
gnc_lot_get_title (const GNCLot *lot)
|
||||
{
|
||||
GValue v = G_VALUE_INIT;
|
||||
if (!lot) return NULL;
|
||||
return kvp_frame_get_string (qof_instance_get_slots(QOF_INSTANCE (lot)),
|
||||
"/title");
|
||||
g_value_init (&v, G_TYPE_STRING);
|
||||
qof_instance_get_kvp (QOF_INSTANCE (lot), "/title", &v);
|
||||
return g_value_get_string (&v);
|
||||
}
|
||||
|
||||
const char *
|
||||
gnc_lot_get_notes (const GNCLot *lot)
|
||||
{
|
||||
GValue v = G_VALUE_INIT;
|
||||
if (!lot) return NULL;
|
||||
return kvp_frame_get_string (qof_instance_get_slots(QOF_INSTANCE (lot)),
|
||||
"/notes");
|
||||
g_value_init (&v, G_TYPE_STRING);
|
||||
qof_instance_get_kvp (QOF_INSTANCE (lot), "/notes", &v);
|
||||
return g_value_get_string (&v);
|
||||
}
|
||||
|
||||
void
|
||||
gnc_lot_set_title (GNCLot *lot, const char *str)
|
||||
{
|
||||
GValue v = G_VALUE_INIT;
|
||||
if (!lot) return;
|
||||
qof_begin_edit(QOF_INSTANCE(lot));
|
||||
g_value_init (&v, G_TYPE_STRING);
|
||||
g_value_set_string (&v, str);
|
||||
qof_instance_set_kvp (QOF_INSTANCE (lot), "/title", &v);
|
||||
qof_instance_set_dirty(QOF_INSTANCE(lot));
|
||||
kvp_frame_set_string (qof_instance_get_slots(QOF_INSTANCE (lot)),
|
||||
"/title", str);
|
||||
gnc_lot_commit_edit(lot);
|
||||
}
|
||||
|
||||
void
|
||||
gnc_lot_set_notes (GNCLot *lot, const char *str)
|
||||
{
|
||||
GValue v = G_VALUE_INIT;
|
||||
if (!lot) return;
|
||||
gnc_lot_begin_edit(lot);
|
||||
qof_begin_edit(QOF_INSTANCE(lot));
|
||||
g_value_init (&v, G_TYPE_STRING);
|
||||
g_value_set_string (&v, str);
|
||||
qof_instance_set_kvp (QOF_INSTANCE (lot), "/notes", &v);
|
||||
qof_instance_set_dirty(QOF_INSTANCE(lot));
|
||||
kvp_frame_set_string (qof_instance_get_slots (QOF_INSTANCE (lot)),
|
||||
"/notes", str);
|
||||
gnc_lot_commit_edit(lot);
|
||||
}
|
||||
|
||||
|
@ -73,13 +73,13 @@ void mark_job (GncJob *job)
|
||||
enum
|
||||
{
|
||||
PROP_0,
|
||||
// PROP_ID, /* Table */
|
||||
PROP_NAME, /* Table */
|
||||
// PROP_REFERENCE, /* Table */
|
||||
// PROP_ACTIVE, /* Table */
|
||||
// PROP_OWNER_TYPE, /* Table */
|
||||
// PROP_OWNER, /* Table */
|
||||
PROP_PDF_DIRNAME, /* KVP */
|
||||
// PROP_ID, /* Table */
|
||||
PROP_NAME, /* Table */
|
||||
// PROP_REFERENCE, /* Table */
|
||||
// PROP_ACTIVE, /* Table */
|
||||
// PROP_OWNER_TYPE, /* Table */
|
||||
// PROP_OWNER, /* Table */
|
||||
PROP_PDF_DIRNAME, /* KVP */
|
||||
};
|
||||
|
||||
/* GObject Initialization */
|
||||
@ -120,9 +120,9 @@ gnc_job_get_property (GObject *object,
|
||||
g_value_set_string(value, job->name);
|
||||
break;
|
||||
case PROP_PDF_DIRNAME:
|
||||
key = OWNER_EXPORT_PDF_DIRNAME;
|
||||
qof_instance_get_kvp (QOF_INSTANCE (job), key, value);
|
||||
break;
|
||||
key = OWNER_EXPORT_PDF_DIRNAME;
|
||||
qof_instance_get_kvp (QOF_INSTANCE (job), key, value);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
|
||||
break;
|
||||
@ -149,9 +149,9 @@ gnc_job_set_property (GObject *object,
|
||||
gncJobSetName(job, g_value_get_string(value));
|
||||
break;
|
||||
case PROP_PDF_DIRNAME:
|
||||
key = OWNER_EXPORT_PDF_DIRNAME;
|
||||
qof_instance_set_kvp (QOF_INSTANCE (job), key, value);
|
||||
break;
|
||||
key = OWNER_EXPORT_PDF_DIRNAME;
|
||||
qof_instance_set_kvp (QOF_INSTANCE (job), key, value);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
|
||||
break;
|
||||
@ -204,10 +204,10 @@ gnc_job_class_init (GncJobClass *klass)
|
||||
g_param_spec_string ("export-pdf-dir",
|
||||
"Export PDF Directory Name",
|
||||
"A subdirectory for exporting PDF reports which is "
|
||||
"appended to the target directory when writing them "
|
||||
"out. It is retrieved from preferences and stored on "
|
||||
"each 'Owner' object which prints items after "
|
||||
"printing.",
|
||||
"appended to the target directory when writing them "
|
||||
"out. It is retrieved from preferences and stored on "
|
||||
"each 'Owner' object which prints items after "
|
||||
"printing.",
|
||||
NULL,
|
||||
G_PARAM_READWRITE));
|
||||
}
|
||||
@ -314,16 +314,15 @@ void gncJobSetRate (GncJob *job, gnc_numeric rate)
|
||||
|
||||
gncJobBeginEdit (job);
|
||||
if (!gnc_numeric_zero_p(rate))
|
||||
kvp_frame_set_numeric(job->inst.kvp_data, GNC_JOB_RATE, rate);
|
||||
{
|
||||
GValue v = G_VALUE_INIT;
|
||||
g_value_init (&v, GNC_TYPE_NUMERIC);
|
||||
g_value_set_boxed (&v, &rate);
|
||||
qof_instance_set_kvp (QOF_INSTANCE (job), GNC_JOB_RATE, &v);
|
||||
}
|
||||
else
|
||||
{
|
||||
KvpFrame *frame;
|
||||
KvpValue *value;
|
||||
|
||||
value = NULL;
|
||||
frame = kvp_frame_set_value_nc (job->inst.kvp_data,
|
||||
GNC_JOB_RATE, value);
|
||||
if (!frame) kvp_value_delete (value);
|
||||
qof_instance_set_kvp (QOF_INSTANCE (job), GNC_JOB_RATE, NULL);
|
||||
}
|
||||
mark_job (job);
|
||||
gncJobCommitEdit (job);
|
||||
@ -423,7 +422,7 @@ static void gncJobOnDone (QofInstance *qof) { }
|
||||
void gncJobCommitEdit (GncJob *job)
|
||||
{
|
||||
/* GnuCash 2.6.3 and earlier didn't handle job kvp's... */
|
||||
if (!kvp_frame_is_empty (job->inst.kvp_data))
|
||||
if (qof_instance_has_kvp (QOF_INSTANCE (job)))
|
||||
gnc_features_set_used (qof_instance_get_book (QOF_INSTANCE (job)), GNC_FEATURE_KVP_EXTRA_DATA);
|
||||
|
||||
if (!qof_commit_edit (QOF_INSTANCE(job))) return;
|
||||
@ -454,8 +453,15 @@ const char * gncJobGetReference (const GncJob *job)
|
||||
|
||||
gnc_numeric gncJobGetRate (const GncJob *job)
|
||||
{
|
||||
GValue v = G_VALUE_INIT;
|
||||
gnc_numeric *rate;
|
||||
if (!job) return gnc_numeric_zero ();
|
||||
return kvp_frame_get_numeric(job->inst.kvp_data, GNC_JOB_RATE);
|
||||
g_value_init (&v, GNC_TYPE_NUMERIC);
|
||||
qof_instance_get_kvp (QOF_INSTANCE (job), GNC_JOB_RATE, &v);
|
||||
rate = (gnc_numeric*)g_value_get_boxed (&v);
|
||||
if (rate)
|
||||
return *rate;
|
||||
return gnc_numeric_zero();
|
||||
}
|
||||
|
||||
GncOwner * gncJobGetOwner (GncJob *job)
|
||||
|
Loading…
Reference in New Issue
Block a user