Re: [evolution-patches] [IMPROVED PATCH]Bug#55208:warn user about wrong birthdate and anniversary date in contacts
- From: Chris Toshok <toshok ximian com>
- To: S N Tejasvi <tejasvi_sn gawab com>
- Cc: evolution-patches lists ximian com
- Subject: Re: [evolution-patches] [IMPROVED PATCH]Bug#55208:warn user about wrong birthdate and anniversary date in contacts
- Date: Tue, 13 Apr 2004 12:43:25 -0700
Two very minor things, and then the patch is fine by me. Who needs to
review the message in the dialog? Ben was going over error messages
recently, does he need to look at it?
On Sat, 2004-04-10 at 21:22 +0530, S N Tejasvi wrote:
>
> + if(!e_contact_editor_is_valid(EAB_EDITOR(ce)))
> + return;
space between "if" and "(", here and elsewhere.
> ecs->ce = ce;
> g_object_ref (ecs->ce);
>
> ecs->should_close = should_close;
>
> gtk_widget_set_sensitive (ce->app, FALSE);
> @@ -1662,7 +1663,42 @@
> e_contact_editor_is_valid (EABEditor *editor)
> {
> /* insert checks here (date format, for instance, etc.) */
> - return TRUE;
> + EContactEditor *ce = E_CONTACT_EDITOR (editor);
> + GtkWidget *dialog,*widget;
> + gboolean validation_error = FALSE;
> + gint result;
> + GString *errmsg = g_string_new (_("The following entries are invalid:\n\n"));
> +
> + widget = glade_xml_get_widget (ce->gui, "dateedit-birthday");
> + if(!(e_date_edit_date_is_valid (E_DATE_EDIT (widget)))) {
> + g_string_append_printf (errmsg,"%s: %s",
> + e_contact_pretty_name (E_CONTACT_BIRTH_DATE),
> + _("Example: 04/04/2004\n\n"));
> + validation_error = TRUE;
> + }
> +
> + widget = glade_xml_get_widget (ce->gui, "dateedit-anniversary");
> + if(!(e_date_edit_date_is_valid (E_DATE_EDIT (widget)))) {
> + g_string_append_printf (errmsg,"%s: %s",
> + e_contact_pretty_name (E_CONTACT_ANNIVERSARY),
> + _("Example: 04/04/2004\n\n"));
> + validation_error = TRUE;
> + }
> +
> + if(validation_error) {
> + dialog = gtk_message_dialog_new (GTK_WINDOW (ce->app),
> + 0,
> + GTK_MESSAGE_INFO,
> + GTK_BUTTONS_OK,
> + errmsg->str);
> + result = gtk_dialog_run (GTK_DIALOG (dialog));
> + gtk_widget_destroy (dialog);
> + g_string_free (errmsg, TRUE);
> + return FALSE;
> + }
> + else
> + g_string_free (errmsg, TRUE);
> + return TRUE;
braces around these two lines.
Chris
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]