first_weekday is relative to week_1stday, not to Sunday. Gotta love the

2005-09-09  Matthias Clasen  <mclasen@redhat.com>

	* gtk/gtkcalendar.c (gtk_calendar_init): first_weekday is relative
	to week_1stday, not to Sunday. Gotta love the ISO 14652 guys...
	(#314473, Stanislav Brabec)
This commit is contained in:
Matthias Clasen 2005-09-09 17:26:14 +00:00 committed by Matthias Clasen
parent d8b026adb0
commit c23e27390d
3 changed files with 27 additions and 3 deletions

View File

@ -1,3 +1,9 @@
2005-09-09 Matthias Clasen <mclasen@redhat.com>
* gtk/gtkcalendar.c (gtk_calendar_init): first_weekday is relative
to week_1stday, not to Sunday. Gotta love the ISO 14652 guys...
(#314473, Stanislav Brabec)
2005-09-09 Matthias Clasen <mclasen@redhat.com> 2005-09-09 Matthias Clasen <mclasen@redhat.com>
* gtk/gtktreeview.c (gtk_tree_view_get_visible_range): Document * gtk/gtktreeview.c (gtk_tree_view_get_visible_range): Document

View File

@ -1,3 +1,9 @@
2005-09-09 Matthias Clasen <mclasen@redhat.com>
* gtk/gtkcalendar.c (gtk_calendar_init): first_weekday is relative
to week_1stday, not to Sunday. Gotta love the ISO 14652 guys...
(#314473, Stanislav Brabec)
2005-09-09 Matthias Clasen <mclasen@redhat.com> 2005-09-09 Matthias Clasen <mclasen@redhat.com>
* gtk/gtktreeview.c (gtk_tree_view_get_visible_range): Document * gtk/gtktreeview.c (gtk_tree_view_get_visible_range): Document

View File

@ -565,8 +565,9 @@ gtk_calendar_init (GtkCalendar *calendar)
time_t tmp_time; time_t tmp_time;
GtkCalendarPrivate *priv; GtkCalendarPrivate *priv;
gchar *year_before; gchar *year_before;
gchar *week_start; gchar *week_start, week_startsub = 1;
guint week_origin;
priv = calendar->priv = G_TYPE_INSTANCE_GET_PRIVATE (calendar, priv = calendar->priv = G_TYPE_INSTANCE_GET_PRIVATE (calendar,
GTK_TYPE_CALENDAR, GTK_TYPE_CALENDAR,
GtkCalendarPrivate); GtkCalendarPrivate);
@ -652,7 +653,15 @@ gtk_calendar_init (GtkCalendar *calendar)
#ifdef HAVE__NL_TIME_FIRST_WEEKDAY #ifdef HAVE__NL_TIME_FIRST_WEEKDAY
week_start = nl_langinfo (_NL_TIME_FIRST_WEEKDAY); week_start = nl_langinfo (_NL_TIME_FIRST_WEEKDAY);
priv->week_start = (*((unsigned char *) week_start) - 1) % 7; week_origin = GPOINTER_TO_INT (nl_langinfo (_NL_TIME_WEEK_1STDAY));
if (week_origin == 19971130)
week_startsub = 0;
else if (week_origin == 19971201)
week_startsub = 1;
else
g_warning ("Unknown value of _NL_TIME_WEEK_1STDAY.\n");
priv->week_start = (*((unsigned char *) week_start) - week_startsub) % 7;
#else #else
/* Translate to calendar:week_start:0 if you want Sunday to be the /* Translate to calendar:week_start:0 if you want Sunday to be the
* first day of the week to calendar:week_start:1 if you want Monday * first day of the week to calendar:week_start:1 if you want Monday
@ -2169,8 +2178,11 @@ calendar_paint_day (GtkCalendar *calendar,
gtk_paint_focus (widget->style, gtk_paint_focus (widget->style,
priv->main_win, priv->main_win,
state,
#if 0
(calendar->selected_day == day) (calendar->selected_day == day)
? GTK_STATE_SELECTED : GTK_STATE_NORMAL, ? GTK_STATE_SELECTED : GTK_STATE_NORMAL,
#endif
NULL, widget, "calendar-day", NULL, widget, "calendar-day",
day_rect.x, day_rect.y, day_rect.x, day_rect.y,
day_rect.width, day_rect.height); day_rect.width, day_rect.height);