diff options
author | Dan Winship <danw@src.gnome.org> | 2000-04-30 03:17:46 +0800 |
---|---|---|
committer | Dan Winship <danw@src.gnome.org> | 2000-04-30 03:17:46 +0800 |
commit | 6942830c985d410264fff20734541b23dc62f64f (patch) | |
tree | af92bbad4147f77a0cc03437125c7e74cde8f59a /mail/mail-display.c | |
parent | 8d848e0e56a38c4da1d9c47ebe2ac3e7d0a7da39 (diff) | |
download | gsoc2013-evolution-6942830c985d410264fff20734541b23dc62f64f.tar gsoc2013-evolution-6942830c985d410264fff20734541b23dc62f64f.tar.gz gsoc2013-evolution-6942830c985d410264fff20734541b23dc62f64f.tar.bz2 gsoc2013-evolution-6942830c985d410264fff20734541b23dc62f64f.tar.lz gsoc2013-evolution-6942830c985d410264fff20734541b23dc62f64f.tar.xz gsoc2013-evolution-6942830c985d410264fff20734541b23dc62f64f.tar.zst gsoc2013-evolution-6942830c985d410264fff20734541b23dc62f64f.zip |
Improve the builtin vs bonobo selection code. (handle_mystery): Include
* mail-format.c (lookup_handler, etc): Improve the builtin vs
bonobo selection code.
(handle_mystery): Include name and Content-Description in the
"mystery data" info, when available
(handle_unknown_type): Call mail_identify_mime_part before
giving up.
(handle_undisplayable): Split out of handle_unknown_type now
that handle_unknown_type can try alternate viewers.
(handle_via_bonobo): Fall back to handle_undisplayable if the
bonobo control fails.
* mail-identify.c (mail_identify_mime_part): New function to
attempt to identify a MIME part that we can't identify based on
Content-Type alone.
* mail-display.c (on_url_requested): redo the mystery data icon
display stuff less kludgily.
svn path=/trunk/; revision=2684
Diffstat (limited to 'mail/mail-display.c')
-rw-r--r-- | mail/mail-display.c | 55 |
1 files changed, 32 insertions, 23 deletions
diff --git a/mail/mail-display.c b/mail/mail-display.c index 036ebad60b..448426d70c 100644 --- a/mail/mail-display.c +++ b/mail/mail-display.c @@ -24,17 +24,6 @@ static GtkObjectClass *mail_display_parent_class; * Callbacks *----------------------------------------------------------------------*/ -static CamelStream * -cid_stream (const char *cid, CamelMimeMessage *message) -{ - CamelDataWrapper *data; - - data = gtk_object_get_data (GTK_OBJECT (message), cid); - g_return_val_if_fail (CAMEL_IS_DATA_WRAPPER (data), NULL); - - return camel_data_wrapper_get_output_stream (data); -} - static void on_link_clicked (GtkHTML *html, const char *url, gpointer user_data) { @@ -53,24 +42,44 @@ on_url_requested (GtkHTML *html, const char *url, GtkHTMLStreamHandle handle, { char buf[1024]; int nread; - CamelStream *output; CamelMimeMessage *message = CAMEL_MIME_MESSAGE (user_data); - if (strncmp (url, "camel:", 6) == 0) { - output = GUINT_TO_POINTER (strtoul (url + 6, NULL, 0)); - g_return_if_fail (CAMEL_IS_STREAM (output)); + if (strncmp (url, "x-gnome-icon:", 13) == 0) { + const char *name = url + 13; + char *path = gnome_pixmap_file (name); + int fd; + + g_return_if_fail (path != NULL); + fd = open (path, O_RDONLY); + g_free (path); + g_return_if_fail (fd != -1); + + while (1) { + nread = read (fd, buf, sizeof (buf)); + if (nread < 1) + break; + gtk_html_write (html, handle, buf, nread); + } + close (fd); } else if (strncmp (url, "cid:", 4) == 0) { - output = cid_stream (url + 4, message); + const char *cid = url + 4; + CamelDataWrapper *data; + CamelStream *output; + + data = gtk_object_get_data (GTK_OBJECT (message), cid); + g_return_if_fail (CAMEL_IS_DATA_WRAPPER (data)); + + output = camel_data_wrapper_get_output_stream (data); g_return_if_fail (CAMEL_IS_STREAM (output)); + + camel_stream_reset (output); + do { + nread = camel_stream_read (output, buf, sizeof (buf)); + if (nread > 0) + gtk_html_write (html, handle, buf, nread); + } while (!camel_stream_eos (output)); } else return; - - camel_stream_reset (output); - do { - nread = camel_stream_read (output, buf, sizeof (buf)); - if (nread > 0) - gtk_html_write (html, handle, buf, nread); - } while (!camel_stream_eos (output)); } /* HTML part code */ |