From fad634bfb68b5947a43ad27773098f3b262e853f Mon Sep 17 00:00:00 2001 From: Dave Peticolas Date: Mon, 4 Jun 2001 09:35:29 +0000 Subject: [PATCH] 2001-06-04 Dave Peticolas * src/SplitLedger.c: fix spelling errors * src/register/gnome/gnucash-item-edit.c: same as below * src/register/gnome/gnucash-sheet.c: check change confirmation before popping up combo list. * src/register/table-allgui.c (gnc_table_confirm_change): new func git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@4408 57a11ea4-9604-0410-9ed3-97b8803252fd --- ChangeLog | 11 ++++++++++ src/SplitLedger.c | 2 +- src/register/gnome/gnucash-item-edit.c | 30 +++++++++++++++++++++++--- src/register/gnome/gnucash-sheet.c | 4 +++- src/register/table-allgui.c | 15 +++++++++++++ src/register/table-allgui.h | 4 +++- 6 files changed, 60 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 94c73b7dc8..4baba0bc74 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2001-06-04 Dave Peticolas + + * src/SplitLedger.c: fix spelling errors + + * src/register/gnome/gnucash-item-edit.c: same as below + + * src/register/gnome/gnucash-sheet.c: check change confirmation + before popping up combo list. + + * src/register/table-allgui.c (gnc_table_confirm_change): new func + 2001-06-03 Christian Stimming * po/de.po: Massive update of the German translation according to diff --git a/src/SplitLedger.c b/src/SplitLedger.c index db0d7efa20..7800b4ba75 100644 --- a/src/SplitLedger.c +++ b/src/SplitLedger.c @@ -4449,7 +4449,7 @@ xaccSRConfirmHandler (VirtualLocation virt_loc, Split *split; char recn; - /* This assumes we reset the flag whenver we change splits. + /* This assumes we reset the flag whenever we change splits. * This happens in LedgerMoveCursor. */ if (info->change_confirmed) return TRUE; diff --git a/src/register/gnome/gnucash-item-edit.c b/src/register/gnome/gnucash-item-edit.c index 3ea8b7bc99..6d38fa786d 100644 --- a/src/register/gnome/gnucash-item-edit.c +++ b/src/register/gnome/gnucash-item-edit.c @@ -1119,8 +1119,32 @@ static void item_edit_popup_toggled (GtkToggleButton *button, gpointer data) { ItemEdit *item_edit = ITEM_EDIT (data); + gboolean show_popup; - item_edit->show_popup = gtk_toggle_button_get_active (button); + show_popup = gtk_toggle_button_get_active (button); + if (show_popup) + { + Table *table; + VirtualLocation virt_loc; + + table = item_edit->sheet->table; + virt_loc = table->current_cursor_loc; + + if (!gnc_table_confirm_change (table, virt_loc)) + { + gtk_signal_handler_block_by_data + (GTK_OBJECT (button), data); + + gtk_toggle_button_set_active (button, FALSE); + + gtk_signal_handler_unblock_by_data + (GTK_OBJECT (button), data); + + return; + } + } + + item_edit->show_popup = show_popup; if (!item_edit->show_popup) item_edit_hide_popup (item_edit); @@ -1499,10 +1523,10 @@ item_edit_hide_popup (ItemEdit *item_edit) gtk_arrow_set (item_edit->popup_toggle.arrow, GTK_ARROW_DOWN, GTK_SHADOW_IN); - gtk_widget_grab_focus (GTK_WIDGET (item_edit->sheet)); - gtk_toggle_button_set_active (item_edit->popup_toggle.toggle_button, FALSE); + + gtk_widget_grab_focus (GTK_WIDGET (item_edit->sheet)); } void diff --git a/src/register/gnome/gnucash-sheet.c b/src/register/gnome/gnucash-sheet.c index 811f879af6..5d3df98c86 100644 --- a/src/register/gnome/gnucash-sheet.c +++ b/src/register/gnome/gnucash-sheet.c @@ -1617,7 +1617,9 @@ gnucash_sheet_key_press_event (GtkWidget *widget, GdkEventKey *event) item_edit = ITEM_EDIT (sheet->item_editor); - item_edit_show_popup (item_edit); + if (gnc_table_confirm_change (table, + cur_virt_loc)) + item_edit_show_popup (item_edit); return TRUE; } diff --git a/src/register/table-allgui.c b/src/register/table-allgui.c index 8cdee43da7..660e1a6f77 100644 --- a/src/register/table-allgui.c +++ b/src/register/table-allgui.c @@ -953,6 +953,21 @@ gnc_table_leave_update(Table *table, VirtualLocation virt_loc) /* ==================================================== */ +gboolean +gnc_table_confirm_change (Table *table, VirtualLocation virt_loc) +{ + if (!table) + return TRUE; + + if (!table->view.confirm_handler) + return TRUE; + + return table->view.confirm_handler (virt_loc, + table->view.handler_user_data); +} + +/* ==================================================== */ + /* returned result should not be touched by the caller. * NULL return value means the edit was rejected. */ const char * diff --git a/src/register/table-allgui.h b/src/register/table-allgui.h index f7e7b6077e..37c79ee8a2 100644 --- a/src/register/table-allgui.h +++ b/src/register/table-allgui.h @@ -421,7 +421,9 @@ gboolean gnc_table_enter_update(Table *table, int *start_selection, int *end_selection); -void gnc_table_leave_update(Table *table, VirtualLocation virt_loc); +void gnc_table_leave_update(Table *table, VirtualLocation virt_loc); + +gboolean gnc_table_confirm_change(Table *table, VirtualLocation virt_loc); const char * gnc_table_modify_update(Table *table, VirtualLocation virt_loc,