aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/gui/weekday-picker.c
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 /calendar/gui/weekday-picker.c
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
Diffstat (limited to 'calendar/gui/weekday-picker.c')
-rw-r--r--calendar/gui/weekday-picker.c37
1 files changed, 26 insertions, 11 deletions
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;
}