aboutsummaryrefslogtreecommitdiffstats
path: root/libical
diff options
context:
space:
mode:
Diffstat (limited to 'libical')
-rw-r--r--libical/ChangeLog6
-rw-r--r--libical/src/libical/icaltimezone.c22
-rw-r--r--libical/src/libical/icaltimezone.h4
3 files changed, 31 insertions, 1 deletions
diff --git a/libical/ChangeLog b/libical/ChangeLog
index 6843ea1c12..fde2b9b064 100644
--- a/libical/ChangeLog
+++ b/libical/ChangeLog
@@ -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):
diff --git a/libical/src/libical/icaltimezone.c b/libical/src/libical/icaltimezone.c
index 9e15fbf993..f7d62a3383 100644
--- a/libical/src/libical/icaltimezone.c
+++ b/libical/src/libical/icaltimezone.c
@@ -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)
{
diff --git a/libical/src/libical/icaltimezone.h b/libical/src/libical/icaltimezone.h
index b072f0dd9a..2a692c441b 100644
--- a/libical/src/libical/icaltimezone.h
+++ b/libical/src/libical/icaltimezone.h
@@ -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);