aboutsummaryrefslogtreecommitdiffstats
path: root/composer
diff options
context:
space:
mode:
authorDan Winship <danw@src.gnome.org>2000-12-29 03:29:09 +0800
committerDan Winship <danw@src.gnome.org>2000-12-29 03:29:09 +0800
commit87d3886d23295d8dc8ce02a717696af927d8833a (patch)
tree4fcdc6cbf374cb4536578b1cb5add8814d20e065 /composer
parent22876b6aa8f2e00c61e70352336ad00250dcec33 (diff)
downloadgsoc2013-evolution-87d3886d23295d8dc8ce02a717696af927d8833a.tar.gz
gsoc2013-evolution-87d3886d23295d8dc8ce02a717696af927d8833a.tar.zst
gsoc2013-evolution-87d3886d23295d8dc8ce02a717696af927d8833a.zip
Use CamelContentType instead of GMimeContentField.
* e-msg-composer.c (handle_multipart_alternative, handle_multipart, e_msg_composer_new_with_message): Use CamelContentType instead of GMimeContentField. * e-msg-composer-attachment.c (e_msg_composer_attachment_edit): * e-msg-composer-attachment-bar.c (update, attach_to_multipart): Use CamelContentType, and use the header_content_type_* functions rather than operating on the structure by hand. svn path=/trunk/; revision=7188
Diffstat (limited to 'composer')
-rw-r--r--composer/ChangeLog11
-rw-r--r--composer/e-msg-composer-attachment-bar.c19
-rw-r--r--composer/e-msg-composer-attachment.c5
-rw-r--r--composer/e-msg-composer.c16
4 files changed, 28 insertions, 23 deletions
diff --git a/composer/ChangeLog b/composer/ChangeLog
index c5ec71ff9f..075358e16e 100644
--- a/composer/ChangeLog
+++ b/composer/ChangeLog
@@ -1,3 +1,14 @@
+2000-12-28 Dan Winship <danw@helixcode.com>
+
+ * e-msg-composer.c (handle_multipart_alternative,
+ handle_multipart, e_msg_composer_new_with_message): Use
+ CamelContentType instead of GMimeContentField.
+
+ * e-msg-composer-attachment.c (e_msg_composer_attachment_edit):
+ * e-msg-composer-attachment-bar.c (update, attach_to_multipart):
+ Use CamelContentType, and use the header_content_type_* functions
+ rather than operating on the structure by hand.
+
2000-12-15 Jeffrey Stedfast <fejj@helixcode.com>
* e-msg-composer.c (e_msg_composer_get_pgp_encrypt): New function
diff --git a/composer/e-msg-composer-attachment-bar.c b/composer/e-msg-composer-attachment-bar.c
index 7eeb601237..ebab16a971 100644
--- a/composer/e-msg-composer-attachment-bar.c
+++ b/composer/e-msg-composer-attachment-bar.c
@@ -236,22 +236,17 @@ update (EMsgComposerAttachmentBar *bar)
EMsgComposerAttachment *attachment;
const gchar *desc;
gchar *size_string, *label, *mime_type;
- GMimeContentField *content_type;
+ CamelContentType *content_type;
GdkPixbuf *pixbuf;
- gboolean image = FALSE;
+ gboolean image;
attachment = p->data;
content_type = camel_mime_part_get_content_type (attachment->body);
-
- mime_type = g_strdup_printf ("%s/%s", content_type->type,
- content_type->subtype);
+ mime_type = header_content_type_format (content_type);
/* Get the image out of the attachment
and create a thumbnail for it */
- if (strcmp (content_type->type, "image") == 0)
- image = TRUE;
- else
- image = FALSE;
+ image = header_content_type_is (content_type, "image", "*");
if (image && attachment->pixbuf_cache == NULL) {
CamelDataWrapper *wrapper;
@@ -718,11 +713,11 @@ static void
attach_to_multipart (CamelMultipart *multipart,
EMsgComposerAttachment *attachment)
{
- GMimeContentField *content_type;
+ CamelContentType *content_type;
content_type = camel_mime_part_get_content_type (attachment->body);
- if (!g_strcasecmp (content_type->type, "text")) {
+ if (header_content_type_is (content_type, "text", "*")) {
CamelStream *stream;
GByteArray *array;
guchar *text;
@@ -739,7 +734,7 @@ attach_to_multipart (CamelMultipart *multipart,
camel_mime_part_set_encoding (attachment->body, CAMEL_MIME_PART_ENCODING_7BIT);
camel_object_unref (CAMEL_OBJECT (stream));
- } else if (g_strcasecmp (content_type->type, "message") != 0) {
+ } else if (!header_content_type_is (content_type, "message", "*")) {
camel_mime_part_set_encoding (attachment->body,
CAMEL_MIME_PART_ENCODING_BASE64);
}
diff --git a/composer/e-msg-composer-attachment.c b/composer/e-msg-composer-attachment.c
index 8483e318db..56a54877ce 100644
--- a/composer/e-msg-composer-attachment.c
+++ b/composer/e-msg-composer-attachment.c
@@ -391,7 +391,7 @@ e_msg_composer_attachment_edit (EMsgComposerAttachment *attachment,
"mime_type_entry"));
if (attachment != NULL) {
- GMimeContentField *content_type;
+ CamelContentType *content_type;
char *type;
set_entry (editor_gui, "file_name_entry",
@@ -399,8 +399,7 @@ e_msg_composer_attachment_edit (EMsgComposerAttachment *attachment,
set_entry (editor_gui, "description_entry",
camel_mime_part_get_description (attachment->body));
content_type = camel_mime_part_get_content_type (attachment->body);
- type = g_strdup_printf ("%s/%s", content_type->type,
- content_type->subtype);
+ type = header_content_type_format (content_type);
set_entry (editor_gui, "mime_type_entry", type);
g_free (type);
}
diff --git a/composer/e-msg-composer.c b/composer/e-msg-composer.c
index 44994540cb..a494fce920 100644
--- a/composer/e-msg-composer.c
+++ b/composer/e-msg-composer.c
@@ -1483,13 +1483,13 @@ handle_multipart_alternative (EMsgComposer *composer, CamelMultipart *multipart)
nparts = camel_multipart_get_number (multipart);
for (i = 0; i < nparts; i++) {
- GMimeContentField *content_type;
+ CamelContentType *content_type;
CamelMimePart *mime_part;
mime_part = camel_multipart_get_part (multipart, i);
content_type = camel_mime_part_get_content_type (mime_part);
- if (gmime_content_field_is_type (content_type, "text", "html")) {
+ if (header_content_type_is (content_type, "text", "html")) {
CamelDataWrapper *contents;
char *text, *final_text;
gboolean is_html;
@@ -1520,13 +1520,13 @@ handle_multipart (EMsgComposer *composer, CamelMultipart *multipart, int depth)
nparts = camel_multipart_get_number (multipart);
for (i = 0; i < nparts; i++) {
- GMimeContentField *content_type;
+ CamelContentType *content_type;
CamelMimePart *mime_part;
mime_part = camel_multipart_get_part (multipart, i);
content_type = camel_mime_part_get_content_type (mime_part);
- if (gmime_content_field_is_type (content_type, "multipart", "alternative")) {
+ if (header_content_type_is (content_type, "multipart", "alternative")) {
/* this structure contains the body */
CamelDataWrapper *wrapper;
CamelMultipart *mpart;
@@ -1535,7 +1535,7 @@ handle_multipart (EMsgComposer *composer, CamelMultipart *multipart, int depth)
mpart = CAMEL_MULTIPART (wrapper);
handle_multipart_alternative (composer, mpart);
- } else if (gmime_content_field_is_type (content_type, "multipart", "*")) {
+ } else if (header_content_type_is (content_type, "multipart", "*")) {
/* another layer of multipartness... */
CamelDataWrapper *wrapper;
CamelMultipart *mpart;
@@ -1581,7 +1581,7 @@ e_msg_composer_new_with_message (CamelMimeMessage *msg)
{
const CamelInternetAddress *to, *cc, *bcc;
GList *To = NULL, *Cc = NULL, *Bcc = NULL;
- GMimeContentField *content_type;
+ CamelContentType *content_type;
const gchar *subject;
EMsgComposer *new;
guint len, i;
@@ -1647,7 +1647,7 @@ e_msg_composer_new_with_message (CamelMimeMessage *msg)
free_recipients (Bcc);
content_type = camel_mime_part_get_content_type (CAMEL_MIME_PART (msg));
- if (gmime_content_field_is_type (content_type, "multipart", "alternative")) {
+ if (header_content_type_is (content_type, "multipart", "alternative")) {
/* multipart/alternative contains the text/plain and text/html versions of the message body */
CamelDataWrapper *wrapper;
CamelMultipart *multipart;
@@ -1656,7 +1656,7 @@ e_msg_composer_new_with_message (CamelMimeMessage *msg)
multipart = CAMEL_MULTIPART (wrapper);
handle_multipart_alternative (new, multipart);
- } else if (gmime_content_field_is_type (content_type, "multipart", "*")) {
+ } else if (header_content_type_is (content_type, "multipart", "*")) {
/* there must be attachments... */
CamelDataWrapper *wrapper;
CamelMultipart *multipart;