2002-04-21 Joshua Sled <jsled@asynchronous.org>

* src/gnome/dialog-sx-from-trans.c (sxftd_advanced_clicked): Since
	"Advanced..." editing completely entails the from-transaction
	dialog, we close it if the user selects "Advanced..." to prevent
	errors when the from-trans dialog is "Ok"'d.

	* src/gnome/dialog-scheduledxaction.c (delete_button_clicked):
	Better deletion confirmation checking; we now look for
	being-edited scheduled transactions and confirm them specially
	with the user to prevent inconsistencies from cropping up.

	* src/doc/TODO-schedxactions: Updated; more 'X'-ed off items make
	me happy.


git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@6818 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Joshua Sled committed 2002-04-21 21:03:57 +00:00
1 parent 7e2051e60d
commit 66b982375e
4 files changed
+101 -56

No files matched your search

+15
View File
@@ -1,3 +1,18 @@
2002-04-21 Joshua Sled <jsled@asynchronous.org>
* src/gnome/dialog-sx-from-trans.c (sxftd_advanced_clicked): Since
"Advanced..." editing completely entails the from-transaction
dialog, we close it if the user selects "Advanced..." to prevent
errors when the from-trans dialog is "Ok"'d.
* src/gnome/dialog-scheduledxaction.c (delete_button_clicked):
Better deletion confirmation checking; we now look for
being-edited scheduled transactions and confirm them specially
with the user to prevent inconsistencies from cropping up.
* src/doc/TODO-schedxactions: Updated; more 'X'-ed off items make
me happy.
2002-04-21 Joshua Sled <jsled@asynchronous.org> 2002-04-21 Joshua Sled <jsled@asynchronous.org>
* src/backend/file/sixtp.c (sixtp_parse_file): Explicitly create * src/backend/file/sixtp.c (sixtp_parse_file): Explicitly create
+11 -7
View File
@@ -101,7 +101,9 @@ X create a template register
. SX list . SX list
. add a big calendar [gnome-pim? evo?] to SXaction List/overview . add a big calendar [gnome-pim? evo?] to SXaction List/overview
. tab order . tab order
. "** CRITICAL **: file dialog-scheduledxaction.c: line 570 (row_select_handler): assertion `event' failed." when key-navigating sx list. X "** CRITICAL **: file dialog-scheduledxaction.c: line 570
(row_select_handler): assertion `event' failed." when key-navigating sx
list.
. SX editor . SX editor
. tab order . tab order
@@ -119,19 +121,21 @@ X create a template register
. make-from-transaction . make-from-transaction
. bugs . bugs
. number-of-instances in 'simple' results in "Warning:
sxftd_advanced_clicked: something bad happened in sxftd_compute_sx"
. general: there's going to be all sorts of interaction issues like these . general: there's going to be all sorts of interaction issues like these
between these things [SX-from-trans, SX list, SX editor] that should be between these things [SX-from-trans, SX list, SX editor] that should be
handled. handled.
. you can delete a freshly-from-trans'd SX from the list with the
from-trans dlg still open, then 'ok' the dlg to get a segfault.
. you can generally manipulate SXes into bad/weird states since both
dialogs are open.
. creating a SX from trans with the SX list open does not update the SX . creating a SX from trans with the SX list open does not update the SX
list list
. So since Advanced editing entails "Simple" editing, it should just X you can delete a freshly-from-trans'd SX from the list with the
from-trans dlg still open, then 'ok' the dlg to get a segfault.
X you can generally manipulate SXes into bad/weird states since both
dialogs are open.
X So since Advanced editing entails "Simple" editing, it should just
replace that window. Then, with some CM hookup between the List and replace that window. Then, with some CM hookup between the List and
the Editor, all is well. the Editor, all is well.
. 20020419 - Wilddev manages to create two SXes from one; the first is X 20020419 - Wilddev manages to create two SXes from one; the first is
okay, but the second is h0rk3d [deleting it causes segfault, though it okay, but the second is h0rk3d [deleting it causes segfault, though it
can be instantiated correctly]. can be instantiated correctly].
. tab-order . tab-order
+62 -35
View File
@@ -558,7 +558,6 @@ gnc_ui_scheduled_xaction_dialog_create(void)
sxd = g_new0( SchedXactionDialog, 1 ); sxd = g_new0( SchedXactionDialog, 1 );
/* sxd->dialog = create_Scheduled_Transaction_List(); */
sxd->gxml = gnc_glade_xml_new( "sched-xact.glade", SX_LIST_GLADE_NAME ); sxd->gxml = gnc_glade_xml_new( "sched-xact.glade", SX_LIST_GLADE_NAME );
sxd->dialog = glade_xml_get_widget( sxd->gxml, SX_LIST_GLADE_NAME ); sxd->dialog = glade_xml_get_widget( sxd->gxml, SX_LIST_GLADE_NAME );
@@ -729,7 +728,6 @@ gnc_ui_scheduled_xaction_editor_dialog_create( SchedXactionDialog *sxd,
sxed = g_new0( SchedXactionEditorDialog, 1 ); sxed = g_new0( SchedXactionEditorDialog, 1 );
/* sxed->dialog = create_Scheduled_Transaction_Editor(); */
sxed->gxml = gnc_glade_xml_new( "sched-xact.glade", sxed->gxml = gnc_glade_xml_new( "sched-xact.glade",
SX_EDITOR_GLADE_NAME ); SX_EDITOR_GLADE_NAME );
sxed->dialog = glade_xml_get_widget( sxed->gxml, SX_EDITOR_GLADE_NAME ); sxed->dialog = glade_xml_get_widget( sxed->gxml, SX_EDITOR_GLADE_NAME );
@@ -1129,21 +1127,21 @@ edit_button_clicked( GtkButton *b, gpointer d )
} }
} }
static static void
void
delete_button_clicked( GtkButton *b, gpointer d ) delete_button_clicked( GtkButton *b, gpointer d )
{ {
GNCBook *book; GNCBook *book;
GtkCList *cl; GtkCList *cl;
GList *sel, *sxList; GList *sel, *sxList, *beingEditedList, *l;
SchedXactionDialog *sxd; SchedXactionDialog *sxd;
GnomeDialog *confirmDlg; char *beingEditedMessage =
GtkLabel *dlgMsgLbl; _( "The following transactions are presently being edited;\n"
static char *confirmMessage = "are you sure you want to delete them?" );
"Delete the selected scheduled transactions?"; char *confirmMessage =
int confirmSel; _( "Delete the selected Scheduled Transactions?" );
GString *realMsg; GString *realConfDelOpenMsg, *realConfDeleteMsg;
SchedXaction *sx; SchedXaction *sx;
gboolean destroyOpenedResult = FALSE;
sxd = (SchedXactionDialog*)d; sxd = (SchedXactionDialog*)d;
@@ -1154,29 +1152,59 @@ delete_button_clicked( GtkButton *b, gpointer d )
return; return;
} }
realMsg = g_string_new( confirmMessage ); realConfDeleteMsg = g_string_new( confirmMessage );
do { realConfDelOpenMsg = g_string_new( beingEditedMessage );
beingEditedList = NULL;
for ( ; sel ; sel = sel->next ) {
sx = gtk_clist_get_row_data( cl, (int)sel->data ); sx = gtk_clist_get_row_data( cl, (int)sel->data );
g_string_sprintfa( realMsg, "\n\"%s\"", xaccSchedXactionGetName( sx ) ); g_string_sprintfa( realConfDeleteMsg, "\n\"%s\"",
} while ( (sel = g_list_next(sel)) ); xaccSchedXactionGetName( sx ) );
if ( (l = gnc_find_gui_components( DIALOG_SCHEDXACTION_EDITOR_CM_CLASS,
editor_component_sx_equality,
sx )) ) {
beingEditedList = g_list_append( beingEditedList, (gpointer)l );
g_string_sprintfa( realConfDelOpenMsg, "\n\"%s\"",
xaccSchedXactionGetName( sx ) );
}
}
confirmDlg = if ( g_list_length( beingEditedList ) > 0 ) {
GNOME_DIALOG(gnome_dialog_new( "Confirm Delete", /* Figure out the user's disposition [toward the opened
GNOME_STOCK_BUTTON_YES, * transactions], but if it's true, don't act on it until
GNOME_STOCK_BUTTON_NO, * they confirm they actually want to do the deletion
NULL )); * generically. If it's false, cleanup and return. */
dlgMsgLbl = GTK_LABEL(gtk_label_new( realMsg->str )); if ( ! (destroyOpenedResult =
gtk_box_pack_start( GTK_BOX( confirmDlg->vbox ), gnc_verify_dialog_parented( sxd->dialog,
GTK_WIDGET(dlgMsgLbl), TRUE, TRUE, 0 ); realConfDelOpenMsg->str,
gnome_dialog_set_parent( confirmDlg, FALSE )) ) {
GTK_WINDOW(sxd->dialog) ); for ( l = beingEditedList; l; l = l->next ) {
gtk_widget_show_all( GTK_WIDGET(confirmDlg) ); g_list_free( (GList*)l->data );
}
g_list_free( beingEditedList );
goto cleanupStrings;
return; /* unreachable, but clearer. */
}
}
confirmSel = gnome_dialog_run_and_close( confirmDlg ); if ( gnc_verify_dialog_parented( sxd->dialog,
g_string_free( realMsg, TRUE ); realConfDeleteMsg->str,
FALSE ) ) {
/* Close the being-edited transactions. */
if ( destroyOpenedResult ) {
GList *component;
for ( l = beingEditedList; l; l = l->next ) {
component = (GList*)l->data;
/* FIXME: We'd like to force the cancellation
* of ledger/other changes, here. */
editor_cancel_button_clicked( NULL,
(SchedXactionEditorDialog*)component->
data );
g_list_free( component );
}
g_list_free( beingEditedList );
}
switch ( confirmSel ) { /* Now, actually do the deletions... */
case 0:
sel = cl->selection; sel = cl->selection;
book = gnc_get_current_book (); book = gnc_get_current_book ();
sxList = gnc_book_get_schedxactions( book ); sxList = gnc_book_get_schedxactions( book );
@@ -1192,12 +1220,11 @@ delete_button_clicked( GtkButton *b, gpointer d )
gtk_clist_clear( cl ); gtk_clist_clear( cl );
g_list_foreach( sxList, putSchedXactionInClist, sxd ); g_list_foreach( sxList, putSchedXactionInClist, sxd );
gtk_clist_thaw( cl ); gtk_clist_thaw( cl );
break;
case 1:
default:
return;
break;
} }
cleanupStrings:
g_string_free( realConfDeleteMsg, TRUE );
g_string_free( realConfDelOpenMsg, TRUE );
} }
static static
+13 -14
View File
@@ -396,7 +396,6 @@ sxftd_delete(SXFromTransInfo *sxfti, gboolean delete_sx)
{ {
/* FIXME: do we need to clean up the GladeXML pointer ?*/ /* FIXME: do we need to clean up the GladeXML pointer ?*/
gnome_dialog_close( GNOME_DIALOG(sxfti->dialog)); gnome_dialog_close( GNOME_DIALOG(sxfti->dialog));
if(sxfti->sx && delete_sx) if(sxfti->sx && delete_sx)
@@ -468,28 +467,28 @@ sxftd_cancel_clicked(GtkWidget *w, gpointer user_data)
static void static void
sxftd_advanced_clicked(GtkWidget *w, gpointer user_data) sxftd_advanced_clicked(GtkWidget *w, gpointer user_data)
{ {
SXFromTransInfo *sxfti = user_data; SXFromTransInfo *sxfti = user_data;
guint sx_error = sxftd_compute_sx(sxfti); guint sx_error = sxftd_compute_sx(sxfti);
SchedXactionDialog *adv_dlg; SchedXactionDialog *adv_dlg;
SchedXactionEditorDialog *adv_edit_dlg; SchedXactionEditorDialog *adv_edit_dlg;
if (sx_error == 0) if (sx_error != 0)
{ {
adv_dlg = gnc_ui_scheduled_xaction_dialog_create(); PWARN( "something bad happened in sxftd_compute_sx" );
adv_edit_dlg = gnc_ui_scheduled_xaction_editor_dialog_create(adv_dlg, return;
sxfti->sx, 1);
} }
gtk_widget_hide( sxfti->dialog );
/* force a gui update. */
while (g_main_iteration(FALSE));
else adv_dlg = gnc_ui_scheduled_xaction_dialog_create();
{ adv_edit_dlg = gnc_ui_scheduled_xaction_editor_dialog_create(adv_dlg,
PWARN("something bad happened in sxftd_compute_sx"); sxfti->sx, 1);
} /* close ourself, since advanced editing entails us, and there are sync
* issues otherwise. */
return; sxftd_delete(sxfti, FALSE);
} }
void void
gnc_sx_create_from_trans(Transaction *trans) gnc_sx_create_from_trans(Transaction *trans)
{ {