Index: gnome-wp-info.c
===================================================================
RCS file: /cvs/gnome/gnome-control-center/capplets/background/gnome-wp-info.c,v
retrieving revision 1.10
diff -u -p -r1.10 gnome-wp-info.c
--- gnome-wp-info.c	27 Jan 2006 03:01:58 -0000	1.10
+++ gnome-wp-info.c	16 Nov 2006 04:33:56 -0000
@@ -38,24 +38,11 @@ GnomeWPInfo * gnome_wp_info_new (const g
 				    GNOME_VFS_FILE_INFO_FOLLOW_LINKS);
   if (info == NULL || info->mime_type == NULL || result != GNOME_VFS_OK) {
     if (!strcmp (uri, "(none)")) {
-      gchar * md5sum;
-
       new = g_new0 (GnomeWPInfo, 1);
 
       new->mime_type = g_strdup ("image/x-no-data");
       new->uri = g_strdup (uri);
-
-      md5sum = gnome_thumbnail_md5 (escaped_path);
-
-      new->thumburi = g_strconcat (g_get_home_dir (),
-				   "/.thumbnails/normal/",
-				   md5sum,
-				   ".png",
-				   NULL);
-      g_free (md5sum);
-
       new->name = g_strdup (_("No Wallpaper"));
-
       new->size = 0;
     } else {
       new = NULL;
@@ -68,19 +55,6 @@ GnomeWPInfo * gnome_wp_info_new (const g
     new->thumburi = gnome_thumbnail_factory_lookup (thumbs,
 						    escaped_path,
 						    info->mtime);
-    if (new->thumburi == NULL) {
-      gchar * md5sum;
-
-      md5sum = gnome_thumbnail_md5 (escaped_path);
-
-      new->thumburi = g_strconcat (g_get_home_dir (),
-				   "/.thumbnails/normal/",
-				   md5sum,
-				   ".png",
-				   NULL);
-
-      g_free (md5sum);
-    }
     new->name = g_strdup (info->name);
     new->mime_type = g_strdup (info->mime_type);
 
Index: gnome-wp-item.c
===================================================================
RCS file: /cvs/gnome/gnome-control-center/capplets/background/gnome-wp-item.c,v
retrieving revision 1.22
diff -u -p -r1.22 gnome-wp-item.c
--- gnome-wp-item.c	27 Jan 2006 03:01:58 -0000	1.22
+++ gnome-wp-item.c	16 Nov 2006 04:33:57 -0000
@@ -201,7 +201,6 @@ static void collect_save_options (GdkPix
 GdkPixbuf * gnome_wp_item_get_thumbnail (GnomeWPItem * item,
 					 GnomeThumbnailFactory * thumbs) {
   GdkPixbuf * pixbuf, * bgpixbuf;
-  GdkPixbuf * tmpbuf;
   GdkPixbuf * scaled = NULL;
   gint sw, sh, bw, bh, pw, ph, tw, th;
   gdouble ratio;
@@ -241,22 +240,42 @@ GdkPixbuf * gnome_wp_item_get_thumbnail 
      If we are creating the thumbnail for "No Wallpaper", then we just copy
      the background colors pixbuf we created above, here
   */
-  if (item->fileinfo->thumburi != NULL &&
-      g_file_test (item->fileinfo->thumburi, G_FILE_TEST_EXISTS)) {
-    pixbuf = gdk_pixbuf_new_from_file (item->fileinfo->thumburi, NULL);
-  } else if (!strcmp (item->filename, "(none)")) {
+  pixbuf = NULL;
+  if (!strcmp (item->filename, "(none)")) {
     return bgpixbuf;
   } else {
-    gchar * escaped_path;
+    gchar * escaped_path, * thumbnail_filename;
 
     escaped_path = gnome_vfs_escape_path_string (item->filename);
+    thumbnail_filename = gnome_thumbnail_factory_lookup (thumbs,
+                                                         escaped_path,
+                                                         item->fileinfo->mtime);
 
+    if (thumbnail_filename == NULL) {
     pixbuf = gnome_thumbnail_factory_generate_thumbnail (thumbs,
 							 escaped_path,
 							 item->fileinfo->mime_type);
     gnome_thumbnail_factory_save_thumbnail (thumbs, pixbuf,
 					    escaped_path,
 					    item->fileinfo->mtime);
+       g_object_unref (pixbuf);
+       pixbuf = NULL;
+
+       thumbnail_filename = gnome_thumbnail_factory_lookup (thumbs,
+                                                            escaped_path,
+                                                            item->fileinfo->mtime);
+    }
+
+    if (thumbnail_filename != NULL) {
+ 
+      pixbuf = gdk_pixbuf_new_from_file (thumbnail_filename, NULL);
+
+      if (pixbuf != NULL) {
+        item->fileinfo->thumburi = thumbnail_filename;
+        thumbnail_filename = NULL;
+      }
+    }
+
     g_free (escaped_path);
   }
 
@@ -273,16 +292,12 @@ GdkPixbuf * gnome_wp_item_get_thumbnail 
 	gchar ** keys = NULL;
 	gchar ** vals = NULL;
 
-	tmpbuf = gdk_pixbuf_new_from_file (item->filename, NULL);
-
-	item->width = gdk_pixbuf_get_width (tmpbuf);
-	item->height = gdk_pixbuf_get_height (tmpbuf);
-
+        gdk_pixbuf_get_file_info (item->filename, 
+                                  &item->width, &item->height); 
 	collect_save_options (pixbuf, &keys, &vals, item->width, item->height);
 	gdk_pixbuf_savev (pixbuf, item->fileinfo->thumburi, "png",
 			  keys, vals, NULL);
 
-	g_object_unref (tmpbuf);
 	g_strfreev (keys);
 	g_strfreev (vals);
       }
@@ -322,9 +337,10 @@ GdkPixbuf * gnome_wp_item_get_thumbnail 
       }
       scaled = gnome_wp_pixbuf_center (pixbuf, bgpixbuf, tw, th);
     }
+
+    g_object_unref (pixbuf);
   }
 
-  g_object_unref (pixbuf);
   g_object_unref (bgpixbuf);
 
   return scaled;
