diff options
author | Alexander Larsson <alexl@redhat.com> | 2003-03-13 11:43:44 +0000 |
---|---|---|
committer | Alexander Larsson <alexl@src.gnome.org> | 2003-03-13 11:43:44 +0000 |
commit | f2427d9b18e872d6ec2a0d5a570515a3e08a5da8 (patch) | |
tree | f5d98fba515025aede7fb3aa6022d421b99f7121 /libnautilus-private/nautilus-icon-factory.c | |
parent | c505989d59fa6e04ebe0eed8b6b9eff225b50620 (diff) | |
download | nautilus-f2427d9b18e872d6ec2a0d5a570515a3e08a5da8.tar.gz |
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.
Diffstat (limited to 'libnautilus-private/nautilus-icon-factory.c')
-rw-r--r-- | libnautilus-private/nautilus-icon-factory.c | 39 |
1 files changed, 35 insertions, 4 deletions
diff --git a/libnautilus-private/nautilus-icon-factory.c b/libnautilus-private/nautilus-icon-factory.c index 436af37d4..bba82b1a7 100644 --- a/libnautilus-private/nautilus-icon-factory.c +++ b/libnautilus-private/nautilus-icon-factory.c @@ -706,10 +706,41 @@ image_uri_to_name_or_uri (const char *image_uri) } static gboolean -should_show_thumbnail (NautilusFile *file) +mimetype_limited_by_size (const char *mime_type) { - if (nautilus_file_get_size (file) > - (unsigned int)cached_thumbnail_limit) { + guint i; + 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; } @@ -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); - show_thumb = should_show_thumbnail (file); + show_thumb = should_show_thumbnail (file, mime_type); if (show_thumb) { thumb_factory = factory->thumbnail_factory; |