From 155223435b0a80bcc8fa3a6ff0b03d2031ae2403 Mon Sep 17 00:00:00 2001 From: Rodrigo Moya Date: Tue, 8 Oct 2002 17:58:08 +0000 Subject: Fixes #11434 2002-10-08 Rodrigo Moya Fixes #11434 * gui/dialogs/comp-editor-page.[ch] (comp_editor_page_display_validation_error): new function. * gui/dialogs/event-page.c (event_page_fill_component): * gui/dialogs/recurrence-page.c (fill_component): * gui/dialogs/task-details-page.c (task_details_page_fill_component): * gui/dialogs/task-page.c (task_page_fill_component): added checks for all date values, and return FALSE if we find some invalid date/times. * gui/dialogs/comp-editor.c (save_comp): activate the page that returns error in fill_component. svn path=/trunk/; revision=18352 --- calendar/gui/dialogs/comp-editor-page.c | 35 +++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) (limited to 'calendar/gui/dialogs/comp-editor-page.c') diff --git a/calendar/gui/dialogs/comp-editor-page.c b/calendar/gui/dialogs/comp-editor-page.c index b1fabf28be..d2de97586e 100644 --- a/calendar/gui/dialogs/comp-editor-page.c +++ b/calendar/gui/dialogs/comp-editor-page.c @@ -23,6 +23,10 @@ #endif #include +#include +#include +#include +#include #include "comp-editor-page.h" @@ -384,3 +388,34 @@ comp_editor_page_notify_dates_changed (CompEditorPage *page, comp_editor_page_signals[DATES_CHANGED], dates); } + +/** + * comp_editor_page_display_validation_error: + * @page: An editor page. + * @msg: Error message to display. + * @field: Widget that caused the validation error. + * + * Displays an error message about a validation problem in the + * given field. Once the error message has been displayed, the + * focus is set to the widget that caused the validation error. + */ +void +comp_editor_page_display_validation_error (CompEditorPage *page, + const char *msg, + GtkWidget *field) +{ + GtkWidget *dialog; + char *real_msg; + + g_return_if_fail (IS_COMP_EDITOR_PAGE (page)); + g_return_if_fail (msg != NULL); + g_return_if_fail (GTK_IS_WIDGET (field)); + + real_msg = g_strdup_printf (_("Validation error: %s"), msg); + dialog = gnome_error_dialog (real_msg); + gnome_dialog_run_and_close (GNOME_DIALOG (dialog)); + + gtk_widget_grab_focus (field); + + g_free (real_msg); +} -- cgit v1.2.3