]> err.no Git - mapper/blob - src/image-cache.h
More map widget integration changes
[mapper] / src / image-cache.h
1 /*
2  * This file is part of mapper
3  *
4  * Copyright (C) 2008 Kaj-Michael Lang
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License along
17  * with this program; if not, write to the Free Software Foundation, Inc.,
18  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19  */
20
21 #ifndef _MAPPER_IMAGE_CACHE_H
22 #define _MAPPER_IMAGE_CACHE_H
23
24 #include <glib.h>
25 #include <gtk/gtk.h>
26
27 typedef struct _image_cache_item ImageCacheItem;
28 struct _image_cache_item {
29         GdkPixbuf *pixbuf;
30         time_t last_hit;
31 };
32
33 typedef struct _image_cache ImageCache;
34 struct _image_cache {
35         GHashTable *cache;
36         guint hit;
37         guint miss;
38         guint error;
39         guint cache_max;
40         guint gc;
41 };
42
43 ImageCache *image_cache_new(guint cache_max);
44 void image_cache_free(ImageCache *ic);
45 void image_cache_clear(ImageCache *ic);
46 void image_cache_set_size(ImageCache *ic, guint cache_size);
47 void image_cache_gc(ImageCache *ic, gint max);
48 void image_cache_invalidate(ImageCache *ic, const gchar *key);
49 void image_cache_invalidate_by_image(ImageCache *ic, GdkPixbuf *pixbuf);
50 GdkPixbuf *image_cache_get(ImageCache *ic, const gchar *key, const gchar *icon);
51
52 #endif