- content_type = tny_mime_part_get_content_type (mime_part);
- if (tny_mime_part_decode_to_stream (mime_part, TNY_STREAM (temp_stream), &err) >= 0) {
- /* make the file read-only */
- if (g_chmod(filepath, 0444) != 0)
- g_warning ("%s: failed to set file '%s' to read-only: %s",
- __FUNCTION__, filepath, strerror(errno));
-
- modest_platform_activate_file (filepath, content_type);
- } else {
- /* error while saving attachment, maybe cerm_device_memory_full */
- show_error_banner = TRUE;
- if (err != NULL) {
- g_warning ("%s: tny_mime_part_decode_to_stream failed (%s)", __FUNCTION__, err->message);
- g_error_free (err);
- }
- }
+ tny_mime_part_decode_to_stream_async (mime_part, TNY_STREAM (temp_stream),
+ on_decode_to_stream_async_handler,
+ NULL,
+ g_strdup (filepath));