From 8736c6d840daeeb44716802f4af88892b5ad2615 Mon Sep 17 00:00:00 2001 From: Marco Pesenti Gritti Date: Wed, 23 Feb 2005 07:01:01 +0000 Subject: Use gnome-vfs API to launch external applications 2005-02-22 Marco Pesenti Gritti * mail/em-popup.c: (emp_apps_open_in), (emp_standard_menu_factory): Use gnome-vfs API to launch external applications svn path=/trunk/; revision=28862 --- mail/ChangeLog | 5 +++++ mail/em-popup.c | 39 ++++++++++++--------------------------- 2 files changed, 17 insertions(+), 27 deletions(-) diff --git a/mail/ChangeLog b/mail/ChangeLog index f407aa6629..f84ca8f964 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,3 +1,8 @@ +2005-02-22 Marco Pesenti Gritti + + * mail/em-popup.c: (emp_apps_open_in), (emp_standard_menu_factory): + Use gnome-vfs API to launch external applications + 2005-02-22 Not Zed ** See bug #40515 diff --git a/mail/em-popup.c b/mail/em-popup.c index 9672b4b362..ecda95612c 100644 --- a/mail/em-popup.c +++ b/mail/em-popup.c @@ -40,6 +40,7 @@ #include #include +#include #include #include "em-popup.h" @@ -567,32 +568,16 @@ emp_apps_open_in(EPopup *ep, EPopupItem *item, void *data) path = em_utils_temp_save_part(target->target.widget, target->part); if (path) { GnomeVFSMimeApplication *app = item->user_data; - int douri = (app->expects_uris == GNOME_VFS_MIME_APPLICATION_ARGUMENT_TYPE_URIS); - char *command; + char *uri; + GList *uris = NULL; - if (app->requires_terminal) { - char *term, *args = NULL; - GConfClient *gconf; - - gconf = gconf_client_get_default (); - if ((term = gconf_client_get_string (gconf, "/desktop/gnome/applications/terminal/exec", NULL))) - args = gconf_client_get_string (gconf, "/desktop/gnome/applications/terminal/exec_arg", NULL); - g_object_unref (gconf); - - if (term == NULL) - return; - - command = g_strdup_printf ("%s%s%s %s %s%s &", term, args ? " " : "", args ? args : "", - app->command, douri ? "file://" : "", path); - g_free (term); - g_free (args); - } else { - command = g_strdup_printf ("%s %s%s &", app->command, douri ? "file://" : "", path); - } - - /* FIXME: Do not use system here */ - system(command); - g_free(command); + uri = gnome_vfs_get_uri_from_local_path(path); + uris = g_list_append(uris, uri); + + gnome_vfs_mime_application_launch(app, uris); + + g_free(uri); + g_list_free(uris); g_free(path); } } @@ -642,7 +627,7 @@ emp_standard_menu_factory(EPopup *emp, void *data) break; } case EM_POPUP_TARGET_PART: { EMPopupTargetPart *t = (EMPopupTargetPart *)emp->target; - GList *apps = gnome_vfs_mime_get_short_list_applications(t->mime_type); + GList *apps = gnome_vfs_mime_get_all_applications(t->mime_type); /* FIXME: use the snoop_part stuff from em-format.c */ if (apps == NULL && strcmp(t->mime_type, "application/octet-stream") == 0) { @@ -657,7 +642,7 @@ emp_standard_menu_factory(EPopup *emp, void *data) else name_type = gnome_vfs_mime_type_from_name(filename); if (name_type) - apps = gnome_vfs_mime_get_short_list_applications(name_type); + apps = gnome_vfs_mime_get_all_applications(name_type); } } -- cgit v1.2.3