aboutsummaryrefslogtreecommitdiffstats
path: root/mail/mail-display.c
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@ximian.com>2001-08-25 06:41:24 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2001-08-25 06:41:24 +0800
commite00591f0081d57618d709e59f6d4a4d671fc2fb0 (patch)
tree8c68694840ff446e45f5ca24c9eaf901f289a074 /mail/mail-display.c
parent7a67b5c2ff35239e7f53fb94896064af9d3c5d17 (diff)
downloadgsoc2013-evolution-e00591f0081d57618d709e59f6d4a4d671fc2fb0.tar.gz
gsoc2013-evolution-e00591f0081d57618d709e59f6d4a4d671fc2fb0.tar.zst
gsoc2013-evolution-e00591f0081d57618d709e59f6d4a4d671fc2fb0.zip
Use the new e_mkdtemp function.
2001-08-24 Jeffrey Stedfast <fejj@ximian.com> * mail-display.c (launch_cb): Use the new e_mkdtemp function. * folder-browser.c (message_list_drag_data_get): Use the new e_mkdtemp function. svn path=/trunk/; revision=12462
Diffstat (limited to 'mail/mail-display.c')
-rw-r--r--mail/mail-display.c37
1 files changed, 14 insertions, 23 deletions
diff --git a/mail/mail-display.c b/mail/mail-display.c
index 912785ea71..9a9fe89db6 100644
--- a/mail/mail-display.c
+++ b/mail/mail-display.c
@@ -39,6 +39,7 @@
#include <gtkhtml/htmlinterval.h> /* XXX */
#include "e-util/e-html-utils.h"
+#include "e-util/e-mktemp.h"
#include "addressbook/backend/ebook/e-book-util.h"
#include "e-searching-tokenizer.h"
@@ -250,15 +251,16 @@ launch_cb (GtkWidget *widget, gpointer user_data)
MailMimeHandler *handler;
GList *apps, *children, *c;
GnomeVFSMimeApplication *app;
- char *tmpl, *tmpdir, *filename, *url, *argv[2];
-
+ char *filename, *url, *argv[2];
+ const char *tmpdir;
+
handler = mail_lookup_handler (gtk_object_get_data (user_data, "mime_type"));
g_return_if_fail (handler != NULL && handler->applications != NULL);
-
+
/* Yum. Too bad EPopupMenu doesn't allow per-item closures. */
children = gtk_container_children (GTK_CONTAINER (widget->parent));
g_return_if_fail (children != NULL && children->next != NULL && children->next->next != NULL);
-
+
for (c = children->next->next, apps = handler->applications; c && apps; c = c->next, apps = apps->next) {
if (c->data == widget)
break;
@@ -266,46 +268,35 @@ launch_cb (GtkWidget *widget, gpointer user_data)
g_list_free (children);
g_return_if_fail (c != NULL && apps != NULL);
app = apps->data;
-
- tmpl = g_strdup ("/tmp/evolution.XXXXXX");
-#ifdef HAVE_MKDTEMP
- tmpdir = mkdtemp (tmpl);
-#else
- tmpdir = mktemp (tmpl);
- if (tmpdir) {
- if (mkdir (tmpdir, S_IRWXU) == -1)
- tmpdir = NULL;
- }
-#endif
+
+ tmpdir = e_mkdtemp ("evolution.XXXXXX");
+
if (!tmpdir) {
char *msg = g_strdup_printf (_("Could not create temporary "
"directory: %s"),
g_strerror (errno));
gnome_error_dialog (msg);
- g_free (tmpl);
g_free (msg);
return;
}
-
+
filename = make_safe_filename (tmpdir, part);
-
+
if (!write_data_to_file (part, filename, TRUE)) {
- g_free (tmpl);
g_free (filename);
return;
}
-
+
if (app->expects_uris == GNOME_VFS_MIME_APPLICATION_ARGUMENT_TYPE_URIS) {
url = g_strdup_printf ("file:%s", filename);
g_free (filename);
filename = url;
}
-
+
argv[0] = app->command;
argv[1] = filename;
-
+
gnome_execute_async (tmpdir, 2, argv);
- g_free (tmpdir);
g_free (filename);
}