Attached are a pair of patches to fix several bugs with the cell
Validation functionality. The patch is against latest CVS on both the
HEAD and gnome_1_4 branches. The patch is appropriate for 1.0.4 because
it contains only bug-fixes (not new features) and because it's small, even
though the following changelog isn't particularly. =)
* src/validation.c:
Return VALIDATION_STATUS_VALID on assertion failure, not "1".
Treat VALIDATION_TYPE_AS_DATE/VALIDATION_TYPE_AS_TIME as
VALIDATION_TYPE_ANY, since no one seems to know what they ought to
do (added a TODO #warning here, too).
Cleaned up the VALIDATION_TYPE_AS_NUMBER case with a switch statement.
Covered corner cases better, and clarified the error messages to
correspond with the wording in the validation properties dialog.
Fixed a logic bug in VALIDATION_OP_BETWEEN that caused us to ignore the
lower bound in this case.
Clarified the default error message.
(same changes here to both 1.0.4 and 1.1.x branch to keep code parallel)
* src/workbook-control-gui.c
(delete_sheet_if_possible,wbcg_validation_message)
*** 1.1.x BRANCH ONLY ***
The gtk_dialog_run() function doesn't destroy the dialog window
before it returns, like gnumeric_dialog_run did. We have to do it
ourselves (otherwise the window never goes away!). Also,
wbcg_validation_message accidentally inverted its test so
it would always report that the opposite button had been pressed.
* src/dialogs/cell-format.glade:
Fixed the dialog entry for the NOT_BETWEEN case: the test should
be 'val < min || max < val' not 'val <= min || max <= val'. Also
changed the '||' in the dialog to english 'or'.
* src/dialogs/dialog-cell-format.c (validation_entry_to_expr):
The validation_entry_to_expr function can be called before
cb_fmt_dialog_set_focus sets the proper flags on the
GnumericExprEntry, so we need to do it ourselves. If we don't,
gnumeric_expr_entry_parse/gnm_expr_entry_parse will fail and
we'll 'forget' the proper value of the arguments. (You'll
see this bug if you open the validation window, change something
[the validation operation, for example] and hit okay without ever
focusing on the min/max fields. Open the validation window
again and the contents previously in min/max will be gone.)
* src/dialogs/dialog-cell-format.c (validation_entry_from_expr):
*** 1.1.x BRANCH ONLY ***
You can't cast a GnumericExprEntry to a GtkEntry. You need
to call gnm_expr_entry_get_entry. This was causing the
validation argument fields to always show up blank.
Enjoy!
--scott
Boston KGB President AP Cheney United Nations MI5 mail drop Morwenstow
Bejing TASS domestic disruption Uzi World Trade Center Sudan blowfish
( http://lesser-magoo.lcs.mit.edu/~cananian )
Attachment:
patch-1.0.4-cvs.valid2
Description: patch for 1.0.4 branch
Attachment:
patch-HEAD-cvs.valid2
Description: patch for 1.1.x branch