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

* src/gnome/dialog-scheduledxaction.c
	(editor_ok_button_clicked): Added checks for ScheduledTransactions
	with no name, same name as existing SchedXaction.
	(row_select_handler): Resolved "critical" GTK run-time warning
	regarding navigating the Scheduled Transaction list with the arrow
	keys.


git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@6805 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Joshua Sled
2002-04-18 06:28:37 +00:00
parent 1949ee142b
commit 477202a04a
2 changed files with 80 additions and 14 deletions
+13 -5
View File
@@ -101,6 +101,7 @@ 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.
. SX editor
. tab order
@@ -118,12 +119,15 @@ X create a template register
. make-from-transaction
. bugs
. 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.
. creating a SX from trans with the SX list open does not update it.
. 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
. tab-order
. better frequency guess?
[ related... ]
@@ -139,7 +143,7 @@ X create a template register
which may not be the Right Thing]
. need "since-last-run" UI for instanatiation.
. need nifty visual style
. need nifty visual style for druid.
. use color-setting code in src/gnome-utils/druid-utils.[ch]
. support sorting in various clists
. tab-order
@@ -156,8 +160,12 @@ X create a template register
. bugs
. correct "Back" button behavior in Druid paradigm
. tab-order on variable-entry window isn't always correct.
. created SXes are put in GL forever... :(
. created SXes are put in GL forever. :(
. But this is true of manually-created transactions, too ... is this
actually correct behavior?
. inital "To-Create Transactions" varbinding table doesn't setup table correctly.
. creating/cancelling a bunch [FIXME:define "bunch"] of transactions
takes too long, with no progress indication.
X twunder reports [2002.01.29] register growing a little bit at a time if
tab is hit to switch between register fields -- started with update on
1/21.
+64 -6
View File
@@ -242,9 +242,13 @@ editor_ok_button_clicked( GtkButton *b, SchedXactionEditorDialog *sxed )
/* FIXMEs: Do checks on validity and such, interrupting the user if
* things aren't right.
* FIXME: We should do all validity checks before we change anything
* about the SX; for clarity as well as consistency.
*
* . SX name is unique
* . balancing the SX if contain numeric-only formula data.
* . agreement with create-automagically/notification controls
* X SX has a name
* X "weekly" FS has some days set.
* X "once" with reasonable start/end dates.
* X This doesn't work at the time the 'weekly' one was fixed with
@@ -299,11 +303,62 @@ editor_ok_button_clicked( GtkButton *b, SchedXactionEditorDialog *sxed )
}
#endif /* 0 */
gdate = g_date_new();
/* read out data back into SchedXaction object. */
w = glade_xml_get_widget( sxed->gxml, "sxe_name" );
xaccSchedXactionSetName( sxed->sx, gtk_entry_get_text( GTK_ENTRY(w) ) );
/* FIXME: this is getting too deep; split out. */
{
char *name;
GList *sxList;
gboolean nameExists, nameHasChanged;
w = glade_xml_get_widget( sxed->gxml, "sxe_name" );
name = gtk_entry_get_text( GTK_ENTRY(w) );
if ( strlen(name) == 0 ) {
char *sx_has_no_name_msg =
_( "Please name the Scheduled Transaction." );
gnc_error_dialog_parented( GTK_WINDOW(sxed->dialog),
sx_has_no_name_msg );
return;
}
nameExists = FALSE;
nameHasChanged =
(xaccSchedXactionGetName(sxed->sx) == NULL)
|| (strcmp( xaccSchedXactionGetName(sxed->sx), name ) != 0);
sxList = gnc_book_get_schedxactions( gnc_get_current_book() );
for ( ; nameHasChanged && !nameExists && sxList ;
sxList = sxList->next ) {
char *existingName;
existingName =
xaccSchedXactionGetName( (SchedXaction*)sxList->
data );
nameExists |= ( g_strcasecmp(name, existingName) == 0 );
}
if ( nameHasChanged && nameExists ) {
char *sx_has_existing_name_msg =
_( "A Scheduled Transaction with this name \"%s\" already exists.\n"
"Are you sure you want to name this one the same?" );
GString *realMsg;
int len = strlen( sx_has_existing_name_msg)
+ strlen( name );
realMsg = g_string_sized_new( len );
g_string_sprintf( realMsg, sx_has_existing_name_msg, name );
if ( ! gnc_verify_dialog_parented( sxed->dialog,
realMsg->str,
FALSE ) ) {
/* They don't; so don't. */
g_string_free( realMsg, TRUE );
return;
}
g_string_free( realMsg, TRUE );
}
xaccSchedXactionSetName( sxed->sx, name );
}
gdate = g_date_new();
optEndDate = glade_xml_get_widget( sxed->gxml, "rb_enddate" );
optNoEnd = glade_xml_get_widget( sxed->gxml, "rb_noend" );
optNumOccur = glade_xml_get_widget( sxed->gxml, "rb_num_occur" );
@@ -566,17 +621,19 @@ row_select_handler( GtkCList *clist,
gpointer d )
{
SchedXactionDialog *sxd;
SchedXactionEditorDialog *sxed;
SchedXaction *sx;
sxd = (SchedXactionDialog*)d;
g_return_if_fail( event );
if ( event == NULL ) {
/* it could be a keypress */
return;
}
switch ( event->type ) {
case GDK_2BUTTON_PRESS:
sx = (SchedXaction*)gtk_clist_get_row_data( clist, row );
sxed = gnc_ui_scheduled_xaction_editor_dialog_create( sxd, sx, 0 );
gnc_ui_scheduled_xaction_editor_dialog_create( sxd, sx, 0 );
break;
default:
/* noop */
@@ -728,6 +785,7 @@ gnc_ui_scheduled_xaction_editor_dialog_create( SchedXactionDialog *sxd,
gtk_widget_show_all(sxed->dialog);
return sxed;
}