9fa05644991cbe4ee6940efe7f43ab780f20603e
diff --git a/libnautilus-private/nautilus-autorun.c b/libnautilus-private/nautilus-autorun.c
index af01348..86fb254 100644
--- a/libnautilus-private/nautilus-autorun.c
+++ b/libnautilus-private/nautilus-autorun.c
@@ -698,6 +698,7 @@ nautilus_autorun_launch_for_mount (GMount *mount, GAppInfo *app_info)
 	files = g_list_append (NULL, file);
 	nautilus_launch_application (app_info,
 				     files,
+				     NULL,
 				     NULL); /* TODO: what to set here? */
 	g_object_unref (file);
 	g_list_free (files);
diff --git a/libnautilus-private/nautilus-mime-actions.c b/libnautilus-private/nautilus-mime-actions.c
index 84d28f5..fb663a9 100644
--- a/libnautilus-private/nautilus-mime-actions.c
+++ b/libnautilus-private/nautilus-mime-actions.c
@@ -56,9 +56,15 @@ typedef enum {
 typedef struct {
 	GAppInfo *application;
 	GList *files;
+	GList *uris;
 } ApplicationLaunchParameters;
 
 typedef struct {
+	GList *files;
+	GList *uris;
+} ListPair;
+
+typedef struct {
 	NautilusWindowSlotInfo *slot_info;
 	gpointer window_info;
 	GtkWindow *parent_window;
@@ -66,6 +72,7 @@ typedef struct {
 	GList *files;
 	GList *mountables;
 	GList *not_mounted;
+	GList *activation_uris;
 	NautilusWindowOpenMode mode;
 	NautilusWindowOpenFlags flags;
 	char *timed_wait_prompt;
@@ -101,16 +108,16 @@ static void activate_callback                       (GList              *files,
 static void activation_mount_not_mounted            (ActivateParameters *parameters);
 
 
-
-
 static ApplicationLaunchParameters *
 application_launch_parameters_new (GAppInfo *application,
-			      	   GList *files)
+			      	   GList *uris,
+				   GList *files)
 {
 	ApplicationLaunchParameters *result;
 
 	result = g_new0 (ApplicationLaunchParameters, 1);
 	result->application = g_object_ref (application);
+	result->uris = eel_g_str_list_copy (uris);
 	result->files = nautilus_file_list_copy (files);
 
 	return result;
@@ -120,6 +127,7 @@ static void
 application_launch_parameters_free (ApplicationLaunchParameters *parameters)
 {
 	g_object_unref (parameters->application);
+	eel_g_list_free_deep (parameters->uris);
 	nautilus_file_list_free (parameters->files);
 
 	g_free (parameters);
@@ -784,6 +792,21 @@ nautilus_mime_file_opens_in_external_app (NautilusFile *file)
   return (activation_action == ACTIVATION_ACTION_OPEN_IN_APPLICATION);
 }
 
+static ListPair *
+list_pair_new (void)
+{
+	ListPair *pair;
+	pair = g_new0 (ListPair, 1);
+
+	return pair;
+}
+
+static void
+list_pair_free (ListPair *pair)
+{
+	g_list_free (pair->uris);
+	g_list_free (pair->files);
+}
 
 static unsigned int
 mime_application_hash (GAppInfo *app)
@@ -801,15 +824,17 @@ mime_application_hash (GAppInfo *app)
 
 static void
 list_to_parameters_foreach (GAppInfo *application,
-			    GList *files,
+			    ListPair *pair,
 			    GList **ret)
 {
 	ApplicationLaunchParameters *parameters;
+	GList *files, *uris;
 
-	files = g_list_reverse (files);
+	uris = g_list_reverse (pair->uris);
+	files = g_list_reverse (pair->files);
 
 	parameters = application_launch_parameters_new
-		(application, files);
+		(application, uris, files);
 	*ret = g_list_prepend (*ret, parameters);
 }
 
@@ -828,12 +853,14 @@ list_to_parameters_foreach (GAppInfo *application,
  **/
 static GList *
 fm_directory_view_make_activation_parameters (GList *files,
+					      GList *uris,
 					      GList **unhandled_files)
 {
-	GList *ret, *l, *app_files;
+	GList *ret, *l, *m, *app_uris;
 	NautilusFile *file;
 	GAppInfo *app, *old_app;
 	GHashTable *app_table;
+	ListPair *pair;
 
 	ret = NULL;
 	*unhandled_files = NULL;
@@ -842,29 +869,31 @@ fm_directory_view_make_activation_parameters (GList *files,
 		((GHashFunc) mime_application_hash,
 		 (GEqualFunc) g_app_info_equal,
 		 (GDestroyNotify) g_object_unref,
-		 (GDestroyNotify) g_list_free);
+		 (GDestroyNotify) list_pair_free);
 
-	for (l = files; l != NULL; l = l->next) {
+	for (l = files, m = uris; l != NULL; l = l->next, m = m->next) {
 		file = NAUTILUS_FILE (l->data);
 
 		app = nautilus_mime_get_default_application_for_file (file);
 		if (app != NULL) {
-			app_files = NULL;
+			app_uris = NULL;
 
 			if (g_hash_table_lookup_extended (app_table, app,
 							  (gpointer *) &old_app,
-							  (gpointer *) &app_files)) {
+							  (gpointer *) &pair)) {
 				g_hash_table_steal (app_table, old_app);
 
-				app_files = g_list_prepend (app_files, file);
+				app_uris = g_list_prepend (app_uris, m->data);
 
 				g_object_unref (app);
 				app = old_app;
 			} else {
-				app_files = g_list_prepend (NULL, file);
+				pair = list_pair_new ();
+				pair->uris = g_list_prepend (NULL, m->data);
+				pair->files = g_list_prepend (NULL, file);
 			}
 
-			g_hash_table_insert (app_table, app, app_files);
+			g_hash_table_insert (app_table, app, pair);
 		} else {
 			*unhandled_files = g_list_prepend (*unhandled_files, file);
 		}
@@ -1016,11 +1045,12 @@ activate_files (ActivateParameters *parameters)
 	GList *launch_files;
 	GList *launch_in_terminal_files;
 	GList *open_in_app_files;
+	GList *open_in_app_uris;
 	GList *open_in_app_parameters;
 	GList *unhandled_open_in_app_files;
 	ApplicationLaunchParameters *one_parameters;
 	GList *open_in_view_files;
-	GList *l;
+	GList *l, *m;
 	int count;
 	char *uri;
 	char *executable_path, *quoted_path, *name;
@@ -1036,7 +1066,7 @@ activate_files (ActivateParameters *parameters)
 	open_in_app_files = NULL;
 	open_in_view_files = NULL;
 
-	for (l = parameters->files; l != NULL; l = l->next) {
+	for (l = parameters->files, m = parameters->activation_uris; l != NULL; l = l->next, m = m->next) {
 		file = NAUTILUS_FILE (l->data);
 
 		if (file_was_cancelled (file)) {
@@ -1044,6 +1074,7 @@ activate_files (ActivateParameters *parameters)
 		}
 
 		action = get_activation_action (file);
+		g_print ("action %d\n", action);
 		if (action == ACTIVATION_ACTION_ASK) {
 			/* Special case for executable text files, since it might be
 			 * dangerous & unexpected to launch these.
@@ -1065,6 +1096,7 @@ activate_files (ActivateParameters *parameters)
 			open_in_view_files = g_list_prepend (open_in_view_files, file);
 			break;
 		case ACTIVATION_ACTION_OPEN_IN_APPLICATION :
+			open_in_app_uris = g_list_prepend (open_in_app_uris, m->data);
 			open_in_app_files = g_list_prepend (open_in_app_files, file);
 			break;
 		case ACTIVATION_ACTION_DO_NOTHING :
@@ -1194,7 +1226,7 @@ activate_files (ActivateParameters *parameters)
 		open_in_app_files = g_list_reverse (open_in_app_files);
 
 		open_in_app_parameters = fm_directory_view_make_activation_parameters
-			(open_in_app_files, &unhandled_open_in_app_files);
+			(open_in_app_files, open_in_app_uris, &unhandled_open_in_app_files);
 	}
 
 	for (l = open_in_app_parameters; l != NULL; l = l->next) {
@@ -1202,6 +1234,7 @@ activate_files (ActivateParameters *parameters)
 
 		nautilus_launch_application (one_parameters->application,
 					     one_parameters->files,
+					     one_parameters->uris,
 					     parameters->parent_window);
 		application_launch_parameters_free (one_parameters);
 	}
@@ -1425,12 +1458,17 @@ activate_activation_uris_ready_callback (GList *files_ignore,
 		file = NAUTILUS_FILE (l->data);
 
 		/* We want the file for the activation URI since we care
-		 * about the attributes for that, not for the original file.
+		 * about the attributes for that, not for the original file, but
+		 * we store activation uris themselves separately to avoid
+		 * GFile roundtrips.
 		 */
 		uri = nautilus_file_get_activation_uri (file);
+		parameters->activation_uris = 
+			g_list_append (parameters->activation_uris, g_strdup (uri));
+
 		if (uri != NULL) {
 			NautilusFile *actual_file;
-			
+
 			actual_file = nautilus_file_get_by_uri (uri);
 			if (actual_file != NULL) {
 				nautilus_file_unref (file);
@@ -1612,6 +1650,7 @@ nautilus_mime_activate_files (GtkWindow *parent_window,
 	parameters->user_confirmation = user_confirmation;
 
 	file_count = g_list_length (files);
+
 	if (file_count == 1) {
 		file_name = nautilus_file_get_display_name (files->data);
 		parameters->timed_wait_prompt = g_strdup_printf (_("Opening \"%s\"."), file_name);
diff --git a/libnautilus-private/nautilus-program-choosing.c b/libnautilus-private/nautilus-program-choosing.c
index 1f28844..ad28bbe 100644
--- a/libnautilus-private/nautilus-program-choosing.c
+++ b/libnautilus-private/nautilus-program-choosing.c
@@ -143,8 +143,9 @@ application_cannot_open_location (GAppInfo *application,
  * @parent_window: A window to use as the parent for any error dialogs.
  */
 void
-nautilus_launch_application (GAppInfo *application, 
+nautilus_launch_application (GAppInfo *application,
 			     GList *files,
+			     GList *activation_uris,
 			     GtkWindow *parent_window)
 {
 	char            *uri, *uri_scheme;
@@ -168,13 +169,18 @@ nautilus_launch_application (GAppInfo *application,
 		file = NAUTILUS_FILE (l->data);
 		
 		location = nautilus_file_get_activation_location (file);
-		uri = nautilus_file_get_activation_uri (file);
-
 		if (g_file_is_native (location)) {
 			count++;
 		}
 
 		locations = g_list_prepend (locations, location);
+
+		if (!activation_uris) {
+			uri = nautilus_file_get_activation_uri (file);
+		} else {
+			uri = g_strdup (g_list_nth_data (activation_uris, g_list_position (files, l)));
+		}
+
 		uris = g_list_prepend (uris, uri);
 	}
 	locations = g_list_reverse (locations);
diff --git a/libnautilus-private/nautilus-program-choosing.h b/libnautilus-private/nautilus-program-choosing.h
index 20e2756..6ddb9b4 100644
--- a/libnautilus-private/nautilus-program-choosing.h
+++ b/libnautilus-private/nautilus-program-choosing.h
@@ -35,6 +35,7 @@ typedef void (*NautilusApplicationChoiceCallback) (GAppInfo
 
 void nautilus_launch_application                 (GAppInfo                          *application,
 						  GList                             *files,
+						  GList                             *activation_uris,
 						  GtkWindow                         *parent_window);
 void nautilus_launch_application_from_command    (GdkScreen                         *screen,
 						  const char                        *name,
diff --git a/src/file-manager/fm-directory-view.c b/src/file-manager/fm-directory-view.c
index 20f6f4d..9802573 100644
--- a/src/file-manager/fm-directory-view.c
+++ b/src/file-manager/fm-directory-view.c
@@ -875,7 +875,7 @@ application_selected_cb (NautilusOpenWithDialog *dialog,
 	files.next = NULL;
 	files.prev = NULL;
 	files.data = file;
-	nautilus_launch_application (app, &files, parent_window);
+	nautilus_launch_application (app, &files, NULL, parent_window);
 }
 
 static void
@@ -4112,6 +4112,7 @@ open_with_launch_application_callback (GtkAction *action,
 	nautilus_launch_application 
 		(launch_parameters->application,
 		 launch_parameters->files,
+		 NULL,
 		 fm_directory_view_get_containing_window (launch_parameters->directory_view));
 }
 
diff --git a/src/nautilus-information-panel.c b/src/nautilus-information-panel.c
index 6a603b0..787f543 100644
--- a/src/nautilus-information-panel.c
+++ b/src/nautilus-information-panel.c
@@ -802,7 +802,7 @@ command_button_callback (GtkWidget *button, GAppInfo *application)
 	files.next = NULL;
 	files.prev = NULL;
 	files.data = information_panel->details->file;
-	nautilus_launch_application (application, &files,
+	nautilus_launch_application (application, &files, NULL,
 				     nautilus_information_panel_get_window (information_panel));	
 }
 
