diff options
author | Jeffrey Stedfast <fejj@ximian.com> | 2002-03-13 06:23:08 +0800 |
---|---|---|
committer | Jeffrey Stedfast <fejj@src.gnome.org> | 2002-03-13 06:23:08 +0800 |
commit | 8ffcf0b7552e8b921228a8aa372335a161d262b8 (patch) | |
tree | 0742e7cc5dc7d17053c46d68b31a07a90eb0fc33 | |
parent | 5020c3bd9a2b87eca463118f31fdb75ff44caa46 (diff) | |
download | gsoc2013-evolution-8ffcf0b7552e8b921228a8aa372335a161d262b8.tar gsoc2013-evolution-8ffcf0b7552e8b921228a8aa372335a161d262b8.tar.gz gsoc2013-evolution-8ffcf0b7552e8b921228a8aa372335a161d262b8.tar.bz2 gsoc2013-evolution-8ffcf0b7552e8b921228a8aa372335a161d262b8.tar.lz gsoc2013-evolution-8ffcf0b7552e8b921228a8aa372335a161d262b8.tar.xz gsoc2013-evolution-8ffcf0b7552e8b921228a8aa372335a161d262b8.tar.zst gsoc2013-evolution-8ffcf0b7552e8b921228a8aa372335a161d262b8.zip |
Handle digest: urls.
2002-03-12 Jeffrey Stedfast <fejj@ximian.com>
* mail-display.c (on_link_clicked): Handle digest: urls.
* mail-format.c (setup_mime_tables): Add a handler for multipart/digest.
(handle_multipart_digest): Handle multipart/digest parts.
svn path=/trunk/; revision=16133
-rw-r--r-- | mail/ChangeLog | 7 | ||||
-rw-r--r-- | mail/mail-display.c | 41 | ||||
-rw-r--r-- | mail/mail-format.c | 21 |
3 files changed, 64 insertions, 5 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog index 315d25ba04..1382e4a04f 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,5 +1,12 @@ 2002-03-12 Jeffrey Stedfast <fejj@ximian.com> + * mail-display.c (on_link_clicked): Handle digest: urls. + + * mail-format.c (setup_mime_tables): Add a handler for multipart/digest. + (handle_multipart_digest): Handle multipart/digest parts. + +2002-03-12 Jeffrey Stedfast <fejj@ximian.com> + * folder-browser.c (folder_browser_set_folder): Set the folder on a folder-browser object. diff --git a/mail/mail-display.c b/mail/mail-display.c index 3b82856107..234ecd8db5 100644 --- a/mail/mail-display.c +++ b/mail/mail-display.c @@ -46,6 +46,8 @@ #include "e-searching-tokenizer.h" #include "folder-browser-factory.h" #include "mail-stream-gtkhtml.h" +#include "folder-browser-window.h" +#include "folder-browser.h" #include "mail-display.h" #include "mail-config.h" #include "mail-ops.h" @@ -217,17 +219,46 @@ mail_display_jump_to_anchor (MailDisplay *md, const char *url) } static void +mail_display_digest_clicked (MailDisplay *md, const char *url) +{ + FolderBrowser *fb, *parent_fb; + CamelFolder *digest; + CamelStore *store; + GtkWidget *window; + + parent_fb = (FolderBrowser *) gtk_widget_get_ancestor (GTK_WIDGET (md), FOLDER_BROWSER_TYPE); + + store = camel_digest_store_new (url); + + digest = camel_digest_folder_new (store, md->current_message); + camel_object_unref (CAMEL_OBJECT (store)); + if (!digest) + return; + + fb = (FolderBrowser *) folder_browser_new (parent_fb->shell, NULL); + folder_browser_set_message_preview (fb, TRUE); + folder_browser_set_folder (fb, digest, url); + camel_object_unref (CAMEL_OBJECT (digest)); + gtk_widget_show (GTK_WIDGET (fb)); + + window = folder_browser_window_new (fb); + gtk_widget_show (window); +} + +static void on_link_clicked (GtkHTML *html, const char *url, MailDisplay *md) { - if (!g_strncasecmp (url, "news:", 5) || - !g_strncasecmp (url, "nntp:", 5)) + if (!g_strncasecmp (url, "news:", 5) || !g_strncasecmp (url, "nntp:", 5)) { g_warning ("Can't handle news URLs yet."); - else if (!g_strncasecmp (url, "mailto:", 7)) + } else if (!g_strncasecmp (url, "mailto:", 7)) { send_to_url (url); - else if (*url == '#') + } else if (!g_strncasecmp (url, "digest:", 7)) { + mail_display_digest_clicked (md, url); + } else if (*url == '#') { mail_display_jump_to_anchor (md, url); - else + } else { gnome_url_show (url); + } } static void diff --git a/mail/mail-format.c b/mail/mail-format.c index 1cc5a3d851..d353b0b249 100644 --- a/mail/mail-format.c +++ b/mail/mail-format.c @@ -92,6 +92,9 @@ static gboolean handle_multipart_encrypted (CamelMimePart *part, static gboolean handle_multipart_signed (CamelMimePart *part, const char *mime_type, MailDisplay *md, GtkHTML *html, GtkHTMLStream *stream); +static gboolean handle_multipart_digest (CamelMimePart *part, + const char *mime_type, + MailDisplay *md, GtkHTML *html, GtkHTMLStream *stream); static gboolean handle_message_rfc822 (CamelMimePart *part, const char *mime_type, MailDisplay *md, GtkHTML *html, GtkHTMLStream *stream); @@ -364,6 +367,8 @@ setup_mime_tables (void) handle_multipart_encrypted); g_hash_table_insert (mime_function_table, "multipart/signed", handle_multipart_signed); + g_hash_table_insert (mime_function_table, "multipart/digest", + handle_multipart_digest); /* RFC 2046 says unrecognized text subtypes can be treated * as text/plain (as long as you recognize the character set), @@ -1694,6 +1699,22 @@ handle_multipart_mixed (CamelMimePart *part, const char *mime_type, } static gboolean +handle_multipart_digest (CamelMimePart *part, const char *mime_type, + MailDisplay *md, GtkHTML *html, GtkHTMLStream *stream) +{ + CamelDataWrapper *wrapper = + camel_medium_get_content_object (CAMEL_MEDIUM (part)); + + g_return_val_if_fail (CAMEL_IS_MULTIPART (wrapper), FALSE); + + gtk_html_stream_printf (stream, " <a href=\"digest:\"><img src=\"%s\">%s</a>", + get_url_for_icon (EVOLUTION_ICONSDIR "/envelope.png", md), + U_("View messages...")); + + return TRUE; +} + +static gboolean handle_multipart_encrypted (CamelMimePart *part, const char *mime_type, MailDisplay *md, GtkHTML *html, GtkHTMLStream *stream) { |