Add a Cancel button to the dialog that is invoked when a register

containing a modified transaction is closed via the window manager
close button.  #105742


git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@8665 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
David Hampton
2003-06-24 02:55:55 +00:00
parent 506d7f64d6
commit bc7900035c
5 changed files with 48 additions and 11 deletions

View File

@@ -23,6 +23,20 @@
* src/report/standard-reports/register.scm: Show the running
balance column by default. #92052.
* src/gnome/window-register.c: Annotate the window title to
indicate whether a register is for a single account or it includes
all subaccounts. #107927
* src/gnome/gnc-split-reg.c: Change the register close dialog to
include a cancel option. #105742
* src/gnome/window-register.c: Don't close the register if the
user cancelled. #105742
* src/engine/Scrub.c (xaccSplitScrub): Change a warning message to
an info. This clause is hit every time a user saves a changed
transaction by clicking on another transaction.
2003-06-22 David Hampton <hampton@employees.org>
* src/gnome-utils/dialog-commodity.[ch]: Clean up usage of the

View File

@@ -243,7 +243,11 @@ xaccSplitScrub (Split *split)
return;
}
PWARN ("Adjusted split with mismatched values, desc=\"%s\" memo=\"%s\""
/*
* This will be hit every time you answer yes to the dialog "The
* current transaction has changed. Would you like to record it.
*/
PINFO ("Adjusted split with mismatched values, desc=\"%s\" memo=\"%s\""
" old amount %s %s, new amount %s",
trans->description, split->memo,
gnc_numeric_to_string (split->amount),

View File

@@ -911,25 +911,34 @@ gnc_split_reg_ld_destroy( GNCLedgerDisplay *ledger )
gboolean
gnc_split_reg_check_close( GNCSplitReg *gsr )
{
GNCVerifyResult result;
gboolean pending_changes;
SplitRegister *reg;
const char *message = _("The current transaction has been changed.\n"
"Would you like to record it?");
reg = gnc_ledger_display_get_split_register( gsr->ledger );
pending_changes = gnc_split_register_changed( reg );
if ( !pending_changes )
return FALSE;
return TRUE;
result = gnc_verify_cancel_dialog_parented(gsr->window, GNC_VERIFY_YES,
message);
switch (result)
{
const char *message = _("The current transaction has been changed.\n"
"Would you like to record it?");
if ( gnc_verify_dialog_parented( gsr->window, TRUE, message) ) {
case GNC_VERIFY_YES:
case GNC_VERIFY_OK:
gnc_split_reg_record_trans_cb( gsr->window, gsr );
return TRUE;
} else {
case GNC_VERIFY_NO:
gnc_split_register_cancel_cursor_trans_changes( reg );
return TRUE;
case GNC_VERIFY_CANCEL:
return FALSE;
}
}
return TRUE;
}
void

View File

@@ -278,6 +278,13 @@ void gnc_split_reg_set_double_line( GNCSplitReg *gsr, gboolean doubleLine );
**/
void gnc_split_reg_use_extended_popup( GNCSplitReg *gsr );
/**
* Check if its OK to close this register window. Gives the register
* a chance to abort the close if there are roblems, e.g. an open
* transaction.
*
* @return TRUE if the register may be closed, FALSE if not.
**/
gboolean gnc_split_reg_check_close( GNCSplitReg *gsr );
void gnc_split_reg_raise( GNCSplitReg *gsr );

View File

@@ -722,8 +722,10 @@ gnc_register_delete_cb(GtkWidget *widget, GdkEvent *event, gpointer data)
gnc_reg_save_size( regData );
}
gnc_split_reg_check_close(regData->gsr);
gnc_ledger_display_close (regData->ledger);
if (gnc_split_reg_check_close(regData->gsr) != FALSE) {
gnc_ledger_display_close (regData->ledger);
return FALSE;
}
return TRUE; /* don't close */
}
@@ -1551,8 +1553,9 @@ void
gnc_register_close_cb (GtkWidget *widget, gpointer data)
{
RegWindow *regData = data;
gnc_split_reg_check_close( GNC_SPLIT_REG(regData->gsr) );
gnc_ledger_display_close( regData->ledger );
if (gnc_split_reg_check_close(regData->gsr) != FALSE)
gnc_ledger_display_close( regData->ledger );
}
static int