m_images.clear();
}
-void container_linux::clear_images(gint desired_size)
+gint container_linux::clear_images(gint desired_size)
{
gint size = 0;
+ gint num = 0;
/* First, tally up size of all the stored GdkPixbufs and
* deallocate those which make the total size be above
if (size + cursize > desired_size) {
g_object_unref(img->second);
img->second = NULL;
+ num++;
} else {
size += cursize;
}
return true;
return false;
});
+
+ return num;
}
const litehtml::tchar_t* container_linux::get_default_font_name() const
/* Trim down images cache to less than desired_size [bytes],
* starting from oldest stored. */
- void clear_images(gint desired_size);
+ gint clear_images(gint desired_size);
protected:
virtual void draw_ellipse(cairo_t* cr, int x, int y, int width, int height, const litehtml::web_color& color, int line_width);
void lh_widget::open_html(const gchar *contents)
{
- clear_images(lh_prefs_get()->image_cache_size * 1024 * 1000);
+ gint num = clear_images(lh_prefs_get()->image_cache_size * 1024 * 1000);
+
+ debug_print("LH: cleared %d images from image cache\n", num);
+
lh_widget_statusbar_push("Loading HTML part ...");
m_html = litehtml::document::createFromString(contents, this, &m_context);
m_rendered_width = 0;