aboutsummaryrefslogtreecommitdiffstats
path: root/widgets/misc
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 /widgets/misc
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 'widgets/misc')
-rw-r--r--widgets/misc/ChangeLog8
-rw-r--r--widgets/misc/e-calendar-item.c34
-rw-r--r--widgets/misc/e-calendar-item.h3
3 files changed, 16 insertions, 29 deletions
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 <mbarnes@redhat.com>
+
+ ** 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 <mbarnes@redhat.com>
** 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];