Index: src/file-manager/fm-properties-window.c
===================================================================
RCS file: /cvs/gnome/nautilus/src/file-manager/fm-properties-window.c,v
retrieving revision 1.217
diff -u -p -r1.217 fm-properties-window.c
--- src/file-manager/fm-properties-window.c	11 Jul 2005 10:07:53 -0000	1.217
+++ src/file-manager/fm-properties-window.c	28 Jul 2005 19:56:41 -0000
@@ -76,6 +76,7 @@
 #include <libnautilus-private/nautilus-module.h>
 #include <libnautilus-private/nautilus-undo-signal-handlers.h>
 #include <libnautilus-private/nautilus-mime-actions.h>
+#include <libnautilus-private/nautilus-trash-monitor.h>
 #include <libnautilus-private/nautilus-undo.h>
 #include <string.h>
 
@@ -295,8 +296,21 @@ get_original_file (FMPropertiesWindow *w
 	return NAUTILUS_FILE (window->details->original_files->data);
 }
 
-static NautilusFile *
-get_target_file_for_original_file (NautilusFile *file)
+static void
+prepend_trash_target_directories (GList **target_files)
+{
+	GList *files, *l;
+
+	files = nautilus_trash_monitor_get_trash_directories_as_files ();
+	for (l = files; l != NULL; l = l->next) {
+		*target_files = g_list_prepend (*target_files, l->data);
+	}
+	g_list_free (files);
+}
+
+static void
+prepend_target_files_for_original_file (NautilusFile *file,
+					GList **target_files)
 {
 	NautilusFile *target_file;
 	char *uri_to_display;
@@ -323,25 +337,28 @@ get_target_file_for_original_file (Nauti
 		link = nautilus_desktop_icon_file_get_link (NAUTILUS_DESKTOP_ICON_FILE (file));
 
 		if (link != NULL) {
-			/* map to linked URI for these types of links */
-			uri_to_display = nautilus_desktop_link_get_activation_uri (link);
-			if (uri_to_display) {
-				target_file = nautilus_file_get (uri_to_display);
-				g_free (uri_to_display);
+			if (nautilus_desktop_link_get_link_type (link) == NAUTILUS_DESKTOP_LINK_TRASH) {
+				prepend_trash_target_directories (target_files);
+				g_object_unref (link);
+				return;
+			} else {
+				/* map to linked URI for these types of links */
+				uri_to_display = nautilus_desktop_link_get_activation_uri (link);
+				if (uri_to_display) {
+					target_file = nautilus_file_get (uri_to_display);
+					g_free (uri_to_display);
+				}
 			}
 			
 			g_object_unref (link);
 		}
-        }
+        } 
 
-
-	if (target_file != NULL) {
-		return target_file;
+	if (target_file == NULL) {
+		target_file = nautilus_file_ref (file);
 	}
 
-	/* Ref passed-in file here since we've decided to use it. */
-	nautilus_file_ref (file);
-	return file;
+	*target_files = g_list_prepend (*target_files, target_file);
 }
 
 static NautilusFile *
@@ -2225,16 +2242,20 @@ create_page_with_table_in_vbox (GtkNoteb
 }		
 
 static gboolean
-is_merged_trash_directory (NautilusFile *file) 
+is_trash_desktop_link (NautilusFile *file)
 {
-	char *file_uri;
-	gboolean result;
+	NautilusDesktopLink *link;
+
+	if (NAUTILUS_IS_DESKTOP_ICON_FILE (file)) {
+		link = nautilus_desktop_icon_file_get_link (NAUTILUS_DESKTOP_ICON_FILE (file));
 
-	file_uri = nautilus_file_get_uri (file);
-	result = gnome_vfs_uris_match (file_uri, EEL_TRASH_URI);
-	g_free (file_uri);
+		if (link != NULL &&
+		    (nautilus_desktop_link_get_link_type (link) == NAUTILUS_DESKTOP_LINK_TRASH)) {
+			return TRUE;
+		}
+	}
 
-	return result;
+	return FALSE;
 }
 
 static gboolean
@@ -2246,7 +2267,7 @@ should_show_custom_icon_buttons (FMPrope
 	 * When bug 5642 is fixed we can remove this case.
 	 */
 	if (!is_multi_file_window (window) 
-	    && is_merged_trash_directory (get_target_file (window))) {
+	    && is_trash_desktop_link (get_original_file (window))) {
 		return FALSE;
 	}
 
@@ -2258,7 +2279,7 @@ should_show_file_type (FMPropertiesWindo
 {
 	/* The trash on the desktop is one-of-a-kind */
 	if (!is_multi_file_window (window) 
-	    && is_merged_trash_directory (get_target_file (window))) {
+	    && is_trash_desktop_link (get_original_file (window))) {
 		return FALSE;
 	}
 
@@ -3213,7 +3234,7 @@ should_show_emblems (FMPropertiesWindow 
 	 * When bug 5643 is fixed we can remove this case.
 	 */
 	if (!is_multi_file_window (window) 
-	    && is_merged_trash_directory (get_target_file (window))) {
+	    && is_trash_desktop_link (get_original_file (window))) {
 		return FALSE;
 	}
 
@@ -3227,7 +3248,7 @@ should_show_permissions (FMPropertiesWin
 	 * really a file system object.
 	 */
 	if (!is_multi_file_window (window)
-	    && is_merged_trash_directory (get_target_file (window))) {
+	    && is_trash_desktop_link (get_original_file (window))) {
 		return FALSE;
 	}
 
@@ -3508,11 +3529,7 @@ get_target_file_list (GList *original_fi
 	ret = NULL;
 	
 	for (l = original_files; l != NULL; l = l->next) {
-		NautilusFile *target;
-		
-		target = get_target_file_for_original_file (NAUTILUS_FILE (l->data));
-		
-		ret = g_list_prepend (ret, target);
+		prepend_target_files_for_original_file (NAUTILUS_FILE (l->data), &ret);
 	}
 
 	ret = g_list_reverse (ret);
