+ fd = g_open (helper->file_path, O_RDONLY, 0644);
+ if (fd != -1) {
+ file_stream = tny_fs_stream_new (fd);
+
+ mgr = modest_runtime_get_window_mgr ();
+
+ account = g_strdup (modest_window_get_active_account (MODEST_WINDOW (helper->self)));
+ mailbox = modest_window_get_active_mailbox (MODEST_WINDOW (helper->self));
+
+ if (!account)
+ account = modest_account_mgr_get_default_account (modest_runtime_get_account_mgr ());
+
+ msg = tny_camel_msg_new ();
+ tny_camel_msg_parse (msg, file_stream);
+ msg_win = modest_msg_view_window_new_for_attachment (TNY_MSG (msg), account, mailbox, helper->attachment_uid);
+ modest_window_set_zoom (MODEST_WINDOW (msg_win),
+ modest_window_get_zoom (MODEST_WINDOW (helper->self)));
+ if (modest_window_mgr_register_window (mgr, msg_win, MODEST_WINDOW (helper->self)))
+ gtk_widget_show_all (GTK_WIDGET (msg_win));
+ else
+ gtk_widget_destroy (GTK_WIDGET (msg_win));
+ g_object_unref (msg);
+ g_object_unref (file_stream);
+ } else {
+ modest_platform_information_banner (NULL, NULL, _("mail_ib_file_operation_failed"));
+ }
+
+ } else {
+
+ /* make the file read-only */
+ g_chmod(helper->file_path, 0444);
+
+ /* Activate the file */
+ modest_platform_activate_file (helper->file_path, tny_mime_part_get_content_type (mime_part));
+ }