From 929bca04c574420198e9a3ddede0eae1f5b67ef2 Mon Sep 17 00:00:00 2001 From: Linas Vepstas Date: Sun, 21 Sep 2003 20:43:52 +0000 Subject: [PATCH] tweaks; add wrappers for lot title, lot notes git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@9392 57a11ea4-9604-0410-9ed3-97b8803252fd --- src/engine/cap-gains.c | 2 ++ src/engine/gnc-lot.c | 31 +++++++++++++++++++++++++++++++ src/engine/gnc-lot.h | 8 +++++++- 3 files changed, 40 insertions(+), 1 deletion(-) diff --git a/src/engine/cap-gains.c b/src/engine/cap-gains.c index 3c9f6692cb..af16372c83 100644 --- a/src/engine/cap-gains.c +++ b/src/engine/cap-gains.c @@ -145,6 +145,7 @@ xaccAccountFindEarliestOpenLot (Account *acc, gnc_numeric sign) { struct early_lot_s es; + ENTER (" sign=%lld/%lld", sign.num, sign.denom); es.lot = NULL; es.ts.tv_sec = 10000000LL * ((long long) LONG_MAX); es.ts.tv_nsec = 0; @@ -153,6 +154,7 @@ xaccAccountFindEarliestOpenLot (Account *acc, gnc_numeric sign) else es.numeric_pred = gnc_numeric_positive_p; xaccAccountForEachLot (acc, earliest_helper, &es); + LEAVE ("found lot=%p %s", es.lot, gnc_lot_get_title (es.lot)); return es.lot; } diff --git a/src/engine/gnc-lot.c b/src/engine/gnc-lot.c index ba28608d48..54c945463c 100644 --- a/src/engine/gnc-lot.c +++ b/src/engine/gnc-lot.c @@ -186,6 +186,37 @@ gint gnc_lot_count_splits (GNCLot *lot) return g_list_length (lot->splits); } +/* ============================================================== */ +/* Hmm, we should probably inline these. */ + +const char * +gnc_lot_get_title (GNCLot *lot) +{ + if (!lot) return NULL; + return kvp_frame_get_string (lot->kvp_data, "/title"); +} + +const char * +gnc_lot_get_notes (GNCLot *lot) +{ + if (!lot) return NULL; + return kvp_frame_get_string (lot->kvp_data, "/notes"); +} + +void +gnc_lot_set_title (GNCLot *lot, const char *str) +{ + if (!lot) return; + return kvp_frame_set_str (lot->kvp_data, "/title", str); +} + +void +gnc_lot_set_notes (GNCLot *lot, const char *str) +{ + if (!lot) return; + return kvp_frame_set_str (lot->kvp_data, "/notes", str); +} + /* ============================================================= */ gnc_numeric diff --git a/src/engine/gnc-lot.h b/src/engine/gnc-lot.h index 7e50fe33f8..dae01330fc 100644 --- a/src/engine/gnc-lot.h +++ b/src/engine/gnc-lot.h @@ -103,8 +103,14 @@ Split * gnc_lot_get_earliest_split (GNCLot *lot); */ Split * gnc_lot_get_latest_split (GNCLot *lot); +/** Get and set the account title, or the account notes. */ +const char * gnc_lot_get_title (GNCLot *); +const char * gnc_lot_get_notes (GNCLot *); +void gnc_lot_set_title (GNCLot *, const char *); +void gnc_lot_set_notes (GNCLot *, const char *); + /** Every lot has a place to hang kvp data. This routine returns that - * place. + * place. * */ KvpFrame * gnc_lot_get_slots (GNCLot *);