aboutsummaryrefslogtreecommitdiffstats
path: root/widgets/misc/e-attachment.c
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@src.gnome.org>2009-04-02 06:58:10 +0800
committerMatthew Barnes <mbarnes@src.gnome.org>2009-04-02 06:58:10 +0800
commit3a6dd7931ed7787b49a574ebe69eba5f46289fff (patch)
treef8bdde77fe6bf3fe9d8f4e68fbdb46df6a7abf56 /widgets/misc/e-attachment.c
parent0485fb58c5beeb04f0b3d833e6b73a2d2ec1acc7 (diff)
downloadgsoc2013-evolution-3a6dd7931ed7787b49a574ebe69eba5f46289fff.tar
gsoc2013-evolution-3a6dd7931ed7787b49a574ebe69eba5f46289fff.tar.gz
gsoc2013-evolution-3a6dd7931ed7787b49a574ebe69eba5f46289fff.tar.bz2
gsoc2013-evolution-3a6dd7931ed7787b49a574ebe69eba5f46289fff.tar.lz
gsoc2013-evolution-3a6dd7931ed7787b49a574ebe69eba5f46289fff.tar.xz
gsoc2013-evolution-3a6dd7931ed7787b49a574ebe69eba5f46289fff.tar.zst
gsoc2013-evolution-3a6dd7931ed7787b49a574ebe69eba5f46289fff.zip
Finish attachment drag and drop.
Expunge em-popup.c of dead code. Not much left. Kill the save-attachments (experimental) plugin. The attachment bar can already save all at once. svn path=/branches/kill-bonobo/; revision=37488
Diffstat (limited to 'widgets/misc/e-attachment.c')
-rw-r--r--widgets/misc/e-attachment.c25
1 files changed, 21 insertions, 4 deletions
diff --git a/widgets/misc/e-attachment.c b/widgets/misc/e-attachment.c
index fb84261fa2..bd9795c908 100644
--- a/widgets/misc/e-attachment.c
+++ b/widgets/misc/e-attachment.c
@@ -22,6 +22,7 @@
#include "e-attachment.h"
#include <errno.h>
+#include <config.h>
#include <glib/gi18n.h>
#include <camel/camel-iconv.h>
#include <camel/camel-data-wrapper.h>
@@ -32,6 +33,7 @@
#include <camel/camel-stream-vfs.h>
#include "e-util/e-util.h"
+#include "e-util/e-mktemp.h"
#include "e-attachment-store.h"
#define E_ATTACHMENT_GET_PRIVATE(obj) \
@@ -1914,18 +1916,30 @@ static void
attachment_open_save_temporary (OpenContext *open_context)
{
GFile *file;
+ gchar *template;
gchar *path;
- gint fd;
GError *error = NULL;
- fd = e_file_open_tmp (&path, &error);
+ errno = 0;
+ /* XXX This could trigger a blocking temp directory cleanup. */
+ template = g_strdup_printf (PACKAGE "-%s-XXXXXX", g_get_user_name ());
+ path = e_mktemp (template);
+ g_free (template);
+
+ /* XXX Let's hope errno got set properly. */
+ if (path == NULL)
+ g_set_error (
+ &error, G_FILE_ERROR,
+ g_file_error_from_errno (errno),
+ "%s", g_strerror (errno));
+
+ /* We already know if there's an error, but this does the cleanup. */
if (attachment_open_check_for_error (open_context, error))
return;
file = g_file_new_for_path (path);
- close (fd);
g_free (path);
e_attachment_save_async (
@@ -2519,8 +2533,11 @@ e_attachment_save_handle_error (EAttachment *attachment,
g_return_if_fail (GTK_IS_WINDOW (parent));
file = e_attachment_save_finish (attachment, result, &error);
- if (file != NULL)
+
+ if (file != NULL) {
g_object_unref (file);
+ return;
+ }
/* Ignore cancellations. */
if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))