From 773b070345bf479afba3b907ed48c1fd47fb589e Mon Sep 17 00:00:00 2001 From: John Ralls Date: Mon, 23 Jul 2018 12:00:12 -0700 Subject: [PATCH] Don't set transaction properties via scheme in C code. --- gnucash/register/ledger-core/split-register.c | 10 +- libgnucash/app-utils/guile-util.c | 99 ------------------- libgnucash/app-utils/guile-util.h | 4 - 3 files changed, 5 insertions(+), 108 deletions(-) diff --git a/gnucash/register/ledger-core/split-register.c b/gnucash/register/ledger-core/split-register.c index f534f28e10..9e3beac971 100644 --- a/gnucash/register/ledger-core/split-register.c +++ b/gnucash/register/ledger-core/split-register.c @@ -1386,7 +1386,7 @@ gnc_split_register_save_to_scm (SplitRegister *reg, time64 time; cell = gnc_table_layout_get_cell (reg->table->layout, DATE_CELL); gnc_date_cell_get_date ((DateCell *) cell, &time); - gnc_trans_scm_set_date(trans_scm, time); + xaccTransSetDatePostedSecsNormalized(trans, time); } if (gnc_table_layout_get_cell_changed (reg->table->layout, NUM_CELL, TRUE)) @@ -1395,7 +1395,7 @@ gnc_split_register_save_to_scm (SplitRegister *reg, value = gnc_table_layout_get_cell_value (reg->table->layout, NUM_CELL); if (reg->use_tran_num_for_num_field) - gnc_trans_scm_set_num (trans_scm, value); + xaccTransSetNum (trans, value); /* else this contains the same as ACTN_CELL which is already handled below * * and the TNUM_CELL contains transaction number which is handled in next * * if statement. */ @@ -1407,7 +1407,7 @@ gnc_split_register_save_to_scm (SplitRegister *reg, value = gnc_table_layout_get_cell_value (reg->table->layout, TNUM_CELL); if (!reg->use_tran_num_for_num_field) - gnc_trans_scm_set_num (trans_scm, value); + xaccTransSetNum (trans, value); /* else this cell is not used */ } @@ -1416,7 +1416,7 @@ gnc_split_register_save_to_scm (SplitRegister *reg, const char *value; value = gnc_table_layout_get_cell_value (reg->table->layout, DESC_CELL); - gnc_trans_scm_set_description (trans_scm, value); + xaccTransSetDescription (trans, value); } if (gnc_table_layout_get_cell_changed (reg->table->layout, NOTES_CELL, TRUE)) @@ -1424,7 +1424,7 @@ gnc_split_register_save_to_scm (SplitRegister *reg, const char *value; value = gnc_table_layout_get_cell_value (reg->table->layout, NOTES_CELL); - gnc_trans_scm_set_notes (trans_scm, value); + xaccTransSetNotes (trans, value); } if (gnc_table_layout_get_cell_changed (reg->table->layout, RECN_CELL, TRUE)) diff --git a/libgnucash/app-utils/guile-util.c b/libgnucash/app-utils/guile-util.c index 1d2b00ab5a..2628919854 100644 --- a/libgnucash/app-utils/guile-util.c +++ b/libgnucash/app-utils/guile-util.c @@ -699,105 +699,6 @@ gnc_copy_trans_scm_onto_trans_swap_accounts(SCM trans_scm, } } -/********************************************************************\ - * gnc_trans_scm_set_date * - * set the date of a scheme transaction. * - * * - * Args: trans_scm - the scheme transaction * - * ts - the time to set * - * Returns: Nothing * -\********************************************************************/ -void -gnc_trans_scm_set_date(SCM trans_scm, time64 time) -{ - SCM arg; - Timespec ts = {time, 0}; - initialize_scm_functions(); - if (!gnc_is_trans_scm(trans_scm)) - return; - arg = gnc_timespec2timepair(ts); - scm_call_2(setters.trans_scm_date, trans_scm, arg); -} - - -/********************************************************************\ - * gnc_trans_scm_set_num * - * set the num of a scheme transaction. * - * * - * Args: trans_scm - the scheme transaction * - * num - the num to set * - * Returns: Nothing * -\********************************************************************/ -void -gnc_trans_scm_set_num(SCM trans_scm, const char *num) -{ - SCM arg; - - initialize_scm_functions(); - - if (!gnc_is_trans_scm(trans_scm)) - return; - if (num == NULL) - return; - - arg = scm_from_utf8_string(num); - - scm_call_2(setters.trans_scm_num, trans_scm, arg); -} - - -/********************************************************************\ - * gnc_trans_scm_set_description * - * set the description of a scheme transaction. * - * * - * Args: trans_scm - the scheme transaction * - * description - the description to set * - * Returns: Nothing * -\********************************************************************/ -void -gnc_trans_scm_set_description(SCM trans_scm, const char *description) -{ - SCM arg; - - initialize_scm_functions(); - - if (!gnc_is_trans_scm(trans_scm)) - return; - if (description == NULL) - return; - - arg = scm_from_utf8_string(description); - - scm_call_2(setters.trans_scm_description, trans_scm, arg); -} - - -/********************************************************************\ - * gnc_trans_scm_set_notes * - * set the notes of a scheme transaction. * - * * - * Args: trans_scm - the scheme transaction * - * notes - the notes to set * - * Returns: Nothing * -\********************************************************************/ -void -gnc_trans_scm_set_notes(SCM trans_scm, const char *notes) -{ - SCM arg; - - initialize_scm_functions(); - - if (!gnc_is_trans_scm(trans_scm)) - return; - if (notes == NULL) - return; - - arg = scm_from_utf8_string(notes); - - scm_call_2(setters.trans_scm_notes, trans_scm, arg); -} - - /********************************************************************\ * gnc_trans_scm_append_split_scm * * append the scheme split onto the scheme transaction * diff --git a/libgnucash/app-utils/guile-util.h b/libgnucash/app-utils/guile-util.h index 9623172fbb..f95d38e887 100644 --- a/libgnucash/app-utils/guile-util.h +++ b/libgnucash/app-utils/guile-util.h @@ -68,10 +68,6 @@ void gnc_copy_trans_scm_onto_trans_swap_accounts(SCM trans_scm, gboolean do_commit, QofBook *book); -void gnc_trans_scm_set_date(SCM trans_scm, time64 time); -void gnc_trans_scm_set_num(SCM trans_scm, const char *num); -void gnc_trans_scm_set_description(SCM trans_scm, const char *description); -void gnc_trans_scm_set_notes(SCM trans_scm, const char *notes); void gnc_trans_scm_append_split_scm(SCM trans_scm, SCM split_scm); SCM gnc_trans_scm_get_split_scm(SCM trans_scm, int index);