Index: nautilus-2.16.3/libnautilus-private/nautilus-file.c
===================================================================
--- nautilus-2.16.3.orig/libnautilus-private/nautilus-file.c	2007-02-15 17:12:39.000000000 +0100
+++ nautilus-2.16.3/libnautilus-private/nautilus-file.c	2007-02-15 17:12:42.000000000 +0100
@@ -40,6 +40,7 @@
 #include "nautilus-link-desktop-file.h"
 #include "nautilus-metadata.h"
 #include "nautilus-module.h"
+#include "nautilus-program-choosing.h"
 #include "nautilus-search-directory.h"
 #include "nautilus-search-directory-file.h"
 #include "nautilus-thumbnails.h"
@@ -2735,6 +2736,35 @@
 		 monitor_remove, (file, client));
 }			      
 
+static gboolean
+safe_to_launch_desktop_file (NautilusFile *file)
+{
+	gboolean ret = TRUE;
+	char *uri = nautilus_file_get_uri (file);
+	char *path = NULL;
+
+	if (uri) {
+		path = gnome_vfs_get_local_path_from_uri (uri);
+	}
+
+	if (!path ||
+	    eel_str_has_prefix (path, "/mnt") ||
+	    eel_str_has_prefix (path, "/media") ||
+	    !eel_str_has_suffix (path, ".desktop")) {
+		ret = FALSE;
+	}
+
+	if (ret) {
+		char *owner = nautilus_file_get_owner_name (file);
+		if (strcmp (owner, g_get_user_name ()) && strcmp (owner, "root"))
+			ret = FALSE;
+		g_free (owner);
+	}
+
+	g_free (uri);
+	g_free (path);
+	return ret;
+}
 
 /* Return the uri associated with the passed-in file, which may not be
  * the actual uri if the file is an desktop file or a nautilus
@@ -2749,7 +2779,9 @@
 		return NULL;
 	}
 
-	if (file->details->activation_uri != NULL) {
+	if (file->details->activation_uri != NULL &&
+	    (!eel_str_has_prefix (file->details->activation_uri, NAUTILUS_DESKTOP_COMMAND_SPECIFIER) ||
+	     safe_to_launch_desktop_file (file))) {
 		return g_strdup (file->details->activation_uri);
 	}
 	
Index: nautilus-2.16.3/src/file-manager/fm-directory-view.c
===================================================================
--- nautilus-2.16.3.orig/src/file-manager/fm-directory-view.c	2007-02-15 17:22:55.000000000 +0100
+++ nautilus-2.16.3/src/file-manager/fm-directory-view.c	2007-02-15 17:51:07.000000000 +0100
@@ -4566,14 +4566,6 @@
 	}
 }
 
-static gboolean
-can_use_component_for_file (NautilusFile *file)
-{
-	return (nautilus_file_is_directory (file) ||
-		NAUTILUS_IS_DESKTOP_ICON_FILE (file) ||
-		nautilus_file_is_nautilus_link (file));
-}
-
 static ActivationAction
 get_activation_action (NautilusFile *file)
 {
@@ -4606,7 +4598,8 @@
 	} 
 
 	if (action == ACTIVATION_ACTION_DO_NOTHING) {
-		if (can_use_component_for_file (file)) {
+		if (nautilus_file_is_directory (file) ||
+		    NAUTILUS_IS_DESKTOP_ICON_FILE (file)) {
 			action = ACTIVATION_ACTION_OPEN_IN_VIEW;
 		} else {
 			action = ACTIVATION_ACTION_OPEN_IN_APPLICATION;
@@ -4652,12 +4645,14 @@
 	for (node = selection; node != NULL; node = node->next) {
 		file = NAUTILUS_FILE (node->data);
 
-		other_applications_visible &=
-			(!can_use_component_for_file (file) ||
-			 nautilus_file_is_directory (file));
-
 		activation_action = get_activation_action (file);
 
+		if (activation_action != ACTIVATION_ACTION_OPEN_IN_APPLICATION &&
+		    (NAUTILUS_IS_DESKTOP_ICON_FILE (file) ||
+		     nautilus_file_is_nautilus_link (file))) {
+			other_applications_visible = FALSE;
+		}
+
 		/* Only use the default app for open if there is not
 		   a mime mismatch, otherwise we can't use it in the
 		   open with menu */
