From caf215883e225dcc3a4f0d244dab0a61dfdf6ae8 Mon Sep 17 00:00:00 2001 From: Federico Mena Quintero Date: Thu, 4 Feb 1999 17:36:04 +0000 Subject: Make the calendar start weeks on Monday if appropriate. 1999-02-03 Federico Mena Quintero * gncal-week-view.c (gncal_week_view_new): Make the calendar start weeks on Monday if appropriate. (gncal_week_view_time_format_changed): New function to notify the week view that the time format has changed. * gncal-day-panel.c (gncal_day_panel_new): Make the calendar start weeks on Monday if appropriate. (gncal_day_panel_time_format_changed): New function to notify the day panel that the time format has changed. * gnome-cal.c (gnome_calendar_time_format_changed): Tell the day and week views that the time format has changed. svn path=/trunk/; revision=643 --- calendar/gui/gncal-day-panel.c | 19 ++++++++++++++++++- calendar/gui/gncal-day-panel.h | 9 +++++---- calendar/gui/gncal-week-view.c | 20 +++++++++++++++++++- calendar/gui/gncal-week-view.h | 9 +++++---- calendar/gui/gnome-cal.c | 2 ++ 5 files changed, 49 insertions(+), 10 deletions(-) (limited to 'calendar/gui') diff --git a/calendar/gui/gncal-day-panel.c b/calendar/gui/gncal-day-panel.c index 0c69026278..b847cf8168 100644 --- a/calendar/gui/gncal-day-panel.c +++ b/calendar/gui/gncal-day-panel.c @@ -150,7 +150,10 @@ gncal_day_panel_new (GnomeCalendar *calendar, time_t start_of_day) w = gtk_calendar_new (); dpanel->gtk_calendar = GTK_CALENDAR (w); gtk_calendar_display_options (dpanel->gtk_calendar, - GTK_CALENDAR_SHOW_HEADING | GTK_CALENDAR_SHOW_DAY_NAMES); + (GTK_CALENDAR_SHOW_HEADING + | GTK_CALENDAR_SHOW_DAY_NAMES + | (week_starts_on_monday + ? GTK_CALENDAR_WEEK_START_MONDAY : 0))); gtk_calendar_select_month (dpanel->gtk_calendar, tm->tm_mon, tm->tm_year + 1900); gtk_calendar_select_day (dpanel->gtk_calendar, tm->tm_mday); dpanel->day_selected_id = gtk_signal_connect (GTK_OBJECT (dpanel->gtk_calendar), @@ -245,3 +248,17 @@ gncal_day_panel_set (GncalDayPanel *dpanel, time_t start_of_day) update (dpanel, FALSE, NULL, 0); } + +void +gncal_day_panel_time_format_changed (GncalDayPanel *dpanel) +{ + g_return_if_fail (dpanel != NULL); + g_return_if_fail (GNCAL_IS_DAY_PANEL (dpanel)); + + gtk_calendar_display_options (dpanel->gtk_calendar, + (week_starts_on_monday + ? (dpanel->gtk_calendar->display_flags + | GTK_CALENDAR_WEEK_START_MONDAY) + : (dpanel->gtk_calendar->display_flags + & ~GTK_CALENDAR_WEEK_START_MONDAY))); +} diff --git a/calendar/gui/gncal-day-panel.h b/calendar/gui/gncal-day-panel.h index 87bce9732f..48ba6f38b1 100644 --- a/calendar/gui/gncal-day-panel.h +++ b/calendar/gui/gncal-day-panel.h @@ -49,11 +49,12 @@ struct _GncalDayPanelClass { }; -guint gncal_day_panel_get_type (void); -GtkWidget *gncal_day_panel_new (GnomeCalendar *calendar, time_t start_of_day); +guint gncal_day_panel_get_type (void); +GtkWidget *gncal_day_panel_new (GnomeCalendar *calendar, time_t start_of_day); -void gncal_day_panel_update (GncalDayPanel *dpanel, iCalObject *ico, int flags); -void gncal_day_panel_set (GncalDayPanel *dpanel, time_t start_of_day); +void gncal_day_panel_update (GncalDayPanel *dpanel, iCalObject *ico, int flags); +void gncal_day_panel_set (GncalDayPanel *dpanel, time_t start_of_day); +void gncal_day_panel_time_format_changed (GncalDayPanel *dpanel); END_GNOME_DECLS diff --git a/calendar/gui/gncal-week-view.c b/calendar/gui/gncal-week-view.c index 63255702a7..41b2596016 100644 --- a/calendar/gui/gncal-week-view.c +++ b/calendar/gui/gncal-week-view.c @@ -10,6 +10,7 @@ #include #include #include "gncal-week-view.h" +#include "main.h" #include "timeutil.h" static void gncal_week_view_init (GncalWeekView *wview); @@ -140,7 +141,11 @@ gncal_week_view_new (GnomeCalendar *calendar, time_t start_of_week) GTK_SIGNAL_FUNC(sync_week), wview); gtk_calendar_display_options (wview->gtk_calendar, - GTK_CALENDAR_SHOW_HEADING | GTK_CALENDAR_SHOW_DAY_NAMES); + (GTK_CALENDAR_SHOW_HEADING + | GTK_CALENDAR_SHOW_DAY_NAMES + | (week_starts_on_monday + ? GTK_CALENDAR_WEEK_START_MONDAY : 0))); + gtk_table_attach (GTK_TABLE (table), GTK_WIDGET (wview->gtk_calendar), 0, 3, 1, 2, @@ -235,3 +240,16 @@ gncal_week_view_set (GncalWeekView *wview, time_t start_of_week) } } +void +gncal_week_view_time_format_changed (GncalWeekView *wview) +{ + g_return_if_fail (wview != NULL); + g_return_if_fail (GNCAL_IS_WEEK_VIEW (wview)); + + gtk_calendar_display_options (wview->gtk_calendar, + (week_starts_on_monday + ? (wview->gtk_calendar->display_flags + | GTK_CALENDAR_WEEK_START_MONDAY) + : (wview->gtk_calendar->display_flags + & ~GTK_CALENDAR_WEEK_START_MONDAY))); +} diff --git a/calendar/gui/gncal-week-view.h b/calendar/gui/gncal-week-view.h index 19d1e36b78..ab06161844 100644 --- a/calendar/gui/gncal-week-view.h +++ b/calendar/gui/gncal-week-view.h @@ -44,11 +44,12 @@ struct _GncalWeekViewClass { }; -guint gncal_week_view_get_type (void); -GtkWidget *gncal_week_view_new (GnomeCalendar *calendar, time_t start_of_week); +guint gncal_week_view_get_type (void); +GtkWidget *gncal_week_view_new (GnomeCalendar *calendar, time_t start_of_week); -void gncal_week_view_update (GncalWeekView *wview, iCalObject *ico, int flags); -void gncal_week_view_set (GncalWeekView *wview, time_t start_of_week); +void gncal_week_view_update (GncalWeekView *wview, iCalObject *ico, int flags); +void gncal_week_view_set (GncalWeekView *wview, time_t start_of_week); +void gncal_week_view_time_format_changed (GncalWeekView *wview); END_GNOME_DECLS diff --git a/calendar/gui/gnome-cal.c b/calendar/gui/gnome-cal.c index 51cda3472f..5b59cb379c 100644 --- a/calendar/gui/gnome-cal.c +++ b/calendar/gui/gnome-cal.c @@ -465,7 +465,9 @@ gnome_calendar_time_format_changed (GnomeCalendar *gcal) /* FIXME: the queue resizes will do until we rewrite those views... */ + gncal_day_panel_time_format_changed (GNCAL_DAY_PANEL (gcal->day_view)); gtk_widget_queue_resize (gcal->day_view); + gncal_week_view_time_format_changed (GNCAL_WEEK_VIEW (gcal->week_view)); gtk_widget_queue_resize (gcal->week_view); month_view_time_format_changed (MONTH_VIEW (gcal->month_view)); year_view_time_format_changed (YEAR_VIEW (gcal->year_view)); -- cgit v1.2.3