aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/timeutil.c
diff options
context:
space:
mode:
authorFederico Mena Quintero <federico@nuclecu.unam.mx>1998-08-25 10:19:20 +0800
committerArturo Espinosa <unammx@src.gnome.org>1998-08-25 10:19:20 +0800
commitbf844f9fa82ee8540f99df6bd1bb533e99a70562 (patch)
tree5c75b30f1a5ac3d7a9978e8efc511b8adc7162c6 /calendar/timeutil.c
parent4d075f28b587361a5014edd4946f30d9ae113e9f (diff)
downloadgsoc2013-evolution-bf844f9fa82ee8540f99df6bd1bb533e99a70562.tar.gz
gsoc2013-evolution-bf844f9fa82ee8540f99df6bd1bb533e99a70562.tar.zst
gsoc2013-evolution-bf844f9fa82ee8540f99df6bd1bb533e99a70562.zip
Today: Beautification of the Preferences dialog. Made the menus more
Today: Beautification of the Preferences dialog. Made the menus more consistent with the rest of GNOME. Started work on the meat of the month view. Minor fixups on some of the other views. 1998-08-24 Federico Mena Quintero <federico@nuclecu.unam.mx> * prop.c (build_two_radio_group): Doh. Set the state of the radio buttons properly. * month-view.c (month_view_time_format_changed): New public function that notifies the month view of a time format change. * gnome-cal.c (gnome_calendar_time_format_changed): New public function that notifies the calendar of a time format change. * main.c (time_format_changed): Use gnome_calendar_time_format_changed(). * month-view.c (month_view_update): New public function to update the month view when an event changes. This is still unfinished. (month_view_set): New public function to set the month in the month view. * gnome-cal.c (gnome_calendar_direction): Add case for month view. (gnome_calendar_set_view): Likewise. (gnome_calendar_update_all): Likewise. * timeutil.c (time_add_week): Implemented the time_add_week() function, which was on the header file. (time_add_month): Added public month-adding routine. * gnome-cal.c (gnome_calendar_get_current_view_name): Add case for month view. (gnome_calendar_goto): Likewise, and set the time on the month view. * month-view.c (month_view_new): Now it takes the calendar plus the time_t representing the month. * gnome-month-item.h: Added documentation on the object arguments for the month item. * month-view.c (month_view_init): Added a month/year heading to the month view. * TODO: Updated the TODO list a bit. * main.c (gnome_cal_file_menu): The preferences menu option should go in the File menu. (gnome_cal_edit_menu): Added stock pixmaps to the menu items. (gnome_cal_menu): Renamed the Calendar menu to Edit. (gnome_cal_help_menu): Use "About Gnomecal", not just "About". * prop.c (hour_activated): Notify the property box that it has changed. svn path=/trunk/; revision=337
Diffstat (limited to 'calendar/timeutil.c')
-rw-r--r--calendar/timeutil.c31
1 files changed, 28 insertions, 3 deletions
diff --git a/calendar/timeutil.c b/calendar/timeutil.c
index c27a8dbd45..03d9465daa 100644
--- a/calendar/timeutil.c
+++ b/calendar/timeutil.c
@@ -89,6 +89,21 @@ format_simple_hour (int hour, int use_am_pm)
}
time_t
+time_add_minutes (time_t time, int minutes)
+{
+ struct tm *tm = localtime (&time);
+ time_t new_time;
+
+ tm->tm_min += minutes;
+ if ((new_time = mktime (tm)) == -1){
+ g_warning ("mktime could not handling adding a day with\n");
+ print_time_t (time);
+ return time;
+ }
+ return new_time;
+}
+
+time_t
time_add_day (time_t time, int days)
{
struct tm *tm = localtime (&time);
@@ -104,14 +119,24 @@ time_add_day (time_t time, int days)
}
time_t
-time_add_minutes (time_t time, int minutes)
+time_add_week (time_t time, int weeks)
+{
+ return time_add_day (time, weeks * 7);
+}
+
+time_t
+time_add_month (time_t time, int months)
{
struct tm *tm = localtime (&time);
time_t new_time;
- tm->tm_min += minutes;
+ /* FIXME: this will not work correctly when switching, say, from a 31-day month to a 30-day
+ * month. Figure out the number of days in the month and go to the nearest "limit" day.
+ */
+
+ tm->tm_mon += months;
if ((new_time = mktime (tm)) == -1){
- g_warning ("mktime could not handling adding a day with\n");
+ g_warning ("mktime could not handling adding a month with\n");
print_time_t (time);
return time;
}