[gnome-calendar/ui-rewrite] utils: retrieve first_weekday from locale



commit 0f1ebae0073088398c13f72249440cfc2b072e67
Author: Erick Pérez Castellanos <erick red gmail com>
Date:   Fri Nov 7 14:49:45 2014 -0500

    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(+), 0 deletions(-)
---
diff --git a/src/gcal-utils.c b/src/gcal-utils.c
index 5e2137b..33aeab7 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 11e0381..ac1bab7 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,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]