aboutsummaryrefslogtreecommitdiffstats
path: root/mail/mail-identify.c
diff options
context:
space:
mode:
authorDan Winship <danw@src.gnome.org>2001-01-26 01:07:23 +0800
committerDan Winship <danw@src.gnome.org>2001-01-26 01:07:23 +0800
commit54a2910f896626046666ffa8d88f052acdb5c201 (patch)
treeeef885546b87b45417383993478c60ef6363b516 /mail/mail-identify.c
parent9100d6bcdd7928ddd74587ba58367658816bffe5 (diff)
downloadgsoc2013-evolution-54a2910f896626046666ffa8d88f052acdb5c201.tar
gsoc2013-evolution-54a2910f896626046666ffa8d88f052acdb5c201.tar.gz
gsoc2013-evolution-54a2910f896626046666ffa8d88f052acdb5c201.tar.bz2
gsoc2013-evolution-54a2910f896626046666ffa8d88f052acdb5c201.tar.lz
gsoc2013-evolution-54a2910f896626046666ffa8d88f052acdb5c201.tar.xz
gsoc2013-evolution-54a2910f896626046666ffa8d88f052acdb5c201.tar.zst
gsoc2013-evolution-54a2910f896626046666ffa8d88f052acdb5c201.zip
Check if a message part's content is available, and if it's not, queue a
* mail-format.c (mail_content_loaded): Check if a message part's content is available, and if it's not, queue a thread that will load it and then queue an idle-handler redisplay of the message. (call_handler_function): Call mail_content_loaded() on the part and don't try to display it if it's currently offline. (get_data_wrapper_text): Simplify a bit * mail-display.c (mail_display_queue_redisplay): rename and make non-static. (mail_display_redisplay): Use a "new and improved" way of preserving the GtkHTML scroll location. ("new and improved" is code for "gross and hackish", but there should be a real interface for this eventually.) (on_url_requested): Use mail_content_loaded() and don't write out offline cid: URLs * mail-identify.c (mail_identify_mime_part): Use mail_content_loaded and don't try to identify the data if it's offline. svn path=/trunk/; revision=7813
Diffstat (limited to 'mail/mail-identify.c')
-rw-r--r--mail/mail-identify.c30
1 files changed, 18 insertions, 12 deletions
diff --git a/mail/mail-identify.c b/mail/mail-identify.c
index 3f86ea361c..61b2d1fe10 100644
--- a/mail/mail-identify.c
+++ b/mail/mail-identify.c
@@ -35,12 +35,13 @@
/**
* mail_identify_mime_part:
* @part: a CamelMimePart
+ * @md: the MailDisplay @part is being shown in
*
* Try to identify the MIME type of the data in @part (which presumably
* doesn't have a useful Content-Type).
**/
char *
-mail_identify_mime_part (CamelMimePart *part)
+mail_identify_mime_part (CamelMimePart *part, MailDisplay *md)
{
const char *filename, *type;
GnomeVFSMimeSniffBuffer *sniffer;
@@ -62,17 +63,22 @@ mail_identify_mime_part (CamelMimePart *part)
/* Try file magic. */
data = camel_medium_get_content_object (CAMEL_MEDIUM (part));
- ba = g_byte_array_new ();
- memstream = camel_stream_mem_new_with_byte_array (ba);
- camel_data_wrapper_write_to_stream (data, memstream);
- if (ba->len) {
- sniffer = gnome_vfs_mime_sniff_buffer_new_from_memory (
- ba->data, ba->len);
- type = gnome_vfs_get_mime_type_for_buffer (sniffer);
- gnome_vfs_mime_sniff_buffer_free (sniffer);
- } else
- type = NULL;
- camel_object_unref (CAMEL_OBJECT (memstream));
+ /* FIXME: In a perfect world, we would not load the content just
+ * to identify the MIME type.
+ */
+ if (mail_content_loaded (data, md)) {
+ ba = g_byte_array_new ();
+ memstream = camel_stream_mem_new_with_byte_array (ba);
+ camel_data_wrapper_write_to_stream (data, memstream);
+ if (ba->len) {
+ sniffer = gnome_vfs_mime_sniff_buffer_new_from_memory (
+ ba->data, ba->len);
+ type = gnome_vfs_get_mime_type_for_buffer (sniffer);
+ gnome_vfs_mime_sniff_buffer_free (sniffer);
+ } else
+ type = NULL;
+ camel_object_unref (CAMEL_OBJECT (memstream));
+ }
if (type)
return g_strdup (type);