diff options
author | Milan Crha <mcrha@redhat.com> | 2010-05-27 23:27:47 +0800 |
---|---|---|
committer | Milan Crha <mcrha@redhat.com> | 2010-05-27 23:27:47 +0800 |
commit | c98ff48755c6a0bdd1005e9427d184385a4999b8 (patch) | |
tree | 012149825495a1d43f48aed21fb22668cbeb03a2 /calendar/gui/dialogs/comp-editor-util.c | |
parent | 7f51095908ab0332ca2722beceffbcb123eefc1c (diff) | |
download | gsoc2013-evolution-c98ff48755c6a0bdd1005e9427d184385a4999b8.tar.gz gsoc2013-evolution-c98ff48755c6a0bdd1005e9427d184385a4999b8.tar.zst gsoc2013-evolution-c98ff48755c6a0bdd1005e9427d184385a4999b8.zip |
Bug #248105 - No warning if you create an appointment in the past
Diffstat (limited to 'calendar/gui/dialogs/comp-editor-util.c')
-rw-r--r-- | calendar/gui/dialogs/comp-editor-util.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/calendar/gui/dialogs/comp-editor-util.c b/calendar/gui/dialogs/comp-editor-util.c index 9856bd7c96..6d3adfe733 100644 --- a/calendar/gui/dialogs/comp-editor-util.c +++ b/calendar/gui/dialogs/comp-editor-util.c @@ -381,3 +381,34 @@ comp_editor_have_in_new_attendees_lst (const GSList *new_attendees, return FALSE; } + +/** + * comp_editor_test_time_in_the_past: + * @time_tt: Time to check. + * @parent: Parent window for a question dialog. + * @tag: Question message tag to use. + * Returns whether given time is in the past. + * + * Tests the given @time_tt whether occurs in the past, + * and if so, returns TRUE. + **/ +gboolean +comp_editor_test_time_in_the_past (const struct icaltimetype time_tt) +{ + struct icaltimetype now_tt; + gboolean is_past; + + if (icaltime_is_null_time (time_tt)) + return FALSE; + + if (time_tt.is_date) { + now_tt = icaltime_today (); + is_past = icaltime_compare_date_only (time_tt, now_tt) < 0; + } else { + now_tt = icaltime_current_time_with_zone (time_tt.zone); + now_tt.zone = time_tt.zone; + is_past = icaltime_compare (time_tt, now_tt) < 0; + } + + return is_past; +} |