aboutsummaryrefslogtreecommitdiff
path: root/src/mimeview.c
diff options
context:
space:
mode:
authorhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2006-03-09 06:37:55 +0000
committerhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2006-03-09 06:37:55 +0000
commit39683eb5ab1e51c69ddf12a9da1ce0402f78380f (patch)
treed7f296191bfad70c9edf0c6fe10c42b2fe8ccb49 /src/mimeview.c
parent57da061f6ef7b0b005066dcf7fd5bd317f394339 (diff)
added a hidden option "mime_command" for backward compatibility.
git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@1035 ee746299-78ed-0310-b773-934348b2243d
Diffstat (limited to 'src/mimeview.c')
-rw-r--r--src/mimeview.c25
1 files changed, 18 insertions, 7 deletions
diff --git a/src/mimeview.c b/src/mimeview.c
index 5f4774bd..3a79811a 100644
--- a/src/mimeview.c
+++ b/src/mimeview.c
@@ -1126,8 +1126,7 @@ static void mimeview_view_file(const gchar *filename, MimeInfo *partinfo,
const gchar *cmdline)
{
const gchar *cmd = NULL;
- const gchar *p;
- gchar *cmdbuf;
+ gchar buf[BUFFSIZE];
if (!cmdline) {
#ifdef G_OS_WIN32
@@ -1155,16 +1154,28 @@ static void mimeview_view_file(const gchar *filename, MimeInfo *partinfo,
else if (MIME_TEXT_HTML == partinfo->mime_type)
cmd = prefs_common.uri_cmd;
if (!cmd) {
- procmime_execute_open_file
- (filename, partinfo->content_type);
- return;
+ if (prefs_common.mime_cmd) {
+ if (str_find_format_times
+ (prefs_common.mime_cmd, 's') == 2) {
+ g_snprintf(buf, sizeof(buf),
+ prefs_common.mime_cmd,
+ partinfo->content_type,
+ "%s");
+ cmd = buf;
+ } else
+ cmd = prefs_common.mime_cmd;
+ } else {
+ procmime_execute_open_file
+ (filename, partinfo->content_type);
+ return;
+ }
}
#endif
} else
cmd = cmdline;
- if (cmd && (p = strchr(cmd, '%')) && *(p + 1) == 's' &&
- !strchr(p + 2, '%')) {
+ if (cmd && str_find_format_times(cmd, 's') == 1) {
+ gchar *cmdbuf;
cmdbuf = g_strdup_printf(cmd, filename);
execute_command_line(cmdbuf, TRUE);
g_free(cmdbuf);