Index: src/file-manager/fm-tree-model.c
===================================================================
--- src/file-manager/fm-tree-model.c	(Revision 13031)
+++ src/file-manager/fm-tree-model.c	(Arbeitskopie)
@@ -250,7 +250,7 @@ tree_node_get_pixbuf_from_factory (TreeN
 			 GTK_ICON_SIZE_MENU, NULL);
 	}
 	return nautilus_icon_factory_get_pixbuf_for_file_with_stock_size
-		(node->file, modifier, GTK_ICON_SIZE_MENU);
+		(node->file, modifier, GTK_ICON_SIZE_MENU, FALSE);
 }
 
 static gboolean
Index: src/file-manager/fm-list-model.c
===================================================================
--- src/file-manager/fm-list-model.c	(Revision 13031)
+++ src/file-manager/fm-list-model.c	(Arbeitskopie)
@@ -309,7 +309,7 @@ fm_list_model_get_value (GtkTreeModel *t
 				modifier = "visiting";
 			}
 			
-			icon = nautilus_icon_factory_get_pixbuf_for_file (file, modifier, icon_size, TRUE);
+			icon = nautilus_icon_factory_get_pixbuf_for_file (file, modifier, icon_size, TRUE, FALSE);
   
 			g_value_set_object (value, icon);
 			g_object_unref (icon);
Index: src/file-manager/fm-directory-view.c
===================================================================
--- src/file-manager/fm-directory-view.c	(Revision 13031)
+++ src/file-manager/fm-directory-view.c	(Arbeitskopie)
@@ -5427,7 +5427,7 @@ add_script_to_scripts_menus (FMDirectory
 
 	launch_parameters = script_launch_parameters_new (file, directory_view);
 	pixbuf = nautilus_icon_factory_get_pixbuf_for_file_with_stock_size
-		(file, NULL, GTK_ICON_SIZE_MENU);
+		(file, NULL, GTK_ICON_SIZE_MENU, TRUE);
 
 	action_name = escape_action_name (uri, "script_");
 	escaped_label = eel_str_double_underscores (name);
@@ -5501,7 +5501,7 @@ add_submenu_to_directory_menus (FMDirect
 	uri = nautilus_file_get_uri (file);
 	name = nautilus_file_get_display_name (file);
 	pixbuf = nautilus_icon_factory_get_pixbuf_for_file_with_stock_size
-		(file, NULL, GTK_ICON_SIZE_MENU);
+		(file, NULL, GTK_ICON_SIZE_MENU, TRUE);
 	add_submenu (ui_manager, action_group, merge_id, menu_path, uri, name, pixbuf);
 	add_submenu (ui_manager, action_group, merge_id, popup_path, uri, name, pixbuf);
 	add_submenu (ui_manager, action_group, merge_id, popup_bg_path, uri, name, pixbuf);
@@ -5681,7 +5681,7 @@ add_template_to_templates_menus (FMDirec
 	}
 
 	pixbuf = nautilus_icon_factory_get_pixbuf_for_file_with_stock_size
-		(file, NULL, GTK_ICON_SIZE_MENU);
+		(file, NULL, GTK_ICON_SIZE_MENU, TRUE);
 
 	action_name = escape_action_name (uri, "template_");
 	escaped_label = eel_str_double_underscores (name);
Index: src/nautilus-sidebar-title.c
===================================================================
--- src/nautilus-sidebar-title.c	(Revision 13031)
+++ src/nautilus-sidebar-title.c	(Arbeitskopie)
@@ -317,7 +317,7 @@ update_icon (NautilusSidebarTitle *sideb
 		pixbuf = nautilus_icon_factory_get_pixbuf_for_file (sidebar_title->details->file,
 								    "accept",
 								    sidebar_title->details->best_icon_size,
-								    FALSE);
+								    FALSE, TRUE);
 	} else if (sidebar_title->details->determined_icon) {
 		/* We used to know the icon for this file, but now the file says it isn't
 		 * ready. This means that some file info has been invalidated, which
Index: src/nautilus-spatial-window.c
===================================================================
--- src/nautilus-spatial-window.c	(Revision 13031)
+++ src/nautilus-spatial-window.c	(Arbeitskopie)
@@ -695,7 +695,7 @@ location_button_drag_begin_callback (Gtk
 	GdkPixbuf *pixbuf;
 
 	pixbuf = nautilus_icon_factory_get_pixbuf_for_file (NAUTILUS_WINDOW (window)->details->viewed_file,
-							    "open", get_dnd_icon_size (window), FALSE);
+							    "open", get_dnd_icon_size (window), FALSE, TRUE);
 
 	gtk_drag_set_icon_pixbuf (context, pixbuf, 0, 0);
 
Index: libnautilus-private/nautilus-icon-factory.c
===================================================================
--- libnautilus-private/nautilus-icon-factory.c	(Revision 13031)
+++ libnautilus-private/nautilus-icon-factory.c	(Arbeitskopie)
@@ -29,6 +29,7 @@
 #include "nautilus-icon-factory.h"
 
 #include "nautilus-default-file-icon.h"
+#include "nautilus-directory-notify.h"
 #include "nautilus-file-attributes.h"
 #include "nautilus-file-private.h"
 #include "nautilus-file-utilities.h"
@@ -154,6 +155,8 @@ typedef struct {
 	CacheIcon *fallback_icon;
 	GHashTable *image_mime_types;
 
+	GThreadPool *thumbnail_loading_thread_pool;
+	GMutex *mutex;
 } NautilusIconFactory;
 
 #define NAUTILUS_ICON_FACTORY(obj) \
@@ -347,6 +350,95 @@ load_thumbnail_frame (NautilusIconFactor
 	g_free (image_path);
 }
 
+typedef struct {
+	NautilusFile *file;
+	char *icon;
+	char *modifier;
+	guint size_in_pixels;
+	gboolean force_size;
+} ThumbnailLoadingThreadData;
+
+static gboolean
+thumbnail_loading_notify_file_changed (gpointer file_uri)
+{
+	NautilusFile *file;
+
+	GDK_THREADS_ENTER ();
+
+	file = nautilus_file_get ((char *) file_uri);
+	if (file != NULL) {
+		nautilus_file_set_is_loading_thumbnail (file, FALSE);
+		nautilus_file_changed (file);
+		nautilus_file_unref (file);
+	}
+
+	g_free (file_uri);
+
+	GDK_THREADS_LEAVE ();
+
+	return FALSE;
+
+}
+
+static void
+thumbnail_loading_thread_func (gpointer my_data,
+			       gpointer my_factory)
+{
+	GdkPixbuf *pixbuf;
+	NautilusIconFactory *factory;
+	ThumbnailLoadingThreadData *data;
+	char *file_uri;
+
+	factory = NAUTILUS_ICON_FACTORY (my_factory);
+	g_assert (factory == get_icon_factory ());
+
+	data = (ThumbnailLoadingThreadData *) my_data;
+
+	pixbuf = nautilus_icon_factory_get_pixbuf_for_icon (data->icon,
+							    data->modifier,
+							    data->size_in_pixels,
+							    NULL, NULL,
+							    data->force_size,
+							    TRUE, NULL);
+
+	file_uri = nautilus_file_get_uri (data->file);
+	g_idle_add (thumbnail_loading_notify_file_changed,
+		    g_strdup (file_uri));
+	g_free (file_uri);
+
+	/* We loaded the pixbuf for the main thread, and it's
+ 	 * still in the cache, so the main thread can fetch it from
+ 	 * there. */
+	g_object_unref (pixbuf);
+
+	nautilus_file_unref (data->file);
+	g_free (data->icon);
+	g_free (data->modifier);
+	g_free (data);
+}
+
+static void
+schedule_threaded_thumbnail_loading (NautilusFile *file,
+				     const char *icon,
+				     const char *modifier,
+				     guint size_in_pixels,
+				     gboolean force_size)
+{
+	NautilusIconFactory *factory;
+	ThumbnailLoadingThreadData *data;
+
+	factory = get_icon_factory ();
+
+	data = g_new (ThumbnailLoadingThreadData, 1);
+	data->file = nautilus_file_ref (file);
+	data->icon = g_strdup (icon);
+	data->modifier = g_strdup (modifier);
+	data->size_in_pixels = size_in_pixels;
+	data->force_size = force_size;
+
+	g_thread_pool_push (factory->thumbnail_loading_thread_pool, data, NULL);
+}
+
 static void
 nautilus_icon_factory_instance_init (NautilusIconFactory *factory)
 {
@@ -399,6 +491,10 @@ nautilus_icon_factory_instance_init (Nau
 				     (gpointer) types [i],
 				     GUINT_TO_POINTER (1));
 	}
+
+	factory->thumbnail_loading_thread_pool = g_thread_pool_new (thumbnail_loading_thread_func, factory,
+								    2, TRUE, NULL);
+	factory->mutex = g_mutex_new ();
 }
 
 static void
@@ -691,6 +787,13 @@ nautilus_icon_factory_finalize (GObject 
 
 	factory = NAUTILUS_ICON_FACTORY (object);
 
+	/* TODO?
+ 	 * won't wait_ == FALSE cause leaks for all non-running threads?
+ 	 * Might not be relevant since this is a singleton and it is finalized when
+ 	 * leaving nautilus. */
+	g_thread_pool_free (factory->thumbnail_loading_thread_pool, TRUE, FALSE);
+	g_mutex_free (factory->mutex);
+
 	if (factory->icon_cache) {
 		g_hash_table_destroy (factory->icon_cache);
 		factory->icon_cache = NULL;
@@ -888,7 +991,8 @@ gtk_icon_size_to_nominal_size (GtkIconSi
 
 /* key routine to get the icon for a file */
 char *
-nautilus_icon_factory_get_icon_for_file (NautilusFile *file, gboolean embedd_text)
+nautilus_icon_factory_get_icon_for_file (NautilusFile *file,
+					 gboolean embedd_text)
 {
  	char *custom_uri, *file_uri, *icon_name, *mime_type, *custom_icon, *special_icon;
 	NautilusIconFactory *factory;
@@ -1285,6 +1389,38 @@ create_normal_cache_icon (const char *ic
 	return cache_icon;
 }
 
+static CacheIcon *
+lookup_icon_from_cache (const char *icon,
+			const char *modifier,
+			guint       nominal_size,
+			gboolean    force_nominal)
+{
+	NautilusIconFactory *factory;
+	GHashTable *hash_table;
+	CacheKey lookup_key, *key;
+	CacheIcon *value;
+
+	lookup_key.name = (char *)icon;
+	lookup_key.modifier = (char *)modifier;
+	lookup_key.nominal_size = nominal_size;
+	lookup_key.force_nominal = force_nominal;
+
+	factory = get_icon_factory ();
+	hash_table = factory->icon_cache;
+
+	if (g_hash_table_lookup_extended (hash_table, &lookup_key,
+					  (gpointer *) &key, (gpointer *) &value)) {
+		/* Found it in the table. */
+		g_assert (key != NULL);
+		g_assert (value != NULL);
+	} else {
+		key = NULL;
+		value = NULL;
+	}
+
+	return value;
+}
+			
 
 /* Get the icon, handling the caching.
  * If @picky is true, then only an unscaled icon is acceptable.
@@ -1301,34 +1437,19 @@ get_icon_from_cache (const char *icon,
 {
 	NautilusIconFactory *factory;
 	GHashTable *hash_table;
-	CacheKey lookup_key;
 	CacheKey *key;
 	CacheIcon *cached_icon;
-	gpointer key_in_table, value;
 	struct stat statbuf;
 	
 	g_return_val_if_fail (icon != NULL, NULL);
-
-	key = NULL;
-	cached_icon = NULL;
 	
 	factory = get_icon_factory ();
 	hash_table = factory->icon_cache;
 
 	/* Check to see if it's already in the table. */
-	lookup_key.name = (char *)icon;
-	lookup_key.modifier = (char *)modifier;
-	lookup_key.nominal_size = nominal_size;
-	lookup_key.force_nominal = force_nominal;
-
-	if (g_hash_table_lookup_extended (hash_table, &lookup_key,
-					  &key_in_table, &value)) {
-		/* Found it in the table. */
-		g_assert (key_in_table != NULL);
-		g_assert (value != NULL);
-		key = key_in_table;
-		cached_icon = value;
-	}
+	g_mutex_lock (factory->mutex);
+	cached_icon = lookup_icon_from_cache (icon, modifier, nominal_size, force_nominal);
+	g_mutex_unlock (factory->mutex);
 
 	/* Make sure that thumbnails and image-as-itself icons gets
 	   reloaded when they change: */
@@ -1372,7 +1493,9 @@ get_icon_from_cache (const char *icon,
 		key->nominal_size = nominal_size;
 		key->force_nominal = force_nominal;
 
+		g_mutex_lock (factory->mutex);
 		g_hash_table_insert (hash_table, key, cached_icon);
+		g_mutex_unlock (factory->mutex);
 	}
 
 	/* Hand back a ref to the caller. */
@@ -1532,20 +1655,90 @@ nautilus_get_relative_icon_size_for_zoom
 	return (float)nautilus_get_icon_size_for_zoom_level (zoom_level) / NAUTILUS_ICON_SIZE_STANDARD;
 }
 
-
-
 /* Convenience cover for nautilus_icon_factory_get_icon_for_file
  * and nautilus_icon_factory_get_pixbuf_for_icon.
+ *
+ * If immediate_thumb_loading is true, and a file has an associated thumbnail,
+ * the thumb is loaded immediately.
+ *
+ * If immediate_thumb_loading is false, and a file has an associated thumbnail,
+ * the thumb is loaded asynchronously, a loading thumbnail image is returned
+ * and the file will receive a "changed" event once the thumbnail has been loaded.
+ *
+ * The "file" parameter is only used for scheduled thumbnailing,
+ * for the file change notification once the actual thumbnail
+ * has been loaded.
+ */
+GdkPixbuf *
+nautilus_icon_factory_get_pixbuf_for_file_with_icon (NautilusFile                *file,
+						     const char                  *icon,
+						     const char                  *modifier,
+						     guint                        size_in_pixels,
+						     NautilusEmblemAttachPoints  *attach_points,
+						     GdkRectangle                *embedded_text_rect,
+						     gboolean                     force_size,
+						     gboolean                     wants_default,
+						     char                       **display_name,
+						     gboolean                     immediate_thumb_loading)
+{
+	GdkPixbuf *pixbuf;
+	NautilusIconFactory *factory;
+	gboolean is_thumbnail;
+	gboolean schedule_thumbnailing;
+
+	factory = get_icon_factory ();
+
+	is_thumbnail = strstr (icon, "/.thumbnails/") != NULL;
+
+	schedule_thumbnailing = is_thumbnail && !immediate_thumb_loading;
+	if (schedule_thumbnailing) {
+		g_mutex_lock (factory->mutex);
+		schedule_thumbnailing &=
+			!lookup_icon_from_cache (icon, modifier, size_in_pixels, force_size);
+		g_mutex_unlock (factory->mutex);
+	}
+
+	if (schedule_thumbnailing) {
+		/* Schedule thumbnailing if thumbnail must not be returned immediately.
+		 * This heavily improves performance for folders containing lots of
+		 * previously thumbnailed files.
+		 *
+		 * Note: We do not pass the additional thumbnail parameters (attach points etc.)
+		 * to the thread as we don't need them for the cache. The API user may itself
+		 * re-request the loaded thumbnail with the correct parameters, which will be inserted
+		 * in nautilus_icon_factory_get_pixbuf_for_icon() on cache hit once it is filled.
+		 */
+
+		nautilus_file_set_is_loading_thumbnail (file, TRUE);
+		schedule_threaded_thumbnail_loading (file, icon, modifier, size_in_pixels, force_size);
+	}
+
+
+	pixbuf = nautilus_icon_factory_get_pixbuf_for_icon (schedule_thumbnailing ? ICON_NAME_THUMBNAIL_LOADING : icon,
+							    modifier, size_in_pixels,
+							    attach_points, embedded_text_rect,
+							    force_size,
+							    wants_default, display_name);
+
+	return pixbuf;
+}
+
+/*
+ * like nautilus_icon_factory_get_pixbuf_for_file_with_icon() but does the icon lookup itself,
+ * doesn't allow emblem and text rect fetching.
  */
 GdkPixbuf *
 nautilus_icon_factory_get_pixbuf_for_file (NautilusFile *file,
 					   const char *modifier,
 					   guint size_in_pixels,
-					   gboolean force_size)
+					   gboolean force_size,
+					   gboolean immediate_thumb_loading)
 {
-	char *icon;
 	GdkPixbuf *pixbuf;
+	NautilusIconFactory *factory;
+	char *icon;
 
+	factory = get_icon_factory ();
 
 	/* Get the pixbuf for this file. */
 	icon = nautilus_icon_factory_get_icon_for_file (file, FALSE);
@@ -1553,12 +1746,13 @@ nautilus_icon_factory_get_pixbuf_for_fil
 		return NULL;
 	}
 
-	pixbuf = nautilus_icon_factory_get_pixbuf_for_icon (icon, modifier,
-							    size_in_pixels,
-							    NULL, NULL,
-							    force_size,
-							    TRUE, NULL);
-	
+	pixbuf = nautilus_icon_factory_get_pixbuf_for_file_with_icon (file,
+								      icon, modifier,
+								      size_in_pixels,
+								      NULL, NULL,
+								      force_size,
+								      TRUE, NULL,
+								      immediate_thumb_loading);
 	g_free (icon);
 
 	return pixbuf;
@@ -1567,11 +1761,13 @@ nautilus_icon_factory_get_pixbuf_for_fil
 GdkPixbuf *
 nautilus_icon_factory_get_pixbuf_for_file_with_stock_size (NautilusFile *file,
 							   const char   *modifier,
-							   GtkIconSize   stock_size)
+							   GtkIconSize   stock_size,
+							   gboolean      immediate_thumb_loading)
 {
 	return nautilus_icon_factory_get_pixbuf_for_file (file, modifier,
 							  gtk_icon_size_to_nominal_size (stock_size),
-							  TRUE); /* force_size */
+							  TRUE /* force_size */,
+							  immediate_thumb_loading);
 
 }
 
Index: libnautilus-private/nautilus-icon-factory.h
===================================================================
--- libnautilus-private/nautilus-icon-factory.h	(Revision 13031)
+++ libnautilus-private/nautilus-icon-factory.h	(Arbeitskopie)
@@ -145,10 +145,23 @@ GdkPixbuf *nautilus_icon_factory_get_pix
 GdkPixbuf *nautilus_icon_factory_get_pixbuf_for_file            (NautilusFile *file,
 								 const char   *modifer,
 								 guint         size_in_pixels,
-								 gboolean      force_size);
+								 gboolean      force_size,
+								 gboolean      immediate_thumb_loading);
 GdkPixbuf *nautilus_icon_factory_get_pixbuf_for_file_with_stock_size (NautilusFile *file,
 								      const char   *modifier,
-								      GtkIconSize   stock_size);
+								      GtkIconSize   stock_size,
+								      gboolean      immediate_thumb_loading);
+
+GdkPixbuf * nautilus_icon_factory_get_pixbuf_for_file_with_icon (NautilusFile               *file,
+								 const char                 *icon,
+								 const char                 *modifier,
+								 guint                       size_in_pixels,
+								 NautilusEmblemAttachPoints *attach_points,
+								 GdkRectangle               *embedded_text_rect,
+								 gboolean                    force_size,
+								 gboolean                    wants_default,
+								 char                      **display_name,
+								 gboolean                    immediate_thumb_loading);
 
 
 /* Convenience routine for getting a pixbuf from an icon name
Index: libnautilus-private/nautilus-file-private.h
===================================================================
--- libnautilus-private/nautilus-file-private.h	(Revision 13031)
+++ libnautilus-private/nautilus-file-private.h	(Arbeitskopie)
@@ -155,6 +155,7 @@ struct NautilusFileDetails
 	eel_boolean_bit link_info_is_up_to_date       : 1;
 
 	eel_boolean_bit is_thumbnailing               : 1;
+	eel_boolean_bit is_loading_thumbnail          : 1;
 
 	eel_boolean_bit has_volume                    : 1;
 	eel_boolean_bit has_drive                     : 1;
@@ -216,6 +217,8 @@ void                   nautilus_file_inf
 /* Thumbnailing: */
 void          nautilus_file_set_is_thumbnailing            (NautilusFile           *file,
 							    gboolean                is_thumbnailing);
+void          nautilus_file_set_is_loading_thumbnail       (NautilusFile           *file,
+							    gboolean                is_loading_thumbnail);
 
 /* Volumes: */
 void nautilus_file_set_drive  (NautilusFile   *file,
Index: libnautilus-private/nautilus-icon-container.c
===================================================================
--- libnautilus-private/nautilus-icon-container.c	(Revision 13031)
+++ libnautilus-private/nautilus-icon-container.c	(Arbeitskopie)
@@ -5732,15 +5732,15 @@ nautilus_icon_container_update_icon (Nau
 		modifier = "accept";
 	}
 	
-	pixbuf = nautilus_icon_factory_get_pixbuf_for_icon
-		(icon_name,
+	pixbuf = nautilus_icon_factory_get_pixbuf_for_file_with_icon
+		((NautilusFile *) icon->data,
+		 icon_name,
 		 modifier,
 		 icon_size,
 		 &attach_points,
 		 &embedded_text_rect,
-		 FALSE, TRUE, NULL);
-	
-	g_free (icon_name);
+		 FALSE, TRUE, NULL,
+		 FALSE);
 
 	if (embedded_text_rect.width > MINIMUM_EMBEDDED_TEXT_RECT_WIDTH &&
 	    embedded_text_rect.height > MINIMUM_EMBEDDED_TEXT_RECT_HEIGHT &&
@@ -5791,6 +5791,81 @@ nautilus_icon_container_update_icon (Nau
 			     "additional_text", additional_text,
 			     "highlighted_for_drop", icon == details->drop_target,
 			     NULL);
+
+	if (nautilus_file_is_thumbnailing ((NautilusFile *) icon->data) ||
+	    nautilus_file_is_loading_thumbnail ((NautilusFile *) icon->data)) {
+		/* resize the ICON_NAME_THUMBNAIL_LOADING icon to the expected thumbnail size. */
+
+		double pixels_per_unit = (double) nautilus_get_icon_size_for_zoom_level (container->details->zoom_level)
+			/ NAUTILUS_ICON_SIZE_STANDARD;
+
+		if (gdk_pixbuf_get_width (pixbuf) < NAUTILUS_ICON_SIZE_THUMBNAIL * pixels_per_unit &&
+		    gdk_pixbuf_get_height (pixbuf) < NAUTILUS_ICON_SIZE_THUMBNAIL * pixels_per_unit) {
+			/* TODO? this only handles icons smaller than the expected thumbnail size ATM.
+			 * Should not be a common problem, though */
+			GdkPixbuf *new_pixbuf;
+			double x_size;
+			double y_size;
+			double x_offset;
+			double y_offset;
+			char *mime_type;
+			int i;
+
+			mime_type = nautilus_file_get_mime_type ((NautilusFile *)icon->data);
+			if (g_str_has_prefix (mime_type, "video/")) {
+				/* assume 4:3 aspect ratio, i.e. we'll always occupy the full width. */
+				x_size = NAUTILUS_ICON_SIZE_THUMBNAIL * pixels_per_unit;
+				y_size = 3./4 * x_size;
+			} else {
+				/* scale up to the max. thumbnail size.
+				 * This is correct at least in one dimension, and prevents the icons from jumping
+				 * around as the thumbnail is created, if it is tall for text below icon, and if it
+				 * is wide for text beside icon.
+				 */
+				x_size = NAUTILUS_ICON_SIZE_THUMBNAIL * pixels_per_unit;
+				y_size = NAUTILUS_ICON_SIZE_THUMBNAIL * pixels_per_unit;
+			}
+			g_free (mime_type);
+
+			/* maybe the size was smaller than the input pixbuf, so size it up.
+ 			 * This only seems to be relevant in the 4:3 case, for y_size.
+ 			 */
+			x_size = MAX (x_size, gdk_pixbuf_get_width (pixbuf));
+			y_size = MAX (y_size, gdk_pixbuf_get_width (pixbuf));
+
+			x_offset = x_size - gdk_pixbuf_get_width (pixbuf);
+			y_offset = y_size - gdk_pixbuf_get_height (pixbuf);
+
+			/* center wrt "minor" dimension, i.e. horizontally for text below
+ 			 * and vertically for text besides icon */
+			if (details->label_position == NAUTILUS_ICON_LABEL_POSITION_BESIDE)
+				y_offset /= 2;
+			else 
+				x_offset /= 2;
+
+			new_pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, TRUE,
+						     gdk_pixbuf_get_bits_per_sample (pixbuf),
+						     x_size, y_size);
+
+			gdk_pixbuf_fill (new_pixbuf, 0x00000000);
+			gdk_pixbuf_copy_area (pixbuf,
+					      0, 0,
+					      gdk_pixbuf_get_width (pixbuf),
+					      gdk_pixbuf_get_height (pixbuf),
+					      new_pixbuf,
+					      x_offset, y_offset);
+			g_object_unref (pixbuf);
+			pixbuf = new_pixbuf;
+
+			for (i = 0; i < attach_points.num_points; i++) {
+				attach_points.points[i].x += x_offset;
+				attach_points.points[i].y += y_offset;
+			}
+
+			embedded_text_rect.x += x_offset;
+			embedded_text_rect.y += y_offset;
+		}
+	}
 	
 	nautilus_icon_canvas_item_set_image (icon->item, pixbuf);
 	nautilus_icon_canvas_item_set_attach_points (icon->item, &attach_points);
@@ -5804,6 +5879,8 @@ nautilus_icon_container_update_icon (Nau
 
 	g_free (editable_text);
 	g_free (additional_text);
+
+	g_free (icon_name);
 }
 
 static gboolean
Index: libnautilus-private/nautilus-file.c
===================================================================
--- libnautilus-private/nautilus-file.c	(Revision 13031)
+++ libnautilus-private/nautilus-file.c	(Arbeitskopie)
@@ -5736,6 +5736,23 @@ nautilus_file_set_is_thumbnailing (Nauti
 	file->details->is_thumbnailing = is_thumbnailing;
 }
 
+gboolean
+nautilus_file_is_loading_thumbnail (NautilusFile *file)
+{
+	g_return_val_if_fail (NAUTILUS_IS_FILE (file), FALSE);
+	
+	return file->details->is_loading_thumbnail;
+}
+
+void
+nautilus_file_set_is_loading_thumbnail (NautilusFile *file,
+					gboolean is_loading_thumbnail)
+{
+	g_return_if_fail (NAUTILUS_IS_FILE (file));
+	
+	file->details->is_loading_thumbnail = is_loading_thumbnail;
+}
+
 
 /**
  * nautilus_file_invalidate_attributes
Index: libnautilus-private/nautilus-file.h
===================================================================
--- libnautilus-private/nautilus-file.h	(Revision 13031)
+++ libnautilus-private/nautilus-file.h	(Arbeitskopie)
@@ -339,6 +339,7 @@ void                    nautilus_file_se
 
 /* Thumbnailing handling */
 gboolean                nautilus_file_is_thumbnailing                   (NautilusFile                   *file);
+gboolean                nautilus_file_is_loading_thumbnail              (NautilusFile                   *file);
 
 /* Convenience functions for dealing with a list of NautilusFile objects that each have a ref.
  * These are just convenient names for functions that work on lists of GtkObject *.
