]> err.no Git - mapper/commitdiff
Add function to set cache size
authorKaj-Michael Lang <milang@tal.org>
Fri, 25 Apr 2008 10:11:46 +0000 (13:11 +0300)
committerKaj-Michael Lang <milang@tal.org>
Fri, 25 Apr 2008 10:11:46 +0000 (13:11 +0300)
src/image-cache.c
src/image-cache.h

index 0b384fcb8de268657d9667e0c2b3420296fd9aed..56836ee301782a5fefdb79568101b4032d594b27 100644 (file)
@@ -20,6 +20,17 @@ g_hash_table_destroy(ic->cache);
 g_slice_free(ImageCache, ic);
 }
 
+void
+image_cache_set_size(ImageCache *ic, guint cache_size)
+{
+guint old;
+
+old=ic->cache_max;
+ic->cache_max=cache_size;
+if (old>cache_size)
+       image_cache_gc(ic, cache_size);
+}
+
 static void
 image_cache_stats(ImageCache *ic)
 {
index 15ccd1ff9497decd7a2aa9ee0e8a2b1f21c69002..9bc71308a6821f4835e3d7e09c7f5c7a3093726f 100644 (file)
@@ -23,6 +23,7 @@ struct _image_cache {
 ImageCache *image_cache_new(guint cache_max);
 void image_cache_free(ImageCache *ic);
 void image_cache_clear(ImageCache *ic);
+void image_cache_set_size(ImageCache *ic, guint cache_size);
 void image_cache_gc(ImageCache *ic, gint max);
 void image_cache_invalidate(ImageCache *ic, const gchar *key);
 void image_cache_invalidate_by_image(ImageCache *ic, GdkPixbuf *pixbuf);