From 41bfcb956af6bdfc4235d062f871620f7a7a8d9d Mon Sep 17 00:00:00 2001 From: Dave Peticolas Date: Sun, 24 Jun 2001 22:28:59 +0000 Subject: [PATCH] 2001-06-24 Kevin Finn * src/gnome/dialog-transfer.[ch]: reformatted my previous changes to 80 cols. Added interface to specify whether description quickfill will be based on From or To account splits. Enhance quickfill to also select the appropriate account in the account tree for the matched transaction. * src/gnome/window-reconcile.c: reformatted my previous changes to 80 cols. Change the auto interest xfer dialog so that it quickfills based on the reconcile account, rather than always on the From account. git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@4777 57a11ea4-9604-0410-9ed3-97b8803252fd --- ChangeLog | 13 +++ src/gnome/dialog-transfer.c | 174 +++++++++++++++++++++++++++-------- src/gnome/dialog-transfer.h | 12 ++- src/gnome/window-reconcile.c | 104 +++++++++++++-------- 4 files changed, 223 insertions(+), 80 deletions(-) diff --git a/ChangeLog b/ChangeLog index a9e383649f..4e23fb9489 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +2001-06-24 Kevin Finn + + * src/gnome/dialog-transfer.[ch]: reformatted my previous changes + to 80 cols. Added interface to specify whether description + quickfill will be based on From or To account splits. Enhance + quickfill to also select the appropriate account in the account + tree for the matched transaction. + + * src/gnome/window-reconcile.c: reformatted my previous changes to + 80 cols. Change the auto interest xfer dialog so that it + quickfills based on the reconcile account, rather than always on + the From account. + 2001-06-24 Dave Peticolas * AUTHORS: credits diff --git a/src/gnome/dialog-transfer.c b/src/gnome/dialog-transfer.c index a6ad85ebfb..676563df00 100644 --- a/src/gnome/dialog-transfer.c +++ b/src/gnome/dialog-transfer.c @@ -68,8 +68,10 @@ struct _xferDialog GNCAccountTree * from; GNCAccountTree * to; - QuickFill * qf; /* Quickfill on transfer descriptions, - loading matches from the "From" account. */ + QuickFill * qf; /* Quickfill on transfer descriptions, + defaults to matching on the "From" account. */ + + gboolean quickfill_to; /* match on the "To" account instead. */ /* stored data for the description quickfill functionality */ gint desc_start_selection; @@ -362,7 +364,14 @@ gnc_xfer_dialog_reload_quickfill( XferDialog *xferData ) GList *splitlist, *node; Split *split; Transaction *trans; - Account *account = gnc_account_tree_get_current_account(GNC_ACCOUNT_TREE(xferData->from)); + Account *account; + + if( xferData->quickfill_to ) + account = gnc_account_tree_get_current_account( + GNC_ACCOUNT_TREE(xferData->to)); + else + account = gnc_account_tree_get_current_account( + GNC_ACCOUNT_TREE(xferData->from)); /* get a new QuickFill to use */ gnc_quickfill_destroy( xferData->qf ); @@ -374,7 +383,8 @@ gnc_xfer_dialog_reload_quickfill( XferDialog *xferData ) { split = node->data; trans = xaccSplitGetParent( split ); - gnc_quickfill_insert( xferData->qf, xaccTransGetDescription (trans), QUICKFILL_LIFO); + gnc_quickfill_insert( xferData->qf, + xaccTransGetDescription (trans), QUICKFILL_LIFO); } } @@ -401,8 +411,9 @@ gnc_xfer_dialog_from_tree_select_cb(GNCAccountTree *tree, gnc_amount_edit_set_fraction (GNC_AMOUNT_EDIT (xferData->amount_edit), xaccAccountGetCurrencySCU (account)); - /* Reload the xferDialog quickfill which is based on the from account */ - gnc_xfer_dialog_reload_quickfill(xferData); + /* Reload the xferDialog quickfill if it is based on the from account */ + if( !xferData->quickfill_to ) + gnc_xfer_dialog_reload_quickfill(xferData); } @@ -427,6 +438,10 @@ gnc_xfer_dialog_to_tree_select_cb(GNCAccountTree *tree, print_info); gnc_amount_edit_set_fraction (GNC_AMOUNT_EDIT (xferData->to_amount_edit), xaccAccountGetCurrencySCU (account)); + + /* Reload the xferDialog quickfill if it is based on the to account */ + if( xferData->quickfill_to ) + gnc_xfer_dialog_reload_quickfill(xferData); } @@ -524,21 +539,27 @@ static gboolean gnc_xfer_dialog_quickfill( XferDialog *xferData ) { char *desc; - Account *from; + Account *match_account; /* the matched text was from this account */ Transaction *trans; /* the transaction to autocomplete from */ Split *split; /* the split to autocomplete from */ + Split *other = NULL; /* the other split of the transaction */ + Account *other_acct = NULL; /* the Account of the other split */ gboolean changed = FALSE; if( !xferData ) return( FALSE ); - from = gnc_account_tree_get_current_account( xferData->from ); + if( xferData->quickfill_to ) + match_account = gnc_account_tree_get_current_account( xferData->to ); + else + match_account = gnc_account_tree_get_current_account( xferData->from ); + desc = gtk_entry_get_text( GTK_ENTRY(xferData->description_entry) ); if( !desc || desc[0] == '\0' ) /* no description to match */ return( FALSE ); - split = xaccAccountFindSplitByDesc( from, desc ); + split = xaccAccountFindSplitByDesc( match_account, desc ); if( !split ) return( FALSE ); @@ -548,11 +569,13 @@ gnc_xfer_dialog_quickfill( XferDialog *xferData ) * we were passed (assumed to match the split's transaction). */ - if( gnc_numeric_zero_p( gnc_amount_edit_get_amount( GNC_AMOUNT_EDIT(xferData->amount_edit) ) ) ) + if( gnc_numeric_zero_p( + gnc_amount_edit_get_amount(GNC_AMOUNT_EDIT(xferData->amount_edit)))) { gnc_numeric amt = xaccSplitGetValue( split ); - /* If we've matched a previous transfer, it will appear to be negative in the from account. + /* If we've matched a previous transfer, it will appear + * to be negative in the from account. * Need to swap the sign in order for this value * to be posted as a withdrawal from the "from" account. */ @@ -563,9 +586,46 @@ gnc_xfer_dialog_quickfill( XferDialog *xferData ) changed = TRUE; } - if( !safe_strcmp( gtk_entry_get_text( GTK_ENTRY(xferData->memo_entry) ), "" ) ) + if( !safe_strcmp(gtk_entry_get_text(GTK_ENTRY(xferData->memo_entry)),"" )) { - gtk_entry_set_text( GTK_ENTRY(xferData->memo_entry), xaccSplitGetMemo( split ) ); + gtk_entry_set_text( GTK_ENTRY(xferData->memo_entry), + xaccSplitGetMemo( split ) ); + changed = TRUE; + } + + /* Since we're quickfilling off of one account (either from or to) + * that account must be the account of the matched split. + * Find the other account from the other split, + * and select that account in the appropriate account tree. + */ + if( ( other = xaccSplitGetOtherSplit( split ) ) && + ( other_acct = xaccSplitGetAccount( other ) ) ) + { + GNCAccountTree *other_tree; + GNCAccountType other_type; + GtkWidget *other_button; + + if( xferData->quickfill_to ) + { + other_tree = xferData->from; + other_button = xferData->from_show_button; + } + else + { + other_tree = xferData->to; + other_button = xferData->to_show_button; + } + + other_type = xaccAccountGetType(other_acct); + + /* Don't want to deactivate the button just because this + * isn't an income or expense account + */ + if( (other_type == EXPENSE) || (other_type == INCOME) ) + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(other_button), TRUE); + + gnc_account_tree_select_account(other_tree, other_acct, TRUE); + changed = TRUE; } @@ -666,9 +726,12 @@ gnc_xfer_description_insert_cb(GtkEntry *entry, /* This doesn't seem to fix the selection problems, why? */ gtk_entry_select_region( entry, 0, 0 ); - gtk_editable_claim_selection( GTK_EDITABLE(entry), FALSE, GDK_CURRENT_TIME ); + gtk_editable_claim_selection( GTK_EDITABLE(entry), + FALSE, + GDK_CURRENT_TIME ); - /* Store off data for the key_press_cb or the button_release_cb to make use of. */ + /* Store off data for the key_press_cb or + * the button_release_cb to make use of. */ xferData->desc_cursor_position = new_text_len; xferData->desc_start_selection = new_text_len; xferData->desc_end_selection = -1; @@ -691,7 +754,7 @@ common_post_quickfill_handler(guint32 time, XferDialog *xferData ) gint current_pos = gtk_editable_get_position( GTK_EDITABLE(entry) ); gint current_start = GTK_EDITABLE(entry)->selection_start_pos; gint current_end = GTK_EDITABLE(entry)->selection_end_pos; - gboolean did_something = FALSE; /* Did this function change the selection or position? */ + gboolean did_something = FALSE; /* was the selection or position changed? */ if( current_pos != xferData->desc_cursor_position ) { @@ -704,7 +767,8 @@ common_post_quickfill_handler(guint32 time, XferDialog *xferData ) ( xferData->desc_start_selection != xferData->desc_end_selection || xferData->desc_start_selection == 0 ) ) { - gtk_entry_select_region( entry, xferData->desc_start_selection, xferData->desc_end_selection ); + gtk_entry_select_region( entry, xferData->desc_start_selection, + xferData->desc_end_selection ); gtk_editable_claim_selection( GTK_EDITABLE(entry), TRUE, time ); did_something = TRUE; } @@ -726,12 +790,15 @@ common_post_quickfill_handler(guint32 time, XferDialog *xferData ) } static gboolean -gnc_xfer_description_key_press_cb( GtkEntry *entry, GdkEventKey *event, XferDialog *xferData ) +gnc_xfer_description_key_press_cb( GtkEntry *entry, + GdkEventKey *event, + XferDialog *xferData ) { gboolean done_with_input = FALSE; - /* Most "special" keys are allowed to be handled directly by the entry's key press handler, - * but in some cases that doesn't seem to work right, so handle it here. + /* Most "special" keys are allowed to be handled directly by + * the entry's key press handler, but in some cases that doesn't + * seem to work right, so handle it here. */ switch( event->keyval ) { @@ -742,7 +809,8 @@ gnc_xfer_description_key_press_cb( GtkEntry *entry, GdkEventKey *event, XferDial done_with_input = TRUE; break; - case GDK_Return: /* On the first activate, need to do the quickfill completion */ + case GDK_Return: /* On the first activate, need to + * do the quickfill completion */ case GDK_KP_Enter: if( gnc_xfer_dialog_quickfill( xferData ) ) done_with_input = TRUE; @@ -754,11 +822,12 @@ gnc_xfer_description_key_press_cb( GtkEntry *entry, GdkEventKey *event, XferDial case GDK_Tab: case GDK_ISO_Left_Tab: - if( !( event->state & GDK_SHIFT_MASK) ) /* Complete on Tab, but not Shift-Tab */ + if( !( event->state & GDK_SHIFT_MASK) ) /* Complete on Tab, + * but not Shift-Tab */ { gnc_xfer_dialog_quickfill( xferData ); - /* NOT done with input, though, since we need to focus to the next field. - * Unselect the current field, though. + /* NOT done with input, though, since we need to focus to the next + * field. Unselect the current field, though. */ gtk_entry_select_region( GTK_ENTRY(xferData->description_entry), 0, 0 ); gtk_editable_claim_selection( GTK_EDITABLE(xferData->description_entry), @@ -1563,6 +1632,9 @@ gnc_xfer_dialog_create(GtkWidget * parent, XferDialog *xferData) GTK_SELECTION_BROWSE); gtk_clist_set_selection_mode(GTK_CLIST(xferData->to), GTK_SELECTION_BROWSE); + + /* default to quickfilling off of the "From" account. */ + xferData->quickfill_to = FALSE; } static void @@ -1634,11 +1706,13 @@ gnc_xfer_dialog_set_title( XferDialog *xferData, const gchar *title ) } void -gnc_xfer_dialog_set_information_frame_label( XferDialog *xferData, const gchar *label ) +gnc_xfer_dialog_set_information_frame_label( XferDialog *xferData, + const gchar *label ) { if( xferData && label ) { - GtkWidget *frame = gnc_glade_lookup_widget (xferData->dialog, "transferinfo-frame" ); + GtkWidget *frame = gnc_glade_lookup_widget (xferData->dialog, + "transferinfo-frame" ); gtk_frame_set_label( GTK_FRAME(frame), label ); } } @@ -1653,39 +1727,46 @@ gnc_xfer_dialog_set_account_frame_label( XferDialog *xferData, { /* "frame34" is the from frame, "frame35" is the to frame */ GtkWidget *frame = gnc_glade_lookup_widget (xferData->dialog, - ( direction == XFER_DIALOG_FROM ? - "transferfrom-frame" : "transferto-frame" )); + ( direction == XFER_DIALOG_FROM ? + "transferfrom-frame" : + "transferto-frame" )); gtk_frame_set_label( GTK_FRAME(frame), label ); } } void -gnc_xfer_dialog_set_from_account_frame_label( XferDialog *xferData, const gchar *label ) +gnc_xfer_dialog_set_from_account_frame_label( XferDialog *xferData, + const gchar *label ) { gnc_xfer_dialog_set_account_frame_label( xferData, label, XFER_DIALOG_FROM ); } void -gnc_xfer_dialog_set_to_account_frame_label( XferDialog *xferData, const gchar *label ) +gnc_xfer_dialog_set_to_account_frame_label( XferDialog *xferData, + const gchar *label ) { gnc_xfer_dialog_set_account_frame_label( xferData, label, XFER_DIALOG_TO ); } void -gnc_xfer_dialog_set_from_show_button_active( XferDialog *xferData, gboolean set_value ) +gnc_xfer_dialog_set_from_show_button_active( XferDialog *xferData, + gboolean set_value ) { if( xferData && xferData->from_show_button ) { - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(xferData->from_show_button), set_value ); + gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(xferData->from_show_button), + set_value ); } } void -gnc_xfer_dialog_set_to_show_button_active( XferDialog *xferData, gboolean set_value ) +gnc_xfer_dialog_set_to_show_button_active( XferDialog *xferData, + gboolean set_value ) { if( xferData && xferData->to_show_button ) { - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(xferData->to_show_button), set_value ); + gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(xferData->to_show_button), + set_value ); } } @@ -1698,7 +1779,8 @@ void gnc_xfer_dialog_add_user_specified_button( XferDialog *xferData, if( xferData && label && callback ) { GtkWidget *button = gtk_button_new_with_label( label ); - GtkWidget *box = gnc_glade_lookup_widget (xferData->dialog, "transfermain-vbox" ); + GtkWidget *box = gnc_glade_lookup_widget (xferData->dialog, + "transfermain-vbox" ); gtk_box_pack_end( GTK_BOX(box), button, FALSE, FALSE, 0 ); gtk_signal_connect( GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC( callback ), user_data ); @@ -1726,9 +1808,9 @@ find_xfer (gpointer find_data, gpointer user_data) return( find_data == user_data ); } -/* Run the dialog until the user has either successfully completed the transaction - * (just clicking OK doesn't always count) or clicked Cancel. Return TRUE if the - * transaction was a success, FALSE otherwise. +/* Run the dialog until the user has either successfully completed the + * transaction (just clicking OK doesn't always count) or clicked Cancel. + * Return TRUE if the transaction was a success, FALSE otherwise. */ gboolean gnc_xfer_dialog_run_until_done( XferDialog *xferData ) { @@ -1766,3 +1848,19 @@ gboolean gnc_xfer_dialog_run_until_done( XferDialog *xferData ) return( FALSE ); } + +/* Indicate that the dialog should quickfill based on the "To" account, + * rather than the default which is the "From" account. + */ + +void +gnc_xfer_dialog_quickfill_to_account(XferDialog *xferData, + gboolean qf_to_account ) +{ + gboolean old = xferData->quickfill_to; + xferData->quickfill_to = qf_to_account; + + /* reload the quickfill if necessary */ + if( old != qf_to_account ) + gnc_xfer_dialog_reload_quickfill( xferData ); +} diff --git a/src/gnome/dialog-transfer.h b/src/gnome/dialog-transfer.h index 617bdf6273..4d932562e8 100644 --- a/src/gnome/dialog-transfer.h +++ b/src/gnome/dialog-transfer.h @@ -40,7 +40,8 @@ void gnc_xfer_dialog_close( XferDialog * ); void gnc_xfer_dialog_set_title( XferDialog *, const gchar * ); /* set the label of the topmost frame */ -void gnc_xfer_dialog_set_information_frame_label( XferDialog *, const gchar * ); +void gnc_xfer_dialog_set_information_frame_label( XferDialog *, + const gchar * ); /* Add a button with a user-specified label and "clicked" callback. * For now this doesn't offer a lot of flexibility, but it doesn't have to. @@ -53,7 +54,8 @@ void gnc_xfer_dialog_add_user_specified_button( XferDialog *xferData, void gnc_xfer_dialog_toggle_currency_frame( XferDialog *xferData, gboolean show_frame ); -void gnc_xfer_dialog_set_from_account_frame_label( XferDialog *, const gchar * ); +void gnc_xfer_dialog_set_from_account_frame_label( XferDialog *, + const gchar * ); void gnc_xfer_dialog_set_to_account_frame_label( XferDialog *, const gchar * ); /* set the buttons for "Show Income/Expense" */ @@ -74,4 +76,10 @@ void gnc_xfer_dialog_set_description(XferDialog *xferData, const char *description); void gnc_xfer_dialog_set_date(XferDialog *xferData, time_t set_time); +/* Indicate whether the dialog should quickfill based on the "To" account, + * rather than the default which is the "From" account. + */ +void gnc_xfer_dialog_quickfill_to_account(XferDialog *xferData, + gboolean qf_to_account ); + #endif diff --git a/src/gnome/window-reconcile.c b/src/gnome/window-reconcile.c index 64a5fe6ab2..dfc859f05e 100644 --- a/src/gnome/window-reconcile.c +++ b/src/gnome/window-reconcile.c @@ -121,32 +121,32 @@ struct _RecnWindow */ 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 */ + 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 */ - GNCAmountEdit *end_value; /* the dialog's ending balance amount edit */ + GtkWidget *startRecnWindow; /* the startRecnWindow dialog */ + GtkWidget *xfer_button; /* the dialog's interest transfer button */ + GNCAmountEdit *end_value; /* the dialog's ending balance amount edit */ - XferDialog *xferData; /* the interest xfer dialog (if it exists) */ + XferDialog *xferData; /* the interest xfer dialog (if it exists) */ - time_t date; /* the reconcile date for the interest xfer */ + time_t date; /* the interest xfer reconcile date */ } startRecnWindowData; -/* Note: make sure to update the help text for this in prefs.scm if these change! - * These macros define the account types for which an auto interest xfer dialog - * could pop up, if the user's preferences allow it. +/* Note: make sure to update the help text for this in prefs.scm if these + * change! These macros define the account types for which an auto interest + * xfer dialog could pop up, if the user's preferences allow it. */ -#define account_type_has_auto_interest_charge( type ) ( ( (type) == CREDIT ) || \ - ( (type) == LIABILITY ) ) +#define account_type_has_auto_interest_charge(type) (((type) == CREDIT) || \ + ((type) == LIABILITY)) -#define account_type_has_auto_interest_payment( type ) ( ( (type) == BANK ) || \ - ( (type) == ASSET ) || \ - ( (type) == MUTUAL ) ) +#define account_type_has_auto_interest_payment(type) (((type) == BANK) || \ + ((type) == ASSET) || \ + ((type) == MUTUAL)) -#define account_type_has_auto_interest_xfer( type ) \ +#define account_type_has_auto_interest_xfer(type) \ ( account_type_has_auto_interest_charge(type) || \ account_type_has_auto_interest_payment(type) ) @@ -341,9 +341,10 @@ gnc_start_recn_date_changed (GtkWidget *widget, startRecnWindowData *data) gnc_amount_edit_set_amount (GNC_AMOUNT_EDIT (data->end_value), new_balance); } -/* For a given account, determine if an auto interest xfer dialog should be shown, - * based on both the per-account flag as well as the global reconcile option. - * The global option is the default that is used if there is no per-account option. +/* For a given account, determine if an auto interest xfer dialog should be + * shown, based on both the per-account flag as well as the global reconcile + * option. The global option is the default that is used if there is no + * per-account option. */ static gboolean gnc_recn_interest_xfer_get_auto_interest_xfer_allowed( Account *account ) @@ -359,7 +360,7 @@ gnc_recn_interest_xfer_get_auto_interest_xfer_allowed( Account *account ) * opens up a window to prompt the user to enter an interest * * charge or payment for an account prior to reconciling it. * * Only to be called for some types of accounts, as defined * - * in the macros at the top of this file. + * in the macros at the top of this file. * * * * NOTE: This function does not return until the user presses "Ok" * * or "Cancel", which means that the transaction must be * @@ -393,7 +394,8 @@ static void gnc_recn_interest_xfer_no_auto_clicked_cb(GtkButton *button, startRecnWindowData *data) { - /* Indicate that the user doesn't want an auto interest xfer for this account. + /* Indicate that the user doesn't want + * an auto interest xfer for this account. */ xaccAccountSetAutoInterestXfer( data->account, FALSE ); @@ -416,44 +418,59 @@ recnInterestXferWindow( startRecnWindowData *data) if( !account_type_has_auto_interest_xfer( data->account_type ) ) return; /* get a normal transfer dialog... */ - data->xferData = gnc_xfer_dialog( GTK_WIDGET(data->startRecnWindow), data->account ); + data->xferData = gnc_xfer_dialog( GTK_WIDGET(data->startRecnWindow), + data->account ); /* ...and start changing things: */ /* change title */ if( account_type_has_auto_interest_payment( data->account_type ) ) - title = gnc_recn_make_interest_window_name( data->account, "Interest Payment" ); + title = gnc_recn_make_interest_window_name( data->account, + _("Interest Payment") ); else - title = gnc_recn_make_interest_window_name( data->account, "Interest Charge" ); + title = gnc_recn_make_interest_window_name( data->account, + _("Interest Charge") ); gnc_xfer_dialog_set_title( data->xferData, title ); g_free( title ); /* change frame labels */ - gnc_xfer_dialog_set_information_frame_label( data->xferData, _("Payment Information") ); + gnc_xfer_dialog_set_information_frame_label( data->xferData, + _("Payment Information") ); - /* interest accrued is a transaction from an income account to a bank account. - * interest charged is a transaction from a credit account to an expense account. - * The user isn't allowed to change the account (bank or credit) being reconciled. + /* Interest accrued is a transaction from an income account + * to a bank account. Interest charged is a transaction from + * a credit account to an expense account. The user isn't allowed + * to change the account (bank or credit) being reconciled. */ if( account_type_has_auto_interest_payment( data->account_type ) ) { - gnc_xfer_dialog_set_from_account_frame_label( data->xferData, _("Payment From") ); + gnc_xfer_dialog_set_from_account_frame_label( data->xferData, + _("Payment From") ); gnc_xfer_dialog_set_from_show_button_active( data->xferData, TRUE ); - gnc_xfer_dialog_set_to_account_frame_label( data->xferData, _("Reconcile Account") ); + gnc_xfer_dialog_set_to_account_frame_label( data->xferData, + _("Reconcile Account") ); gnc_xfer_dialog_select_to_account( data->xferData, data->account ); gnc_xfer_dialog_lock_to_account_tree( data->xferData ); + + /* Quickfill based on the reconcile account, which is the "To" acct. */ + gnc_xfer_dialog_quickfill_to_account( data->xferData, TRUE ); } else /* interest charged to account rather than paid to it */ { - gnc_xfer_dialog_set_from_account_frame_label( data->xferData, _("Reconcile Account") ); + gnc_xfer_dialog_set_from_account_frame_label( data->xferData, + _("Reconcile Account") ); gnc_xfer_dialog_select_from_account( data->xferData, data->account ); gnc_xfer_dialog_lock_from_account_tree( data->xferData ); - gnc_xfer_dialog_set_to_account_frame_label( data->xferData, _("Payment To") ); + gnc_xfer_dialog_set_to_account_frame_label( data->xferData, + _("Payment To") ); gnc_xfer_dialog_set_to_show_button_active( data->xferData, TRUE ); + + /* Quickfill based on the reconcile account, which is the "From" acct. */ + gnc_xfer_dialog_quickfill_to_account( data->xferData, FALSE ); } @@ -492,8 +509,10 @@ recnInterestXferWindow( startRecnWindowData *data) static void gnc_reconcile_interest_xfer_run(startRecnWindowData *data) { - GtkWidget *entry = gnc_amount_edit_gtk_entry( GNC_AMOUNT_EDIT(data->end_value) ); - gnc_numeric before = gnc_amount_edit_get_amount( GNC_AMOUNT_EDIT(data->end_value) ); + GtkWidget *entry = gnc_amount_edit_gtk_entry( + GNC_AMOUNT_EDIT(data->end_value) ); + gnc_numeric before = gnc_amount_edit_get_amount( + GNC_AMOUNT_EDIT(data->end_value) ); gnc_numeric after = gnc_numeric_zero(); recnInterestXferWindow( data ); @@ -519,7 +538,8 @@ gnc_reconcile_interest_xfer_run(startRecnWindowData *data) static void gnc_start_recn_interest_clicked_cb(GtkButton *button, startRecnWindowData *data) { - /* indicate in account that user wants an auto interest xfer for this account */ + /* indicate in account that user wants + * an auto interest xfer for this account */ xaccAccountSetAutoInterestXfer( data->account, TRUE ); /* make the button unclickable since we're popping up the window */ @@ -570,7 +590,8 @@ startRecnWindow(GtkWidget *parent, Account *account, data.date = *statement_date; /* whether to have an automatic interest xfer dialog or not */ - auto_interest_xfer_option = gnc_recn_interest_xfer_get_auto_interest_xfer_allowed( account ); + auto_interest_xfer_option = + gnc_recn_interest_xfer_get_auto_interest_xfer_allowed( account ); if( data.use_shares ) { @@ -697,7 +718,8 @@ startRecnWindow(GtkWidget *parent, Account *account, (GNC_AMOUNT_EDIT (end_value))); } - /* Allow the user to enter an interest payment or charge prior to reconciling */ + /* Allow the user to enter an interest payment + * or charge prior to reconciling */ if( account_type_has_auto_interest_xfer( data.account_type ) && auto_interest_xfer_option ) { @@ -1612,9 +1634,11 @@ gnc_get_reconcile_info (Account *account, * the statement balance based on the statement date. */ if (use_shares) - *new_ending = xaccAccountGetShareBalanceAsOfDate(account, *statement_date); + *new_ending = + xaccAccountGetShareBalanceAsOfDate(account, *statement_date); else - *new_ending = xaccAccountGetBalanceAsOfDate(account, *statement_date); + *new_ending = + xaccAccountGetBalanceAsOfDate(account, *statement_date); } }