aboutsummaryrefslogtreecommitdiffstats
path: root/widgets
diff options
context:
space:
mode:
authorChenthill Palanisamy <pchen@src.gnome.org>2009-03-08 23:57:20 +0800
committerChenthill Palanisamy <pchen@src.gnome.org>2009-03-08 23:57:20 +0800
commit60f4e2fdef88702a49505ddee43c968f6d319369 (patch)
tree98fa66e77d104ec7ffa4a3952bed6bd6eb99219e /widgets
parentbbbfa78a1051fda16871ccdcecc40c67c2c1b91d (diff)
downloadgsoc2013-evolution-60f4e2fdef88702a49505ddee43c968f6d319369.tar.gz
gsoc2013-evolution-60f4e2fdef88702a49505ddee43c968f6d319369.tar.zst
gsoc2013-evolution-60f4e2fdef88702a49505ddee43c968f6d319369.zip
Fixes #342446
svn path=/trunk/; revision=37383
Diffstat (limited to 'widgets')
-rw-r--r--widgets/misc/ChangeLog8
-rw-r--r--widgets/misc/e-calendar-item.c37
2 files changed, 40 insertions, 5 deletions
diff --git a/widgets/misc/ChangeLog b/widgets/misc/ChangeLog
index 0cd6767fd5..ab84dfd7ba 100644
--- a/widgets/misc/ChangeLog
+++ b/widgets/misc/ChangeLog
@@ -1,3 +1,11 @@
+2009-03-08 Chenthill Palanisamy <pchenthill@novell.com>
+
+ Fixes #342446
+ * widgets/misc/e-calendar-item.c: Check whether its
+ appropriate to use %Id format for digits. Incorporated
+ the fix from Wang Xin <jedy.wang@sun.com> to build in
+ solaris.
+
2009-02-25 Milan Crha <mcrha@redhat.com>
** Fix for bug #559027
diff --git a/widgets/misc/e-calendar-item.c b/widgets/misc/e-calendar-item.c
index da4c063175..07f0bb3980 100644
--- a/widgets/misc/e-calendar-item.c
+++ b/widgets/misc/e-calendar-item.c
@@ -1364,6 +1364,33 @@ e_calendar_item_draw_month (ECalendarItem *calitem,
cairo_destroy (cr);
}
+static const char *
+get_digit_fomat ()
+{
+
+#ifdef HAVE_GNU_GET_LIBC_VERSION
+#include <gnu/libc-version.h>
+
+ const char *libc_version = gnu_get_libc_version ();
+ char **split = g_strsplit (libc_version, ".", -1);
+ int major = 0;
+ int minor = 0;
+ int revision = 0;
+
+ major = atoi (split [0]);
+ minor = atoi (split [1]);
+
+ if (g_strv_length (split) > 2)
+ revision = atoi (split [2]);
+ g_strfreev (split);
+
+ if (major > 2 || minor > 2 || (minor == 2 && revision > 2)) {
+ return _("%Id");
+ }
+#endif
+
+ return "%d";
+}
static void
e_calendar_item_draw_day_numbers (ECalendarItem *calitem,
@@ -1505,12 +1532,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];
- num_chars += sprintf (&buffer[num_chars], "%Id", digit);
+ num_chars += sprintf (&buffer[num_chars], get_digit_fomat (), digit);
}
digit = week_num % 10;
text_x -= calitem->week_number_digit_widths[digit] + 6;
- num_chars += sprintf (&buffer[num_chars], "%Id", digit);
+ num_chars += sprintf (&buffer[num_chars], get_digit_fomat (), digit);
cairo_save (cr);
gdk_cairo_set_source_color (cr, &style->text[GTK_STATE_ACTIVE]);
@@ -1618,12 +1645,12 @@ e_calendar_item_draw_day_numbers (ECalendarItem *calitem,
if (day_num >= 10) {
digit = day_num / 10;
day_x -= calitem->digit_widths[digit];
- num_chars += sprintf (&buffer[num_chars], "%Id", digit);
+ num_chars += sprintf (&buffer[num_chars], get_digit_fomat (), digit);
}
digit = day_num % 10;
day_x -= calitem->digit_widths[digit];
- num_chars += sprintf (&buffer[num_chars], "%Id", digit);
+ num_chars += sprintf (&buffer[num_chars], get_digit_fomat (), digit);
cairo_save (cr);
if (fg_color) {
@@ -1958,7 +1985,7 @@ e_calendar_item_recalc_sizes (ECalendarItem *calitem)
gchar locale_digit[5];
int locale_digit_len;
- locale_digit_len = sprintf (locale_digit, "%Id", digit);
+ locale_digit_len = sprintf (locale_digit, get_digit_fomat (), digit);
pango_layout_set_text (layout, locale_digit, locale_digit_len);
pango_layout_get_pixel_size (layout, &width, NULL);