Make the thumbnail size prefs only affect images.

2003-03-13  Alexander Larsson  <alexl@redhat.com>

	* libnautilus-private/nautilus-icon-factory.c (should_show_thumbnail):
	Make the thumbnail size prefs only affect images.
This commit is contained in:
Alexander Larsson 2003-03-13 11:43:44 +00:00 committed by Alexander Larsson
parent c505989d59
commit f2427d9b18
2 changed files with 40 additions and 4 deletions

View file

@ -1,3 +1,8 @@
2003-03-13 Alexander Larsson <alexl@redhat.com>
* libnautilus-private/nautilus-icon-factory.c (should_show_thumbnail):
Make the thumbnail size prefs only affect images.
2003-03-13 Alexander Larsson <alexl@redhat.com> 2003-03-13 Alexander Larsson <alexl@redhat.com>
* src/nautilus-file-management-properties.c (nautilus_file_management_properties_dialog_show): * src/nautilus-file-management-properties.c (nautilus_file_management_properties_dialog_show):

View file

@ -706,10 +706,41 @@ image_uri_to_name_or_uri (const char *image_uri)
} }
static gboolean static gboolean
should_show_thumbnail (NautilusFile *file) mimetype_limited_by_size (const char *mime_type)
{ {
if (nautilus_file_get_size (file) > guint i;
(unsigned int)cached_thumbnail_limit) { static GHashTable *formats = NULL;
static const char *types [] = {
"image/x-bmp", "image/x-ico", "image/jpeg", "image/gif",
"image/png", "image/pnm", "image/ras", "image/tga",
"image/tiff", "image/wbmp", "image/x-xbitmap",
"image/x-xpixmap"
};
if (formats == NULL) {
formats = eel_g_hash_table_new_free_at_exit
(g_str_hash, g_str_equal,
"nautilus-icon-factory.c: mimetype_limited_by_size");
for (i = 0; i < G_N_ELEMENTS (types); i++) {
g_hash_table_insert (formats,
(gpointer) types [i],
GUINT_TO_POINTER (1));
}
}
if (g_hash_table_lookup (formats, mime_type)) {
return TRUE;
}
return FALSE;
}
static gboolean
should_show_thumbnail (NautilusFile *file, const char *mime_type)
{
if (mimetype_limited_by_size (mime_type) &&
nautilus_file_get_size (file) > (unsigned int)cached_thumbnail_limit) {
return FALSE; return FALSE;
} }
@ -765,7 +796,7 @@ nautilus_icon_factory_get_icon_for_file (NautilusFile *file, gboolean embedd_tex
file_info = nautilus_file_peek_vfs_file_info (file); file_info = nautilus_file_peek_vfs_file_info (file);
show_thumb = should_show_thumbnail (file); show_thumb = should_show_thumbnail (file, mime_type);
if (show_thumb) { if (show_thumb) {
thumb_factory = factory->thumbnail_factory; thumb_factory = factory->thumbnail_factory;