diff --git a/ChangeLog b/ChangeLog index b6d32ea53a..cdb73efa03 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,18 @@ +2001-07-12 Dave Peticolas + + * src/gnome/druid-stock-split.c: remove share api + + * src/engine/Account.[ch]: remove 'share' api and other + unused api. + + * src/scm/qif-import/qif-to-gnc.scm: remove share api + + * src/guile/gnc.gwp: remove share api + + * src/gnome/window-reconcile.c: remove share api + + * src/gnome/window-register.c: remove share api + 2001-07-11 Dave Peticolas * src/engine/io-gncxml-v2.c: same as below diff --git a/src/engine/Account.c b/src/engine/Account.c index 04a428a21a..89abe092cd 100644 --- a/src/engine/Account.c +++ b/src/engine/Account.c @@ -1314,42 +1314,6 @@ DxaccAccountGetSecurity (Account *acc) return gnc_commodity_table_lookup_unique (gnc_engine_commodities (), s); } -double -DxaccAccountGetBalance (Account *acc) -{ - return gnc_numeric_to_double(xaccAccountGetBalance(acc)); -} - -double -DxaccAccountGetClearedBalance (Account *acc) -{ - return gnc_numeric_to_double(xaccAccountGetClearedBalance(acc)); -} - -double -DxaccAccountGetReconciledBalance (Account *acc) -{ - return gnc_numeric_to_double(xaccAccountGetReconciledBalance(acc)); -} - -double -DxaccAccountGetShareBalance (Account *acc) -{ - return gnc_numeric_to_double(xaccAccountGetShareBalance(acc)); -} - -double -DxaccAccountGetShareClearedBalance (Account *acc) -{ - return gnc_numeric_to_double(xaccAccountGetShareClearedBalance(acc)); -} - -double -DxaccAccountGetShareReconciledBalance (Account *acc) -{ - return gnc_numeric_to_double(xaccAccountGetShareReconciledBalance(acc)); -} - gnc_numeric xaccAccountGetBalance (Account *acc) { if (!acc) return gnc_numeric_zero(); @@ -1370,52 +1334,24 @@ xaccAccountGetReconciledBalance (Account *acc) return acc->reconciled_balance; } -gnc_numeric -xaccAccountGetShareBalance (Account *acc) -{ - if (!acc) return gnc_numeric_zero(); - return acc->balance; -} - -gnc_numeric -xaccAccountGetShareClearedBalance (Account *acc) -{ - if (!acc) return gnc_numeric_zero(); - return acc->cleared_balance; -} - -gnc_numeric -xaccAccountGetShareReconciledBalance (Account *acc) -{ - if (!acc) return gnc_numeric_zero(); - return acc->reconciled_balance; -} - /********************************************************************\ \********************************************************************/ -static gnc_numeric -get_balance_as_of_date (Account *acc, time_t date, gboolean use_shares) +gnc_numeric +xaccAccountGetBalanceAsOfDate (Account *acc, time_t date) { - /* This is common code to handle both xaccAccountGetBalanceAsOfDate - * and xaccAccountGetShareBalanceAsOfDate. use_shares is TRUE if the - * share balance is being requested. - */ - /* Ideally this could use xaccAccountForEachSplit, but * it doesn't exist yet and I'm uncertain of exactly how * it would work at this time, since it differs from * xaccAccountForEachTransaction by using gpointer return * values rather than gbooleans. */ - GList *lp; Timespec ts, trans_ts; gboolean found = FALSE; gnc_numeric balance; - - balance = use_shares ? - xaccAccountGetShareBalance( acc ) : xaccAccountGetBalance( acc ); + + balance = xaccAccountGetBalance( acc ); xaccAccountSortSplits( acc ); /* just in case, normally a nop */ @@ -1454,9 +1390,7 @@ get_balance_as_of_date (Account *acc, time_t date, gboolean use_shares) /* Since lp is now pointing to a split which was past the reconcile * date, get the running balance of the previous split. */ - balance = use_shares ? - xaccSplitGetShareBalance( (Split *)lp->prev->data ) : - xaccSplitGetBalance( (Split *)lp->prev->data ); + balance = xaccSplitGetBalance( (Split *)lp->prev->data ); } /* Otherwise there were no splits posted after the given date, @@ -1466,43 +1400,15 @@ get_balance_as_of_date (Account *acc, time_t date, gboolean use_shares) return( balance ); } -gnc_numeric -xaccAccountGetBalanceAsOfDate (Account *acc, time_t date) -{ - return( get_balance_as_of_date( acc, date, FALSE ) ); -} - -gnc_numeric -xaccAccountGetShareBalanceAsOfDate (Account *acc, time_t date) -{ - return( get_balance_as_of_date( acc, date, TRUE ) ); -} - /********************************************************************\ \********************************************************************/ -Split * -xaccAccountGetSplit(Account *acc, int i) { - GList *result; - - if (!acc) return(NULL); - result = g_list_nth(acc->splits, i); - if(!result) return(NULL); - return((Split *) result->data); -} - GList * xaccAccountGetSplitList (Account *acc) { if (!acc) return NULL; return (acc->splits); } -int -xaccAccountGetNumSplits (Account *acc) { - if (!acc) return 0; - return g_list_length(acc->splits); -} - /********************************************************************\ \********************************************************************/ diff --git a/src/engine/Account.h b/src/engine/Account.h index 66885964a7..032c4d5700 100644 --- a/src/engine/Account.h +++ b/src/engine/Account.h @@ -226,27 +226,11 @@ AccountGroup * xaccAccountGetChildren (Account *account); AccountGroup * xaccAccountGetParent (Account *account); Account * xaccAccountGetParentAccount (Account *account); -/* deprecated old double API : this will go away! */ -double DxaccAccountGetBalance (Account *account); -double DxaccAccountGetClearedBalance (Account *account); -double DxaccAccountGetReconciledBalance (Account *account); -double DxaccAccountGetShareBalance (Account *account); -double DxaccAccountGetShareClearedBalance (Account *account); -double DxaccAccountGetShareReconciledBalance (Account *account); - gnc_numeric xaccAccountGetBalance (Account *account); gnc_numeric xaccAccountGetClearedBalance (Account *account); gnc_numeric xaccAccountGetReconciledBalance (Account *account); -gnc_numeric xaccAccountGetShareBalance (Account *account); -gnc_numeric xaccAccountGetShareClearedBalance (Account *account); -gnc_numeric xaccAccountGetShareReconciledBalance (Account *account); gnc_numeric xaccAccountGetBalanceAsOfDate (Account *account, time_t date); -gnc_numeric xaccAccountGetShareBalanceAsOfDate (Account *account, - time_t date); - -Split * xaccAccountGetSplit (Account *account, int i); -int xaccAccountGetNumSplits (Account *account); GList* xaccAccountGetSplitList (Account *account); @@ -275,13 +259,6 @@ void xaccAccountSetTaxUSPayerNameSource (Account *account, */ char * xaccAccountGetFullName (Account *account, const char separator); -/* xaccAccountsHaveCommonCurrency returns true if the two given accounts - * have a currency in common, i.e., if they can have common transactions. - * Useful for UI sanity checks. - */ -gboolean xaccAccountsHaveCommonCurrency(Account *account_1, - Account *account_2); - /* Returns true if the account has 'ancestor' as an ancestor. * Returns false if either is NULL. */ gboolean xaccAccountHasAncestor (Account *account, Account *ancestor); diff --git a/src/gnome/druid-stock-split.c b/src/gnome/druid-stock-split.c index 31493bf9ea..2713a790a9 100644 --- a/src/gnome/druid-stock-split.c +++ b/src/gnome/druid-stock-split.c @@ -110,7 +110,7 @@ fill_account_list (StockSplitInfo *info, Account *account) account_type != MUTUAL) continue; - balance = xaccAccountGetShareBalance (account); + balance = xaccAccountGetBalance (account); if (gnc_numeric_zero_p (balance)) continue; diff --git a/src/gnome/window-reconcile.c b/src/gnome/window-reconcile.c index b03d0662b4..cf14cc2de9 100644 --- a/src/gnome/window-reconcile.c +++ b/src/gnome/window-reconcile.c @@ -122,7 +122,6 @@ typedef struct _startRecnWindowData { Account *account; /* the account being reconciled */ GNCAccountType account_type; /* the type of the account */ - gboolean use_shares; /* whether to use shares for the account */ GtkWidget *startRecnWindow; /* the startRecnWindow dialog */ GtkWidget *xfer_button; /* the dialog's interest transfer button */ @@ -320,7 +319,7 @@ gnc_start_recn_date_changed (GtkWidget *widget, startRecnWindowData *data) new_date = gnc_date_edit_get_date_end (gde); /* get the balance for the account as of the new date */ - xaccAccountGetBalanceAsOfDate (data->account, new_date); + new_balance = xaccAccountGetBalanceAsOfDate (data->account, new_date); /* use the correct sign */ if (gnc_reverse_balance (data->account)) @@ -508,10 +507,7 @@ gnc_reconcile_interest_xfer_run(startRecnWindowData *data) recnInterestXferWindow( data ); /* recompute the ending balance */ - if (data->use_shares) - after = xaccAccountGetShareBalanceAsOfDate(data->account, data->date); - else - after = xaccAccountGetBalanceAsOfDate(data->account, data->date); + after = xaccAccountGetBalanceAsOfDate(data->account, data->date); /* update the ending balance in the startRecnWindow if it has changed. */ if( gnc_numeric_compare( before, after ) ) @@ -580,7 +576,7 @@ startRecnWindow(GtkWidget *parent, Account *account, auto_interest_xfer_option = gnc_recn_interest_xfer_get_auto_interest_xfer_allowed( account ); - ending = xaccAccountGetShareReconciledBalance(account); + ending = xaccAccountGetReconciledBalance(account); print_info = gnc_account_print_info (account, TRUE); if (gnc_reverse_balance(account)) @@ -2056,7 +2052,7 @@ find_payment_account(Account *account) continue; /* ignore 'purchases' */ - if (!gnc_numeric_positive_p (xaccSplitGetShareAmount(split))) + if (!gnc_numeric_positive_p (xaccSplitGetAmount(split))) continue; trans = xaccSplitGetParent(split); diff --git a/src/gnome/window-register.c b/src/gnome/window-register.c index 02240c0a8b..20969215e5 100644 --- a/src/gnome/window-register.c +++ b/src/gnome/window-register.c @@ -2370,7 +2370,7 @@ gnc_register_redraw_all_cb (GnucashRegister *g_reg, gpointer data) { print_info = gnc_account_print_info (leader, TRUE); - amount = xaccAccountGetShareBalance (leader); + amount = xaccAccountGetBalance (leader); if (reverse) amount = gnc_numeric_neg (amount); @@ -2397,7 +2397,7 @@ gnc_register_redraw_all_cb (GnucashRegister *g_reg, gpointer data) print_info = gnc_commodity_print_info (currency, TRUE); - amount = xaccAccountGetShareBalance (leader); + amount = xaccAccountGetBalance (leader); if (reverse) amount = gnc_numeric_neg (amount); diff --git a/src/scm/qif-import/qif-to-gnc.scm b/src/scm/qif-import/qif-to-gnc.scm index 015e43cac5..db9b4df03c 100644 --- a/src/scm/qif-import/qif-to-gnc.scm +++ b/src/scm/qif-import/qif-to-gnc.scm @@ -595,7 +595,7 @@ ((stksplit) (let* ((splitratio (n/ num-shares (gnc:numeric-create 10 1))) (in-shares - (gnc:account-get-share-balance near-acct)) + (gnc:account-get-balance near-acct)) (out-shares (n* in-shares splitratio))) (gnc:split-set-share-amount gnc-near-split out-shares) (gnc:split-set-share-amount gnc-far-split (n- in-shares))