diff options
author | Dan Winship <danw@src.gnome.org> | 2000-05-18 09:00:25 +0800 |
---|---|---|
committer | Dan Winship <danw@src.gnome.org> | 2000-05-18 09:00:25 +0800 |
commit | 0cd1c1934c5a366a8d506c177c859d65075fb942 (patch) | |
tree | 34553076f5f83d2087fdf55b3ba807f42f6f3f36 /camel/camel-data-wrapper.c | |
parent | 844e27e365aa00a3d49055d316e5848c03118895 (diff) | |
download | gsoc2013-evolution-0cd1c1934c5a366a8d506c177c859d65075fb942.tar gsoc2013-evolution-0cd1c1934c5a366a8d506c177c859d65075fb942.tar.gz gsoc2013-evolution-0cd1c1934c5a366a8d506c177c859d65075fb942.tar.bz2 gsoc2013-evolution-0cd1c1934c5a366a8d506c177c859d65075fb942.tar.lz gsoc2013-evolution-0cd1c1934c5a366a8d506c177c859d65075fb942.tar.xz gsoc2013-evolution-0cd1c1934c5a366a8d506c177c859d65075fb942.tar.zst gsoc2013-evolution-0cd1c1934c5a366a8d506c177c859d65075fb942.zip |
remove get/set_output_stream operations. They're redundant with
* camel-data-wrapper.c: remove get/set_output_stream operations.
They're redundant with write_to_stream, and CamelMimePart and
CamelMimeMessage only implement the latter, meaning that trying to
get_output_stream on a CamelMimeMessage that was built from pieces
rather than being parsed from a stream doesn't work. Anything that
uses get_output_stream can be rewritten to use write_to_stream, so
we'll standardize on that.
(camel_data_wrapper_new): remove this: CamelDataWrapper is
supposed to be an abstract class.
(write_to_stream): remove default implementation. (Moved to
CamelSimpleDataWrapper)
* camel-simple-data-wrapper.c: resurrect, although it's not really
the same thing it was before. A simple data wrapper, which is
backed by a CamelStream.
* camel-mime-part-utils.c
(simple_data_wrapper_construct_from_parser): Use
construct_from_stream rather than set_output_stream.
(camel_mime_part_construct_content_from_parser): Change
camel_data_wrapper_new to camel_simple_data_wrapper_new.
* camel-mime-part.c (camel_mime_part_set_content): Change
camel_data_wrapper_new to camel_simple_data_wrapper_new.
svn path=/trunk/; revision=3112
Diffstat (limited to 'camel/camel-data-wrapper.c')
-rw-r--r-- | camel/camel-data-wrapper.c | 114 |
1 files changed, 9 insertions, 105 deletions
diff --git a/camel/camel-data-wrapper.c b/camel/camel-data-wrapper.c index fcd7abb812..61cee59a51 100644 --- a/camel/camel-data-wrapper.c +++ b/camel/camel-data-wrapper.c @@ -36,10 +36,6 @@ static CamelObjectClass *parent_class = NULL; #define CDW_CLASS(so) CAMEL_DATA_WRAPPER_CLASS (GTK_OBJECT (so)->klass) -static void set_output_stream (CamelDataWrapper *data_wrapper, - CamelStream *stream); -static CamelStream *get_output_stream (CamelDataWrapper *data_wrapper); - static int construct_from_stream(CamelDataWrapper *, CamelStream *); static int write_to_stream (CamelDataWrapper *data_wrapper, CamelStream *stream, CamelException *ex); @@ -66,9 +62,6 @@ camel_data_wrapper_class_init (CamelDataWrapperClass *camel_data_wrapper_class) camel_data_wrapper_class->get_mime_type_field = get_mime_type_field; camel_data_wrapper_class->set_mime_type_field = set_mime_type_field; - camel_data_wrapper_class->set_output_stream = set_output_stream; - camel_data_wrapper_class->get_output_stream = get_output_stream; - camel_data_wrapper_class->construct_from_stream = construct_from_stream; /* virtual method overload */ @@ -118,107 +111,16 @@ finalize (GtkObject *object) if (camel_data_wrapper->mime_type) gmime_content_field_unref (camel_data_wrapper->mime_type); - if (camel_data_wrapper->input_stream) - gtk_object_unref (GTK_OBJECT (camel_data_wrapper->input_stream)); - - if (camel_data_wrapper->output_stream) - gtk_object_unref (GTK_OBJECT (camel_data_wrapper->output_stream)); - GTK_OBJECT_CLASS (parent_class)->finalize (object); } -/** - * camel_data_wrapper_new: - * - * Create a new camel data wrapper object. - * - * Return value: - **/ -CamelDataWrapper * -camel_data_wrapper_new(void) -{ - return gtk_type_new(camel_data_wrapper_get_type()); -} - - -static void -set_output_stream (CamelDataWrapper *data_wrapper, CamelStream *stream) -{ - if (data_wrapper->output_stream) - gtk_object_unref (GTK_OBJECT (data_wrapper->output_stream)); - - data_wrapper->output_stream = stream; - if (stream) - gtk_object_ref (GTK_OBJECT (stream)); - d(printf("data_wrapper:: set_output_stream(%p)\n", stream)); -} - -/** - * camel_data_wrapper_set_output_stream: - * @data_wrapper: a data wrapper - * @stream: a stream that can be read from - * - * This is an internal function to be used by implementors of - * the camel-data-wrapper to set their contents as a stream. - * - * The output stream should theoretically be a stream that, if read - * from, produces the data wrapper's contents. However, while certain - * pieces of code assume this, nothing enforces it. - * - **/ -void -camel_data_wrapper_set_output_stream (CamelDataWrapper *data_wrapper, - CamelStream *stream) -{ - g_return_if_fail (CAMEL_IS_DATA_WRAPPER (data_wrapper)); - g_return_if_fail (CAMEL_IS_STREAM (stream)); - - CDW_CLASS (data_wrapper)->set_output_stream (data_wrapper, stream); -} - - -static CamelStream * -get_output_stream (CamelDataWrapper *data_wrapper) -{ - d(printf("data_wrapper:: get_output_stream(%p) = %p\n", data_wrapper, data_wrapper->output_stream)); - return data_wrapper->output_stream; -} - -/** - * camel_data_wrapper_get_output_stream: - * @data_wrapper: a data wrapper - * - * If the data wrapper has contents, this will return a stream representing - * the data wrappers contents. Currently only the body of a simple - * mime part may be read in this way, although conceivably a whole - * mime message or partial mime message could be processed this way. - * - * Return value: @data_wrapper's output stream - **/ -CamelStream * -camel_data_wrapper_get_output_stream (CamelDataWrapper *data_wrapper) -{ - g_return_val_if_fail (CAMEL_IS_DATA_WRAPPER (data_wrapper), NULL); - - return CDW_CLASS (data_wrapper)->get_output_stream (data_wrapper); -} - - static int write_to_stream (CamelDataWrapper *data_wrapper, CamelStream *stream, CamelException *ex) { - CamelStream *output_stream; - - d(printf("data_wrapper::write_to_stream\n")); - - output_stream = camel_data_wrapper_get_output_stream (data_wrapper); - g_return_val_if_fail (CAMEL_IS_STREAM (output_stream), -1); - - camel_stream_reset (output_stream, ex); - if (camel_exception_is_set (ex)) - return -1; - return camel_stream_write_to_stream (output_stream, stream, ex); + g_warning ("CamelDataWrapper::write_to_stream not implemented for " + "`%s'", gtk_type_name (GTK_OBJECT_TYPE (data_wrapper))); + return -1; } /** @@ -246,11 +148,11 @@ camel_data_wrapper_write_to_stream (CamelDataWrapper *data_wrapper, } static int -construct_from_stream(CamelDataWrapper *data_wrapper, - CamelStream *stream) +construct_from_stream (CamelDataWrapper *data_wrapper, CamelStream *stream) { - camel_data_wrapper_set_output_stream (data_wrapper, stream); - return 0; + g_warning ("CamelDataWrapper::construct_from_stream not implemented " + "for `%s'", gtk_type_name (GTK_OBJECT_TYPE (data_wrapper))); + return -1; } /** @@ -262,6 +164,8 @@ construct_from_stream(CamelDataWrapper *data_wrapper, * supplied @stream. * * This could fail, but you can't know if it did. + * + * Return value: Who knows. FIXME **/ int camel_data_wrapper_construct_from_stream (CamelDataWrapper *data_wrapper, |