mirror of
https://github.com/Gnucash/gnucash.git
synced 2026-10-12 17:32:00 -05:00
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:
1 parent
7e2051e60d
commit
66b982375e
4 files changed
+101
-56
No files matched your search
@@ -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>
|
||||
|
||||
* src/backend/file/sixtp.c (sixtp_parse_file): Explicitly create
|
||||
|
||||
@@ -101,7 +101,9 @@ X create a template register
|
||||
. SX list
|
||||
. add a big calendar [gnome-pim? evo?] to SXaction List/overview
|
||||
. 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
|
||||
. tab order
|
||||
@@ -119,19 +121,21 @@ X create a template register
|
||||
|
||||
. make-from-transaction
|
||||
. 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
|
||||
between these things [SX-from-trans, SX list, SX editor] that should be
|
||||
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
|
||||
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
|
||||
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
|
||||
can be instantiated correctly].
|
||||
. tab-order
|
||||
|
||||
@@ -558,7 +558,6 @@ gnc_ui_scheduled_xaction_dialog_create(void)
|
||||
|
||||
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->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->dialog = create_Scheduled_Transaction_Editor(); */
|
||||
sxed->gxml = gnc_glade_xml_new( "sched-xact.glade",
|
||||
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
|
||||
void
|
||||
static void
|
||||
delete_button_clicked( GtkButton *b, gpointer d )
|
||||
{
|
||||
GNCBook *book;
|
||||
GtkCList *cl;
|
||||
GList *sel, *sxList;
|
||||
GList *sel, *sxList, *beingEditedList, *l;
|
||||
SchedXactionDialog *sxd;
|
||||
GnomeDialog *confirmDlg;
|
||||
GtkLabel *dlgMsgLbl;
|
||||
static char *confirmMessage =
|
||||
"Delete the selected scheduled transactions?";
|
||||
int confirmSel;
|
||||
GString *realMsg;
|
||||
char *beingEditedMessage =
|
||||
_( "The following transactions are presently being edited;\n"
|
||||
"are you sure you want to delete them?" );
|
||||
char *confirmMessage =
|
||||
_( "Delete the selected Scheduled Transactions?" );
|
||||
GString *realConfDelOpenMsg, *realConfDeleteMsg;
|
||||
SchedXaction *sx;
|
||||
gboolean destroyOpenedResult = FALSE;
|
||||
|
||||
sxd = (SchedXactionDialog*)d;
|
||||
|
||||
@@ -1154,29 +1152,59 @@ delete_button_clicked( GtkButton *b, gpointer d )
|
||||
return;
|
||||
}
|
||||
|
||||
realMsg = g_string_new( confirmMessage );
|
||||
do {
|
||||
realConfDeleteMsg = g_string_new( confirmMessage );
|
||||
realConfDelOpenMsg = g_string_new( beingEditedMessage );
|
||||
beingEditedList = NULL;
|
||||
for ( ; sel ; sel = sel->next ) {
|
||||
sx = gtk_clist_get_row_data( cl, (int)sel->data );
|
||||
g_string_sprintfa( realMsg, "\n\"%s\"", xaccSchedXactionGetName( sx ) );
|
||||
} while ( (sel = g_list_next(sel)) );
|
||||
g_string_sprintfa( realConfDeleteMsg, "\n\"%s\"",
|
||||
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 =
|
||||
GNOME_DIALOG(gnome_dialog_new( "Confirm Delete",
|
||||
GNOME_STOCK_BUTTON_YES,
|
||||
GNOME_STOCK_BUTTON_NO,
|
||||
NULL ));
|
||||
dlgMsgLbl = GTK_LABEL(gtk_label_new( realMsg->str ));
|
||||
gtk_box_pack_start( GTK_BOX( confirmDlg->vbox ),
|
||||
GTK_WIDGET(dlgMsgLbl), TRUE, TRUE, 0 );
|
||||
gnome_dialog_set_parent( confirmDlg,
|
||||
GTK_WINDOW(sxd->dialog) );
|
||||
gtk_widget_show_all( GTK_WIDGET(confirmDlg) );
|
||||
if ( g_list_length( beingEditedList ) > 0 ) {
|
||||
/* Figure out the user's disposition [toward the opened
|
||||
* transactions], but if it's true, don't act on it until
|
||||
* they confirm they actually want to do the deletion
|
||||
* generically. If it's false, cleanup and return. */
|
||||
if ( ! (destroyOpenedResult =
|
||||
gnc_verify_dialog_parented( sxd->dialog,
|
||||
realConfDelOpenMsg->str,
|
||||
FALSE )) ) {
|
||||
for ( l = beingEditedList; l; l = l->next ) {
|
||||
g_list_free( (GList*)l->data );
|
||||
}
|
||||
g_list_free( beingEditedList );
|
||||
goto cleanupStrings;
|
||||
return; /* unreachable, but clearer. */
|
||||
}
|
||||
}
|
||||
|
||||
confirmSel = gnome_dialog_run_and_close( confirmDlg );
|
||||
g_string_free( realMsg, TRUE );
|
||||
if ( gnc_verify_dialog_parented( sxd->dialog,
|
||||
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 ) {
|
||||
case 0:
|
||||
/* Now, actually do the deletions... */
|
||||
sel = cl->selection;
|
||||
book = gnc_get_current_book ();
|
||||
sxList = gnc_book_get_schedxactions( book );
|
||||
@@ -1192,12 +1220,11 @@ delete_button_clicked( GtkButton *b, gpointer d )
|
||||
gtk_clist_clear( cl );
|
||||
g_list_foreach( sxList, putSchedXactionInClist, sxd );
|
||||
gtk_clist_thaw( cl );
|
||||
break;
|
||||
case 1:
|
||||
default:
|
||||
return;
|
||||
break;
|
||||
}
|
||||
|
||||
cleanupStrings:
|
||||
g_string_free( realConfDeleteMsg, TRUE );
|
||||
g_string_free( realConfDelOpenMsg, TRUE );
|
||||
}
|
||||
|
||||
static
|
||||
|
||||
@@ -396,7 +396,6 @@ sxftd_delete(SXFromTransInfo *sxfti, gboolean delete_sx)
|
||||
{
|
||||
|
||||
/* FIXME: do we need to clean up the GladeXML pointer ?*/
|
||||
|
||||
gnome_dialog_close( GNOME_DIALOG(sxfti->dialog));
|
||||
|
||||
if(sxfti->sx && delete_sx)
|
||||
@@ -468,28 +467,28 @@ sxftd_cancel_clicked(GtkWidget *w, gpointer user_data)
|
||||
static void
|
||||
sxftd_advanced_clicked(GtkWidget *w, gpointer user_data)
|
||||
{
|
||||
SXFromTransInfo *sxfti = user_data;
|
||||
SXFromTransInfo *sxfti = user_data;
|
||||
guint sx_error = sxftd_compute_sx(sxfti);
|
||||
SchedXactionDialog *adv_dlg;
|
||||
SchedXactionEditorDialog *adv_edit_dlg;
|
||||
|
||||
if (sx_error == 0)
|
||||
if (sx_error != 0)
|
||||
{
|
||||
adv_dlg = gnc_ui_scheduled_xaction_dialog_create();
|
||||
adv_edit_dlg = gnc_ui_scheduled_xaction_editor_dialog_create(adv_dlg,
|
||||
sxfti->sx, 1);
|
||||
|
||||
PWARN( "something bad happened in sxftd_compute_sx" );
|
||||
return;
|
||||
}
|
||||
gtk_widget_hide( sxfti->dialog );
|
||||
/* force a gui update. */
|
||||
while (g_main_iteration(FALSE));
|
||||
|
||||
else
|
||||
{
|
||||
PWARN("something bad happened in sxftd_compute_sx");
|
||||
}
|
||||
|
||||
return;
|
||||
adv_dlg = gnc_ui_scheduled_xaction_dialog_create();
|
||||
adv_edit_dlg = gnc_ui_scheduled_xaction_editor_dialog_create(adv_dlg,
|
||||
sxfti->sx, 1);
|
||||
/* close ourself, since advanced editing entails us, and there are sync
|
||||
* issues otherwise. */
|
||||
sxftd_delete(sxfti, FALSE);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
gnc_sx_create_from_trans(Transaction *trans)
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user