From a7135aebdabb051dc9e0c7c74676f75f4ca388ed Mon Sep 17 00:00:00 2001 From: Zbigniew Chyla Date: Sat, 18 Aug 2001 08:38:49 +0000 Subject: New. (config_read): Use locale's setting as default for 2001-08-18 Zbigniew Chyla * gui/calendar-config.c (locale_uses_24h_time_format): New. (config_read): Use locale's setting as default for /Calendar/Display/Use24HourFormat so that Europeans don't have to switch to 24-hour format manually. svn path=/trunk/; revision=12200 --- calendar/gui/calendar-config.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'calendar/gui/calendar-config.c') diff --git a/calendar/gui/calendar-config.c b/calendar/gui/calendar-config.c index b75c267984..fd95a573b0 100644 --- a/calendar/gui/calendar-config.c +++ b/calendar/gui/calendar-config.c @@ -28,6 +28,7 @@ */ #include +#include #include #include #include @@ -86,6 +87,15 @@ calendar_config_init (void) config_read (); } +static gboolean +locale_uses_24h_time_format (void) +{ + char s[16]; + time_t t = 0; + + strftime (s, sizeof s, "%p", gmtime (&t)); + return s[0] == '\0'; +} static void config_read (void) @@ -115,7 +125,7 @@ config_read (void) "/Calendar/Display/WeekStartDay", 1, NULL); config->use_24_hour_format = bonobo_config_get_boolean_with_default ( - db, "/Calendar/Display/Use24HourFormat", FALSE, NULL); + db, "/Calendar/Display/Use24HourFormat", locale_uses_24h_time_format (), NULL); config->week_start_day = bonobo_config_get_long_with_default (db, "/Calendar/Display/WeekStartDay", 1, NULL); -- cgit