nautilus r13952 - in trunk: . libnautilus-private
- From: cosimoc svn gnome org
- To: svn-commits-list gnome org
- Subject: nautilus r13952 - in trunk: . libnautilus-private
- Date: Tue, 18 Mar 2008 19:05:05 +0000 (GMT)
Author: cosimoc
Date: Tue Mar 18 19:05:05 2008
New Revision: 13952
URL: http://svn.gnome.org/viewvc/nautilus?rev=13952&view=rev
Log:
2008-03-18 Cosimo Cecchi <cosimoc gnome org>
* libnautilus-private/nautilus-file.c:
(nautilus_file_should_show_thumbnail):
* libnautilus-private/nautilus-thumbnails.c: (get_types_table),
(nautilus_thumbnail_is_mimetype_limited_by_size):
* libnautilus-private/nautilus-thumbnails.h:
Always use the thumbnails regardless of the original file size if
it has been already generated (#501268).
Also, reimplement image mimetypes table to determine if we have
to check for file size limit.
Modified:
trunk/ChangeLog
trunk/libnautilus-private/nautilus-file.c
trunk/libnautilus-private/nautilus-thumbnails.c
trunk/libnautilus-private/nautilus-thumbnails.h
Modified: trunk/libnautilus-private/nautilus-file.c
==============================================================================
--- trunk/libnautilus-private/nautilus-file.c (original)
+++ trunk/libnautilus-private/nautilus-file.c Tue Mar 18 19:05:05 2008
@@ -3186,19 +3186,6 @@
static int cached_thumbnail_size;
static int show_image_thumbs;
-static gboolean
-mimetype_limited_by_size (const char *mime_type)
-{
- /* TODO: re-add */
- /*
- if (g_hash_table_lookup (factory->image_mime_types, mime_type)) {
- return TRUE;
- }
- */
-
- return FALSE;
-}
-
GFilesystemPreviewType
nautilus_file_get_filesystem_use_preview (NautilusFile *file)
{
@@ -3229,7 +3216,11 @@
mime_type = "application/octet-stream";
}
- if (mimetype_limited_by_size (mime_type) &&
+ /* If the thumbnail has already been created, don't care about the size
+ * of the original file.
+ */
+ if (nautilus_thumbnail_is_mimetype_limited_by_size (mime_type) &&
+ file->details->thumbnail_path == NULL &&
nautilus_file_get_size (file) > (unsigned int)cached_thumbnail_limit) {
return FALSE;
}
Modified: trunk/libnautilus-private/nautilus-thumbnails.c
==============================================================================
--- trunk/libnautilus-private/nautilus-thumbnails.c (original)
+++ trunk/libnautilus-private/nautilus-thumbnails.c Tue Mar 18 19:05:05 2008
@@ -114,6 +114,14 @@
static GnomeThumbnailFactory *thumbnail_factory = 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/bmp", "image/x-xbitmap",
+ "image/x-xpixmap"
+};
+static GHashTable *image_mime_types = NULL;
+
static int thumbnail_icon_size = 0;
static gboolean
@@ -728,6 +736,36 @@
return FALSE;
}
+static GHashTable *
+get_types_table (void)
+{
+ int i;
+
+ if (image_mime_types == NULL) {
+ image_mime_types = g_hash_table_new (g_str_hash, g_str_equal);
+ for (i = 0; i < G_N_ELEMENTS (types); i++) {
+ g_hash_table_insert (image_mime_types,
+ (gpointer) types [i],
+ GUINT_TO_POINTER (1));
+ }
+ }
+
+ return image_mime_types;
+}
+
+gboolean
+nautilus_thumbnail_is_mimetype_limited_by_size (const char *mime_type)
+{
+ GHashTable *image_mime_types;
+
+ image_mime_types = get_types_table ();
+ if (g_hash_table_lookup (image_mime_types, mime_type)) {
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
gboolean
nautilus_can_thumbnail (NautilusFile *file)
{
Modified: trunk/libnautilus-private/nautilus-thumbnails.h
==============================================================================
--- trunk/libnautilus-private/nautilus-thumbnails.h (original)
+++ trunk/libnautilus-private/nautilus-thumbnails.h Tue Mar 18 19:05:05 2008
@@ -46,6 +46,8 @@
/* Returns NULL if there's no thumbnail yet. */
void nautilus_create_thumbnail (NautilusFile *file);
gboolean nautilus_can_thumbnail (NautilusFile *file);
+gboolean nautilus_thumbnail_is_mimetype_limited_by_size
+ (const char *mime_type);
void nautilus_thumbnail_frame_image (GdkPixbuf **pixbuf);
GdkPixbuf *nautilus_thumbnail_unframe_image (GdkPixbuf *pixbuf);
GdkPixbuf *nautilus_thumbnail_load_image (const char *path,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]