aboutsummaryrefslogtreecommitdiff
path: root/src/mimeview.c
diff options
context:
space:
mode:
authorhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2005-10-13 08:06:40 +0000
committerhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2005-10-13 08:06:40 +0000
commit5d566e74c57ba4d086ec83f4590719a602a83823 (patch)
treed7e129f0f3ff055c2b342a0b10e609c966960b4f /src/mimeview.c
parent2ebd418a6e4f86de03434eb357cc577a4e366f5d (diff)
win32: use ShellExecute() to launch attachments.
git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@642 ee746299-78ed-0310-b773-934348b2243d
Diffstat (limited to 'src/mimeview.c')
-rw-r--r--src/mimeview.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/mimeview.c b/src/mimeview.c
index 5a365f76..7f67b163 100644
--- a/src/mimeview.c
+++ b/src/mimeview.c
@@ -42,6 +42,10 @@
#include <stdio.h>
#include <unistd.h>
+#ifdef G_OS_WIN32
+# include <windows.h>
+#endif
+
#include "main.h"
#include "mimeview.h"
#include "textview.h"
@@ -1115,6 +1119,31 @@ static void mimeview_view_file(const gchar *filename, MimeInfo *partinfo,
const gchar *def_cmd;
const gchar *p;
+#ifdef G_OS_WIN32
+ if (!cmdline) {
+ DWORD dwtype;
+ AlertValue avalue;
+
+ if (str_has_suffix_case(filename, ".exe") ||
+ str_has_suffix_case(filename, ".com") ||
+ str_has_suffix_case(filename, ".scr") ||
+ str_has_suffix_case(filename, ".pif") ||
+ str_has_suffix_case(filename, ".bat") ||
+ str_has_suffix_case(filename, ".vbs") ||
+ str_has_suffix_case(filename, ".js") ||
+ GetBinaryType(filename, &dwtype)) {
+ avalue = alertpanel_full
+ (_("Opening executable file"),
+ _("This is an executable file. Do you really want to launch it?"),
+ ALERT_WARNING, G_ALERTALTERNATE, FALSE,
+ GTK_STOCK_YES, GTK_STOCK_NO, NULL);
+ if (avalue != G_ALERTDEFAULT)
+ return;
+ }
+ execute_open_file(filename, partinfo->content_type);
+ return;
+ }
+#endif
if (cmdline) {
cmd = cmdline;
def_cmd = NULL;