## ETimezoneCache

ETimezoneCache — An interface for caching time zone data

## Functions

void | e_timezone_cache_add_timezone ()
ICalTimezone * | e_timezone_cache_get_timezone ()
GList * | e_timezone_cache_list_timezones ()

## Types and Values

struct | ETimezoneCacheInterface
| ETimezoneCache

## Object Hierarchy

        GInterface
        ╰── ETimezoneCache

## Prerequisites

ETimezoneCache requires GObject.

## Known Implementations

ETimezoneCache is implemented by ECalBackend, ECalBackendSync, ECalCache, ECalClient and ECalMetaBackend.

## Includes

    #include <libecal/libecal.h>

## Description

Several classes (both client-side and server-side) cache ICalTimezone instances internally, indexed by their TZID strings. Classes which do this should implement ETimezoneCacheInterface to provide a consistent API for accessing time zone data.

## Functions

### e_timezone_cache_add_timezone ()

    void
    e_timezone_cache_add_timezone (ETimezoneCache *cache,
                                   ICalTimezone *zone);

Adds a copy of `zone` to `cache` and emits an “timezone-added” signal. The `cache` will use the TZID string returned by `i_cal_timezone_get_tzid()` as the lookup key, which can be passed to `e_timezone_cache_get_timezone()` to obtain `zone` again.

If the `cache` already has an ICalTimezone with the same TZID string as `zone` , the `cache` will remain unchanged to avoid invalidating any ICalTimezone pointers which may have already been returned through `e_timezone_cache_get_timezone()`.

#### Parameters

cache | an ETimezoneCache |
zone | an ICalTimezone |

Since: 3.8

### e_timezone_cache_get_timezone ()

    ICalTimezone *
    e_timezone_cache_get_timezone (ETimezoneCache *cache,
                                   const gchar *tzid);

Obtains an ICalTimezone by its TZID string. If no match is found, the function returns `NULL`. The returned ICalTimezone is owned by the `cache` and should not be modified or freed.

#### Parameters

cache | an ETimezoneCache |
tzid | the TZID of a timezone |

#### Returns

an ICalTimezone, or `NULL`.

[transfer none][nullable]

Since: 3.8

### e_timezone_cache_list_timezones ()

    GList *
    e_timezone_cache_list_timezones (ETimezoneCache *cache);

Returns a list of ICalTimezone instances that were explicitly added to the `cache` through `e_timezone_cache_add_timezone()`. In particular, any built-in time zone data that `e_timezone_cache_get_timezone()` may use to match a TZID string is excluded from the returned list.

Free the returned list with `g_list_free()`. The list elements are owned by the `cache` and should not be modified or freed.

#### Parameters

cache | an ETimezoneCache |

#### Returns

a GList of ICalTimezone instances.

[transfer container][element-type ICalTimezone]

Since: 3.8

## Types and Values

### struct ETimezoneCacheInterface

    struct ETimezoneCacheInterface {
    	/* Methods */
    	void		(*tzcache_add_timezone) (ETimezoneCache *cache,
    						 ICalTimezone *zone);
    	ICalTimezone * (*tzcache_get_timezone) (ETimezoneCache *cache,
    						 const gchar *tzid);
    	GList *		(*tzcache_list_timezones)
    						(ETimezoneCache *cache); /* ICalTimezone * */

    	/* Signals */
    	void		(*timezone_added) (ETimezoneCache *cache,
    						 ICalTimezone *zone);

    	/* Padding for future expansion */
    	gpointer reserved_signals[4];
    };

#### Members

`tzcache_add_timezone` () |  |
`tzcache_get_timezone` () |  |
`tzcache_list_timezones` () |  |
`timezone_added` () |  |
gpointer `reserved_signals`[4]; |  |

Since: 3.8

### ETimezoneCache

    typedef struct _ETimezoneCache ETimezoneCache;

Since: 3.8