Hi, I try to add mutt support to nautilus-sendto (see the patch bellow).
As mutt needs to be open in a terminal window, I currently just add "gnome-terminal -e" command at the beginning of nst->mail_cmd. It works, but that's not very portable... I tried with g_app_info_create_from_commandline("mutt", "mutt", G_APP_INFO_NEEDS_TERMINAL, NULL), but it doesn't seem to work. So, I'm wondering if there is a generic way to get the sensible terminal. Thanks, Colin diff --git a/src/nautilus-sendto.c b/src/nautilus-sendto.c index c0b6fea..79c44fe 100644 --- a/src/nautilus-sendto.c +++ b/src/nautilus-sendto.c @@ -40,6 +40,7 @@ typedef enum { MAILER_BALSA, MAILER_SYLPHEED, MAILER_THUNDERBIRD, + MAILER_MUTT, } MailerType; typedef struct { @@ -72,6 +73,12 @@ get_evo_cmd (void) return retval; } +static void +set_mutt_cmd (NautilusSendto *nst) +{ + nst->mail_cmd = g_strdup_printf("gnome-terminal -e \"%s", nst->mail_cmd); +} + static gboolean init_mailer (NautilusSendto *nst) { @@ -92,6 +99,9 @@ init_mailer (NautilusSendto *nst) g_free (nst->mail_cmd); nst->mail_cmd = get_evo_cmd (); nst->type = MAILER_EVO; + } else if (strstr(nst->mail_cmd, "mutt")) { + set_mutt_cmd(nst); + nst->type = MAILER_MUTT; } else { /* Find what the default mailer is */ if (strstr (nst->mail_cmd, "balsa")) @@ -351,6 +361,26 @@ get_sylpheed_mailto (GString *mailto, } static void +get_mutt_mailto (NautilusSendto *nst, GString *mailto, GList *file_list) +{ + GList *l; + gchar *buf; + + g_string_append_printf (mailto, "-a "); + + buf = g_filename_from_uri(file_list->data, NULL, NULL); + g_string_append_printf (mailto, " %s", (char *)buf); + g_free(buf); + for (l = file_list->next ; l; l = l->next) { + buf = g_filename_from_uri(l->data, NULL, NULL); + g_string_append_printf (mailto, " %s", (char *)buf); + g_free(buf); + } + + g_string_append_printf(mailto, "\""); +} + +static void send_files (NautilusSendto *nst) { GString *mailto; @@ -374,6 +404,9 @@ send_files (NautilusSendto *nst) case MAILER_THUNDERBIRD: get_thunderbird_mailto (mailto, nst->file_list); break; + case MAILER_MUTT: + get_mutt_mailto (nst, mailto, nst->file_list); + break; case MAILER_EVO: default: get_evo_mailto (mailto, nst->file_list); -- nautilus-list mailing list nautilus-list@gnome.org https://mail.gnome.org/mailman/listinfo/nautilus-list