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/ChangeLog | 8 ++++++++ widgets/misc/e-calendar-item.c | 34 ++++++++-------------------------- widgets/misc/e-calendar-item.h | 3 --- 3 files changed, 16 insertions(+), 29 deletions(-) (limited to 'widgets/misc') diff --git a/widgets/misc/ChangeLog b/widgets/misc/ChangeLog index 93934b2bbc..a4b449c7d9 100644 --- a/widgets/misc/ChangeLog +++ b/widgets/misc/ChangeLog @@ -1,3 +1,11 @@ +2007-12-03 Matthew Barnes + + ** Fixes part of bug #392747 + + * e-calendar-item.h (struct _ECalendarItem): + * 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(). + 2007-12-01 Matthew Barnes ** Fixes part of bug #495123 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 diff --git a/widgets/misc/e-calendar-item.h b/widgets/misc/e-calendar-item.h index efd6d60a73..c78d9d14ec 100644 --- a/widgets/misc/e-calendar-item.h +++ b/widgets/misc/e-calendar-item.h @@ -216,9 +216,6 @@ struct _ECalendarItem gint selection_real_start_month_offset; gint selection_real_start_day; - /* The first character of each day of the week, e.g. 'MTWTFSS'. */ - gchar *days; - /* Widths of the day characters. */ gint day_widths[7]; -- cgit v1.2.3