Index: glocalfileinfo.c
===================================================================
--- glocalfileinfo.c	(revision 6591)
+++ glocalfileinfo.c	(working copy)
@@ -86,6 +86,7 @@
 #endif
 #endif
 
+#include "gmount.h"
 #include "glocalfileinfo.h"
 #include "gioerror.h"
 #include "gthemedicon.h"
@@ -1237,26 +1238,76 @@
   char *uri;
   char *filename;
   char *basename;
+  char *local_basename;
+  GMount *mount;
+  char *mount_path;
+  char *rel_path;
+  GFile *file;
+  gboolean got_thumbnail;
+  unsigned int n;
 
+  mount_path = NULL;
+  rel_path = NULL;
+  file = g_file_new_for_path (path);
+  mount = g_file_find_enclosing_mount (file, NULL, NULL);
+  if (mount != NULL)
+    {
+      GFile *mount_root;
+      mount_root = g_mount_get_root (mount);
+      mount_path = g_file_get_path (mount_root);
+      rel_path = g_file_get_relative_path (mount_root, file);
+      g_object_unref (mount_root);
+      g_object_unref (mount);
+    }
+  g_object_unref (file);
+
   uri = g_filename_to_uri (path, NULL, NULL);
-
   checksum = g_checksum_new (G_CHECKSUM_MD5);
   g_checksum_update (checksum, (const guchar *) uri, strlen (uri));
-  
   g_free (uri);
-
   basename = g_strconcat (g_checksum_get_string (checksum), ".png", NULL);
   g_checksum_free (checksum);
 
-  filename = g_build_filename (g_get_home_dir (),
-                               ".thumbnails", "normal", basename,
-                               NULL);
+  /* first try ~/.thumbnails; then .thumblocal on the mount  */
+  got_thumbnail = FALSE;
+  for (n = 0; n < 2 && !got_thumbnail; n++)
+    {
+      switch (n)
+        {
+        default:
+        case 0:
+          filename = g_build_filename (g_get_home_dir (),
+                                       ".thumbnails", "normal", basename,
+                                       NULL);
+          break;
 
-  if (g_file_test (filename, G_FILE_TEST_IS_REGULAR))
-    g_file_info_set_attribute_byte_string (info, G_FILE_ATTRIBUTE_THUMBNAIL_PATH, filename);
-  else
+        case 1:
+          if (rel_path == NULL)
+            {
+              continue;
+            }
+          checksum = g_checksum_new (G_CHECKSUM_MD5);
+          g_checksum_update (checksum, (const guchar *) rel_path, strlen (rel_path));
+          local_basename = g_strconcat (g_checksum_get_string (checksum), ".png", NULL);
+          g_checksum_free (checksum);
+          
+          filename = g_build_filename (mount_path,
+                                       ".thumblocal", "normal", local_basename,
+                                       NULL);
+          break;
+        }
+
+      if (g_file_test (filename, G_FILE_TEST_IS_REGULAR))
+        {
+          g_file_info_set_attribute_byte_string (info, G_FILE_ATTRIBUTE_THUMBNAIL_PATH, filename);
+          got_thumbnail = TRUE;
+        }
+      g_free (filename);
+    }
+
+  /* we're always storing failures in $HOME */
+  if (!got_thumbnail)
     {
-      g_free (filename);
       filename = g_build_filename (g_get_home_dir (),
                                    ".thumbnails", "fail",
                                    "gnome-thumbnail-factory",
@@ -1265,9 +1316,12 @@
 
       if (g_file_test (filename, G_FILE_TEST_IS_REGULAR))
 	g_file_info_set_attribute_boolean (info, G_FILE_ATTRIBUTE_THUMBNAILING_FAILED, TRUE);
+
+      g_free (filename);
     }
+
   g_free (basename);
-  g_free (filename);
+  g_free (mount_path);
 }
 
 #ifdef G_OS_WIN32
Index: gmount.c
===================================================================
--- gmount.c	(revision 6591)
+++ gmount.c	(working copy)
@@ -309,6 +309,34 @@
 }
 
 /**
+ * g_mount_is_encrypted: 
+ * @mount: a #GMount.
+ * 
+ * Checks if the contents of @mount is physically stored in an
+ * encrypted form. 
+ *
+ * Desktop applications can use this hint as a hint that
+ * e.g. thumbnails should be stored locally on the mount and not in
+ * the clear in the users home directory.
+ * 
+ * Returns: %TRUE if the @mount is encrypted.
+ **/
+gboolean
+g_mount_is_encrypted (GMount *mount)
+{
+  GMountIface *iface;
+
+  g_return_val_if_fail (G_IS_MOUNT (mount), FALSE);
+
+  iface = G_MOUNT_GET_IFACE (mount);
+
+  if (iface->is_encrypted == NULL)
+    return FALSE;
+
+  return (* iface->is_encrypted) (mount);
+}
+
+/**
  * g_mount_unmount:
  * @mount: a #GMount.
  * @flags: flags affecting the operation
Index: gmount.h
===================================================================
--- gmount.h	(revision 6591)
+++ gmount.h	(working copy)
@@ -74,6 +74,7 @@
  * @eject_finish: Finishes an eject operation.
  * @remount: Starts remounting a #GMount.
  * @remount_finish: Finishes a remounting operation.
+ * @is_encrypted: Gets whether the #GMount is encrypted.
  * 
  * Interface for implementing operations for mounts.
  **/
@@ -121,6 +122,8 @@
   gboolean           (*remount_finish)       (GMount         *mount,
                                               GAsyncResult    *result,
                                               GError         **error);
+
+  gboolean           (*is_encrypted)         (GMount         *mount);
 };
 
 GType g_mount_get_type (void) G_GNUC_CONST;
@@ -158,6 +161,7 @@
 gboolean           g_mount_remount_finish       (GMount              *mount,
                                                  GAsyncResult        *result,
                                                  GError             **error);
+gboolean           g_mount_is_encrypted         (GMount              *mount);
 
 G_END_DECLS
 
Index: gio.symbols
===================================================================
--- gio.symbols	(revision 6591)
+++ gio.symbols	(working copy)
@@ -705,6 +705,7 @@
 g_mount_eject_finish 
 g_mount_remount 
 g_mount_remount_finish 
+g_mount_is_encrypted
 #endif
 #endif
 
