aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJP Rosevear <jpr@ximian.com>2003-05-31 01:35:10 +0800
committerJP Rosevear <jpr@src.gnome.org>2003-05-31 01:35:10 +0800
commitb732aa4bbbc5839669561e2d51403a70029f1725 (patch)
treef6958c0b3db03af9e78a6fd6feed47bf68b1ac00
parent4d6913170ec76ebd227d8261d41c78e5f897c4b2 (diff)
downloadgsoc2013-evolution-b732aa4bbbc5839669561e2d51403a70029f1725.tar
gsoc2013-evolution-b732aa4bbbc5839669561e2d51403a70029f1725.tar.gz
gsoc2013-evolution-b732aa4bbbc5839669561e2d51403a70029f1725.tar.bz2
gsoc2013-evolution-b732aa4bbbc5839669561e2d51403a70029f1725.tar.lz
gsoc2013-evolution-b732aa4bbbc5839669561e2d51403a70029f1725.tar.xz
gsoc2013-evolution-b732aa4bbbc5839669561e2d51403a70029f1725.tar.zst
gsoc2013-evolution-b732aa4bbbc5839669561e2d51403a70029f1725.zip
Fixes #43775
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 svn path=/trunk/; revision=21355
-rw-r--r--calendar/ChangeLog43
-rw-r--r--calendar/gui/calendar-commands.c23
-rw-r--r--calendar/gui/calendar-config.c3
-rw-r--r--calendar/gui/calendar-model.c11
-rw-r--r--calendar/gui/e-cell-date-edit-text.c4
-rw-r--r--calendar/gui/e-day-view-top-item.c3
-rw-r--r--calendar/gui/e-day-view.c15
-rw-r--r--calendar/gui/e-itip-control.c5
-rw-r--r--calendar/gui/itip-utils.c6
-rw-r--r--calendar/gui/print.c59
-rw-r--r--calendar/gui/weekday-picker.c37
11 files changed, 127 insertions, 82 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog
index d8db94bef4..00f43914b9 100644
--- a/calendar/ChangeLog
+++ b/calendar/ChangeLog
@@ -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
diff --git a/calendar/gui/calendar-commands.c b/calendar/gui/calendar-commands.c
index 0f2f35a527..6c7030a341 100644
--- a/calendar/gui/calendar-commands.c
+++ b/calendar/gui/calendar-commands.c
@@ -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 @@ calendar_set_folder_bar_label (GnomeCalendar *gcal, BonoboControl *control)
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 @@ calendar_set_folder_bar_label (GnomeCalendar *gcal, BonoboControl *control)
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);
diff --git a/calendar/gui/calendar-config.c b/calendar/gui/calendar-config.c
index e191a6e8d8..b9e94cc334 100644
--- a/calendar/gui/calendar-config.c
+++ b/calendar/gui/calendar-config.c
@@ -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 @@ calendar_config_locale_supports_12_hour_format (void)
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';
}
diff --git a/calendar/gui/calendar-model.c b/calendar/gui/calendar-model.c
index 9ee184cee6..2724a0a19c 100644
--- a/calendar/gui/calendar-model.c
+++ b/calendar/gui/calendar-model.c
@@ -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 @@ date_value_to_string (ETableModel *etm, const void *value)
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 @@ calendar_model_value_to_string (ETableModel *etm, int col, const void *value)
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;
diff --git a/calendar/gui/e-cell-date-edit-text.c b/calendar/gui/e-cell-date-edit-text.c
index f6e6e31b60..afd5fc1fb6 100644
--- a/calendar/gui/e-cell-date-edit-text.c
+++ b/calendar/gui/e-cell-date-edit-text.c
@@ -88,7 +88,7 @@ ecd_get_text (ECellText *cell, ETableModel *model, int col, int row)
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 @@ show_date_warning (ECellDateEditText *ecd)
/* 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"),
diff --git a/calendar/gui/e-day-view-top-item.c b/calendar/gui/e-day-view-top-item.c
index 82f74c5c4e..1277f95221 100644
--- a/calendar/gui/e-day-view-top-item.c
+++ b/calendar/gui/e-day-view-top-item.c
@@ -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 @@ e_day_view_top_item_draw (GnomeCanvasItem *canvas_item,
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;
diff --git a/calendar/gui/e-day-view.c b/calendar/gui/e-day-view.c
index ce8ed1d547..6ae7d5553c 100644
--- a/calendar/gui/e-day-view.c
+++ b/calendar/gui/e-day-view.c
@@ -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 @@ e_day_view_style_set (GtkWidget *widget,
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 @@ e_day_view_style_set (GtkWidget *widget,
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 @@ e_day_view_style_set (GtkWidget *widget,
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 @@ e_day_view_style_set (GtkWidget *widget,
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 @@ e_day_view_recalc_cell_sizes (EDayView *day_view)
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 @@ e_day_view_recalc_cell_sizes (EDayView *day_view)
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 @@ e_day_view_recalc_cell_sizes (EDayView *day_view)
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);
diff --git a/calendar/gui/e-itip-control.c b/calendar/gui/e-itip-control.c
index 89434d02c8..25a673c217 100644
--- a/calendar/gui/e-itip-control.c
+++ b/calendar/gui/e-itip-control.c
@@ -628,10 +628,7 @@ write_label_piece (EItipControl *itip, CalComponentDateTime *dt,
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);
diff --git a/calendar/gui/itip-utils.c b/calendar/gui/itip-utils.c
index 5215237930..aea984cb2e 100644
--- a/calendar/gui/itip-utils.c
+++ b/calendar/gui/itip-utils.c
@@ -509,11 +509,9 @@ comp_description (CalComponent *comp)
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"));
diff --git a/calendar/gui/print.c b/calendar/gui/print.c
index dff86a02a2..f078fb367a 100644
--- a/calendar/gui/print.c
+++ b/calendar/gui/print.c
@@ -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 @@ format_date(time_t time, int flags, char *buffer, int bufflen)
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 @@ format_date(time_t time, int flags, char *buffer, int bufflen)
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 @@ print_week_view_background (GnomePrintContext *pc, GnomeFont *font,
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 @@ print_week_view_background (GnomePrintContext *pc, GnomeFont *font,
}
- 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 @@ print_month_summary (GnomePrintContext *pc, GnomeCalendar *gcal, time_t whence,
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 @@ range_selector_new (GtkWidget *dialog, time_t at, int *view)
/* 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 @@ range_selector_new (GtkWidget *dialog, time_t at, int *view)
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 @@ range_selector_new (GtkWidget *dialog, time_t at, int *view)
/* 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 @@ print_date_label (GnomePrintContext *pc, CalComponent *comp, CalClient *client,
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 @@ print_date_label (GnomePrintContext *pc, CalComponent *comp, CalClient *client,
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 @@ print_comp_item (GnomePrintContext *pc, CalComponent *comp, CalClient *client,
/* 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 */
diff --git a/calendar/gui/weekday-picker.c b/calendar/gui/weekday-picker.c
index 1eb4d96f6a..87438fd62d 100644
--- a/calendar/gui/weekday-picker.c
+++ b/calendar/gui/weekday-picker.c
@@ -262,13 +262,30 @@ colorize_items (WeekdayPicker *wp)
}
/* 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 @@ configure_items (WeekdayPicker *wp)
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 @@ configure_items (WeekdayPicker *wp)
"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 @@ weekday_picker_style_set (GtkWidget *widget, GtkStyle *previous_style)
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 @@ weekday_picker_style_set (GtkWidget *widget, GtkStyle *previous_style)
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;
}