aboutsummaryrefslogtreecommitdiffstats
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
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
-rw-r--r--widgets/misc/ChangeLog18
-rw-r--r--widgets/misc/e-calendar-item.c25
-rw-r--r--widgets/misc/e-dateedit.c7
3 files changed, 43 insertions, 7 deletions
diff --git a/widgets/misc/ChangeLog b/widgets/misc/ChangeLog
index 298eb82748..7a5cae8211 100644
--- a/widgets/misc/ChangeLog
+++ b/widgets/misc/ChangeLog
@@ -1,3 +1,21 @@
+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
+
2003-05-19 Anna Marie Dirks <anna@ximian.com>
* e-multi-config-dialog.c (init): Added HIG-appropriate spacing/
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);
diff --git a/widgets/misc/e-dateedit.c b/widgets/misc/e-dateedit.c
index ae4d2928b1..e519981e07 100644
--- a/widgets/misc/e-dateedit.c
+++ b/widgets/misc/e-dateedit.c
@@ -56,6 +56,7 @@
#include <gtk/gtkmain.h>
#include <gtk/gtkvbox.h>
#include <libgnome/gnome-i18n.h>
+#include <gal/util/e-util.h>
#include "e-util/e-time-utils.h"
#include "e-calendar.h"
@@ -1402,7 +1403,7 @@ rebuild_time_popup (EDateEdit *dedit)
/* This is a strftime() format. %I = hour (1-12), %M = minute, %p = am/pm string. */
format = _("%I:%M %p");
- strftime (buffer, sizeof (buffer), format, &tmp_tm);
+ e_utf8_strftime (buffer, sizeof (buffer), format, &tmp_tm);
listitem = gtk_list_item_new_with_label (buffer);
gtk_widget_show (listitem);
@@ -1578,7 +1579,7 @@ e_date_edit_update_date_entry (EDateEdit *dedit)
/* This is a strftime() format for a short date. %m = month,
%d = day of month, %Y = year (all digits). */
- strftime (buffer, sizeof (buffer), _("%m/%d/%Y"), &tmp_tm);
+ e_utf8_strftime (buffer, sizeof (buffer), _("%m/%d/%Y"), &tmp_tm);
gtk_entry_set_text (GTK_ENTRY (priv->date_entry), buffer);
}
}
@@ -1615,7 +1616,7 @@ e_date_edit_update_time_entry (EDateEdit *dedit)
/* This is a strftime() format. %I = hour (1-12), %M = minute, %p = am/pm string. */
format = _("%I:%M %p");
- strftime (buffer, sizeof (buffer), format, &tmp_tm);
+ e_utf8_strftime (buffer, sizeof (buffer), format, &tmp_tm);
gtk_entry_set_text (GTK_ENTRY (GTK_COMBO (priv->time_combo)->entry),
buffer);
}