From e749abc966ea945d1aa34e6b975d3f2612d3536e Mon Sep 17 00:00:00 2001 From: Srinivasa Ragavan Date: Thu, 1 Dec 2011 10:02:16 +0200 Subject: Upstreamed patch from MeeGo Bugzilla: 22945 Check for birthdays which can't be set to future dates. --- addressbook/gui/contact-editor/e-contact-editor.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'addressbook/gui') diff --git a/addressbook/gui/contact-editor/e-contact-editor.c b/addressbook/gui/contact-editor/e-contact-editor.c index 9ad6fc0612..6f4597ab1f 100644 --- a/addressbook/gui/contact-editor/e-contact-editor.c +++ b/addressbook/gui/contact-editor/e-contact-editor.c @@ -3732,6 +3732,7 @@ e_contact_editor_is_valid (EABEditor *editor) gboolean validation_error = FALSE; GSList *iter; GString *errmsg = g_string_new (_("The contact data is invalid:\n\n")); + time_t bday, now = time (NULL); widget = e_builder_get_widget (ce->builder, "dateedit-birthday"); if (!(e_date_edit_date_is_valid (E_DATE_EDIT (widget)))) { @@ -3740,6 +3741,13 @@ e_contact_editor_is_valid (EABEditor *editor) e_contact_pretty_name (E_CONTACT_BIRTH_DATE)); validation_error = TRUE; } + /* If valid, see if the birthday is a future date */ + bday = e_date_edit_get_time (E_DATE_EDIT (widget)); + if (bday > now) { + g_string_append_printf (errmsg, _("'%s' cannot be a future date"), + e_contact_pretty_name (E_CONTACT_BIRTH_DATE)); + validation_error = TRUE; + } widget = e_builder_get_widget (ce->builder, "dateedit-anniversary"); if (!(e_date_edit_date_is_valid (E_DATE_EDIT (widget)))) { -- cgit v1.2.3