diff options
author | Iain Holmes <iain@src.gnome.org> | 2001-09-06 06:28:39 +0800 |
---|---|---|
committer | Iain Holmes <iain@src.gnome.org> | 2001-09-06 06:28:39 +0800 |
commit | 302eaef890f4a90e83b2118bd96e2c1fc459712e (patch) | |
tree | 6ee0d6b622aca7907105f5d1d3a96b8406bfd6d6 /my-evolution | |
parent | 1b46152aea277563c1a001836ea6714c5406d69d (diff) | |
download | gsoc2013-evolution-302eaef890f4a90e83b2118bd96e2c1fc459712e.tar.gz gsoc2013-evolution-302eaef890f4a90e83b2118bd96e2c1fc459712e.tar.zst gsoc2013-evolution-302eaef890f4a90e83b2118bd96e2c1fc459712e.zip |
USe 24hr clock if appropriate, don't mess with the date and time
svn path=/trunk/; revision=12635
Diffstat (limited to 'my-evolution')
-rw-r--r-- | my-evolution/ChangeLog | 8 | ||||
-rw-r--r-- | my-evolution/e-summary-calendar.c | 40 |
2 files changed, 39 insertions, 9 deletions
diff --git a/my-evolution/ChangeLog b/my-evolution/ChangeLog index 2661996642..f66ab4db98 100644 --- a/my-evolution/ChangeLog +++ b/my-evolution/ChangeLog @@ -1,3 +1,11 @@ +2001-09-05 Iain Holmes <iain@ximian.com> + + * e-summary-calendar.c (generate_html): Check if we need to use 24hr + format. Don't try to do fancy things with the date and time of an + appointment. + (locale_uses_24h_time_format): Cut and pasted from calendar. + (e_summary_calendar_init): Get the 24hour preferences from the calendar. + 2001-09-04 Iain Holmes <iain@ximian.com> * Locations: Applied patch from Evert Verhellen to fix the Belgium diff --git a/my-evolution/e-summary-calendar.c b/my-evolution/e-summary-calendar.c index ca7b8bacab..ab143cc718 100644 --- a/my-evolution/e-summary-calendar.c +++ b/my-evolution/e-summary-calendar.c @@ -18,10 +18,15 @@ #include <cal-client/cal-client.h> #include <cal-util/timeutil.h> +#include <bonobo/bonobo-exception.h> +#include <bonobo/bonobo-moniker-util.h> +#include <bonobo-conf/bonobo-config-database.h> + struct _ESummaryCalendar { CalClient *client; char *html; + gboolean wants24hr; }; const char * @@ -169,6 +174,7 @@ generate_html (gpointer data) break; case E_SUMMARY_CALENDAR_ONE_MONTH: + default: f = time_add_month (t, 1); end = time_day_end (f); break; @@ -228,16 +234,10 @@ generate_html (gpointer data) start_str = g_new (char, 20); start_tm = localtime (&start_t); - dt = start_t - t; - /* 86400 == 1 day - 604800 == 1 week - Otherwise: Month */ - if (dt < 86400) { - strftime (start_str, 19, _("%l:%M%p"), start_tm); - } else if (dt < 604800) { - strftime (start_str, 19, _("%a %l:%M%p"), start_tm); + if (calendar->wants24hr == TRUE) { + strftime (start_str, 19, _("%k%M %d %B"), start_tm); } else { - strftime (start_str, 19, _("%d %B"), start_tm); + strftime (start_str, 19, _("%l:%M %d %B"), start_tm); } tmp = g_strdup_printf ("<img align=\"middle\" src=\"new_appointment.xpm\" " @@ -291,9 +291,21 @@ e_summary_calendar_protocol (ESummary *summary, } +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'; +} + void e_summary_calendar_init (ESummary *summary) { + Bonobo_ConfigDatabase db; + CORBA_Environment ev; ESummaryCalendar *calendar; gboolean result; char *uri; @@ -324,6 +336,16 @@ e_summary_calendar_init (ESummary *summary) g_message ("Open calendar failed"); } + CORBA_exception_init (&ev); + db = bonobo_get_object ("wombat:", "Bonobo/ConfigDatabase", &ev); + if (BONOBO_EX (&ev) || db == CORBA_OBJECT_NIL) { + g_warning ("Error getting Wombat. Using defaults"); + } else { + calendar->wants24hr = bonobo_config_get_boolean_with_default (db, "/Calendar/Display/Use24HourFormat", locale_uses_24h_time_format (), NULL); + bonobo_object_release_unref (db, NULL); + } + CORBA_exception_free (&ev); + e_summary_add_protocol_listener (summary, "calendar", e_summary_calendar_protocol, calendar); } |