aboutsummaryrefslogtreecommitdiffstats
path: root/widgets/misc/e-calendar-item.c
diff options
context:
space:
mode:
authorJP Rosevear <jpr@ximian.com>2003-05-31 01:32:31 +0800
committerJP Rosevear <jpr@src.gnome.org>2003-05-31 01:32:31 +0800
commit79f2149fd173467df5be5b55ecacb86ec4588691 (patch)
tree2dc43c6c86bad06aef8051533a6e11dded661fb2 /widgets/misc/e-calendar-item.c
parente7ce96ace2a366fa97519ce9dec059349e802fdf (diff)
downloadgsoc2013-evolution-79f2149fd173467df5be5b55ecacb86ec4588691.tar
gsoc2013-evolution-79f2149fd173467df5be5b55ecacb86ec4588691.tar.gz
gsoc2013-evolution-79f2149fd173467df5be5b55ecacb86ec4588691.tar.bz2
gsoc2013-evolution-79f2149fd173467df5be5b55ecacb86ec4588691.tar.lz
gsoc2013-evolution-79f2149fd173467df5be5b55ecacb86ec4588691.tar.xz
gsoc2013-evolution-79f2149fd173467df5be5b55ecacb86ec4588691.tar.zst
gsoc2013-evolution-79f2149fd173467df5be5b55ecacb86ec4588691.zip
Fixes #43775
2003-05-29 JP Rosevear <jpr@ximian.com> Fixes #43775 * e-calendar-item.c (layout_set_day_text): calculate the day character correctly (e_calendar_item_draw_month): use it * e-dateedit.c (rebuild_time_popup): use e_utf8_strftime (e_date_edit_update_date_entry): ditto (e_date_edit_update_time_entry): ditto * e-calendar-item.c (layout_set_day_text): calculate the day character correctly (e_calendar_item_draw_month): use e_utf8_strftime and above (e_calendar_item_show_popup_menu): use e_utf8_strftime (e_calendar_item_recalc_sizes): use layout_set_day_text svn path=/trunk/; revision=21352
Diffstat (limited to 'widgets/misc/e-calendar-item.c')
-rw-r--r--widgets/misc/e-calendar-item.c25
1 files changed, 21 insertions, 4 deletions
diff --git a/widgets/misc/e-calendar-item.c b/widgets/misc/e-calendar-item.c
index 06b3691095..b900f331e2 100644
--- a/widgets/misc/e-calendar-item.c
+++ b/widgets/misc/e-calendar-item.c
@@ -1001,6 +1001,23 @@ 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));
+
+ pango_layout_set_text (layout, day, char_size);
+}
+
+static void
e_calendar_item_draw_month (ECalendarItem *calitem,
GdkDrawable *drawable,
int x,
@@ -1107,7 +1124,7 @@ e_calendar_item_draw_month (ECalendarItem *calitem,
gdk_gc_set_clip_rectangle (fg_gc, &clip_rect);
/* This is a strftime() format. %B = Month name, %Y = Year. */
- strftime (buffer, sizeof (buffer), _("%B %Y"), &tmp_tm);
+ e_utf8_strftime (buffer, sizeof (buffer), _("%B %Y"), &tmp_tm);
pango_layout_set_font_description (layout, font_desc);
pango_layout_set_text (layout, buffer, -1);
@@ -1165,7 +1182,7 @@ e_calendar_item_draw_month (ECalendarItem *calitem,
day_index = calitem->week_start_day;
pango_layout_set_font_description (layout, font_desc);
for (day = 0; day < 7; day++) {
- pango_layout_set_text (layout, &calitem->days [day_index], 1);
+ layout_set_day_text (calitem, layout, day_index);
gdk_draw_layout (drawable, fg_gc,
text_x - calitem->day_widths [day_index],
text_y,
@@ -1624,7 +1641,7 @@ e_calendar_item_recalc_sizes (ECalendarItem *calitem)
PANGO_PIXELS (pango_font_metrics_get_descent (font_metrics));
for (day = 0; day < 7; day++) {
- pango_layout_set_text (layout, &calitem->days [day], 1);
+ layout_set_day_text (calitem, layout, day);
pango_layout_get_pixel_size (layout, &calitem->day_widths [day], NULL);
}
@@ -2906,7 +2923,7 @@ e_calendar_item_show_popup_menu (ECalendarItem *calitem,
tmp_tm.tm_mday = 1;
tmp_tm.tm_isdst = -1;
mktime (&tmp_tm);
- strftime (buffer, sizeof (buffer), "%B", &tmp_tm);
+ e_utf8_strftime (buffer, sizeof (buffer), "%B", &tmp_tm);
menuitem = gtk_menu_item_new ();
gtk_widget_show (menuitem);