aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/gui
diff options
context:
space:
mode:
Diffstat (limited to 'calendar/gui')
-rw-r--r--calendar/gui/gncal-day-panel.c2
-rw-r--r--calendar/gui/gncal-week-view.c20
-rw-r--r--calendar/gui/gnome-cal.c3
3 files changed, 15 insertions, 10 deletions
diff --git a/calendar/gui/gncal-day-panel.c b/calendar/gui/gncal-day-panel.c
index 099b02f384..3cf2f57b24 100644
--- a/calendar/gui/gncal-day-panel.c
+++ b/calendar/gui/gncal-day-panel.c
@@ -65,7 +65,7 @@ calendar_day_selected (GtkCalendar *calendar, GncalDayPanel *dpanel)
gtk_calendar_get_date (calendar, &y, &m, &d);
- tm.tm_year = y;
+ tm.tm_year = y - 1900;
tm.tm_mon = m;
tm.tm_mday = d;
tm.tm_hour = 0;
diff --git a/calendar/gui/gncal-week-view.c b/calendar/gui/gncal-week-view.c
index 7de8899cb3..ab5e7fbea0 100644
--- a/calendar/gui/gncal-week-view.c
+++ b/calendar/gui/gncal-week-view.c
@@ -175,8 +175,8 @@ gncal_week_view_update (GncalWeekView *wview, iCalObject *ico, int flags)
void
gncal_week_view_set (GncalWeekView *wview, time_t start_of_week)
{
- struct tm tm, start;
- time_t day_start, day_end;
+ struct tm tm;
+ time_t day_start, day_end, week_start, week_end;
int i;
g_return_if_fail (wview != NULL);
@@ -187,15 +187,14 @@ gncal_week_view_set (GncalWeekView *wview, time_t start_of_week)
/* back up to start of week (Monday) */
tm.tm_mday -= (tm.tm_wday == 0) ? 6 : (tm.tm_wday - 1);
-
+
/* Start of day */
tm.tm_hour = 0;
tm.tm_min = 0;
tm.tm_sec = 0;
- day_start = mktime (&tm);
- start = tm;
+ day_start = week_start = mktime (&tm);
/* Calendar */
@@ -218,11 +217,16 @@ gncal_week_view_set (GncalWeekView *wview, time_t start_of_week)
{
char buf [80];
int len;
+ struct tm *t;
- strftime (buf, sizeof (buf), "%A %d %Y - ", &start);
- len = strlen (buf);
+ week_end = time_add_day (week_start, 6);
+ t = localtime (&week_start);
- strftime (buf + len, sizeof (buf) - len, "%A %d %Y", &tm);
+ strftime (buf, sizeof (buf), "%A %d %Y - ", t);
+ len = strlen (buf);
+
+ t = localtime (&week_end);
+ strftime (buf + len, sizeof (buf) - len, "%A %d %Y", t);
gtk_label_set (GTK_LABEL (wview->label), buf);
}
diff --git a/calendar/gui/gnome-cal.c b/calendar/gui/gnome-cal.c
index a71e7fb343..e1c300071d 100644
--- a/calendar/gui/gnome-cal.c
+++ b/calendar/gui/gnome-cal.c
@@ -74,7 +74,8 @@ void
gnome_calendar_goto (GnomeCalendar *gcal, time_t new_time)
{
GtkWidget *current = get_current_page (gcal);
- g_assert (new_time != -1);
+
+ g_return_if_fail (new_time != -1);
if (current == gcal->day_view)
gncal_day_panel_set (GNCAL_DAY_PANEL (gcal->day_view), new_time);