[evolution-patches] 43775
- From: JP Rosevear <jpr ximian com>
- To: evolution-patches ximian com
- Subject: [evolution-patches] 43775
- Date: 29 May 2003 12:54:06 -0400
Please review carefully because its long. Basically I replaced strftime
with gal's e_utf8_strftime to prevent utf8 errors (hence the crash in
etable - the errors made it return NULL). I tested under ru_RU and
zh_CN.
-JP
--
JP Rosevear <jpr ximian com>
Ximian, Inc.
? 41890.patch
? 43103.patch
? 43308.patch
? leak.patch
? utf8-title.patch
? utf8.patch
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/calendar/ChangeLog,v
retrieving revision 1.1785
diff -u -r1.1785 ChangeLog
--- ChangeLog 29 May 2003 09:05:57 -0000 1.1785
+++ ChangeLog 29 May 2003 16:51:05 -0000
@@ -1,3 +1,46 @@
+2003-05-29 JP Rosevear <jpr ximian com>
+
+ Fixes #43775
+
+ * gui/weekday-picker.c (get_day_text): calculate the characters to
+ display correctly
+ (configure_items): use it
+ (weekday_picker_style_set): ditto
+
+ * gui/print.c (format_date): use e_utf8_strftime
+ (print_week_view_background): ditto
+ (print_month_summary): ditto
+ (range_selector_new): ditto
+ (print_comp_item): ditto
+
+ * gui/itip-utils.c (comp_description): the translation is already
+ utf8
+
+ * gui/e-itip-control.c (write_label_piece): the string is already
+ in utf8
+
+ * gui/e-day-view.c (e_day_view_style_set): use e_utf8_strftime
+ (e_day_view_recalc_cell_sizes): ditto
+
+ * gui/e-day-view-top-item.c (e_day_view_top_item_draw): use
+ e_utf8_strftime
+
+ * gui/e-cell-date-edit-text.c (ecd_get_text): return the
+ duplicated buffer (its already utf8)
+ (show_date_warning): use e_utf8_strftime
+
+ * gui/calendar-model.c (date_value_to_string): return the
+ duplicated buffer (its already utf8)
+ (calendar_model_value_to_string): the translations should already
+ be in utf8
+
+ * gui/calendar-config.c
+ (calendar_config_locale_supports_12_hour_format): use
+ e_utf8_strftime
+
+ * gui/calendar-commands.c (calendar_set_folder_bar_label): use
+ e_utf8_strftime
+
2003-05-28 Rodrigo Moya <rodrigo ximian com>
Fixes #43455
Index: gui/calendar-commands.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/calendar-commands.c,v
retrieving revision 1.119
diff -u -r1.119 calendar-commands.c
--- gui/calendar-commands.c 14 May 2003 18:45:55 -0000 1.119
+++ gui/calendar-commands.c 29 May 2003 16:51:05 -0000
@@ -45,6 +45,7 @@
#include <libgnome/gnome-i18n.h>
#include <bonobo/bonobo-ui-util.h>
#include <bonobo/bonobo-exception.h>
+#include <gal/util/e-util.h>
#include <cal-util/timeutil.h>
#include "shell/Evolution.h"
#include "calendar-commands.h"
@@ -414,19 +415,19 @@
if (start_tm.tm_year == end_tm.tm_year
&& start_tm.tm_mon == end_tm.tm_mon
&& start_tm.tm_mday == end_tm.tm_mday) {
- strftime (buffer, sizeof (buffer),
+ e_utf8_strftime (buffer, sizeof (buffer),
_("%A %d %B %Y"), &start_tm);
} else if (start_tm.tm_year == end_tm.tm_year) {
- strftime (buffer, sizeof (buffer),
+ e_utf8_strftime (buffer, sizeof (buffer),
_("%a %d %b"), &start_tm);
- strftime (end_buffer, sizeof (end_buffer),
+ e_utf8_strftime (end_buffer, sizeof (end_buffer),
_("%a %d %b %Y"), &end_tm);
strcat (buffer, " - ");
strcat (buffer, end_buffer);
} else {
- strftime (buffer, sizeof (buffer),
+ e_utf8_strftime (buffer, sizeof (buffer),
_("%a %d %b %Y"), &start_tm);
- strftime (end_buffer, sizeof (end_buffer),
+ e_utf8_strftime (end_buffer, sizeof (end_buffer),
_("%a %d %b %Y"), &end_tm);
strcat (buffer, " - ");
strcat (buffer, end_buffer);
@@ -435,24 +436,24 @@
case GNOME_CAL_MONTH_VIEW:
if (start_tm.tm_year == end_tm.tm_year) {
if (start_tm.tm_mon == end_tm.tm_mon) {
- strftime (buffer, sizeof (buffer),
+ e_utf8_strftime (buffer, sizeof (buffer),
"%d", &start_tm);
- strftime (end_buffer, sizeof (end_buffer),
+ e_utf8_strftime (end_buffer, sizeof (end_buffer),
_("%d %B %Y"), &end_tm);
strcat (buffer, " - ");
strcat (buffer, end_buffer);
} else {
- strftime (buffer, sizeof (buffer),
+ e_utf8_strftime (buffer, sizeof (buffer),
_("%d %B"), &start_tm);
- strftime (end_buffer, sizeof (end_buffer),
+ e_utf8_strftime (end_buffer, sizeof (end_buffer),
_("%d %B %Y"), &end_tm);
strcat (buffer, " - ");
strcat (buffer, end_buffer);
}
} else {
- strftime (buffer, sizeof (buffer),
+ e_utf8_strftime (buffer, sizeof (buffer),
_("%d %B %Y"), &start_tm);
- strftime (end_buffer, sizeof (end_buffer),
+ e_utf8_strftime (end_buffer, sizeof (end_buffer),
_("%d %B %Y"), &end_tm);
strcat (buffer, " - ");
strcat (buffer, end_buffer);
Index: gui/calendar-config.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/calendar-config.c,v
retrieving revision 1.51
diff -u -r1.51 calendar-config.c
--- gui/calendar-config.c 16 Apr 2003 16:23:58 -0000 1.51
+++ gui/calendar-config.c 29 May 2003 16:51:05 -0000
@@ -33,6 +33,7 @@
#include <gtk/gtksignal.h>
#include <libgnome/gnome-config.h>
#include <libgnomeui/gnome-dialog.h>
+#include <gal/util/e-util.h>
#include <widgets/e-timezone-dialog/e-timezone-dialog.h>
#include <cal-util/timeutil.h>
@@ -78,7 +79,7 @@
char s[16];
time_t t = 0;
- strftime (s, sizeof s, "%p", gmtime (&t));
+ e_utf8_strftime (s, sizeof s, "%p", gmtime (&t));
return s[0] != '\0';
}
Index: gui/calendar-model.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/calendar-model.c,v
retrieving revision 1.108
diff -u -r1.108 calendar-model.c
--- gui/calendar-model.c 16 Apr 2003 16:23:58 -0000 1.108
+++ gui/calendar-model.c 29 May 2003 16:51:06 -0000
@@ -32,6 +32,7 @@
#include <libgnomeui/gnome-stock-icons.h>
#include <libgnome/gnome-i18n.h>
#include <gal/widgets/e-unicode.h>
+#include <gal/util/e-util.h>
#include <e-util/e-time-utils.h>
#include <cal-util/timeutil.h>
#include "calendar-commands.h"
@@ -1677,7 +1678,7 @@
e_time_format_date_and_time (&tmp_tm, priv->use_24_hour_format,
TRUE, FALSE,
buffer, sizeof (buffer));
- return g_locale_to_utf8 (buffer, -1, NULL, NULL, NULL);
+ return g_strdup (buffer);
}
@@ -1705,17 +1706,17 @@
case CAL_COMPONENT_FIELD_ICON:
if (GPOINTER_TO_INT (value) == 0)
- return g_locale_to_utf8 (_("Normal"), -1, NULL, NULL, NULL);
+ return _("Normal");
else if (GPOINTER_TO_INT (value) == 1)
- return g_locale_to_utf8 (_("Recurring"), -1, NULL, NULL, NULL);
+ return _("Recurring");
else
- return g_locale_to_utf8 (_("Assigned"), -1, NULL, NULL, NULL);
+ return _("Assigned");
case CAL_COMPONENT_FIELD_HAS_ALARMS:
case CAL_COMPONENT_FIELD_COMPLETE:
case CAL_COMPONENT_FIELD_RECURRING:
case CAL_COMPONENT_FIELD_OVERDUE:
- return g_locale_to_utf8 (value ? _("Yes") : _("No"), -1, NULL, NULL, NULL);
+ return value ? _("Yes") : _("No");
case CAL_COMPONENT_FIELD_COLOR:
return NULL;
Index: gui/e-cell-date-edit-text.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/e-cell-date-edit-text.c,v
retrieving revision 1.9
diff -u -r1.9 e-cell-date-edit-text.c
--- gui/e-cell-date-edit-text.c 23 Feb 2003 06:49:31 -0000 1.9
+++ gui/e-cell-date-edit-text.c 29 May 2003 16:51:06 -0000
@@ -88,7 +88,7 @@
e_time_format_date_and_time (&tmp_tm, ecd->use_24_hour_format,
!dv->tt.is_date, FALSE,
buffer, sizeof (buffer));
- return g_locale_to_utf8 (buffer, -1, NULL, NULL, NULL);
+ return g_strdup (buffer);
}
@@ -120,7 +120,7 @@
/* strftime format of a weekday, a date and a time, 12-hour. */
format = _("%a %m/%d/%Y %I:%M:%S %p");
- strftime (buffer, sizeof (buffer), format, tmp_tm);
+ e_utf8_strftime (buffer, sizeof (buffer), format, tmp_tm);
g_snprintf (message, 256,
_("The date must be entered in the format: \n\n%s"),
Index: gui/e-day-view-top-item.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/e-day-view-top-item.c,v
retrieving revision 1.32
diff -u -r1.32 e-day-view-top-item.c
--- gui/e-day-view-top-item.c 2 Apr 2003 03:08:28 -0000 1.32
+++ gui/e-day-view-top-item.c 29 May 2003 16:51:06 -0000
@@ -28,6 +28,7 @@
#include <config.h>
#include <glib.h>
#include <libgnome/gnome-i18n.h>
+#include <gal/util/e-util.h>
#include "e-util/e-categories-config.h"
#include "cal-util/timeutil.h"
#include "e-day-view-top-item.h"
@@ -269,7 +270,7 @@
else
format = "%d";
- strftime (buffer, sizeof (buffer), format, &day_start);
+ e_utf8_strftime (buffer, sizeof (buffer), format, &day_start);
clip_rect.x = day_view->day_offsets[day] - x;
clip_rect.y = 2 - y;
Index: gui/e-day-view.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/e-day-view.c,v
retrieving revision 1.194
diff -u -r1.194 e-day-view.c
--- gui/e-day-view.c 19 May 2003 15:21:43 -0000 1.194
+++ gui/e-day-view.c 29 May 2003 16:51:08 -0000
@@ -45,6 +45,7 @@
#include <gal/widgets/e-popup-menu.h>
#include <gal/widgets/e-gui-utils.h>
#include <gal/widgets/e-unicode.h>
+#include <gal/util/e-util.h>
#include <libgnomecanvas/gnome-canvas-rect-ellipse.h>
#include <libgnome/gnome-i18n.h>
#include <libgnome/gnome-exec.h>
@@ -1193,7 +1194,7 @@
for (month = 0; month < 12; month++) {
date_tm.tm_mon = month;
- strftime (buffer, sizeof (buffer), "%B", &date_tm);
+ e_utf8_strftime (buffer, sizeof (buffer), "%B", &date_tm);
pango_layout_set_text (layout, buffer, -1);
pango_layout_get_pixel_size (layout, &width, NULL);
@@ -1202,7 +1203,7 @@
day_view->longest_month_name = month;
}
- strftime (buffer, sizeof (buffer), "%b", &date_tm);
+ e_utf8_strftime (buffer, sizeof (buffer), "%b", &date_tm);
pango_layout_set_text (layout, buffer, -1);
pango_layout_get_pixel_size (layout, &width, NULL);
@@ -1224,7 +1225,7 @@
date_tm.tm_mday = 2 + day;
date_tm.tm_wday = day;
- strftime (buffer, sizeof (buffer), "%A", &date_tm);
+ e_utf8_strftime (buffer, sizeof (buffer), "%A", &date_tm);
pango_layout_set_text (layout, buffer, -1);
pango_layout_get_pixel_size (layout, &width, NULL);
@@ -1233,7 +1234,7 @@
day_view->longest_weekday_name = day;
}
- strftime (buffer, sizeof (buffer), "%a", &date_tm);
+ e_utf8_strftime (buffer, sizeof (buffer), "%a", &date_tm);
pango_layout_set_text (layout, buffer, -1);
pango_layout_get_pixel_size (layout, &width, NULL);
@@ -1392,7 +1393,7 @@
date_tm.tm_isdst = -1;
/* strftime format %A = full weekday name, %d = day of month,
%B = full month name. Don't use any other specifiers. */
- strftime (buffer, sizeof (buffer), _("%A %d %B"), &date_tm);
+ e_utf8_strftime (buffer, sizeof (buffer), _("%A %d %B"), &date_tm);
pango_layout_set_text (layout, buffer, -1);
pango_layout_get_pixel_size (layout, &pango_width, NULL);
@@ -1409,7 +1410,7 @@
date_tm.tm_isdst = -1;
/* strftime format %a = abbreviated weekday name, %d = day of month,
%b = abbreviated month name. Don't use any other specifiers. */
- strftime (buffer, sizeof (buffer), _("%a %d %b"), &date_tm);
+ e_utf8_strftime (buffer, sizeof (buffer), _("%a %d %b"), &date_tm);
pango_layout_set_text (layout, buffer, -1);
pango_layout_get_pixel_size (layout, &pango_width, NULL);
@@ -1425,7 +1426,7 @@
date_tm.tm_isdst = -1;
/* strftime format %d = day of month, %b = abbreviated month name.
Don't use any other specifiers. */
- strftime (buffer, sizeof (buffer), _("%d %b"), &date_tm);
+ e_utf8_strftime (buffer, sizeof (buffer), _("%d %b"), &date_tm);
pango_layout_set_text (layout, buffer, -1);
pango_layout_get_pixel_size (layout, &pango_width, NULL);
Index: gui/e-itip-control.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/e-itip-control.c,v
retrieving revision 1.120
diff -u -r1.120 e-itip-control.c
--- gui/e-itip-control.c 25 Apr 2003 01:57:54 -0000 1.120
+++ gui/e-itip-control.c 29 May 2003 16:51:09 -0000
@@ -628,10 +628,7 @@
calendar_config_get_24_hour_format (),
FALSE, FALSE,
time_buf, sizeof (time_buf));
-
- time_utf8 = g_locale_to_utf8 (time_buf, -1, NULL, NULL, NULL);
- strcat (buffer, time_utf8);
- g_free (time_utf8);
+ strcat (buffer, time_buf);
if (!dt->value->is_utc && dt->tzid) {
zone = icalcomponent_get_timezone (priv->top_level, dt->tzid);
Index: gui/itip-utils.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/itip-utils.c,v
retrieving revision 1.77
diff -u -r1.77 itip-utils.c
--- gui/itip-utils.c 29 Apr 2003 16:34:59 -0000 1.77
+++ gui/itip-utils.c 29 May 2003 16:51:09 -0000
@@ -509,11 +509,9 @@
cal_component_free_datetime (&dt);
if (start != NULL && end != NULL) {
- char *tmp, *tmp_utf;
+ char *tmp;
tmp = g_strdup_printf (_("Free/Busy information (%s to %s)"), start, end);
- tmp_utf = g_locale_to_utf8 (tmp, -1, NULL, NULL, NULL);
- description = CORBA_string_dup (tmp_utf);
- g_free (tmp_utf);
+ description = CORBA_string_dup (tmp);
g_free (tmp);
} else {
description = CORBA_string_dup (_("Free/Busy information"));
Index: gui/print.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/print.c,v
retrieving revision 1.48
diff -u -r1.48 print.c
--- gui/print.c 26 Feb 2003 00:07:41 -0000 1.48
+++ gui/print.c 29 May 2003 16:51:10 -0000
@@ -41,6 +41,7 @@
#include <libgnomeprintui/gnome-print-paper-selector.h>
#include <libgnomeprintui/gnome-print-preview.h>
#include <libgnomeprintui/gnome-print-dialog.h>
+#include <gal/util/e-util.h>
#include <e-util/e-dialog-widgets.h>
#include <e-util/e-time-utils.h>
#include <gal/widgets/e-unicode.h>
@@ -493,7 +494,6 @@
icaltimezone *zone = get_timezone ();
char fmt[64];
struct tm tm;
- char *utf_str;
tm = *convert_timet_to_struct_tm (time, zone);
@@ -518,11 +518,9 @@
strcat(fmt, " ");
strcat(fmt, "%Y");
}
- strftime(buffer, bufflen, fmt, &tm);
- utf_str = g_locale_to_utf8 (buffer, -1, NULL, NULL, NULL);
- strncpy (buffer, utf_str, bufflen - 1);
+ e_utf8_strftime(buffer, bufflen, fmt, &tm);
buffer[bufflen - 1] = '\0';
- g_free (utf_str);
+
return buffer;
}
@@ -1483,7 +1481,7 @@
int day, day_x, day_y, day_h;
double x1, x2, y1, y2, font_size, fillcolor;
struct tm tm;
- char *format_string, buffer[128], *utf_str;
+ char *format_string, buffer[128];
font_size = gnome_font_get_size (font);
@@ -1530,11 +1528,9 @@
}
- strftime (buffer, sizeof (buffer), format_string, &tm);
- utf_str = g_locale_to_utf8 (buffer, -1, NULL, NULL, NULL);
- print_text_size (pc, utf_str, ALIGN_RIGHT,
+ e_utf8_strftime (buffer, sizeof (buffer), format_string, &tm);
+ print_text_size (pc, buffer, ALIGN_RIGHT,
x1, x2 - 4, y1 - 2, y1 - 2 - font_size);
- g_free (utf_str);
}
}
@@ -1737,26 +1733,22 @@
y2 = top - font_size * 1.5;
for (col = 0; col < columns; col++) {
- char *utf_str;
-
if (tm.tm_wday == 6 && compress_weekend) {
- strftime (buffer, sizeof (buffer), "%a/", &tm);
+ e_utf8_strftime (buffer, sizeof (buffer), "%a/", &tm);
len = strlen (buffer);
tm.tm_mday++;
tm.tm_wday = (tm.tm_wday + 1) % 7;
- strftime (buffer + len, sizeof (buffer) - len,
+ e_utf8_strftime (buffer + len, sizeof (buffer) - len,
"%a", &tm);
} else {
- strftime (buffer, sizeof (buffer), "%A", &tm);
+ e_utf8_strftime (buffer, sizeof (buffer), "%A", &tm);
}
x1 = left + cell_width * col;
x2 = x1 + cell_width;
print_border (pc, x1, x2, y1, y2, 1.0, -1.0);
- utf_str = g_locale_to_utf8 (buffer, -1, NULL, NULL, NULL);
- print_text_size (pc, utf_str, ALIGN_CENTER, x1, x2, y1, y2);
- g_free (utf_str);
+ print_text_size (pc, buffer, ALIGN_CENTER, x1, x2, y1, y2);
tm.tm_mday++;
tm.tm_wday = (tm.tm_wday + 1) % 7;
@@ -1882,7 +1874,7 @@
/* Day */
- strftime (text, sizeof (text), _("Selected day (%a %b %d %Y)"), &tm);
+ e_utf8_strftime (text, sizeof (text), _("Selected day (%a %b %d %Y)"), &tm);
radio = gtk_radio_button_new_with_label (NULL, text);
group = gtk_radio_button_group (GTK_RADIO_BUTTON (radio));
gtk_box_pack_start (GTK_BOX (box), radio, FALSE, FALSE, 0);
@@ -1907,15 +1899,15 @@
week_end_tm = *convert_timet_to_struct_tm (week_end, zone);
if (week_begin_tm.tm_mon == week_end_tm.tm_mon) {
- strftime (str1, sizeof (str1), _("%a %b %d"), &week_begin_tm);
- strftime (str2, sizeof (str2), _("%a %d %Y"), &week_end_tm);
+ e_utf8_strftime (str1, sizeof (str1), _("%a %b %d"), &week_begin_tm);
+ e_utf8_strftime (str2, sizeof (str2), _("%a %d %Y"), &week_end_tm);
} else {
if (week_begin_tm.tm_year == week_end_tm.tm_year) {
- strftime (str1, sizeof (str1), _("%a %b %d"), &week_begin_tm);
- strftime (str2, sizeof (str2), _("%a %b %d %Y"), &week_end_tm);
+ e_utf8_strftime (str1, sizeof (str1), _("%a %b %d"), &week_begin_tm);
+ e_utf8_strftime (str2, sizeof (str2), _("%a %b %d %Y"), &week_end_tm);
} else {
- strftime (str1, sizeof (str1), _("%a %b %d %Y"), &week_begin_tm);
- strftime (str2, sizeof (str2), _("%a %b %d %Y"), &week_end_tm);
+ e_utf8_strftime (str1, sizeof (str1), _("%a %b %d %Y"), &week_begin_tm);
+ e_utf8_strftime (str2, sizeof (str2), _("%a %b %d %Y"), &week_end_tm);
}
}
@@ -1927,14 +1919,14 @@
/* Month */
- strftime (text, sizeof (text), _("Selected month (%b %Y)"), &tm);
+ e_utf8_strftime (text, sizeof (text), _("Selected month (%b %Y)"), &tm);
radio = gtk_radio_button_new_with_label (group, text);
group = gtk_radio_button_group (GTK_RADIO_BUTTON (radio));
gtk_box_pack_start (GTK_BOX (box), radio, FALSE, FALSE, 0);
/* Year */
- strftime (text, sizeof (text), _("Selected year (%Y)"), &tm);
+ e_utf8_strftime (text, sizeof (text), _("Selected year (%Y)"), &tm);
radio = gtk_radio_button_new_with_label (group, text);
group = gtk_radio_button_group (GTK_RADIO_BUTTON (radio));
gtk_box_pack_start (GTK_BOX (box), radio, FALSE, FALSE, 0);
@@ -2183,7 +2175,7 @@
icaltimezone *start_zone, *end_zone, *due_zone, *completed_zone;
CalComponentDateTime datetime;
time_t start = 0, end = 0, complete = 0, due = 0;
- static char buffer[1024], *utf_text;
+ static char buffer[1024];
cal_component_get_dtstart (comp, &datetime);
if (datetime.value) {
@@ -2239,10 +2231,8 @@
write_label_piece (due, buffer, 1024, _("Due "), NULL);
}
- utf_text = g_locale_to_utf8 (buffer, -1, NULL, NULL, NULL);
- print_text_size_bold (pc, utf_text, ALIGN_LEFT,
+ print_text_size_bold (pc, buffer, ALIGN_LEFT,
left, right, top, top - 15);
- g_free (utf_text);
}
static void
@@ -2335,19 +2325,16 @@
/* Priority */
cal_component_get_priority (comp, &priority);
if (priority && *priority >= 0) {
- char *priority_string, *priority_utf8, *text;
+ char *priority_string, *text;
priority_string = cal_util_priority_to_string (*priority);
cal_component_free_priority (priority);
- priority_utf8 = g_locale_to_utf8 (priority_string, -1, NULL, NULL, NULL);
- text = g_strdup_printf (_("Priority: %s"),
- priority_utf8);
+ text = g_strdup_printf (_("Priority: %s"), priority_string);
top = bound_text (pc, font, text,
left, right, top, bottom, 0);
top += gnome_font_get_size (font) - 6;
g_free (text);
- g_free (priority_utf8);
}
/* Percent Complete */
Index: gui/weekday-picker.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/weekday-picker.c,v
retrieving revision 1.16
diff -u -r1.16 weekday-picker.c
--- gui/weekday-picker.c 15 Apr 2003 22:26:10 -0000 1.16
+++ gui/weekday-picker.c 29 May 2003 16:51:10 -0000
@@ -262,13 +262,30 @@
}
/* Configures the items in the weekday picker by setting their attributes. */
+static char *
+get_day_text (int day_index)
+{
+ const char *str = _("SMTWTFS");
+ char *day;
+ int char_size = 0;
+
+ day = g_utf8_offset_to_pointer (str, 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);
+}
+
static void
configure_items (WeekdayPicker *wp)
{
WeekdayPickerPrivate *priv;
int width, height;
int box_width;
- const char *str;
int i;
priv = wp->priv;
@@ -277,7 +294,6 @@
height = GTK_WIDGET (wp)->allocation.height;
box_width = (width - 1) / 7;
- str = _("SMTWTFS");
for (i = 0; i < 7; i++) {
char *c;
@@ -295,7 +311,7 @@
"width_pixels", 0,
NULL);
- c = g_strndup (str + day, 1);
+ c = get_day_text (day);
gnome_canvas_item_set (priv->labels[i],
"text", c,
#if 0
@@ -363,8 +379,7 @@
WeekdayPicker *wp;
WeekdayPickerPrivate *priv;
int max_width;
- const char *str;
- int i, len;
+ int i;
PangoFontDescription *font_desc;
PangoContext *pango_context;
PangoFontMetrics *font_metrics;
@@ -385,15 +400,15 @@
max_width = 0;
- str = _("SMTWTFS");
- len = strlen (str);
-
- for (i = 0; i < len; i++) {
+ for (i = 0; i < 7; i++) {
+ char *c;
int w;
- pango_layout_set_text (layout, str + i, 1);
+ c = get_day_text (i);
+ pango_layout_set_text (layout, c, strlen (c));
pango_layout_get_pixel_size (layout, &w, NULL);
-
+ g_free (c);
+
if (w > max_width)
max_width = w;
}
? utf8.patch
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/e-util/ChangeLog,v
retrieving revision 1.390
diff -u -r1.390 ChangeLog
--- ChangeLog 16 May 2003 19:20:34 -0000 1.390
+++ ChangeLog 29 May 2003 16:50:23 -0000
@@ -1,3 +1,11 @@
+2003-05-29 JP Rosevear <jpr ximian com>
+
+ Fixes #43775
+
+ * e-time-utils.c (locale_supports_12_hour_format): use e_utf8_strftime
+ (e_time_format_date_and_time): ditto
+ (e_time_format_time): ditto
+
2003-05-16 Dan Winship <danw ximian com>
* e-proxy.c (e_proxy_init): Removing trailing / in key name passed
Index: e-time-utils.c
===================================================================
RCS file: /cvs/gnome/evolution/e-util/e-time-utils.c,v
retrieving revision 1.14
diff -u -r1.14 e-time-utils.c
--- e-time-utils.c 8 Nov 2002 15:19:09 -0000 1.14
+++ e-time-utils.c 29 May 2003 16:50:23 -0000
@@ -26,6 +26,7 @@
#include <ctype.h>
#include <glib.h>
#include <libgnome/gnome-i18n.h>
+#include <gal/util/e-util.h>
#include "e-time-utils.h"
@@ -107,7 +108,7 @@
struct tm tmp_tm = { 0 };
char s[16];
- strftime (s, sizeof (s), "%p", &tmp_tm);
+ e_utf8_strftime (s, sizeof (s), "%p", &tmp_tm);
return s[0] != '\0';
}
@@ -390,7 +391,7 @@
/* strftime returns 0 if the string doesn't fit, and leaves the buffer
undefined, so we set it to the empty string in that case. */
- if (strftime (buffer, buffer_size, format, date_tm) == 0)
+ if (e_utf8_strftime (buffer, buffer_size, format, date_tm) == 0)
buffer[0] = '\0';
}
@@ -426,7 +427,7 @@
/* strftime returns 0 if the string doesn't fit, and leaves the buffer
undefined, so we set it to the empty string in that case. */
- if (strftime (buffer, buffer_size, format, date_tm) == 0)
+ if (e_utf8_strftime (buffer, buffer_size, format, date_tm) == 0)
buffer[0] = '\0';
}
? bonobo-ref.patch
? utf8.patch
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/widgets/misc/ChangeLog,v
retrieving revision 1.222
diff -u -r1.222 ChangeLog
--- ChangeLog 19 May 2003 18:51:06 -0000 1.222
+++ ChangeLog 29 May 2003 16:49:58 -0000
@@ -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/
Index: e-calendar-item.c
===================================================================
RCS file: /cvs/gnome/evolution/widgets/misc/e-calendar-item.c,v
retrieving revision 1.33
diff -u -r1.33 e-calendar-item.c
--- e-calendar-item.c 15 Apr 2003 21:43:05 -0000 1.33
+++ e-calendar-item.c 29 May 2003 16:49:59 -0000
@@ -1001,6 +1001,23 @@
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 @@
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 @@
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 @@
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 @@
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);
Index: e-dateedit.c
===================================================================
RCS file: /cvs/gnome/evolution/widgets/misc/e-dateedit.c,v
retrieving revision 1.33
diff -u -r1.33 e-dateedit.c
--- e-dateedit.c 11 May 2003 21:57:25 -0000 1.33
+++ e-dateedit.c 29 May 2003 16:49:59 -0000
@@ -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 @@
/* 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 @@
/* 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 @@
/* 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);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]