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 --- widgets/misc/e-calendar-item.c | 34 ++++++++-------------------------- 1 file changed, 8 insertions(+), 26 deletions(-) (limited to 'widgets/misc/e-calendar-item.c') diff --git a/widgets/misc/e-calendar-item.c b/widgets/misc/e-calendar-item.c index 7cbfc2f958..f023e89850 100644 --- a/widgets/misc/e-calendar-item.c +++ b/widgets/misc/e-calendar-item.c @@ -411,10 +411,6 @@ e_calendar_item_init (ECalendarItem *calitem) calitem->time_callback_data = NULL; calitem->time_callback_destroy = NULL; - /* Translators: These are the first characters of each day of the - week, 'M' for 'Monday', 'T' for Tuesday etc. */ - calitem->days = _("MTWTFSS"); - calitem->signal_emission_idle_id = 0; } @@ -964,18 +960,11 @@ e_calendar_item_draw (GnomeCanvasItem *canvas_item, static void layout_set_day_text (ECalendarItem *calitem, PangoLayout *layout, int day_index) { - char *day; - int char_size = 0; - - day = g_utf8_offset_to_pointer (calitem->days, 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)); + const gchar *abbr_name; - pango_layout_set_text (layout, day, char_size); + /* day_index: 0 = Monday ... 6 = Sunday */ + abbr_name = e_get_weekday_name (day_index + 1, TRUE); + pango_layout_set_text (layout, abbr_name, -1); } static void @@ -1611,18 +1600,11 @@ e_calendar_item_draw (GnomeCanvasItem *canvas_item, static void layout_set_day_text (ECalendarItem *calitem, PangoLayout *layout, int day_index) { - char *day; - int char_size = 0; - - day = g_utf8_offset_to_pointer (calitem->days, 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)); + const gchar *abbr_name; - pango_layout_set_text (layout, day, char_size); + /* day_index: 0 = Monday ... 6 = Sunday */ + abbr_name = e_get_weekday_name (day_index + 1, TRUE); + pango_layout_set_text (layout, abbr_name, -1); } static void -- cgit v1.2.3