aboutsummaryrefslogtreecommitdiffstats
path: root/mail/mail-format.c
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@ximian.com>2002-04-04 06:55:34 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2002-04-04 06:55:34 +0800
commit2e55f851fb04637dac674bd0d9deb2a071026ba5 (patch)
tree09e64db0152751cc455445b804ea1f855610fca7 /mail/mail-format.c
parent6447ad075851a3f6bc07c3441d4fff44d0bf4cb6 (diff)
downloadgsoc2013-evolution-2e55f851fb04637dac674bd0d9deb2a071026ba5.tar.gz
gsoc2013-evolution-2e55f851fb04637dac674bd0d9deb2a071026ba5.tar.zst
gsoc2013-evolution-2e55f851fb04637dac674bd0d9deb2a071026ba5.zip
Set the window title/icon here instead.
2002-04-03 Jeffrey Stedfast <fejj@ximian.com> * message-tag-followup.c (construct): Set the window title/icon here instead. * message-tag-editor.c (message_tag_editor_init): Don't set the title or window icon here, this is a generic class. * mail-format.c (handle_multipart_signed): Replace get_url_for_icon with the new mail_display_get_url_for_icon function. (handle_multipart_digest): Here too. (get_cid): Use mail_display_add_url instead. (get_location): Same. (handle_text_enriched): Here too. (handle_multipart_signed): And here. * message-tag-followup.c (message_tag_followup_i18n_name): Use the U_() macro, not the _() macro as it is what we really want. * mail-ops.c (mail_send_message): Don't cast the message into a CamelMedium before sending anymore. * mail-callbacks.c (expunge_folder): Set the followup argument to NULL here. (done_message_selected): Get the followup value here and pass it to the mail-display here. (do_mail_fetch_and_print): Again with the NULL followup here. * folder-browser.c (folder_browser_set_message_preview): Update to pass in NULL as the followup since we are setting the message to NULL here. (done_message_selected): Get and set the appropriate followup value here. (do_message_selected): Update to pass in NULL as the followup since we are setting the message to NULL here. * mail-display.c (mail_display_set_message): Now takes a followup tag value. (mail_display_init): Set md->followup to NULL. (mail_display_destroy): Free md->followup. (mail_display_add_url): New: replaces the static add_url function originally in mail-format.c (mail_display_get_url_for_icon): New: replaces get_url_for_icon which was originally in mail-format.c svn path=/trunk/; revision=16334
Diffstat (limited to 'mail/mail-format.c')
-rw-r--r--mail/mail-format.c71
1 files changed, 10 insertions, 61 deletions
diff --git a/mail/mail-format.c b/mail/mail-format.c
index d353b0b249..d0f5da6757 100644
--- a/mail/mail-format.c
+++ b/mail/mail-format.c
@@ -136,22 +136,6 @@ free_data_urls (gpointer urls)
g_hash_table_destroy (urls);
}
-static char *
-add_url (const char *kind, char *url, gpointer data, MailDisplay *md)
-{
- GHashTable *urls;
- gpointer old_key, old_value;
-
- urls = g_datalist_get_data (md->data, kind);
- g_return_val_if_fail (urls != NULL, NULL);
- if (g_hash_table_lookup_extended (urls, url, &old_key, &old_value)) {
- g_free (url);
- url = old_key;
- }
- g_hash_table_insert (urls, url, data);
- return url;
-}
-
/**
* mail_format_mime_message:
* @mime_message: the input mime message
@@ -249,8 +233,8 @@ get_cid (CamelMimePart *part, MailDisplay *md)
camel_mime_part_get_content_id (part));
} else
cid = g_strdup_printf ("cid:@@@%d", fake_cid_counter++);
-
- return add_url ("part_urls", cid, part, md);
+
+ return mail_display_add_url (md, "part_urls", cid, part);
}
static const char *
@@ -263,42 +247,7 @@ get_location (CamelMimePart *part, MailDisplay *md)
if (!loc)
return NULL;
- return add_url ("part_urls", g_strdup (loc), part, md);
-}
-
-static const char *
-get_url_for_icon (const char *icon_name, MailDisplay *md)
-{
- char *icon_path, buf[1024], *url;
- int fd, nread;
- GByteArray *ba;
-
- /* FIXME: cache */
-
- if (*icon_name == '/')
- icon_path = g_strdup (icon_name);
- else {
- icon_path = gnome_pixmap_file (icon_name);
- if (!icon_path)
- return "file:///dev/null";
- }
-
- fd = open (icon_path, O_RDONLY);
- g_free (icon_path);
- if (fd == -1)
- return "file:///dev/null";
-
- ba = g_byte_array_new ();
- while (1) {
- nread = read (fd, buf, sizeof (buf));
- if (nread < 1)
- break;
- g_byte_array_append (ba, buf, nread);
- }
- close (fd);
-
- url = g_strdup_printf ("x-evolution-data:%p", ba);
- return add_url ("data_urls", url, ba, md);
+ return mail_display_add_url (md, "part_urls", g_strdup (loc), part);
}
@@ -1007,11 +956,11 @@ write_headers (CamelMimeMessage *message, MailDisplay *md,
const char *charset;
CamelContentType *ct;
char *value;
-
+
ct = camel_mime_part_get_content_type(CAMEL_MIME_PART(message));
charset = header_content_type_param(ct, "charset");
charset = e_iconv_charset_name(charset);
-
+
header = CAMEL_MIME_PART(message)->headers;
while (header) {
i = default_header_index(header->name);
@@ -1626,7 +1575,7 @@ handle_text_enriched (CamelMimePart *part, const char *mime_type,
xed = g_strdup_printf ("x-evolution-data:%p", part);
gtk_html_stream_printf (stream, "<iframe src=\"%s\" frameborder=0 scrolling=no></iframe>", xed);
- add_url ("data_urls", xed, ba, md);
+ mail_display_add_url (md, "data_urls", xed, ba);
return TRUE;
}
@@ -1708,7 +1657,7 @@ handle_multipart_digest (CamelMimePart *part, const char *mime_type,
g_return_val_if_fail (CAMEL_IS_MULTIPART (wrapper), FALSE);
gtk_html_stream_printf (stream, "&nbsp;&nbsp;&nbsp;&nbsp;<a href=\"digest:\"><img src=\"%s\">%s</a>",
- get_url_for_icon (EVOLUTION_ICONSDIR "/envelope.png", md),
+ mail_display_get_url_for_icon (md, EVOLUTION_ICONSDIR "/envelope.png"),
U_("View messages..."));
return TRUE;
@@ -1800,7 +1749,7 @@ handle_multipart_signed (CamelMimePart *part, const char *mime_type,
"<td><table width=3 cellspacing=0 cellpadding=0>"
"<tr><td></td></tr></table></td>"
"<td><font size=-1>", url);
- add_url ("part_urls", url, subpart, md);
+ mail_display_add_url (md, "part_urls", url, subpart);
mail_html_write (html, stream,
U_("This message is digitally signed. "
@@ -1833,7 +1782,7 @@ handle_multipart_signed (CamelMimePart *part, const char *mime_type,
"<table><tr valign=top>"
"<td><img src=\"%s\"></td>"
"<td>%s<br><br>",
- get_url_for_icon (EVOLUTION_ICONSDIR "/pgp-signature-ok.png", md),
+ mail_display_get_url_for_icon (md, EVOLUTION_ICONSDIR "/pgp-signature-ok.png"),
U_("This message is digitally signed and "
"has been found to be authentic."));
} else {
@@ -1841,7 +1790,7 @@ handle_multipart_signed (CamelMimePart *part, const char *mime_type,
"<table><tr valign=top>"
"<td><img src=\"%s\"></td>"
"<td>%s<br><br>",
- get_url_for_icon (EVOLUTION_ICONSDIR "/pgp-signature-bad.png", md),
+ mail_display_get_url_for_icon (md, EVOLUTION_ICONSDIR "/pgp-signature-bad.png"),
U_("This message is digitally signed but can "
"not be proven to be authentic."));
}