aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--calendar/ChangeLog7
-rw-r--r--calendar/gui/calendar-config.c12
2 files changed, 18 insertions, 1 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog
index 5153925678..de9ebfa34b 100644
--- a/calendar/ChangeLog
+++ b/calendar/ChangeLog
@@ -1,3 +1,10 @@
+2001-08-18 Zbigniew Chyla <cyba@gnome.pl>
+
+ * 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.
+
2001-08-17 Damon Chaplin <damon@ximian.com>
* gui/gnome-cal.c (gnome_calendar_new_task): new function to open the
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 <config.h>
+#include <time.h>
#include <libgnome/gnome-defs.h>
#include <libgnome/gnome-config.h>
#include <libgnomeui/gnome-dialog.h>
@@ -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);