diff --git a/ChangeLog b/ChangeLog
index fd618ffe5097eef119d191ae97f95c1202c2834b..c0b5e230e9fd961ede2897dbc2921ae0c3344bb1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,28 @@
+2006-08-06	Benedikt Meurer <benny@xfce.org>
+
+	* thunar-vfs/thunar-vfs-thumb.c
+	  (thunar_vfs_thumb_factory_lookup_thumbnail): Fix an invalid return
+	  value.
+	* thunar-vfs/thunar-vfs-thumb.c
+	  (thunar_vfs_thumb_factory_generate_thumbnail),
+	  thunar/thunar-icon-factory.c(thunar_icon_factory_load_file_icon):
+	  Add support for generating and loading thumbnails for files in the
+	  trash.
+	* thunar-vfs/thunar-vfs-info.c(_thunar_vfs_io_local_rename),
+	  thunar-vfs/thunar-vfs-mime-application.c
+	  (thunar_vfs_mime_application_new_from_file),
+	  thunar-vfs/thunar-vfs-mime-cleaner.c(main),
+	  thunar-vfs/thunar-vfs-mime-handler.c
+	  (thunar_vfs_mime_handler_set_icon),
+	  thunar/thunar-dialogs.c(thunar_dialogs_show_job_error),
+	  thunar/thunar-launcher.c,
+	  thunar/thunar-path-entry.c(thunar_path_entry_check_completion_idle):
+	  Use strncmp() instead of g_str_has_prefix() where it makes sense. Try
+	  to avoid g_str_has_suffix() if checking only for a single character.
+	* thunar/thunar-standard-view.c(thunar_standard_view_drag_motion):
+	  Deny XdndDirectSave0 and _NETSCAPE_URL drops to locations in the
+	  trash.
+
 2006-08-05	Benedikt Meurer <benny@xfce.org>
 
 	* thunar/thunar-application.c(thunar_application_unlink_files): Unlink
diff --git a/thunar-vfs/thunar-vfs-io-local.c b/thunar-vfs/thunar-vfs-io-local.c
index 3a0d182d251b1c05afdd1326dc1189cdf24e3060..b82642881a2f407e1eb3e83f9e736e8e417538d2 100644
--- a/thunar-vfs/thunar-vfs-io-local.c
+++ b/thunar-vfs/thunar-vfs-io-local.c
@@ -959,7 +959,7 @@ error2:
       info->display_name = g_strdup (name);
 
       /* check if this is a hidden file now */
-      if (strlen (name) > 1 && (g_str_has_prefix (name, ".") || g_str_has_prefix (name, "~")))
+      if (strlen (name) > 1 && (name[0] == '.' || name[strlen (name) - 1] == '~'))
         info->flags |= THUNAR_VFS_FILE_FLAGS_HIDDEN;
       else
         info->flags &= ~THUNAR_VFS_FILE_FLAGS_HIDDEN;
diff --git a/thunar-vfs/thunar-vfs-mime-application.c b/thunar-vfs/thunar-vfs-mime-application.c
index dcd1c8f04a0285a20ed8f68df3ae9a86c304e5ee..a80b3cf739c39e5c843d1e1307a1b1ffe18421bc 100644
--- a/thunar-vfs/thunar-vfs-mime-application.c
+++ b/thunar-vfs/thunar-vfs-mime-application.c
@@ -281,7 +281,7 @@ thunar_vfs_mime_application_new_from_file (const gchar *path,
           for (ms = mt = application->mime_types; *ms != NULL; ++ms)
             {
               /* ignore empty entries, GNOME pseudo mime types and KDE junk */
-              if (**ms == '\0' || g_str_equal (*ms, "x-directory/gnome-default-handler") || g_str_has_prefix (*ms, "print/"))
+              if (**ms == '\0' || g_str_equal (*ms, "x-directory/gnome-default-handler") || strncmp (*ms, "print/", 6) == 0)
                 g_free (*ms);
               else
                 *mt++ = *ms;
diff --git a/thunar-vfs/thunar-vfs-mime-cleaner.c b/thunar-vfs/thunar-vfs-mime-cleaner.c
index e3e49435ce79865a294bdd8603701565801d039e..e7d76e3f500d1fc27fb0986f41e912c5055f8dcb 100644
--- a/thunar-vfs/thunar-vfs-mime-cleaner.c
+++ b/thunar-vfs/thunar-vfs-mime-cleaner.c
@@ -410,7 +410,7 @@ main (int argc, char **argv)
               mt2 = xfce_rc_read_entry_untranslated (rc, "MimeType", NULL);
 
               /* combine the MimeTypes to a single list */
-              if (G_LIKELY (mt1 != NULL && g_str_has_suffix (mt1, ";")))
+              if (G_LIKELY (mt1 != NULL && mt1[strlen (mt1) - 1] == ';'))
                 mt = g_strconcat (mt1, mt2, NULL);
               else if (G_LIKELY (mt1 != NULL))
                 mt = g_strconcat (mt1, ";", mt2, NULL);
diff --git a/thunar-vfs/thunar-vfs-mime-handler.c b/thunar-vfs/thunar-vfs-mime-handler.c
index b4596fc9119cb5daacd4cecb248e23993f0b414a..b1644a40a9c99e0de22915b67cdac8a7e9ac00da 100644
--- a/thunar-vfs/thunar-vfs-mime-handler.c
+++ b/thunar-vfs/thunar-vfs-mime-handler.c
@@ -362,6 +362,8 @@ static void
 thunar_vfs_mime_handler_set_icon (ThunarVfsMimeHandler *mime_handler,
                                   const gchar          *icon)
 {
+  gint icon_len;
+
   /* release the previous icon */
   g_free (mime_handler->icon);
 
@@ -369,8 +371,13 @@ thunar_vfs_mime_handler_set_icon (ThunarVfsMimeHandler *mime_handler,
   mime_handler->icon = g_strdup (icon);
 
   /* strip off known suffixes for image files if a themed icon is specified */
-  if (mime_handler->icon != NULL && !g_path_is_absolute (mime_handler->icon) && g_str_has_suffix (mime_handler->icon, ".png"))
-    mime_handler->icon[strlen (mime_handler->icon) - 4] = '\0';
+  if (mime_handler->icon != NULL && !g_path_is_absolute (mime_handler->icon))
+    {
+      /* check if the icon name ends in .png */
+      icon_len = strlen (mime_handler->icon);
+      if (G_LIKELY (icon_len > 4) && strcmp (mime_handler->icon + (icon_len - 4), ".png") == 0)
+        mime_handler->icon[icon_len - 4] = '\0';
+    }
 }
 
 
diff --git a/thunar-vfs/thunar-vfs-thumb.c b/thunar-vfs/thunar-vfs-thumb.c
index 446512eb9e73ab7241c82ea330efa579727faccf..b3f3d6849eaa131782d6939f89a5483f04026ab6 100644
--- a/thunar-vfs/thunar-vfs-thumb.c
+++ b/thunar-vfs/thunar-vfs-thumb.c
@@ -53,6 +53,7 @@
 
 #include <thunar-vfs/thunar-vfs-enum-types.h>
 #include <thunar-vfs/thunar-vfs-mime-database.h>
+#include <thunar-vfs/thunar-vfs-path-private.h>
 #include <thunar-vfs/thunar-vfs-private.h>
 #include <thunar-vfs/thunar-vfs-thumb-jpeg.h>
 #include <thunar-vfs/thunar-vfs-thumb-pixbuf.h>
@@ -412,20 +413,20 @@ thunar_vfs_thumb_factory_lookup_thumbnail (ThunarVfsThumbFactory *factory,
   g_return_val_if_fail (info != NULL, NULL);
 
   /* determine the URI for the path */
-  if (thunar_vfs_path_to_uri (info->path, uri, sizeof (uri), NULL) < 0)
-    return FALSE;
-
-  /* determine the path to the thumbnail for the factory */
-  md5 = exo_str_get_md5_str (uri);
-  path = g_strconcat (factory->base_path, md5, ".png", NULL);
-  g_free (md5);
+  if (thunar_vfs_path_to_uri (info->path, uri, sizeof (uri), NULL) >= 0)
+    {
+      /* determine the path to the thumbnail for the factory */
+      md5 = exo_str_get_md5_str (uri);
+      path = g_strconcat (factory->base_path, md5, ".png", NULL);
+      g_free (md5);
 
-  /* check if the path contains a valid thumbnail */
-  if (thunar_vfs_thumbnail_is_valid (path, uri, info->mtime))
-    return path;
+      /* check if the path contains a valid thumbnail */
+      if (thunar_vfs_thumbnail_is_valid (path, uri, info->mtime))
+        return path;
 
-  /* no valid thumbnail in the global repository */
-  g_free (path);
+      /* no valid thumbnail in the global repository */
+      g_free (path);
+    }
 
   return NULL;
 }
@@ -659,8 +660,10 @@ thunar_vfs_thumb_factory_generate_thumbnail (ThunarVfsThumbFactory *factory,
   /* determine the pixel size of the thumbnail */
   size = G_LIKELY (factory->size == THUNAR_VFS_THUMB_SIZE_NORMAL) ? 128 : 256;
 
-  /* determine the absolute path to the file */
-  path = thunar_vfs_path_dup_string (info->path);
+  /* determine the absolute local path to the file */
+  path = _thunar_vfs_path_translate_dup_string (info->path, THUNAR_VFS_PATH_SCHEME_FILE, NULL);
+  if (G_UNLIKELY (path == NULL))
+    return NULL;
 
 #ifdef HAVE_GCONF
   /* check if we have a GNOME thumbnailer for the given mime info */
diff --git a/thunar/thunar-dialogs.c b/thunar/thunar-dialogs.c
index dd0fe34e8e7475b44ba1949b6b3f9ef3c5672add..af1aca4f0e75878b8b09dd0c9d8a387057473581 100644
--- a/thunar/thunar-dialogs.c
+++ b/thunar/thunar-dialogs.c
@@ -394,7 +394,7 @@ thunar_dialogs_show_job_error (GtkWindow *parent,
 
   /* try to separate the message into primary and secondary parts */
   separator = strstr (error->message, ": ");
-  if (G_LIKELY (separator != NULL))
+  if (G_LIKELY (separator > error->message))
     {
       /* primary is everything before the colon, plus a dot */
       g_string_append_len (primary, error->message, separator - error->message);
@@ -405,7 +405,7 @@ thunar_dialogs_show_job_error (GtkWindow *parent,
         ++separator;
       while (g_ascii_isspace (*separator));
       g_string_append (secondary, separator);
-      if (!g_str_has_suffix (separator, "."))
+      if (separator[strlen (separator - 1)] != '.')
         g_string_append_c (secondary, '.');
     }
   else
diff --git a/thunar/thunar-icon-factory.c b/thunar/thunar-icon-factory.c
index 4b32f3df2b54379f30e76417780c8d76921c3fb6..ad681143eb5ed83711014129a7182a4e30da99b5 100644
--- a/thunar/thunar-icon-factory.c
+++ b/thunar/thunar-icon-factory.c
@@ -867,7 +867,7 @@ thunar_icon_factory_load_file_icon (ThunarIconFactory  *factory,
     }
 
   /* check if thumbnails are enabled and we can display a thumbnail for the item */
-  if (G_LIKELY (factory->show_thumbnails && thunar_file_is_regular (file) && !thunar_file_is_trashed (file)))
+  if (G_LIKELY (factory->show_thumbnails && thunar_file_is_regular (file)))
     {
       /* determine the thumbnail state */
       thumb_state = thunar_file_get_thumb_state (file);
diff --git a/thunar/thunar-launcher.c b/thunar/thunar-launcher.c
index fd20bb2cab5336c27feaf9bddacc7bf13b444ee5..20d38385c00ba38f0b528f39b5bc45514fedcae3 100644
--- a/thunar/thunar-launcher.c
+++ b/thunar/thunar-launcher.c
@@ -21,6 +21,13 @@
 #include <config.h>
 #endif
 
+#ifdef HAVE_MEMORY_H
+#include <memory.h>
+#endif
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
+
 #include <thunar/thunar-application.h>
 #include <thunar/thunar-chooser-dialog.h>
 #include <thunar/thunar-dialogs.h>
@@ -799,7 +806,7 @@ thunar_launcher_update (ThunarLauncher *launcher)
       /* drop all previous addon actions from the action group */
       actions = gtk_action_group_list_actions (launcher->action_group);
       for (lp = actions; lp != NULL; lp = lp->next)
-        if (g_str_has_prefix (gtk_action_get_name (lp->data), "thunar-launcher-addon-"))
+        if (strncmp (gtk_action_get_name (lp->data), "thunar-launcher-addon-", 22) == 0)
           gtk_action_group_remove_action (launcher->action_group, lp->data);
       g_list_free (actions);
 
@@ -1214,7 +1221,7 @@ thunar_launcher_sendto_idle (gpointer user_data)
       /* drop all previous sendto actions from the action group */
       handlers = gtk_action_group_list_actions (launcher->action_group);
       for (lp = handlers; lp != NULL; lp = lp->next)
-        if (g_str_has_prefix (gtk_action_get_name (lp->data), "thunar-launcher-sendto"))
+        if (strncmp (gtk_action_get_name (lp->data), "thunar-launcher-sendto", 22) == 0)
           gtk_action_group_remove_action (launcher->action_group, lp->data);
       g_list_free (handlers);
 
diff --git a/thunar/thunar-path-entry.c b/thunar/thunar-path-entry.c
index 795fc4e8d6b28dc587467d8c39b7795b3740b96f..83fe7656465f8dc7f29b2e5774b6cb2996e47711 100644
--- a/thunar/thunar-path-entry.c
+++ b/thunar/thunar-path-entry.c
@@ -1313,7 +1313,7 @@ thunar_path_entry_check_completion_idle (gpointer user_data)
 
   /* check if the user entered atleast part of a filename */
   text = gtk_entry_get_text (GTK_ENTRY (path_entry));
-  if (*text != '\0' && !g_str_has_suffix (text, "/"))
+  if (*text != '\0' && text[strlen (text) - 1] != '/')
     {
       /* automatically insert the common prefix */
       thunar_path_entry_common_prefix_append (path_entry, TRUE);
diff --git a/thunar/thunar-standard-view.c b/thunar/thunar-standard-view.c
index 8238759c0b54345d50a7ce2b19997f2af9abd0fc..ee0248a0f5e265724f6dedb56b630a30e5441add 100644
--- a/thunar/thunar-standard-view.c
+++ b/thunar/thunar-standard-view.c
@@ -2817,7 +2817,7 @@ thunar_standard_view_drag_motion (GtkWidget          *view,
           file = thunar_standard_view_get_drop_file (standard_view, x, y, &path);
 
           /* check if we can save here */
-          if (G_LIKELY (file != NULL && thunar_file_is_directory (file) && thunar_file_is_writable (file)))
+          if (G_LIKELY (file != NULL && thunar_file_is_local (file) && thunar_file_is_directory (file) && thunar_file_is_writable (file)))
             action = context->suggested_action;
 
           /* reset path if we cannot drop */