diff options
-rw-r--r-- | calendar/ChangeLog | 8 | ||||
-rw-r--r-- | calendar/conduits/calendar/calendar-conduit.c | 10 | ||||
-rw-r--r-- | calendar/conduits/todo/todo-conduit.c | 10 | ||||
-rw-r--r-- | calendar/gui/alarm-notify/config-data.c | 10 | ||||
-rw-r--r-- | calendar/gui/calendar-config.c | 23 |
5 files changed, 36 insertions, 25 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog index 6c54920a15..ef6efe109f 100644 --- a/calendar/ChangeLog +++ b/calendar/ChangeLog @@ -1,3 +1,11 @@ +2001-11-13 Damon Chaplin <damon@ximian.com> + + * gui/alarm-notify/config-data.c (ensure_inited): + * gui/calendar-config.c (config_read): + * conduits/todo/todo-conduit.c (get_default_timezone): + * conduits/calendar/calendar-conduit.c (get_default_timezone): + make the timezone default to UTC. Fixes bug #14362. + 2001-11-13 Rodrigo Moya <rodrigo@ximian.com> * gui/e-week-view.c (selection_received): only change the day, diff --git a/calendar/conduits/calendar/calendar-conduit.c b/calendar/conduits/calendar/calendar-conduit.c index 552ba41e69..58b7a7020f 100644 --- a/calendar/conduits/calendar/calendar-conduit.c +++ b/calendar/conduits/calendar/calendar-conduit.c @@ -261,14 +261,16 @@ get_default_timezone (void) CORBA_exception_free (&ev); - location = bonobo_config_get_string (db, "/Calendar/Display/Timezone", NULL); - if (location == NULL) - goto cleanup; + location = bonobo_config_get_string_with_default (db, + "/Calendar/Display/Timezone", "UTC", NULL); + if (!location || !location[0]) { + g_free (location); + location = g_strdup ("UTC"); + } timezone = icaltimezone_get_builtin_timezone (location); g_free (location); - cleanup: bonobo_object_release_unref (db, NULL); return timezone; diff --git a/calendar/conduits/todo/todo-conduit.c b/calendar/conduits/todo/todo-conduit.c index 99da43b13f..4964860e22 100644 --- a/calendar/conduits/todo/todo-conduit.c +++ b/calendar/conduits/todo/todo-conduit.c @@ -265,14 +265,16 @@ get_default_timezone (void) CORBA_exception_free (&ev); - location = bonobo_config_get_string (db, "/Calendar/Display/Timezone", NULL); - if (location == NULL) - goto cleanup; + location = bonobo_config_get_string_with_default (db, + "/Calendar/Display/Timezone", "UTC", NULL); + if (!location || !location[0]) { + g_free (location); + location = g_strdup ("UTC"); + } timezone = icaltimezone_get_builtin_timezone (location); g_free (location); - cleanup: bonobo_object_release_unref (db, NULL); return timezone; diff --git a/calendar/gui/alarm-notify/config-data.c b/calendar/gui/alarm-notify/config-data.c index cea1d252f9..71170a3ad6 100644 --- a/calendar/gui/alarm-notify/config-data.c +++ b/calendar/gui/alarm-notify/config-data.c @@ -72,12 +72,14 @@ ensure_inited (void) return; } - location = bonobo_config_get_string (db, "/Calendar/Display/Timezone", NULL); - if (location) { + location = bonobo_config_get_string_with_default (db, + "/Calendar/Display/Timezone", "UTC", NULL); + if (location && location[0]) { local_timezone = icaltimezone_get_builtin_timezone (location); - g_free (location); - } else + } else { local_timezone = icaltimezone_get_utc_timezone (); + } + g_free (location); if (locale_supports_12_hour_format ()) { /* Wasn't the whole point of a configuration engine *NOT* to diff --git a/calendar/gui/calendar-config.c b/calendar/gui/calendar-config.c index 419f4cedb5..b5ae415faf 100644 --- a/calendar/gui/calendar-config.c +++ b/calendar/gui/calendar-config.c @@ -148,15 +148,13 @@ config_read (void) CORBA_exception_free (&ev); - CORBA_exception_init (&ev); - config->timezone = bonobo_config_get_string (db, - "/Calendar/Display/Timezone", &ev); - if (BONOBO_USER_EX (&ev, ex_Bonobo_ConfigDatabase_NotFound)) - config->timezone = NULL; - else if (BONOBO_EX (&ev)) - g_message ("config_read(): Could not get the /Calendar/Display/Timezone"); - - CORBA_exception_free (&ev); + /* Default to UTC if the timezone is not set or is "". */ + config->timezone = bonobo_config_get_string_with_default (db, + "/Calendar/Display/Timezone", "UTC", NULL); + if (!config->timezone || !config->timezone[0]) { + g_free (config->timezone); + config->timezone = g_strdup ("UTC"); + } config->working_days = bonobo_config_get_long_with_default (db, "/Calendar/Display/WorkingDays", CAL_MONDAY | CAL_TUESDAY | @@ -465,9 +463,8 @@ calendar_config_get_timezone (void) } -/* Sets the timezone. You shouldn't really set it to the empty string or NULL, - as this means that Evolution will show the timezone-setting dialog to ask - the user for the timezone. It copies the string. */ +/* Sets the timezone. If set to NULL it defaults to UTC. + FIXME: Should check it is being set to a valid timezone. */ void calendar_config_set_timezone (gchar *timezone) { @@ -476,7 +473,7 @@ calendar_config_set_timezone (gchar *timezone) if (timezone && timezone[0]) config->timezone = g_strdup (timezone); else - config->timezone = NULL; + config->timezone = g_strdup ("UTC"); } |