aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSuman Manjunath <msuman@src.gnome.org>2009-01-30 17:14:05 +0800
committerSuman Manjunath <msuman@src.gnome.org>2009-01-30 17:14:05 +0800
commit01d647401b5cb79177da45f6a7a5e5d73264ac10 (patch)
tree75ab9efbd4aec2b058e067b4050d09767929d2b5
parentcf4b93ce3641ca601a1c7cb434de4a7316c9b627 (diff)
downloadgsoc2013-evolution-01d647401b5cb79177da45f6a7a5e5d73264ac10.tar
gsoc2013-evolution-01d647401b5cb79177da45f6a7a5e5d73264ac10.tar.gz
gsoc2013-evolution-01d647401b5cb79177da45f6a7a5e5d73264ac10.tar.bz2
gsoc2013-evolution-01d647401b5cb79177da45f6a7a5e5d73264ac10.tar.lz
gsoc2013-evolution-01d647401b5cb79177da45f6a7a5e5d73264ac10.tar.xz
gsoc2013-evolution-01d647401b5cb79177da45f6a7a5e5d73264ac10.tar.zst
gsoc2013-evolution-01d647401b5cb79177da45f6a7a5e5d73264ac10.zip
Patch from Behnam Esfahbod - Fix for bug #342446 (Use localized digits in the calendar widget).
svn path=/trunk/; revision=37186
-rw-r--r--widgets/misc/ChangeLog10
-rw-r--r--widgets/misc/e-calendar-item.c24
2 files changed, 25 insertions, 9 deletions
diff --git a/widgets/misc/ChangeLog b/widgets/misc/ChangeLog
index e8c1a5023d..2c1046f0a6 100644
--- a/widgets/misc/ChangeLog
+++ b/widgets/misc/ChangeLog
@@ -1,3 +1,13 @@
+2009-01-30 Suman Manjunath <msuman@novell.com>
+
+ ** Fix for bug #342446
+
+ ** Committing on behalf of Behnam Esfahbod
+
+ * e-calendar-item.c (e_calendar_item_draw_day_numbers),
+ (e_calendar_item_recalc_sizes), (e_calendar_item_position_menu):
+ Use localized digits in the calendar widget.
+
2009-01-11 Matthew Barnes <mbarnes@redhat.com>
* e-attachment-bar.c (eab_icon_clicked_cb):
diff --git a/widgets/misc/e-calendar-item.c b/widgets/misc/e-calendar-item.c
index 3bf1fe65a7..da4c063175 100644
--- a/widgets/misc/e-calendar-item.c
+++ b/widgets/misc/e-calendar-item.c
@@ -1395,7 +1395,7 @@ e_calendar_item_draw_day_numbers (ECalendarItem *calitem,
gboolean today, selected, has_focus, drop_target = FALSE;
gboolean bold, draw_day, finished = FALSE;
gint today_year, today_month, today_mday, month_offset;
- gchar buffer[2];
+ gchar buffer[9];
gint day_style = 0;
PangoContext *pango_context;
PangoFontMetrics *font_metrics;
@@ -1505,12 +1505,12 @@ e_calendar_item_draw_day_numbers (ECalendarItem *calitem,
if (week_num >= 10) {
digit = week_num / 10;
text_x -= calitem->week_number_digit_widths[digit];
- buffer[num_chars++] = digit + '0';
+ num_chars += sprintf (&buffer[num_chars], "%Id", digit);
}
digit = week_num % 10;
text_x -= calitem->week_number_digit_widths[digit] + 6;
- buffer[num_chars++] = digit + '0';
+ num_chars += sprintf (&buffer[num_chars], "%Id", digit);
cairo_save (cr);
gdk_cairo_set_source_color (cr, &style->text[GTK_STATE_ACTIVE]);
@@ -1618,12 +1618,12 @@ e_calendar_item_draw_day_numbers (ECalendarItem *calitem,
if (day_num >= 10) {
digit = day_num / 10;
day_x -= calitem->digit_widths[digit];
- buffer[num_chars++] = digit + '0';
+ num_chars += sprintf (&buffer[num_chars], "%Id", digit);
}
digit = day_num % 10;
day_x -= calitem->digit_widths[digit];
- buffer[num_chars++] = digit + '0';
+ num_chars += sprintf (&buffer[num_chars], "%Id", digit);
cairo_save (cr);
if (fg_color) {
@@ -1913,7 +1913,6 @@ e_calendar_item_recalc_sizes (ECalendarItem *calitem)
{
GnomeCanvasItem *canvas_item;
GtkStyle *style;
- gchar *digits = "0123456789";
gint day, max_day_width, digit, max_digit_width, max_week_number_digit_width;
gint char_height, width, min_cell_width, min_cell_height;
PangoFontDescription *font_desc, *wkfont_desc;
@@ -1956,7 +1955,12 @@ e_calendar_item_recalc_sizes (ECalendarItem *calitem)
max_digit_width = 0;
max_week_number_digit_width = 0;
for (digit = 0; digit < 10; digit++) {
- pango_layout_set_text (layout, &digits [digit], 1);
+ gchar locale_digit[5];
+ int locale_digit_len;
+
+ locale_digit_len = sprintf (locale_digit, "%Id", digit);
+
+ pango_layout_set_text (layout, locale_digit, locale_digit_len);
pango_layout_get_pixel_size (layout, &width, NULL);
calitem->digit_widths[digit] = width;
@@ -1966,7 +1970,7 @@ e_calendar_item_recalc_sizes (ECalendarItem *calitem)
pango_context_set_font_description (pango_context, wkfont_desc);
pango_layout_context_changed (layout);
- pango_layout_set_text (layout, &digits [digit], 1);
+ pango_layout_set_text (layout, locale_digit, locale_digit_len);
pango_layout_get_pixel_size (layout, &width, NULL);
calitem->week_number_digit_widths[digit] = width;
@@ -3352,7 +3356,9 @@ e_calendar_item_position_menu (GtkMenu *menu,
gtk_widget_get_child_requisition (GTK_WIDGET (menu), &requisition);
- *x -= 2;
+ *x -= (gtk_widget_get_direction(GTK_WIDGET(menu)) == GTK_TEXT_DIR_RTL)
+ ? requisition.width - 2
+ : 2;
*y -= requisition.height / 2;
screen_width = gdk_screen_width ();