patches/nautilus-06-execute-shellscript.diff
author dcarbery
Fri, 24 Nov 2006 16:37:59 +0000
branch217update
changeset 19096 d542fc2c823e
parent 8514 5a2ed0a547ed
permissions -rw-r--r--
Merged trunk changes r9797:9829 into 217update branch.

--- /usr/src/redhat/BUILD/nautilus-2.10.1/libnautilus-private/nautilus-file.c	2005-06-14 12:38:27.842030744 +0530
+++ nautilus-2.10.1/libnautilus-private/nautilus-file.c	2005-06-14 12:34:00.415720000 +0530
@@ -5250,10 +5250,31 @@ nautilus_file_get_file_info_result (Naut
 gboolean
 nautilus_file_contains_text (NautilusFile *file)
 {
+	const gchar *script_mime_types[]= {
+		"application/x-shellscript",
+		"application/x-perl",
+		"application/x-python",
+		"application/x-csh",
+		"application/x-ruby",
+		NULL
+	};
+	const gchar **it;
+
 	if (file == NULL) {
 		return FALSE;
 	}
 
+	if (file->details->info == NULL || file->details->info->mime_type == NULL) {
+		return FALSE;
+	}
+
+	it = script_mime_types;
+	while (*it) {
+		if (! strcmp (file->details->info->mime_type, *it))
+			return TRUE;
+		it ++;
+	}
+
 	/* All text files inherit from text/plain */
 	return nautilus_file_is_mime_type (file, "text/plain");
 }