nautilus r14993 - in trunk: . libnautilus-private



Author: cosimoc
Date: Mon Feb 23 10:38:46 2009
New Revision: 14993
URL: http://svn.gnome.org/viewvc/nautilus?rev=14993&view=rev

Log:
2009-02-23  Cosimo Cecchi  <cosimoc gnome org>

	* libnautilus-private/nautilus-thumbnails.c (get_types_table):
	don't hardcode mimetypes for which we limit the file size,
	but load the list of the supported mimetypes from GdkPixbuf
	instead (#545934).


Modified:
   trunk/ChangeLog
   trunk/libnautilus-private/nautilus-thumbnails.c

Modified: trunk/libnautilus-private/nautilus-thumbnails.c
==============================================================================
--- trunk/libnautilus-private/nautilus-thumbnails.c	(original)
+++ trunk/libnautilus-private/nautilus-thumbnails.c	Mon Feb 23 10:38:46 2009
@@ -115,14 +115,6 @@
 
 static GnomeDesktopThumbnailFactory *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
@@ -740,15 +732,28 @@
 static GHashTable *
 get_types_table (void)
 {
+	static GHashTable *image_mime_types = NULL;
+	GSList *format_list, *l;
+	char **types;
 	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));
+
+		format_list = gdk_pixbuf_get_formats ();
+		for (l = format_list; l; l = l->next) {
+			types = gdk_pixbuf_format_get_mime_types (l->data);
+
+			for (i = 0; i < G_N_ELEMENTS (types); i++) {
+				g_hash_table_insert (image_mime_types,
+						     types [i],
+						     GUINT_TO_POINTER (1));
+			}
+
+			g_free (types);
 		}
+
+		g_slist_free (format_list);
 	}
 
 	return image_mime_types;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]