+/* Sets a predicate function that is called after "OK" or another button that
+ accepts the dialog's settings is pushed. If the predicate function returns
+ false, then the button push is ignored. (If the predicate function returns
+ false, then it should take some action to notify the user why the contents
+ are unacceptable, e.g. pop up a dialog box.)
+
+ An accept predicate is preferred over a validity predicate when the reason
+ why the dialog settings are unacceptable may not be obvious to the user, so
+ that the user needs a helpful message to explain. */
+void
+psppire_dialog_set_accept_predicate (PsppireDialog *dialog,
+ ContentsAreValid contents_are_acceptable,
+ gpointer data)
+{
+ dialog->contents_are_acceptable = contents_are_acceptable;
+ dialog->acceptable_data = data;
+}
+
+gboolean
+psppire_dialog_is_acceptable (const PsppireDialog *dialog)
+{
+ return (dialog->contents_are_acceptable == NULL
+ || dialog->contents_are_acceptable (dialog->acceptable_data));
+}