diff options
-rw-r--r-- | mail/e-mail-backend.c | 2 | ||||
-rw-r--r-- | mail/em-format-html-display.c | 19 | ||||
-rw-r--r-- | mail/mail-session.c | 3 | ||||
-rw-r--r-- | widgets/misc/e-attachment.c | 16 | ||||
-rw-r--r-- | widgets/misc/e-attachment.h | 2 |
5 files changed, 27 insertions, 15 deletions
diff --git a/mail/e-mail-backend.c b/mail/e-mail-backend.c index 65633da097..4ab444027f 100644 --- a/mail/e-mail-backend.c +++ b/mail/e-mail-backend.c @@ -342,7 +342,7 @@ mail_backend_folder_changed_cb (MailFolderCache *folder_cache, gint flags = 0; if (!mail_folder_cache_get_folder_from_uri (folder_cache, folder_uri, &folder)) - if (!mail_folder_cache_get_folder_info_flags (folder_cache, folder, &flags)) + if (folder && !mail_folder_cache_get_folder_info_flags (folder_cache, folder, &flags)) g_return_if_reached (); target = em_event_target_new_folder ( diff --git a/mail/em-format-html-display.c b/mail/em-format-html-display.c index c795929091..9228aec472 100644 --- a/mail/em-format-html-display.c +++ b/mail/em-format-html-display.c @@ -799,10 +799,24 @@ efhd_attachment_button(EMFormatHTML *efh, GtkHTMLEmbedded *eb, EMFormatHTMLPObje EAttachment *attachment; GtkWidget *widget; gpointer parent; + EMFormat *emf = (EMFormat *) efh; + CamelMessageInfo *mi = NULL; + CamelMessageContentInfo *ci = NULL; + GFileInfo *fileinfo; + guint32 size; /* FIXME: handle default shown case */ d(printf("adding attachment button/content\n")); + mi = camel_folder_summary_uid (emf->folder->summary, emf->uid); + ci = camel_folder_summary_guess_content_info (mi, ((CamelDataWrapper *)pobject->part)->mime_type); + if (ci) { + size = ci->size; + /* what if its not encoded in base64 ? is it a case to consider? */ + if (ci->encoding && !g_ascii_strcasecmp (ci->encoding, "base64")) + size = size/1.37; + } + info = (struct _attach_puri *)em_format_find_puri((EMFormat *)efh, pobject->classid); if (!info || info->forward) { @@ -828,6 +842,11 @@ efhd_attachment_button(EMFormatHTML *efh, GtkHTMLEmbedded *eb, EMFormatHTMLPObje e_attachment_load_async ( info->attachment, (GAsyncReadyCallback) e_attachment_load_handle_error, parent); + if (size != 0) { + fileinfo = e_attachment_get_file_info (info->attachment); + g_file_info_set_size (fileinfo, size); + e_attachment_set_file_info (info->attachment, fileinfo); + } widget = e_attachment_button_new (view); e_attachment_button_set_attachment ( diff --git a/mail/mail-session.c b/mail/mail-session.c index a5cd5a6ed7..0341b5f050 100644 --- a/mail/mail-session.c +++ b/mail/mail-session.c @@ -432,9 +432,6 @@ alert_user(CamelSession *session, CamelSessionAlertType type, const gchar *promp struct _user_message_msg *m; gboolean result = TRUE; - if (!mail_session->interactive) - return FALSE; - m = mail_msg_new (&user_message_info); m->ismain = mail_in_main_thread (); m->type = type; diff --git a/widgets/misc/e-attachment.c b/widgets/misc/e-attachment.c index 44dd467967..f8b93f9fc2 100644 --- a/widgets/misc/e-attachment.c +++ b/widgets/misc/e-attachment.c @@ -400,8 +400,8 @@ attachment_update_progress_columns (EAttachment *attachment) -1); } -static void -attachment_set_file_info (EAttachment *attachment, +void +e_attachment_set_file_info (EAttachment *attachment, GFileInfo *file_info) { GtkTreeRowReference *reference; @@ -1560,7 +1560,7 @@ attachment_load_finish (LoadContext *load_context) /* Correctly report the size of zero length special files. */ if (g_file_info_get_size (file_info) == 0) { g_file_info_set_size (file_info, size); - attachment_set_file_info (attachment, file_info); + e_attachment_set_file_info (attachment, file_info); } g_simple_async_result_set_op_res_gpointer ( @@ -1708,7 +1708,7 @@ attachment_load_query_info_cb (GFile *file, if (attachment_load_check_for_error (load_context, error)) return; - attachment_set_file_info (attachment, file_info); + e_attachment_set_file_info (attachment, file_info); load_context->file_info = file_info; load_context->total_num_bytes = g_file_info_get_size (file_info); @@ -1730,7 +1730,6 @@ attachment_load_from_mime_part (LoadContext *load_context) const gchar *attribute; const gchar *string; gchar *allocated; - goffset size; attachment = load_context->attachment; mime_part = e_attachment_get_mime_part (attachment); @@ -1785,15 +1784,10 @@ attachment_load_from_mime_part (LoadContext *load_context) g_file_info_set_attribute_string ( file_info, attribute, string); - /* FIXME This can cause Camel to block while downloading the - * MIME part in order to determine the content size. */ - size = (goffset) camel_mime_part_get_content_size (mime_part); - g_file_info_set_size (file_info, size); - string = camel_mime_part_get_disposition (mime_part); e_attachment_set_disposition (attachment, string); - attachment_set_file_info (attachment, file_info); + e_attachment_set_file_info (attachment, file_info); camel_object_ref (mime_part); diff --git a/widgets/misc/e-attachment.h b/widgets/misc/e-attachment.h index d7cfb5be06..d2a31c45af 100644 --- a/widgets/misc/e-attachment.h +++ b/widgets/misc/e-attachment.h @@ -81,6 +81,8 @@ GFile * e_attachment_get_file (EAttachment *attachment); void e_attachment_set_file (EAttachment *attachment, GFile *file); GFileInfo * e_attachment_get_file_info (EAttachment *attachment); +void e_attachment_set_file_info (EAttachment *attachment, GFileInfo *file_info); + gboolean e_attachment_get_loading (EAttachment *attachment); CamelMimePart * e_attachment_get_mime_part (EAttachment *attachment); void e_attachment_set_mime_part (EAttachment *attachment, |