Index: libgnomevfs/gnome-vfs-async-ops.c
===================================================================
RCS file: /cvs/gnome/gnome-vfs/libgnomevfs/gnome-vfs-async-ops.c,v
retrieving revision 1.16
diff -u -p -r1.16 gnome-vfs-async-ops.c
--- libgnomevfs/gnome-vfs-async-ops.c	14 Nov 2005 11:41:13 -0000	1.16
+++ libgnomevfs/gnome-vfs-async-ops.c	3 Apr 2006 08:42:12 -0000
@@ -1199,6 +1199,105 @@ gnome_vfs_async_file_control (GnomeVFSAs
 	_gnome_vfs_async_job_map_unlock ();
 }
 
+static GnomeVFSAsyncHandle *
+async_show (GnomeVFSURI *uri,
+	    char **envp,
+	    gboolean use_parent,
+	    int priority,
+	    GnomeVFSAsyncShowCallback callback,
+	    gpointer callback_data)
+{
+	GnomeVFSJob *job;
+	GnomeVFSShowOp *show_op;
+	GnomeVFSAsyncHandle *result;
+
+	job = _gnome_vfs_job_new (GNOME_VFS_OP_SHOW, priority, (GFunc) callback, callback_data);
+
+	show_op = &job->op->specifics.show;
+
+	show_op->uri = uri == NULL ? NULL : gnome_vfs_uri_ref (uri);
+	show_op->envp = g_strdupv (envp);
+	show_op->use_parent = use_parent;
+
+	result = job->job_handle;
+	_gnome_vfs_job_go (job);
+
+	return result;
+}
+
+/**
+ * gnome_vfs_async_show: 
+ * @handle_return: when the function returns, will point to a handle for the
+ * operation.
+ * @text_uri: a textual URI pointing to the resource that should be shown.
+ * @envp: environment to use for children, or %NULL to use parent environment.
+ * @use_parent: if this is %TRUE, a handler will be launched even if it is
+ * identical to the parent binary.
+ * @priority: a value from %GNOME_VFS_PRIORITY_MIN to %GNOME_VFS_PRIORITY_MAX
+ * (normally should be %GNOME_VFS_PRIORITY_DEFAULT) indicating the priority to
+ * assign to this job in allocating threads from the thread pool.
+ * @callback: #GnomeVFSAsyncShowCallback to be called when the operation is
+ * complete.
+ * @user_data: data to pass to @callback.
+ *
+ * This asynchronously does the same as gnome_vfs_show_cancellable().
+ **/
+void
+gnome_vfs_async_show (GnomeVFSAsyncHandle **handle_return,
+		      const char *text_uri,
+		      char **envp,
+		      gboolean use_parent,
+		      int priority,
+		      GnomeVFSAsyncShowCallback callback,
+		      gpointer callback_data)
+{
+	GnomeVFSURI *uri;
+
+	uri = gnome_vfs_uri_new (text_uri);
+	g_return_if_fail (uri != NULL);
+
+	gnome_vfs_async_show_uri (handle_return, uri, envp, use_parent,
+				  priority, callback, callback_data);
+
+	gnome_vfs_uri_unref (uri);
+}
+
+/**
+ * gnome_vfs_async_show_uri: 
+ * @handle_return: when the function returns, will point to a handle for the
+ * operation.
+ * @text_uri: a #GnomeVFSURI pointing to the resource that should be shown.
+ * @envp: environment to use for children, or %NULL to use parent environment.
+ * @use_parent: if this is %TRUE, a handler will be launched even if it is
+ * identical to the parent binary.
+ * @priority: a value from %GNOME_VFS_PRIORITY_MIN to %GNOME_VFS_PRIORITY_MAX
+ * (normally should be %GNOME_VFS_PRIORITY_DEFAULT) indicating the priority to
+ * assign to this job in allocating threads from the thread pool.
+ * @callback: #GnomeVFSAsyncShowCallback to be called when the operation is
+ * complete.
+ * @user_data: data to pass to @callback.
+ *
+ * This asynchronously does the same as gnome_vfs_show_cancellable_uri().
+ **/
+void
+gnome_vfs_async_show_uri (GnomeVFSAsyncHandle **handle_return,
+			  GnomeVFSURI *uri,
+			  char **envp,
+			  gboolean use_parent,
+			  int priority,
+			  GnomeVFSAsyncShowCallback callback,
+			  gpointer callback_data)
+{
+	g_return_if_fail (handle_return != NULL);
+	g_return_if_fail (uri != NULL);
+	g_return_if_fail (callback != NULL);
+	g_return_if_fail (priority >= GNOME_VFS_PRIORITY_MIN);
+	g_return_if_fail (priority <= GNOME_VFS_PRIORITY_MAX);
+
+	*handle_return = async_show (uri, envp, use_parent, priority,
+				     callback, callback_data);
+}
+
 #ifdef OLD_CONTEXT_DEPRECATED
 
 guint
Index: libgnomevfs/gnome-vfs-async-ops.h
===================================================================
RCS file: /cvs/gnome/gnome-vfs/libgnomevfs/gnome-vfs-async-ops.h,v
retrieving revision 1.38
diff -u -p -r1.38 gnome-vfs-async-ops.h
--- libgnomevfs/gnome-vfs-async-ops.h	6 May 2005 11:52:40 -0000	1.38
+++ libgnomevfs/gnome-vfs-async-ops.h	3 Apr 2006 08:42:13 -0000
@@ -259,13 +259,29 @@ typedef void	(* GnomeVFSAsyncDirectoryLo
  * (depending on the particular state of @info->status) should be returned
  * informing the transfer engine how to proceed.
  *
- * Return value: 0 or an item from #GnomeVFSXferErrorAction or #GnomeVFSOverwriteAction
+ * For details see #GnomeVFSXferProgressCallback.
+ *
+ * Return value: 0 or an item from #GnomeVFSXferErrorAction or #GnomeVFSOverwriteAction.
  **/
 typedef gint    (* GnomeVFSAsyncXferProgressCallback)
 						(GnomeVFSAsyncHandle *handle,
 						 GnomeVFSXferProgressInfo *info,
 						 gpointer data);
 
+/**
+ * GnomeVFSAsyncShowCallback:
+ * @handle: handle of the show operation generating the callback
+ * @result: result of the operation.
+ * @data: user data defined when the operation was established.
+ *
+ * Callback for the gnome_vfs_async_show() and gnome_vfs_async_show_uri()
+ * function.
+ **/
+typedef void    (* GnomeVFSAsyncShowCallback)
+						(GnomeVFSAsyncHandle *handle,
+						 GnomeVFSResult       result,
+						 gpointer             user_data);
+
 struct _GnomeVFSFindDirectoryResult {
 	GnomeVFSURI *uri;
 	GnomeVFSResult result;
@@ -454,6 +470,22 @@ void           gnome_vfs_async_file_cont
 						       GDestroyNotify                         operation_data_destroy_func,
 						       GnomeVFSAsyncFileControlCallback       callback,
 						       gpointer                               callback_data);
+
+void           gnome_vfs_async_show                   (GnomeVFSAsyncHandle **handle_return,
+						       const char   *text_uri,
+						       char  **envp,
+						       gboolean      use_parent,
+						       int           priority,
+						       GnomeVFSAsyncShowCallback callback,
+						       gpointer user_data);
+
+void           gnome_vfs_async_show_uri               (GnomeVFSAsyncHandle **handle_return,
+						       GnomeVFSURI  *uri,
+						       char  **envp,
+						       gboolean      use_parent,
+						       int           priority,
+						       GnomeVFSAsyncShowCallback callback,
+						       gpointer user_data);
 
 G_END_DECLS
 
Index: libgnomevfs/gnome-vfs-cancellable-ops.h
===================================================================
RCS file: /cvs/gnome/gnome-vfs/libgnomevfs/gnome-vfs-cancellable-ops.h,v
retrieving revision 1.21
diff -u -p -r1.21 gnome-vfs-cancellable-ops.h
--- libgnomevfs/gnome-vfs-cancellable-ops.h	19 Dec 2002 17:57:19 -0000	1.21
+++ libgnomevfs/gnome-vfs-cancellable-ops.h	3 Apr 2006 08:42:13 -0000
@@ -24,6 +24,7 @@
 #ifndef GNOME_VFS_CANCELLABLE_OPS_H
 #define GNOME_VFS_CANCELLABLE_OPS_H
 
+#include <libgnomevfs/gnome-vfs-context.h>
 #include <libgnomevfs/gnome-vfs-directory.h>
 #include <libgnomevfs/gnome-vfs-find-directory.h>
 #include <libgnomevfs/gnome-vfs-handle.h>
@@ -156,6 +157,17 @@ GnomeVFSResult  gnome_vfs_file_control_c
                                         (GnomeVFSHandle *handle,
 					 const char *operation,
 					 gpointer operation_data,
+					 GnomeVFSContext *context);
+
+GnomeVFSResult	gnome_vfs_show_uri_cancellable
+					(GnomeVFSURI *uri,
+					 char **envp,
+					 gboolean use_parent_exec,
+					 GnomeVFSContext *context);
+GnomeVFSResult	gnome_vfs_show_cancellable
+					(const char *text_uri,
+					 char **envp,
+					 gboolean use_parent_exec,
 					 GnomeVFSContext *context);
 
 G_END_DECLS
Index: libgnomevfs/gnome-vfs-job.c
===================================================================
RCS file: /cvs/gnome/gnome-vfs/libgnomevfs/gnome-vfs-job.c,v
retrieving revision 1.106
diff -u -p -r1.106 gnome-vfs-job.c
--- libgnomevfs/gnome-vfs-job.c	2 Dec 2005 18:25:17 -0000	1.106
+++ libgnomevfs/gnome-vfs-job.c	3 Apr 2006 08:42:25 -0000
@@ -103,6 +103,7 @@ _gnome_vfs_job_complete (GnomeVFSJob *jo
 	case GNOME_VFS_OP_READ_WRITE_DONE:
 	case GNOME_VFS_OP_FILE_CONTROL:
 	case GNOME_VFS_OP_SEEK:
+	case GNOME_VFS_OP_SHOW:
 		return FALSE;
 	
 	default:
@@ -307,6 +308,15 @@ dispatch_file_control_callback (GnomeVFS
 }
 
 static void
+dispatch_show_callback (GnomeVFSNotifyResult *notify_result)
+{
+	notify_result->specifics.show.callback (notify_result->job_handle,
+						notify_result->specifics.show.result,
+						notify_result->specifics.show.callback_data);
+}
+
+
+static void
 empty_close_callback (GnomeVFSAsyncHandle *handle,
 		      GnomeVFSResult result,
 		      gpointer callback_data)
@@ -370,6 +380,7 @@ _gnome_vfs_job_destroy_notify_result (Gn
 	case GNOME_VFS_OP_OPEN:
 	case GNOME_VFS_OP_OPEN_AS_CHANNEL:
 	case GNOME_VFS_OP_READ:
+	case GNOME_VFS_OP_SHOW:
 		g_free (notify_result);
 		break;
 		
@@ -581,6 +592,9 @@ dispatch_job_callback (gpointer data)
 	case GNOME_VFS_OP_FILE_CONTROL:
 		dispatch_file_control_callback (notify_result);
 		break;
+	case GNOME_VFS_OP_SHOW:
+		dispatch_show_callback (notify_result);
+		break;
 	default:
 		g_assert_not_reached ();
 		break;
@@ -729,6 +743,10 @@ gnome_vfs_op_destroy (GnomeVFSOp *op)
 	case GNOME_VFS_OP_FILE_CONTROL:
 		g_free (op->specifics.file_control.operation);
 		break;
+	case GNOME_VFS_OP_SHOW:
+		gnome_vfs_uri_unref (op->specifics.show.uri);
+		g_strfreev (op->specifics.show.envp);
+		break;
 	default:
 		g_warning (_("Unknown operation type %u"), op->type);
 	}
@@ -1626,6 +1644,31 @@ execute_file_control (GnomeVFSJob *job)
 }
 
 
+static void
+execute_show (GnomeVFSJob *job)
+{
+	GnomeVFSShowOp *show_op;
+	GnomeVFSNotifyResult *notify_result;
+
+	show_op = &job->op->specifics.show;
+
+	notify_result = g_new0 (GnomeVFSNotifyResult, 1);
+	notify_result->job_handle = job->job_handle;
+	notify_result->type = job->op->type;
+	notify_result->specifics.show.callback = (GnomeVFSAsyncShowCallback) job->op->callback;
+	notify_result->specifics.show.callback_data = job->op->callback_data;
+
+	notify_result->specifics.show.result = gnome_vfs_show_uri_cancellable (show_op->uri,
+									       show_op->envp,
+									       show_op->use_parent,
+									       job->op->context);
+
+	job->op->type = GNOME_VFS_OP_SHOW;
+
+	job_oneway_notify (job, notify_result);
+}
+
+
 /*
  * _gnome_vfs_job_execute:
  * @job: the job to execute
@@ -1693,6 +1736,9 @@ _gnome_vfs_job_execute (GnomeVFSJob *job
 			break;
 		case GNOME_VFS_OP_FILE_CONTROL:
 			execute_file_control (job);
+			break;
+		case GNOME_VFS_OP_SHOW:
+			execute_show (job);
 			break;
 		default:
 			g_warning (_("Unknown job kind %u"), job->op->type);
Index: libgnomevfs/gnome-vfs-job.h
===================================================================
RCS file: /cvs/gnome/gnome-vfs/libgnomevfs/gnome-vfs-job.h,v
retrieving revision 1.54
diff -u -p -r1.54 gnome-vfs-job.h
--- libgnomevfs/gnome-vfs-job.h	17 Jan 2006 00:10:43 -0000	1.54
+++ libgnomevfs/gnome-vfs-job.h	3 Apr 2006 08:42:27 -0000
@@ -104,7 +104,8 @@ enum GnomeVFSOpType {
 	GNOME_VFS_OP_GET_FILE_INFO,
 	GNOME_VFS_OP_SET_FILE_INFO,
 	GNOME_VFS_OP_MODULE_CALLBACK,
-	GNOME_VFS_OP_FILE_CONTROL
+	GNOME_VFS_OP_FILE_CONTROL,
+	GNOME_VFS_OP_SHOW
 };
 
 typedef enum GnomeVFSOpType GnomeVFSOpType;
@@ -310,6 +311,18 @@ typedef struct {
 	GDestroyNotify operation_data_destroy_func;
 } GnomeVFSFileControlOpResult;
 
+typedef struct {
+	GnomeVFSURI *uri;
+	char **envp;
+	gboolean use_parent;
+} GnomeVFSShowOp;
+
+typedef struct {
+	GnomeVFSAsyncShowCallback callback;
+	void *callback_data;
+	GnomeVFSResult result;
+} GnomeVFSShowOpResult;
+
 typedef union {
 	GnomeVFSOpenOp open;
 	GnomeVFSOpenAsChannelOp open_as_channel;
@@ -326,6 +339,7 @@ typedef union {
 	GnomeVFSSetFileInfoOp set_file_info;
 	GnomeVFSFindDirectoryOp find_directory;
 	GnomeVFSFileControlOp file_control;
+	GnomeVFSShowOp show;
 } GnomeVFSSpecificOp;
 
 typedef struct {
@@ -360,6 +374,7 @@ typedef union {
 	GnomeVFSXferOpResult xfer;
 	GnomeVFSModuleCallbackOpResult callback;
 	GnomeVFSFileControlOpResult file_control;
+	GnomeVFSShowOpResult show;
 } GnomeVFSSpecificNotifyResult;
 
 typedef struct {
Index: libgnomevfs/gnome-vfs-mime-private.h
===================================================================
RCS file: /cvs/gnome/gnome-vfs/libgnomevfs/gnome-vfs-mime-private.h,v
retrieving revision 1.12
diff -u -p -r1.12 gnome-vfs-mime-private.h
--- libgnomevfs/gnome-vfs-mime-private.h	6 Feb 2006 10:55:55 -0000	1.12
+++ libgnomevfs/gnome-vfs-mime-private.h	3 Apr 2006 08:42:27 -0000
@@ -25,6 +25,7 @@
 
 #include <libgnomevfs/gnome-vfs-mime-monitor.h>
 #include <libgnomevfs/gnome-vfs-mime-handlers.h>
+#include <libgnomevfs/gnome-vfs-context.h>
 
 G_BEGIN_DECLS
 
@@ -41,8 +42,13 @@ gboolean         _gnome_vfs_file_date_tr
 void             _gnome_vfs_mime_info_mark_gnome_mime_dir_dirty  (void);
 void             _gnome_vfs_mime_info_mark_user_mime_dir_dirty   (void);
 
-GnomeVFSResult _gnome_vfs_get_slow_mime_type_internal (const char  *text_uri,
-						       char       **mime_type);
+GnomeVFSResult _gnome_vfs_get_slow_mime_type_internal     (const char       *text_uri,
+							   char            **mime_type,
+							   GnomeVFSContext  *context);
+
+GnomeVFSResult _gnome_vfs_get_slow_mime_type_uri_internal (GnomeVFSURI     *uri,
+							   char           **mime_type,
+							   GnomeVFSContext *context);
 
 G_END_DECLS
 
Index: libgnomevfs/gnome-vfs-mime.c
===================================================================
RCS file: /cvs/gnome/gnome-vfs/libgnomevfs/gnome-vfs-mime.c,v
retrieving revision 1.63
diff -u -p -r1.63 gnome-vfs-mime.c
--- libgnomevfs/gnome-vfs-mime.c	16 Jan 2006 15:10:17 -0000	1.63
+++ libgnomevfs/gnome-vfs-mime.c	3 Apr 2006 08:42:28 -0000
@@ -28,6 +28,7 @@
 #include "gnome-vfs-mime.h"
 #include "xdgmime.h"
 
+#include "gnome-vfs-cancellable-ops.h"
 #include "gnome-vfs-mime-private.h"
 #include "gnome-vfs-mime-sniff-buffer-private.h"
 #include "gnome-vfs-mime-utils.h"
@@ -918,7 +919,7 @@ gnome_vfs_get_slow_mime_type (const char
 	GnomeVFSResult result;
 	char *ret;
 
-	result = _gnome_vfs_get_slow_mime_type_internal (text_uri, &ret);
+	result = _gnome_vfs_get_slow_mime_type_internal (text_uri, &ret, NULL);
 	g_assert (result == GNOME_VFS_OK || ret == NULL);
 
 	return ret;
@@ -926,26 +927,56 @@ gnome_vfs_get_slow_mime_type (const char
 
 /* This is private due to the feature freeze, maybe it should be public */
 GnomeVFSResult
-_gnome_vfs_get_slow_mime_type_internal (const char  *text_uri,
-					char       **mime_type)
+_gnome_vfs_get_slow_mime_type_internal (const char       *text_uri,
+					char            **mime_type,
+					GnomeVFSContext  *context)
+{
+	GnomeVFSURI *uri;
+	GnomeVFSResult result;
+
+	g_assert (mime_type != NULL);
+
+	uri = gnome_vfs_uri_new (text_uri);
+	if (uri == NULL) {
+		*mime_type = NULL;
+		return GNOME_VFS_ERROR_INVALID_URI;
+	}
+
+	result = _gnome_vfs_get_slow_mime_type_uri_internal
+		(uri, mime_type, context);
+
+	gnome_vfs_uri_unref (uri);
+
+	return result;
+}
+
+
+GnomeVFSResult
+_gnome_vfs_get_slow_mime_type_uri_internal (GnomeVFSURI      *uri,
+					    char            **mime_type,
+					    GnomeVFSContext  *context)
 {
 	GnomeVFSFileInfo *info;
 	GnomeVFSResult result;
 
 	g_assert (mime_type != NULL);
 
+	*mime_type = NULL;
+
+	g_return_val_if_fail (uri != NULL, GNOME_VFS_ERROR_BAD_PARAMETERS);
+
 	info = gnome_vfs_file_info_new ();
-	result = gnome_vfs_get_file_info (text_uri, info,
-					  GNOME_VFS_FILE_INFO_GET_MIME_TYPE |
-					  GNOME_VFS_FILE_INFO_FORCE_SLOW_MIME_TYPE |
-					  GNOME_VFS_FILE_INFO_FOLLOW_LINKS);
+	result = gnome_vfs_get_file_info_uri_cancellable
+		(uri, info,
+		 GNOME_VFS_FILE_INFO_GET_MIME_TYPE |
+		 GNOME_VFS_FILE_INFO_FORCE_SLOW_MIME_TYPE |
+		 GNOME_VFS_FILE_INFO_FOLLOW_LINKS,
+		 context);
 	if (result == GNOME_VFS_OK && info->mime_type == NULL) {
 		result = GNOME_VFS_ERROR_GENERIC;
 	}
 
-	if (result != GNOME_VFS_OK) {
-		*mime_type = NULL;
-	} else {
+	if (result == GNOME_VFS_OK) {
 		*mime_type = g_strdup (info->mime_type);
 	}
 
Index: libgnomevfs/gnome-vfs-module-callback.h
===================================================================
RCS file: /cvs/gnome/gnome-vfs/libgnomevfs/gnome-vfs-module-callback.h,v
retrieving revision 1.3
diff -u -p -r1.3 gnome-vfs-module-callback.h
--- libgnomevfs/gnome-vfs-module-callback.h	9 Apr 2003 16:59:11 -0000	1.3
+++ libgnomevfs/gnome-vfs-module-callback.h	3 Apr 2006 08:42:29 -0000
@@ -32,6 +32,19 @@
 
 G_BEGIN_DECLS
 
+/**
+ * GnomeVFSModuleCallback:
+ * @in: data passed from module to application.
+ * @in_size: size of @in bytes.
+ * @out: data passed from application to module.
+ * @out_size: size of @out in bytes.
+ * @callback_data: user data passed when connecting the callback.
+ *
+ * Modules use a #GnomeVFSModuleCallback to send data to
+ * client applications and request data from them synchronously.
+ *
+ * The format of @in and @out is determined by the callback name.
+ **/
 typedef void (* GnomeVFSModuleCallback) (gconstpointer in,
 					 gsize         in_size,
 					 gpointer      out,
@@ -40,6 +53,24 @@ typedef void (* GnomeVFSModuleCallback) 
 
 typedef void (* GnomeVFSModuleCallbackResponse) (gpointer response_data);
 
+/**
+ * GnomeVFSAsyncModuleCallback:
+ * @in: data passed from module to application.
+ * @in_size: size of @in bytes.
+ * @out: data passed from application to module.
+ * @out_size: size of @out in bytes.
+ * @response: #GnomeVFSModuleCallbackResponse that must be invoked when the request is satisfied.
+ * @response_data: data that must be passed to @response when the request is satisfied.
+ * @callback_data: user data passed when connecting the callback.
+ *
+ * Modules use a #GnomeVFSModuleCallback to send data to
+ * client applications and request data from them asynchronously.
+ *
+ * The application is expected to invoke the @response with @response_data
+ * when it is able to satisfy the request.
+ *
+ * The format of @in and @out is determined by the callback name.
+ **/
 typedef void (* GnomeVFSAsyncModuleCallback) (gconstpointer                  in,
 					      gsize                          in_size,
 					      gpointer                       out,
Index: libgnomevfs/gnome-vfs-private-utils.c
===================================================================
RCS file: /cvs/gnome/gnome-vfs/libgnomevfs/gnome-vfs-private-utils.c,v
retrieving revision 1.33
diff -u -p -r1.33 gnome-vfs-private-utils.c
--- libgnomevfs/gnome-vfs-private-utils.c	9 May 2005 13:27:43 -0000	1.33
+++ libgnomevfs/gnome-vfs-private-utils.c	3 Apr 2006 08:42:30 -0000
@@ -36,6 +36,7 @@
 #include <glib/gmessages.h>
 #include <glib/gstrfuncs.h>
 #include <gconf/gconf-client.h>
+#include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 #include <sys/types.h>
@@ -506,8 +507,10 @@ _gnome_vfs_use_handler_for_scheme (const
 
 /**
  * _gnome_vfs_url_show_using_handler_with_env:
- * @url: the url to show
- * @envp: environment for the handler
+ * @uri: the #GnomeVFSURI to show.
+ * @envp: environment for the handler.
+ * @use_parent: whether the parent binary should
+ * be used if it is the handler.
  * 
  * Same as gnome_url_show_using_handler except that the handler
  * will be launched with the given environment.
@@ -522,27 +525,28 @@ _gnome_vfs_use_handler_for_scheme (const
  * Since: 2.4
  */
 GnomeVFSResult
-_gnome_vfs_url_show_using_handler_with_env (const char  *url,
-			                    char       **envp)
+_gnome_vfs_show_using_handler_with_env (GnomeVFSURI *uri,
+			                char       **envp,
+					gboolean     use_parent)
 {
 	GConfClient *client;
 	char *path;
-	char *scheme;
+	const char *scheme;
 	char *template;
 	char **argv;
+	char *text_uri;
 	int argc;
 	int i;
 	gboolean ret;
 	
-	g_return_val_if_fail (url != NULL, GNOME_VFS_ERROR_BAD_PARAMETERS);
-	
-	scheme = gnome_vfs_get_uri_scheme (url);
-	
+	g_return_val_if_fail (uri != NULL, GNOME_VFS_ERROR_BAD_PARAMETERS);
+
+	scheme = gnome_vfs_uri_get_scheme (uri);
+
 	g_return_val_if_fail (scheme != NULL, GNOME_VFS_ERROR_BAD_PARAMETERS);
 	
 	if (!gconf_is_initialized ()) {
 		if (!gconf_init (0, NULL, NULL)) {
-			g_free (scheme);
 			return GNOME_VFS_ERROR_INTERNAL;
 		}
 	}
@@ -552,9 +556,8 @@ _gnome_vfs_url_show_using_handler_with_e
 	template = gconf_client_get_string (client, path, NULL);
 	g_free (path);
 
-	if (template == NULL) {
+	if (template == NULL || (!use_parent && _gnome_vfs_cmd_matches_cmdline (template))) {
 		g_free (template);
-		g_free (scheme);
 		g_object_unref (G_OBJECT (client));
 		return GNOME_VFS_ERROR_NO_HANDLER;
 	}
@@ -564,7 +567,6 @@ _gnome_vfs_url_show_using_handler_with_e
 				 &argv,
 				 NULL)) {
 		g_free (template);
-		g_free (scheme);
 		g_object_unref (G_OBJECT (client));
 		return GNOME_VFS_ERROR_PARSE;
 	}
@@ -575,16 +577,16 @@ _gnome_vfs_url_show_using_handler_with_e
 	if (gconf_client_get_bool (client, path, NULL)) {
 		if (!_gnome_vfs_prepend_terminal_to_vector (&argc, &argv)) {
 			g_free (path);
-			g_free (scheme);
 			g_strfreev (argv);
 			return GNOME_VFS_ERROR_INTERNAL;
 		}
 	}
 	g_free (path);
-	g_free (scheme);
 	
 	g_object_unref (G_OBJECT (client));
 
+	text_uri = gnome_vfs_uri_to_string (uri, GNOME_VFS_URI_HIDE_NONE);
+
 	for (i = 0; i < argc; i++) {
 		char *arg;
 		char **strs;
@@ -599,12 +601,14 @@ _gnome_vfs_url_show_using_handler_with_e
 		arg = argv[i];
 
 		strs = g_strsplit (argv[i], "%s", 0);
-		argv[i] = g_strjoinv (url, strs);
+		argv[i] = g_strjoinv (text_uri, strs);
 		g_strfreev (strs);
 
 		g_free (arg);
 	}
 
+	g_free (text_uri);
+
 	ret = g_spawn_async (NULL /* working directory */,
 			     argv,
 			     envp,
@@ -759,6 +763,72 @@ _gnome_vfs_prepend_terminal_to_vector (i
 	return FALSE;
 #endif /* G_OS_WIN32 */
 }		  
+
+/*
+ * _gnome_vfs_cmd_matches_cmdline:
+ * @cmd: a command.
+ *
+ * Returns: %TRUE iff @cmd matches the command used
+ * for the current process.
+ **/
+gboolean
+_gnome_vfs_cmd_matches_cmdline (const char *cmd)
+{
+#ifndef G_OS_WIN32
+	char *real_cmd;
+	char *tmp;
+	char self_cmd[BUFSIZ];
+	char *real_self_cmd;
+	int fdes;
+	ssize_t bytes_read;
+	gboolean ret;
+
+	if (cmd == NULL) {
+		return FALSE;
+	}
+
+	tmp = strchr (cmd, ' ');
+	tmp = tmp ? g_strndup (cmd, tmp - cmd) : g_strdup (cmd);
+
+	real_cmd = g_find_program_in_path (tmp);
+	g_free (tmp);
+
+	if (real_cmd == NULL) {
+		return FALSE;
+	}
+
+	tmp = g_strdup_printf ("/proc/%d/cmdline", getpid ());
+	fdes = open (tmp, O_RDONLY, 0);
+	g_free (tmp);
+
+	if (fdes == -1) {
+		g_free (real_cmd);
+		return FALSE;
+	}
+
+	bytes_read = read (fdes, self_cmd, BUFSIZ-1);
+	if (bytes_read == 0) {
+		g_free (real_cmd);
+		close (fdes);
+		return FALSE;
+	}	
+
+	close (fdes);
+
+	self_cmd[bytes_read-1] = '\0';
+
+	real_self_cmd = g_find_program_in_path (self_cmd);
+
+	ret = real_self_cmd != NULL && !strcmp (real_self_cmd, real_cmd);
+
+	g_free (real_cmd);
+	g_free (real_self_cmd);
+
+	return ret;
+#else
+	return FALSE;
+#endif /* G_OS_WIN32 */
+}
 
 #ifndef G_OS_WIN32
 /**
Index: libgnomevfs/gnome-vfs-private-utils.h
===================================================================
RCS file: /cvs/gnome/gnome-vfs/libgnomevfs/gnome-vfs-private-utils.h,v
retrieving revision 1.25
diff -u -p -r1.25 gnome-vfs-private-utils.h
--- libgnomevfs/gnome-vfs-private-utils.h	14 Apr 2005 18:48:29 -0000	1.25
+++ libgnomevfs/gnome-vfs-private-utils.h	3 Apr 2006 08:42:30 -0000
@@ -89,8 +89,9 @@ GnomeVFSResult  _gnome_vfs_uri_resolve_a
 gboolean  _gnome_vfs_uri_is_in_subdir (GnomeVFSURI *uri, GnomeVFSURI *dir);
 
 
-GnomeVFSResult _gnome_vfs_url_show_using_handler_with_env (const char   *url,
-                                                           char        **envp);
+GnomeVFSResult _gnome_vfs_show_using_handler_with_env (GnomeVFSURI  *uri,
+                                                       char        **envp,
+						       gboolean      use_parent);
 gboolean       _gnome_vfs_use_handler_for_scheme          (const char   *scheme);
 
 gboolean       _gnome_vfs_prepend_terminal_to_vector      (int          *argc,
@@ -102,6 +103,8 @@ gboolean       _gnome_vfs_socket_set_blo
 int	       _gnome_vfs_pipe				  (int       *fds);
 gboolean       _gnome_vfs_pipe_set_blocking               (int        pipe_fd,
 							   gboolean   blocking);
+
+gboolean       _gnome_vfs_cmd_matches_cmdline             (const char *cmd);
 
 #ifdef G_OS_WIN32
 void	       _gnome_vfs_map_winsock_error_to_errno	  (void);
Index: libgnomevfs/gnome-vfs-utils.c
===================================================================
RCS file: /cvs/gnome/gnome-vfs/libgnomevfs/gnome-vfs-utils.c,v
retrieving revision 1.108
diff -u -p -r1.108 gnome-vfs-utils.c
--- libgnomevfs/gnome-vfs-utils.c	3 Mar 2006 09:28:21 -0000	1.108
+++ libgnomevfs/gnome-vfs-utils.c	3 Apr 2006 08:42:37 -0000
@@ -32,11 +32,13 @@
 #endif
 #include "gnome-vfs-utils.h"
 
+#include "gnome-vfs-cancellable-ops.h"
 #include "gnome-vfs-private-utils.h"
 #include "gnome-vfs-ops.h"
 #include "gnome-vfs-mime-handlers.h"
 #include "gnome-vfs-mime-private.h"
 #include "gnome-vfs-method.h"
+#include "gnome-vfs-uri.h"
 #include <glib.h>
 #include <glib/gi18n-lib.h>
 #include <glib/gstdio.h>
@@ -2152,8 +2154,10 @@ _gnome_vfs_uri_is_in_subdir (GnomeVFSURI
  * Also error codes from gnome_vfs_mime_action_launch()
  * or gnome_vfs_mime_action_launch_with_env().
  *
+ * This function is a wrapper around gnome_vfs_show_cancellable().
+ *
  * Since: 2.4
- */
+ **/
 GnomeVFSResult
 gnome_vfs_url_show (const char *url)
 {
@@ -2161,65 +2165,138 @@ gnome_vfs_url_show (const char *url)
 }
 
 /**
- * gnome_vfs_url_show_with_env:
+ * gnome_vfs_url_show_with_env:
  * @url: url to be shown.
- * @envp: environment data.
+ * @envp: environment to use, or %NULL to use parent's.
  * 
- * Like gnome_vfs_url_show() except that the default action will be launched
- * with the given environment.
+ * Launches the default application or component associated with the given @url
+ * and the given environment @envp.
  *
- * Return value: %GNOME_VFS_OK if the default action was launched.
+ * Return value: %GNOME_VFS_OK if the default action was launched,
  * %GNOME_VFS_ERROR_BAD_PARAMETERS for an invalid or non-existant @url,
  * %GNOME_VFS_ERROR_NO_DEFAULT if no default action is associated with the @url.
- * Also error codes from gnome_vfs_mime_application_launch_with_env()
+ * Also error codes from gnome_vfs_mime_action_launch()
  * or gnome_vfs_mime_action_launch_with_env().
  *
+ * This function is a wrapper around gnome_vfs_show_cancellable().
+ *
  * Since: 2.4
- */
+ **/
 GnomeVFSResult
 gnome_vfs_url_show_with_env (const char  *url,
                              char       **envp)
 {
+	return gnome_vfs_show_cancellable (url, envp, TRUE, NULL);
+}
+
+/**
+ * gnome_vfs_show_cancellable:
+ * @text_uri: a textual URI pointing to the resource that should be shown.
+ * @envp: environment to use for children, or %NULL to use parent environment.
+ * @use_parent: if this is %TRUE, a handler will be launched even if it is
+ * identical to the parent binary.
+ *
+ * Return value: %GNOME_VFS_OK if the default action was launched.
+ * %GNOME_VFS_ERROR_BAD_PARAMETERS for an invalid or non-existant @url,
+ * %GNOME_VFS_ERROR_NO_DEFAULT if no default action is associated with the
+ * @url, or the application was filtered out through @use_parent.
+ *
+ * Also error codes from gnome_vfs_mime_application_launch_with_env()
+ * or gnome_vfs_mime_action_launch_with_env().
+ *
+ * Since: 2.16
+ */
+GnomeVFSResult
+gnome_vfs_show_cancellable (const char *text_uri,
+			    char **envp,
+			    gboolean use_parent,
+			    GnomeVFSContext *context)
+{
+	GnomeVFSURI *uri;
+	GnomeVFSResult result;
+
+	uri = gnome_vfs_uri_new (text_uri);
+	if (uri == NULL) {
+		return GNOME_VFS_ERROR_INVALID_URI;
+	}
+
+	result = gnome_vfs_show_uri_cancellable
+		(uri, envp, use_parent, context);
+
+	gnome_vfs_uri_unref (uri);
+
+	return result;
+}
+
+/**
+ * gnome_vfs_show_uri_cancellable:
+ * @text_uri: a textual URI pointing to the resource that should be shown.
+ * @envp: environment to use for children, or %NULL to use parent environment.
+ * @use_parent: if this is %TRUE, a handler will be launched even if it is
+ * identical to the parent binary.
+ *
+ * Return value: %GNOME_VFS_OK if the default action was launched.
+ * %GNOME_VFS_ERROR_BAD_PARAMETERS for an invalid or non-existant @url,
+ * %GNOME_VFS_ERROR_NO_DEFAULT if no default action is associated with the @url,
+ * or the application was filtered out through @use_parent.
+ *
+ * Also error codes from gnome_vfs_mime_application_launch_with_env()
+ * or gnome_vfs_mime_action_launch_with_env().
+ *
+ * Since: 2.16
+ */
+GnomeVFSResult
+gnome_vfs_show_uri_cancellable (GnomeVFSURI *uri,
+				char **envp,
+				gboolean use_parent,
+				GnomeVFSContext *context)
+{
 	GnomeVFSMimeApplication *app;
 	GnomeVFSMimeAction *action;
 	GnomeVFSResult result;
 	GList params;
 	char *type;
-	char *scheme;
+	const char *scheme;
+
+	g_return_val_if_fail (uri != NULL, GNOME_VFS_ERROR_BAD_PARAMETERS);
 
-	g_return_val_if_fail (url != NULL, GNOME_VFS_ERROR_BAD_PARAMETERS);
+	if (gnome_vfs_context_check_cancellation (context)) {
+		return GNOME_VFS_ERROR_CANCELLED;
+	}
 
-	scheme = gnome_vfs_get_uri_scheme (url);
+	scheme = gnome_vfs_uri_get_scheme (uri);
 	if (scheme == NULL) {
 		return GNOME_VFS_ERROR_BAD_PARAMETERS;
 	}
 	
 	/* check if this scheme requires special handling */
 	if (_gnome_vfs_use_handler_for_scheme (scheme)) {
-		result = _gnome_vfs_url_show_using_handler_with_env (url, envp);
-		g_free (scheme);
+		result = _gnome_vfs_show_using_handler_with_env (uri, envp, use_parent);
 		return result;
 	}
-	
-	g_free (scheme);
 
-	result = _gnome_vfs_get_slow_mime_type_internal (url, &type);
+	result = _gnome_vfs_get_slow_mime_type_uri_internal (uri, &type, context);
 	if (result != GNOME_VFS_OK) {
 		return result;
 	}
 	
-	params.data = (char *) url;
+	params.data = gnome_vfs_uri_to_string (uri, GNOME_VFS_URI_HIDE_NONE);
 	params.prev = NULL;
 	params.next = NULL;
 
-	app = gnome_vfs_mime_get_default_application_for_uri (url, type);
+	app = gnome_vfs_mime_get_default_application_for_uri (params.data, type);
 	
-	if (app != NULL) {
+	if (app != NULL && (use_parent ||
+			    !_gnome_vfs_cmd_matches_cmdline
+			    	(gnome_vfs_mime_application_get_exec (app)))) {
 		result = gnome_vfs_mime_application_launch_with_env (app, &params, envp);
 		gnome_vfs_mime_application_free (app);
 		g_free (type);
+		g_free (params.data);
 		return result;
 	}
+
+	g_free (params.data);
 	
 	action = gnome_vfs_mime_get_default_action (type);
 	
Index: libgnomevfs/gnome-vfs-utils.h
===================================================================
RCS file: /cvs/gnome/gnome-vfs/libgnomevfs/gnome-vfs-utils.h,v
retrieving revision 1.42
diff -u -p -r1.42 gnome-vfs-utils.h
--- libgnomevfs/gnome-vfs-utils.h	10 Apr 2005 20:46:54 -0000	1.42
+++ libgnomevfs/gnome-vfs-utils.h	3 Apr 2006 08:42:37 -0000
@@ -181,8 +181,7 @@ char * gnome_vfs_make_uri_full_from_rela
 
 GnomeVFSResult gnome_vfs_url_show                        (const char   *url);
 GnomeVFSResult gnome_vfs_url_show_with_env               (const char   *url, 
-                                                          char        **envp);
-
+							  char        **envp);
 
 G_END_DECLS
 
