aboutsummaryrefslogtreecommitdiff
path: root/src
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
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')
-rw-r--r--src/compose.c6
-rw-r--r--src/inc.c5
-rw-r--r--src/messageview.c4
-rw-r--r--src/mimeview.c25
-rw-r--r--src/summaryview.c4
5 files changed, 24 insertions, 20 deletions
diff --git a/src/compose.c b/src/compose.c
index c6dc645e..7e34a88d 100644
--- a/src/compose.c
+++ b/src/compose.c
@@ -5440,7 +5440,6 @@ static void compose_exec_ext_editor(Compose *compose)
GPid pid;
static gchar *def_cmd = "emacs %s";
gchar buf[1024];
- gchar *p;
gchar **cmdline;
tmp = g_strdup_printf("%s%ctmpmsg-%p.txt", get_tmp_dir(),
@@ -5460,10 +5459,9 @@ static void compose_exec_ext_editor(Compose *compose)
#endif
if (prefs_common.ext_editor_cmd &&
- (p = strchr(prefs_common.ext_editor_cmd, '%')) &&
- *(p + 1) == 's' && !strchr(p + 2, '%')) {
+ str_find_format_times(prefs_common.ext_editor_cmd, 's') == 1)
g_snprintf(buf, sizeof(buf), prefs_common.ext_editor_cmd, tmp);
- } else {
+ else {
if (prefs_common.ext_editor_cmd)
g_warning(_("External editor command line is invalid: `%s'\n"),
prefs_common.ext_editor_cmd);
diff --git a/src/inc.c b/src/inc.c
index 87837327..c73985b0 100644
--- a/src/inc.c
+++ b/src/inc.c
@@ -182,10 +182,9 @@ static void inc_finished(MainWindow *mainwin, gint new_messages)
prefs_common.enable_newmsg_notify &&
prefs_common.newmsg_notify_cmd) {
gchar buf[1024];
- gchar *p;
- if ((p = strchr(prefs_common.newmsg_notify_cmd, '%')) &&
- *(p + 1) == 'd' && !strchr(p + 2, '%'))
+ if (str_find_format_times
+ (prefs_common.newmsg_notify_cmd, 'd') == 1)
g_snprintf(buf, sizeof(buf),
prefs_common.newmsg_notify_cmd,
new_messages);
diff --git a/src/messageview.c b/src/messageview.c
index 109801a5..4365778b 100644
--- a/src/messageview.c
+++ b/src/messageview.c
@@ -748,7 +748,6 @@ static void print_cb(gpointer data, guint action, GtkWidget *widget)
MessageView *messageview = (MessageView *)data;
const gchar *cmdline;
gchar *msg;
- gchar *p;
if (!messageview->msginfo) return;
@@ -765,8 +764,7 @@ static void print_cb(gpointer data, guint action, GtkWidget *widget)
}
g_free(msg);
- if (cmdline && (!(p = strchr(cmdline, '%')) || *(p + 1) != 's' ||
- strchr(p + 2, '%'))) {
+ if (cmdline && str_find_format_times(cmdline, 's') != 1) {
alertpanel_error(_("Print command line is invalid:\n`%s'"),
cmdline);
return;
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);
diff --git a/src/summaryview.c b/src/summaryview.c
index de3bc835..14cda4ed 100644
--- a/src/summaryview.c
+++ b/src/summaryview.c
@@ -3448,7 +3448,6 @@ void summary_print(SummaryView *summaryview)
GSList *mlist, *cur;
const gchar *cmdline;
gchar *msg;
- gchar *p;
if (gtk_tree_selection_count_selected_rows(summaryview->selection) == 0)
return;
@@ -3466,8 +3465,7 @@ void summary_print(SummaryView *summaryview)
}
g_free(msg);
- if (cmdline && (!(p = strchr(cmdline, '%')) || *(p + 1) != 's' ||
- strchr(p + 2, '%'))) {
+ if (cmdline && str_find_format_times(cmdline, 's') != 1) {
alertpanel_error(_("Print command line is invalid:\n`%s'"),
cmdline);
return;