aboutsummaryrefslogtreecommitdiffstats
path: root/mail
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2010-04-13 03:55:53 +0800
committerMatthew Barnes <mbarnes@redhat.com>2010-04-13 03:55:53 +0800
commit51e5ae5524c778309800530e1e25fdf74f2226da (patch)
treecb4b49e313d0ac80d9b47c3f2ffe6e097fe08442 /mail
parent742b2d946553f3317a7cecc21f735441c37e4478 (diff)
downloadgsoc2013-evolution-51e5ae5524c778309800530e1e25fdf74f2226da.tar.gz
gsoc2013-evolution-51e5ae5524c778309800530e1e25fdf74f2226da.tar.zst
gsoc2013-evolution-51e5ae5524c778309800530e1e25fdf74f2226da.zip
Adapt to Camel API changes.
Diffstat (limited to 'mail')
-rw-r--r--mail/em-composer-utils.c20
-rw-r--r--mail/em-format-html-display.c14
-rw-r--r--mail/em-utils.c16
3 files changed, 30 insertions, 20 deletions
diff --git a/mail/em-composer-utils.c b/mail/em-composer-utils.c
index ffa053712f..3bd5021f12 100644
--- a/mail/em-composer-utils.c
+++ b/mail/em-composer-utils.c
@@ -920,7 +920,8 @@ traverse_parts (GSList *clues, CamelMimeMessage *message, CamelDataWrapper *cont
} else if (CAMEL_IS_MIME_PART (content)) {
CamelMimePart *part = CAMEL_MIME_PART (content);
CamelContentType *type;
- CamelStream *mem;
+ CamelStream *stream;
+ GByteArray *byte_array;
gchar *str;
content = camel_medium_get_content (CAMEL_MEDIUM (part));
@@ -936,17 +937,18 @@ traverse_parts (GSList *clues, CamelMimeMessage *message, CamelDataWrapper *cont
if (!camel_content_type_is (type, "text", "*"))
return;
- mem = camel_stream_mem_new ();
- camel_data_wrapper_decode_to_stream (content, mem);
+ byte_array = g_byte_array_new ();
+ stream = camel_stream_mem_new_with_byte_array (byte_array);
+ camel_data_wrapper_decode_to_stream (content, stream);
- str = g_strndup ((const gchar *)((CamelStreamMem *) mem)->buffer->data, ((CamelStreamMem *) mem)->buffer->len);
- camel_object_unref (mem);
+ str = g_strndup ((gchar *) byte_array->data, byte_array->len);
+ camel_object_unref (stream);
if (replace_variables (clues, message, &str)) {
- mem = camel_stream_mem_new_with_buffer (str, strlen (str));
- camel_stream_reset (mem);
- camel_data_wrapper_construct_from_stream (content, mem);
- camel_object_unref (mem);
+ stream = camel_stream_mem_new_with_buffer (str, strlen (str));
+ camel_stream_reset (stream);
+ camel_data_wrapper_construct_from_stream (content, stream);
+ camel_object_unref (stream);
}
g_free (str);
diff --git a/mail/em-format-html-display.c b/mail/em-format-html-display.c
index 54a768ec59..cca924ac9f 100644
--- a/mail/em-format-html-display.c
+++ b/mail/em-format-html-display.c
@@ -463,11 +463,12 @@ efhd_format_optional (EMFormat *emf,
{
gchar *classid, *html;
struct _attach_puri *info;
- CamelStream *stream;
+ CamelStream *stream = NULL;
- if (CAMEL_IS_STREAM_FILTER (fstream) && ((CamelStreamFilter *) fstream)->source)
- stream = ((CamelStreamFilter *) fstream)->source;
- else
+ if (CAMEL_IS_STREAM_FILTER (fstream))
+ stream = camel_stream_filter_get_source (
+ CAMEL_STREAM_FILTER (fstream));
+ if (stream == NULL)
stream = fstream;
classid = g_strdup_printf ("optional%s", emf->part_id->str);
@@ -970,6 +971,7 @@ efhd_attachment_optional(EMFormatHTML *efh, GtkHTMLEmbedded *eb, EMFormatHTMLPOb
GtkWidget *view;
GtkAllocation allocation;
GtkTextBuffer *buffer;
+ GByteArray *byte_array;
/* FIXME: handle default shown case */
d(printf("adding attachment button/content for optional rendering\n"));
@@ -1027,7 +1029,9 @@ efhd_attachment_optional(EMFormatHTML *efh, GtkHTMLEmbedded *eb, EMFormatHTMLPOb
gtk_text_view_set_editable (GTK_TEXT_VIEW (view), FALSE);
gtk_text_view_set_cursor_visible (GTK_TEXT_VIEW (view), FALSE);
buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW (view));
- gtk_text_buffer_set_text (buffer, (gchar *)info->mstream->buffer->data, info->mstream->buffer->len);
+ byte_array = camel_stream_mem_get_byte_array (info->mstream);
+ gtk_text_buffer_set_text (
+ buffer, (gchar *) byte_array->data, byte_array->len);
camel_object_unref(info->mstream);
info->mstream = NULL;
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scroll),
diff --git a/mail/em-utils.c b/mail/em-utils.c
index ae6f01e7ea..a1dd9ea565 100644
--- a/mail/em-utils.c
+++ b/mail/em-utils.c
@@ -635,21 +635,25 @@ em_utils_read_messages_from_stream(CamelFolder *folder, CamelStream *stream)
* Warning: This could block the ui for an extended period.
**/
void
-em_utils_selection_set_mailbox(GtkSelectionData *data, CamelFolder *folder, GPtrArray *uids)
+em_utils_selection_set_mailbox (GtkSelectionData *data,
+ CamelFolder *folder,
+ GPtrArray *uids)
{
+ GByteArray *byte_array;
CamelStream *stream;
GdkAtom target;
target = gtk_selection_data_get_target (data);
- stream = camel_stream_mem_new();
- if (em_utils_write_messages_to_stream(folder, uids, stream) == 0)
+ byte_array = g_byte_array_new ();
+ stream = camel_stream_mem_new_with_byte_array (byte_array);
+
+ if (em_utils_write_messages_to_stream (folder, uids, stream) == 0)
gtk_selection_data_set(
data, target, 8,
- ((CamelStreamMem *)stream)->buffer->data,
- ((CamelStreamMem *)stream)->buffer->len);
+ byte_array->data, byte_array->len);
- camel_object_unref(stream);
+ camel_object_unref (stream);
}
/**