diff options
author | Christian Persch <chpe@gnome.org> | 2009-10-25 15:04:20 (GMT) |
---|---|---|
committer | Christian Persch <chpe@gnome.org> | 2009-10-25 18:38:22 (GMT) |
commit | 0f1c723ad2fe48a0f22e32619985f93ebb2e02ef (patch) | |
tree | 73a10753be7590bbbd81af531de7d8b2400f7068 /shell/ev-sidebar-attachments.c | |
parent | 6635e60321ca8e4607c30f3303742ca2df559b3c (diff) |
libdocument: Clean up temp file handling
t push origin HEAD:master
Make sure we can cope with not being able to create our temp directory.
Bug #595372.
Diffstat (limited to 'shell/ev-sidebar-attachments.c')
-rw-r--r-- | shell/ev-sidebar-attachments.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/shell/ev-sidebar-attachments.c b/shell/ev-sidebar-attachments.c index d89617b..74e89c4 100644 --- a/shell/ev-sidebar-attachments.c +++ b/shell/ev-sidebar-attachments.c @@ -410,7 +410,7 @@ ev_sidebar_attachments_drag_data_get (GtkWidget *widget, GtkTreePath *path; GtkTreeIter iter; GFile *file; - gchar *filename; + gchar *filename, *template, *name; GError *error = NULL; path = (GtkTreePath *) l->data; @@ -421,13 +421,12 @@ ev_sidebar_attachments_drag_data_get (GtkWidget *widget, COLUMN_ATTACHMENT, &attachment, -1); - filename = g_build_filename (ev_tmp_dir (), - ev_attachment_get_name (attachment), - NULL); - file = g_file_new_for_path (filename); - g_free (filename); + /* FIXMEchpe: convert to filename encoding first! */ + template = g_strdup_printf ("%s.XXXXXX", ev_attachment_get_name (attachment)); + file = ev_mkstemp_file (template, &error); + g_free (template); - if (ev_attachment_save (attachment, file, &error)) { + if (file != NULL && ev_attachment_save (attachment, file, &error)) { gchar *uri; uri = g_file_get_uri (file); |