added function to get a reasonable name to display for the timezone.

2001-10-27  Damon Chaplin  <damon@ximian.com>

	* src/libical/icaltimezone.c (icaltimezone_get_display_name): added
	function to get a reasonable name to display for the timezone.
	(Though it won't be translated.)

svn path=/trunk/; revision=14265
This commit is contained in:
Damon Chaplin
2001-10-28 02:24:22 +00:00
committed by Damon Chaplin
parent 97bf637806
commit 27c2d8fee6
3 changed files with 31 additions and 1 deletions

View File

@ -1,3 +1,9 @@
2001-10-27 Damon Chaplin <damon@ximian.com>
* src/libical/icaltimezone.c (icaltimezone_get_display_name): added
function to get a reasonable name to display for the timezone.
(Though it won't be translated.)
2001-10-25 Damon Chaplin <damon@ximian.com>
* src/libical/icaltimezone.c (icaltimezone_get_tznames_from_vtimezone):

View File

@ -87,7 +87,8 @@ struct _icaltimezone {
/* If this is not NULL it points to the builtin icaltimezone that the
above TZID refers to. This icaltimezone should be used instead when
accessing the timezone changes data, so that the expanded timezone
changes data is shared between calendar components. */
changes data is shared between calendar components. (I don't think
we actually use this at present.) */
icaltimezone *builtin_timezone;
/* This is the last year for which we have expanded the data to.
@ -1208,6 +1209,25 @@ icaltimezone_set_component (icaltimezone *zone,
}
/* Returns the timezone name to display to the user. We prefer to use the
Olson city name, but fall back on the TZNAME, or finally the TZID. We don't
want to use "" as it may be wrongly interpreted as a floating time.
Do not free the returned string. */
char*
icaltimezone_get_display_name (icaltimezone *zone)
{
char *display_name;
display_name = icaltimezone_get_location (zone);
if (!display_name)
display_name = icaltimezone_get_tznames (zone);
if (!display_name)
display_name = icaltimezone_get_tzid (zone);
return display_name;
}
icalarray*
icaltimezone_array_new (void)
{

View File

@ -74,6 +74,10 @@ char* icaltimezone_get_location (icaltimezone *zone);
may also return NULL. */
char* icaltimezone_get_tznames (icaltimezone *zone);
/* Returns a string suitable for displaying to the user. If there is a
LOCATION property it returns that, else the TZNAMEs, else the TZID. */
char* icaltimezone_get_display_name (icaltimezone *zone);
/* Returns the latitude of a builtin timezone. */
double icaltimezone_get_latitude (icaltimezone *zone);