aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/gui/weekday-picker.c
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2007-12-03 21:19:39 +0800
committerMatthew Barnes <mbarnes@src.gnome.org>2007-12-03 21:19:39 +0800
commit796e7ca63b134fca7767d1b009aa973c03fd46a6 (patch)
tree1c43762c65bc236403e02c5d5f0ffd531ada3d80 /calendar/gui/weekday-picker.c
parent0432e0fb2709cf09a898a8c9cf914ed7e81e88b1 (diff)
downloadgsoc2013-evolution-796e7ca63b134fca7767d1b009aa973c03fd46a6.tar
gsoc2013-evolution-796e7ca63b134fca7767d1b009aa973c03fd46a6.tar.gz
gsoc2013-evolution-796e7ca63b134fca7767d1b009aa973c03fd46a6.tar.bz2
gsoc2013-evolution-796e7ca63b134fca7767d1b009aa973c03fd46a6.tar.lz
gsoc2013-evolution-796e7ca63b134fca7767d1b009aa973c03fd46a6.tar.xz
gsoc2013-evolution-796e7ca63b134fca7767d1b009aa973c03fd46a6.tar.zst
gsoc2013-evolution-796e7ca63b134fca7767d1b009aa973c03fd46a6.zip
** Fixes bug #392747
2007-12-03 Matthew Barnes <mbarnes@redhat.com> ** 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
Diffstat (limited to 'calendar/gui/weekday-picker.c')
-rw-r--r--calendar/gui/weekday-picker.c17
1 files changed, 5 insertions, 12 deletions
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 <glib/gi18n.h>
#include <libgnomecanvas/gnome-canvas-rect-ellipse.h>
#include <libgnomecanvas/gnome-canvas-text.h>
+#include <e-util/e-util.h>
#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