From 796e7ca63b134fca7767d1b009aa973c03fd46a6 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Mon, 3 Dec 2007 13:19:39 +0000 Subject: ** Fixes bug #392747 2007-12-03 Matthew Barnes ** Fixes bug #392747 * e-util/e-utils.c (e_get_month_name), (e_get_weekday_name): New functions cache localized month and weekday names (respectively) for easier retrieval than resorting to strftime(). * a11y/widgets/ea-calendar-item.c (ea_calendar_item_get_column_label): Get the column label via e_get_weekday_name(). * calendar/gui/weekday-picker.c (get_day_text): Convert the day_index to GDateWeekday and call e_get_weekday_name(). * widgets/misc/e-calendar-item.h (struct _ECalendarItem): * widgets/misc/e-calendar-item.c (e_calendar_item_init), (e_calendar_item_draw): Lose the local weekday name cache and just call e_get_weekday_name(). svn path=/trunk/; revision=34627 --- calendar/gui/weekday-picker.c | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) (limited to 'calendar/gui') diff --git a/calendar/gui/weekday-picker.c b/calendar/gui/weekday-picker.c index 166c5d5b26..709255f374 100644 --- a/calendar/gui/weekday-picker.c +++ b/calendar/gui/weekday-picker.c @@ -28,6 +28,7 @@ #include #include #include +#include #include "weekday-picker.h" @@ -315,20 +316,12 @@ colorize_items (WeekdayPicker *wp) static char * get_day_text (int day_index) { - /* The first letter of each day of the week starting with Sunday */ - const char *str = _("SMTWTFS"); - char *day; - int char_size = 0; + GDateWeekday weekday; - day = g_utf8_offset_to_pointer (str, day_index); + /* Convert from tm_wday to GDateWeekday. */ + weekday = (day_index == 0) ? G_DATE_SUNDAY : day_index; - /* we use strlen because we actually want to count bytes */ - if (day_index == 6) - char_size = strlen (day); - else - char_size = strlen (day) - strlen (g_utf8_find_next_char (day, NULL)); - - return g_strndup (day, char_size); + return g_strdup (e_get_weekday_name (weekday, TRUE)); } static void -- cgit