From 686273e70da67d8844344f0b8ccc592ca7e92f50 Mon Sep 17 00:00:00 2001 From: bertrand Date: Wed, 25 Aug 1999 15:44:35 +0000 Subject: these methods are in CamelMedium now. 1999-08-25 bertrand * camel/camel-medium.c (_set_content_object): (_get_content_object): these methods are in CamelMedium now. Going to revamp MimePart soon so that it inherits from CamelMedium. svn path=/trunk/; revision=1141 --- camel/camel-medium.c | 62 +++++++++++++++++++++++++++++++++++++++++++++---- camel/camel-medium.h | 6 ++++- camel/camel-mime-part.c | 4 ++++ 3 files changed, 67 insertions(+), 5 deletions(-) (limited to 'camel') diff --git a/camel/camel-medium.c b/camel/camel-medium.c index 8414432a07..b6a3ffc9fc 100644 --- a/camel/camel-medium.c +++ b/camel/camel-medium.c @@ -37,12 +37,14 @@ static CamelDataWrapperClass *parent_class=NULL; /* Returns the class for a CamelMedium */ -#define CMP_CLASS(so) CAMEL_MEDIUM_CLASS (GTK_OBJECT(so)->klass) +#define CM_CLASS(so) CAMEL_MEDIUM_CLASS (GTK_OBJECT(so)->klass) static void _add_header (CamelMedium *medium, gchar *header_name, gchar *header_value); static void _remove_header (CamelMedium *medium, const gchar *header_name); static const gchar *_get_header (CamelMedium *medium, const gchar *header_name); +static CamelDataWrapper *_get_content_object(CamelMedium *medium); +static void _set_content_object(CamelMedium *medium, CamelDataWrapper *content); static void _finalize (GtkObject *object); @@ -121,6 +123,9 @@ _finalize (GtkObject *object) } + +/* **** */ + static void _add_header (CamelMedium *medium, gchar *header_name, gchar *header_value) { @@ -144,10 +149,12 @@ _add_header (CamelMedium *medium, gchar *header_name, gchar *header_value) void camel_medium_add_header (CamelMedium *medium, gchar *header_name, gchar *header_value) { - CMP_CLASS(medium)->add_header(medium, header_name, header_value); + CM_CLASS(medium)->add_header(medium, header_name, header_value); } +/* **** */ + static void _remove_header (CamelMedium *medium, const gchar *header_name) @@ -172,10 +179,12 @@ _remove_header (CamelMedium *medium, const gchar *header_name) void camel_medium_remove_header (CamelMedium *medium, const gchar *header_name) { - CMP_CLASS(medium)->remove_header(medium, header_name); + CM_CLASS(medium)->remove_header(medium, header_name); } +/* **** */ + static const gchar * _get_header (CamelMedium *medium, const gchar *header_name) @@ -192,6 +201,51 @@ _get_header (CamelMedium *medium, const gchar *header_name) const gchar * camel_medium_get_header (CamelMedium *medium, const gchar *header_name) { - return CMP_CLASS(medium)->get_header (medium, header_name); + return CM_CLASS(medium)->get_header (medium, header_name); +} + + +/* **** */ + + +static CamelDataWrapper * +_get_content_object (CamelMedium *medium) +{ + return medium->content; + +} + + +CamelDataWrapper * +camel_medium_get_content_object (CamelMedium *medium) +{ + return CM_CLASS(medium)->get_content_object (medium); } + +/* **** */ + + +static void +_set_content_object (CamelMedium *medium, CamelDataWrapper *content) +{ + GMimeContentField *object_content_field; + + CAMEL_LOG_FULL_DEBUG ("Entering CamelMedium::set_content_object\n"); + if (medium->content) { + CAMEL_LOG_FULL_DEBUG ("CamelMedium::set_content_object unreferencing old content object\n"); + gtk_object_unref (GTK_OBJECT (medium->content)); + } + gtk_object_ref (GTK_OBJECT (content)); + medium->content = content; + +} + +void +camel_medium_set_content_object (CamelMedium *medium, CamelDataWrapper *content) +{ + CM_CLASS(medium)->set_content_object (medium, content); +} + + +/* **** */ diff --git a/camel/camel-medium.h b/camel/camel-medium.h index c35466336c..d39b5898ad 100644 --- a/camel/camel-medium.h +++ b/camel/camel-medium.h @@ -48,7 +48,6 @@ typedef struct GHashTable *headers; - GMimeContentField *content_type; CamelDataWrapper *content; /* part real content */ } CamelMedium; @@ -63,6 +62,9 @@ typedef struct { void (*remove_header) (CamelMedium *medium, const gchar *header_name); const gchar * (*get_header) (CamelMedium *medium, const gchar *header_name); + CamelDataWrapper * (*get_content_object) (CamelMedium *medium); + void (*set_content_object) (CamelMedium *medium, CamelDataWrapper *content); + } CamelMediumClass; @@ -77,6 +79,8 @@ void camel_medium_remove_header (CamelMedium *medium, const gchar *header_name); const gchar *camel_medium_get_header (CamelMedium *medium, const gchar *header_name); +CamelDataWrapper *camel_medium_get_content_object (CamelMedium *medium); +void camel_medium_set_content_object (CamelMedium *medium, CamelDataWrapper *content); #ifdef __cplusplus diff --git a/camel/camel-mime-part.c b/camel/camel-mime-part.c index edab1636b6..1620eb771f 100644 --- a/camel/camel-mime-part.c +++ b/camel/camel-mime-part.c @@ -572,6 +572,8 @@ _get_content_object(CamelMimePart *mime_part) return mime_part->content; } + + const CamelDataWrapper * camel_mime_part_get_content_object(CamelMimePart *mime_part) { @@ -579,6 +581,8 @@ camel_mime_part_get_content_object(CamelMimePart *mime_part) } + + static void _set_content_object(CamelMimePart *mime_part, CamelDataWrapper *content) { -- cgit v1.2.3