author: CarlsonLee(carlsonlee.freec@hotmail.com), 本代码是freecamera的一部分,freecamera源代码存在:http://gitorious.org/freecamera
static char * get_evo_cmd (void)
{
char *tmp = NULL;
char *retval;
char *cmds[] = {"evolution",
"evolution-2.0",
"evolution-2.2",
"evolution-2.4",
"evolution-2.6",
"evolution-2.8", /* for the future */
"evolution-3.0", /* but how far to go ? */
NULL};
guint i;
for (i = 0; cmds[i] != NULL; i++) {
tmp = g_find_program_in_path (cmds[i]);
if (tmp != NULL)
break;
}
if (tmp == NULL)
return NULL;
retval = g_strdup_printf ("%s --component=mail %%s", tmp);
g_free (tmp);
return retval;
}
void camutil_send_file(const char *file_name)
{
gchar *cmd;
GString *mailto;
char *mail_cmd = get_evo_cmd();
mailto = g_string_new ("");
g_string_append (mailto, "mailto:");
g_string_append (mailto, "/"/"");
g_string_append_printf (mailto,"?attach=/"%s/"", file_name);
cmd = g_strdup_printf (mail_cmd, mailto->str);
g_string_free (mailto, TRUE);
g_spawn_command_line_async (cmd, NULL);
g_free (cmd);
g_free (mail_cmd);
}