Osso Addressbook Reference Manual | ||||
---|---|---|---|---|
OssoABookAvatarCache; OssoABookAvatarCache* osso_abook_avatar_cache_new (void); OssoABookAvatarCache* osso_abook_avatar_cache_get_default (void); OssoABookAvatarCache* osso_abook_avatar_cache_get_for_scale (int width, int height, gboolean crop); OssoABookAvatarCache* osso_abook_avatar_cache_get_for_name (const char *name); void osso_abook_avatar_cache_set_limit (OssoABookAvatarCache *self, unsigned limit); unsigned osso_abook_avatar_cache_get_limit (OssoABookAvatarCache *self); GdkPixbuf* osso_abook_avatar_cache_lookup (OssoABookAvatarCache *self, OssoABookAvatar *avatar); void osso_abook_avatar_cache_add (OssoABookAvatarCache *self, OssoABookAvatar *avatar, GdkPixbuf *pixbuf); void osso_abook_avatar_cache_clear (OssoABookAvatarCache *self); void osso_abook_avatar_cache_drop_by_name (const char *name);
This is a global LRU avatar cache to avoid scaling and loading avatar images over and over again.
The size of the cache is limited by the "cache-limit" property. When adding more pixbufs than permited by this property, the least recently used avatars are removed from the cache.
Avatars also are removed when they get destroyed or when they signal that their avatar image has changed.
OssoABookAvatarCache* osso_abook_avatar_cache_new (void);
Creates a new avatar cache.
Returns : | A newly allocated OssoABookAvatarCache instance. |
OssoABookAvatarCache* osso_abook_avatar_cache_get_default (void);
Retrieves the default avatar cache.
Returns : | The default OssoABookAvatarCache. It is owned by the library and should not be freed. |
OssoABookAvatarCache* osso_abook_avatar_cache_get_for_scale (int width, int height, gboolean crop);
Retrieves the shared avatar cache for the given image scale. Consult
osso_abook_avatar_get_image_scaled()
for more information about arguments.
width : |
image width |
height : |
image height |
crop : |
image cropping mode |
Returns : | The shared OssoABookAvatarCache for this scale. It is owned by the library and should not be freed. |
OssoABookAvatarCache* osso_abook_avatar_cache_get_for_name (const char *name);
Retrieves the shared avatar cache for a given name
.
name : |
the cache id |
Returns : | The shared OssoABookAvatarCache for this name .
It is owned by the library and should not be freed.
|
void osso_abook_avatar_cache_set_limit (OssoABookAvatarCache *self, unsigned limit);
Updates the "cache-limit" property.
cache : |
the OssoABookAvatarCache |
limit : |
new maximum number of pixbufs to cache |
unsigned osso_abook_avatar_cache_get_limit (OssoABookAvatarCache *self);
Retrieves the current maximum number of pixbufs to cache
cache : |
the OssoABookAvatarCache |
Returns : | The current value of the "cache-limit" property. |
GdkPixbuf* osso_abook_avatar_cache_lookup (OssoABookAvatarCache *self, OssoABookAvatar *avatar);
Retrieves the avatar image for this avatar
when possible.
cache : |
the OssoABookAvatarCache |
avatar : |
the OssoABookAvatar for which to find a pixbuf |
Returns : | The avatar image for this avatar , or NULL when the avatar is not
know to this cache yet. The returned GdkPixbuf is owned by the cache and
should not be freed.
|
void osso_abook_avatar_cache_add (OssoABookAvatarCache *self, OssoABookAvatar *avatar, GdkPixbuf *pixbuf);
Updates the current image for the avatar
.
The pixbuf is removed from the cache when avatar
image changes.
cache : |
the OssoABookAvatarCache |
avatar : |
the OssoABookAvatar for which to update the pixbuf |
pixbuf : |
the new GdkPixbuf |
void osso_abook_avatar_cache_clear (OssoABookAvatarCache *self);
Entirely cleans the cache
.
cache : |
the OssoABookAvatarCache |
void osso_abook_avatar_cache_drop_by_name (const char *name);
Entirely cleans the named OssoABookAvatarCache and removes it from the shared avatar cache table. If there are no other references on this cache, the cache is destroyed.
name : |
the cache name |