From ff73499ab059dd5caa5d6511f0ad83a7e69c9eae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Erick=20P=C3=A9rez=20Castellanos?= Date: Fri, 7 Nov 2014 14:49:45 -0500 Subject: [PATCH] utils: retrieve first_weekday from locale Bug: https://bugzilla.gnome.org/show_bug.cgi?id=703317 --- src/gcal-utils.c | 11 +++++++++++ src/gcal-utils.h | 2 ++ 2 files changed, 13 insertions(+) diff --git a/src/gcal-utils.c b/src/gcal-utils.c index 5e2137be..33aeab74 100644 --- a/src/gcal-utils.c +++ b/src/gcal-utils.c @@ -349,6 +349,17 @@ get_desc_from_component (ECalComponent *component, return desc; } +gint +get_first_weekday (void) +{ + const char *const s = nl_langinfo(_NL_TIME_FIRST_WEEKDAY); + + if (s && *s >= 1 && *s <= 7) + return ((int)*s) - 1; + + return 0; +} + /* Function to do a last minute fixup of the AM/PM stuff if the locale * and gettext haven't done it right. Most English speaking countries * except the USA use the 24 hour clock (UK, Australia etc). However diff --git a/src/gcal-utils.h b/src/gcal-utils.h index 11e0381e..ac1bab7a 100644 --- a/src/gcal-utils.h +++ b/src/gcal-utils.h @@ -81,6 +81,8 @@ void print_date (const gchar* gchar* get_desc_from_component (ECalComponent *component, const gchar *joint_char); +gint get_first_weekday (void); + /* code brought from evolution */ gsize e_strftime_fix_am_pm (gchar *str, gsize max,