diff --git a/ChangeLog b/ChangeLog index 06a8e331c2..034a045c04 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2004-03-14 Joshua Sled + + * src/gnome/druid-loan.c (gnc_ui_sx_loan_druid_create): Use the + account-list filtering capability of the GncAccountSel to only + show/allow-creation-of valid account-types in the + loan-druid. Fixes Bug#124595. + 2004-03-13 Joshua Sled * src/gnome/dialog-scheduledxaction.c (gnc_sxed_check_consistent): diff --git a/src/gnome/druid-loan.c b/src/gnome/druid-loan.c index 14494aeb49..fce97ec254 100644 --- a/src/gnome/druid-loan.c +++ b/src/gnome/druid-loan.c @@ -416,6 +416,39 @@ gnc_ui_sx_loan_druid_create(void) /* non-gladeable widget setup */ { + int i; + // LIABILITY + GList *liabilityAcct; + // BANK, CASH, CREDIT, ASSET + LIABILITY + GList *paymentFromAccts; + // EXPENSE, LIABILITY, + payment-froms. + GList *paymentToAccts; + int fromLen = 5; + GNCAccountType paymentFroms[] = { BANK, CASH, CREDIT, ASSET, LIABILITY }; + int toLen = 2; + GNCAccountType paymentTos[] = { EXPENSE }; + + liabilityAcct = NULL; + paymentFromAccts = NULL; + paymentToAccts = NULL; + + liabilityAcct = g_list_append( liabilityAcct, + GINT_TO_POINTER( LIABILITY ) ); + for ( i = 0; i < fromLen; i++ ) + { + paymentFromAccts + = g_list_append( paymentFromAccts, + GINT_TO_POINTER( paymentFroms[i] ) ); + paymentToAccts + = g_list_append( paymentToAccts, + GINT_TO_POINTER( paymentFroms[i] ) ); + } + + for ( i = 0; i < toLen; i++ ) + { + paymentToAccts = g_list_append( paymentToAccts, + GINT_TO_POINTER( paymentTos[i] ) ); + } /* All of the GncAccountSel[ectors]... */ { @@ -427,16 +460,17 @@ gnc_ui_sx_loan_druid_create(void) GtkTable *table; gboolean newAcctAbility; int left, right, top, bottom; + GList *allowableAccounts; } gas_data[] = { /* These ints are the GtkTable boundries */ - { &ldd->prmAccountGAS, ldd->prmTable, TRUE, 1, 4, 0, 1 }, - { &ldd->repAssetsFromGAS, ldd->repTable, TRUE, 1, 4, 2, 3 }, - { &ldd->repPrincToGAS, ldd->repTable, TRUE, 1, 2, 3, 4 }, - { &ldd->repIntToGAS, ldd->repTable, TRUE, 3, 4, 3, 4 }, - { &ldd->payAcctFromGAS, ldd->payTable, TRUE, 1, 2, 4, 5 }, - { &ldd->payAcctEscToGAS, ldd->payTable, FALSE, 3, 4, 4, 5 }, - { &ldd->payAcctEscFromGAS, ldd->payTable, FALSE, 1, 2, 5, 6 }, - { &ldd->payAcctToGAS, ldd->payTable, TRUE, 3, 4, 5, 6 }, + { &ldd->prmAccountGAS, ldd->prmTable, TRUE, 1, 4, 0, 1, liabilityAcct }, + { &ldd->repAssetsFromGAS, ldd->repTable, TRUE, 1, 4, 2, 3, paymentFromAccts }, + { &ldd->repPrincToGAS, ldd->repTable, TRUE, 1, 2, 3, 4, paymentToAccts }, + { &ldd->repIntToGAS, ldd->repTable, TRUE, 3, 4, 3, 4, paymentToAccts }, + { &ldd->payAcctFromGAS, ldd->payTable, TRUE, 1, 2, 4, 5, paymentFromAccts }, + { &ldd->payAcctEscToGAS, ldd->payTable, FALSE, 3, 4, 4, 5, paymentToAccts }, + { &ldd->payAcctEscFromGAS, ldd->payTable, FALSE, 1, 2, 5, 6, paymentFromAccts }, + { &ldd->payAcctToGAS, ldd->payTable, TRUE, 3, 4, 5, 6, paymentToAccts }, { NULL } }; @@ -456,6 +490,10 @@ gnc_ui_sx_loan_druid_create(void) gas = GNC_ACCOUNT_SEL(gnc_account_sel_new()); gnc_account_sel_set_new_account_ability( gas, gas_data[i].newAcctAbility ); + if ( gas_data[i].allowableAccounts != NULL ) { + gnc_account_sel_set_acct_filters( + gas, gas_data[i].allowableAccounts ); + } gtk_container_add( GTK_CONTAINER(a), GTK_WIDGET(gas) ); gtk_table_attach( gas_data[i].table,