[gnumeric] validation: Fix handling of VALIDATION_STYLE_NONE.



commit 30b7c2d8fd973b0816b9f61eec98cd055b08d1fa
Author: Morten Welinder <terra gnome org>
Date:   Fri Apr 24 22:37:18 2009 -0400

    validation: Fix handling of VALIDATION_STYLE_NONE.
---
 ChangeLog        |    3 +++
 NEWS             |    9 +++++----
 src/validation.c |   17 ++++++++++++-----
 3 files changed, 20 insertions(+), 9 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index ccfa812..78a1065 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2009-04-24  Morten Welinder  <terra gnome org>
 
+	* src/validation.c (validation_barf): Ignore the problem if
+	VALIDATION_STYLE_NONE is used.  Fixes #580157.
+
 	* src/expr.c (gnm_expr_as_string): Add defaults for debugging.
 
 	* src/sheet.c (gnm_sheet_resize_main): Restrict the selection to
diff --git a/NEWS b/NEWS
index ae761ce..8740080 100644
--- a/NEWS
+++ b/NEWS
@@ -8,8 +8,8 @@ Andreas:
 	* Quieten GTK warning [#579152]
 	* Print text in sheet object label [#144787]
 	* Implement editing of a sheet object label
-	* Include "italic", "strikethrough" and "bold" buttons in the properties 
-	  dialog for sheet object labels
+	* Include "italic", "strikethrough" and "bold" buttons in the
+	  properties dialog for sheet object labels
 
 Jean:
 	* Variable sheet sizes.
@@ -30,14 +30,15 @@ Morten:
 	* Fix Applix loading crash.  [#577145]
 	* Fix Lotus loading crash.  [#577156]
 	* Fix XLS loading crashes.  [#577205] [#577208] [#577259] [#577260]
-	[#577348] [#577351] [#577399] [#577400] [#577503] [#577504]
+	  [#577348] [#577351] [#577399] [#577400] [#577503] [#577504]
 	* Add sorted sheet list to tab menu.
 	* Fix criticals during Lotus load.
 	* Clean up Sheet object.
 	* Clean up str.h usage.
 	* Load csv and txt files into sheets as big as needed.  [Part of
-	#168875]
+	  #168875]
 	* Implement sheet resize.
+	* Fix validation problem.  [#580157]
 
 Vivien Malerba:
 	* Move to libgda4.
diff --git a/src/validation.c b/src/validation.c
index 0efc58a..98e778d 100644
--- a/src/validation.c
+++ b/src/validation.c
@@ -298,12 +298,20 @@ validation_is_ok (GnmValidation const *v)
 }
 
 static ValidationStatus
-validation_barf (WorkbookControl *wbc, GnmValidation const *gv, char *def_msg)
+validation_barf (WorkbookControl *wbc, GnmValidation const *gv,
+		 char *def_msg, gboolean *showed_dialog)
 {
 	char const *msg = gv->msg ? gv->msg->str : def_msg;
 	char const *title = gv->title ? gv->title->str : _("Gnumeric: Validation");
-	ValidationStatus result = wb_control_validation_msg (wbc,
-		gv->style, title, msg);
+	ValidationStatus result;
+
+	if (gv->style == VALIDATION_STYLE_NONE) {
+		/* Invalid, but we're asked to ignore.  */
+		result = VALIDATION_STATUS_VALID;
+	} else {
+		if (showed_dialog) *showed_dialog = TRUE;
+		result = wb_control_validation_msg (wbc, gv->style, title, msg);
+	}
 	g_free (def_msg);
 	return result;
 }
@@ -319,8 +327,7 @@ cb_validate_custom (GnmValueIter const *v_iter, GnmValue const *target)
 
 #define BARF(msg)					\
   do {							\
-	if (showed_dialog) *showed_dialog = TRUE;	\
-	return validation_barf (wbc, v, msg);		\
+	return validation_barf (wbc, v, msg, showed_dialog);		\
   } while (0)
 
 /**



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]