aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook/gui/contact-editor
diff options
context:
space:
mode:
authorSrinivasa Ragavan <sragavan@gnome.org>2011-12-01 16:02:16 +0800
committerSrinivasa Ragavan <sragavan@gnome.org>2011-12-01 16:02:16 +0800
commite749abc966ea945d1aa34e6b975d3f2612d3536e (patch)
tree99b4b15976fe136547d8672641156e052d54b131 /addressbook/gui/contact-editor
parent832bea90bf2b29db673a86067f193694a493093a (diff)
downloadgsoc2013-evolution-e749abc966ea945d1aa34e6b975d3f2612d3536e.tar.gz
gsoc2013-evolution-e749abc966ea945d1aa34e6b975d3f2612d3536e.tar.zst
gsoc2013-evolution-e749abc966ea945d1aa34e6b975d3f2612d3536e.zip
Upstreamed patch from MeeGo Bugzilla: 22945
Check for birthdays which can't be set to future dates.
Diffstat (limited to 'addressbook/gui/contact-editor')
-rw-r--r--addressbook/gui/contact-editor/e-contact-editor.c8
1 files changed, 8 insertions, 0 deletions
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)))) {