diff options
author | bertrand <Bertrand.Guiheneuf@inria.fr> | 1999-06-23 00:12:27 +0800 |
---|---|---|
committer | Bertrand Guiheneuf <bertrand@src.gnome.org> | 1999-06-23 00:12:27 +0800 |
commit | 7f81757d52326126f88e898241dc40c1668f5164 (patch) | |
tree | ce4f1671ce7d1280f8b1a375c15bbc79bd87cad9 /camel/camel-data-wrapper.c | |
parent | 5deed2f193e7ab91f159f1a764b78578861044cd (diff) | |
download | gsoc2013-evolution-7f81757d52326126f88e898241dc40c1668f5164.tar.gz gsoc2013-evolution-7f81757d52326126f88e898241dc40c1668f5164.tar.zst gsoc2013-evolution-7f81757d52326126f88e898241dc40c1668f5164.zip |
moved all the content-type stuff here. (camel_data_wrapper_init):
1999-06-22 bertrand <Bertrand.Guiheneuf@inria.fr>
* camel/camel-data-wrapper.c (_get_content_type):
moved all the content-type stuff here.
(camel_data_wrapper_init): initialize the instance
content-type field.
* camel/camel-mime-part.c (_parse_header_pair):
parse Content-Type stuff in header.
(_write_to_stream): write the content type stuff to
the stream.
svn path=/trunk/; revision=985
Diffstat (limited to 'camel/camel-data-wrapper.c')
-rw-r--r-- | camel/camel-data-wrapper.c | 49 |
1 files changed, 44 insertions, 5 deletions
diff --git a/camel/camel-data-wrapper.c b/camel/camel-data-wrapper.c index c7793403b4..f885e8a0a6 100644 --- a/camel/camel-data-wrapper.c +++ b/camel/camel-data-wrapper.c @@ -29,10 +29,12 @@ static GtkObjectClass *parent_class=NULL; /* Returns the class for a CamelDataWrapper */ -#define CDH_CLASS(so) CAMEL_DATA_WRAPPER_CLASS (GTK_OBJECT(so)->klass) +#define CDW_CLASS(so) CAMEL_DATA_WRAPPER_CLASS (GTK_OBJECT(so)->klass) static void _construct_from_stream (CamelDataWrapper *data_wrapper, CamelStream *stream, guint size); static void _write_to_stream (CamelDataWrapper *data_wrapper, CamelStream *stream); +static void _set_content_type (CamelDataWrapper *data_wrapper, GString *content_type); +static GString *_get_content_type (CamelDataWrapper *data_wrapper); static void camel_data_wrapper_class_init (CamelDataWrapperClass *camel_data_wrapper_class) @@ -42,6 +44,8 @@ camel_data_wrapper_class_init (CamelDataWrapperClass *camel_data_wrapper_class) /* virtual method definition */ camel_data_wrapper_class->write_to_stream = _write_to_stream; camel_data_wrapper_class->construct_from_stream = _construct_from_stream; + camel_data_wrapper_class->set_content_type = _set_content_type; + camel_data_wrapper_class->get_content_type = _get_content_type; /* virtual method overload */ } @@ -50,6 +54,14 @@ camel_data_wrapper_class_init (CamelDataWrapperClass *camel_data_wrapper_class) +static void +camel_data_wrapper_init (gpointer object, gpointer klass) +{ + CamelDataWrapper *camel_data_wrapper = CAMEL_DATA_WRAPPER (object); + + camel_data_wrapper->content_type = gmime_content_field_new (NULL, NULL); +} + GtkType @@ -64,7 +76,7 @@ camel_data_wrapper_get_type (void) sizeof (CamelDataWrapper), sizeof (CamelDataWrapperClass), (GtkClassInitFunc) camel_data_wrapper_class_init, - (GtkObjectInitFunc) NULL, + (GtkObjectInitFunc) camel_data_wrapper_init, /* reserved_1 */ NULL, /* reserved_2 */ NULL, (GtkClassInitFunc) NULL, @@ -78,7 +90,6 @@ camel_data_wrapper_get_type (void) - /** * _write_to_stream: write data content in a byte stream * @data_wrapper: the data wrapper object @@ -113,7 +124,7 @@ _write_to_stream (CamelDataWrapper *data_wrapper, CamelStream *stream) void camel_data_wrapper_write_to_stream (CamelDataWrapper *data_wrapper, CamelStream *stream) { - CDH_CLASS(data_wrapper)->write_to_stream (data_wrapper, stream); + CDW_CLASS(data_wrapper)->write_to_stream (data_wrapper, stream); } @@ -130,7 +141,35 @@ _construct_from_stream (CamelDataWrapper *data_wrapper, CamelStream *stream, gui void camel_data_wrapper_construct_from_stream (CamelDataWrapper *data_wrapper, CamelStream *stream, guint size) { - CDH_CLASS(data_wrapper)->construct_from_stream (data_wrapper, stream, size); + CDW_CLASS(data_wrapper)->construct_from_stream (data_wrapper, stream, size); } + +static void +_set_content_type (CamelDataWrapper *data_wrapper, GString *content_type) +{ + g_assert (content_type); + gmime_content_field_construct_from_string (data_wrapper->content_type, content_type); +} + +void +camel_data_wrapper_set_content_type (CamelDataWrapper *data_wrapper, GString *content_type) +{ + CDW_CLASS(data_wrapper)->set_content_type (data_wrapper, content_type); +} + +static GString * +_get_content_type (CamelDataWrapper *data_wrapper) +{ + GString *mime_type; + + mime_type = gmime_content_field_get_mime_type (data_wrapper->content_type); + return mime_type; +} + +static GString * +camel_data_wrapper_get_content_type (CamelDataWrapper *data_wrapper) +{ + return CDW_CLASS(data_wrapper)->get_content_type (data_wrapper); +} |