aboutsummaryrefslogtreecommitdiffstats
path: root/camel/camel-data-wrapper.c
diff options
context:
space:
mode:
authorDan Winship <danw@src.gnome.org>2000-12-29 03:28:39 +0800
committerDan Winship <danw@src.gnome.org>2000-12-29 03:28:39 +0800
commit156996ac5eaaddea369e4ae001c06c45f5ad76f4 (patch)
tree4d6f8c6714002dfe6baf2717980bf9530a3c2fb2 /camel/camel-data-wrapper.c
parent1351da8fd7d1207e79cc811f300f3ccbc68ce3c7 (diff)
downloadgsoc2013-evolution-156996ac5eaaddea369e4ae001c06c45f5ad76f4.tar
gsoc2013-evolution-156996ac5eaaddea369e4ae001c06c45f5ad76f4.tar.gz
gsoc2013-evolution-156996ac5eaaddea369e4ae001c06c45f5ad76f4.tar.bz2
gsoc2013-evolution-156996ac5eaaddea369e4ae001c06c45f5ad76f4.tar.lz
gsoc2013-evolution-156996ac5eaaddea369e4ae001c06c45f5ad76f4.tar.xz
gsoc2013-evolution-156996ac5eaaddea369e4ae001c06c45f5ad76f4.tar.zst
gsoc2013-evolution-156996ac5eaaddea369e4ae001c06c45f5ad76f4.zip
Remove this. It was only a thin wrapper around struct _header_content_type
* gmime-content-field.[ch]: Remove this. It was only a thin wrapper around struct _header_content_type anyway, and didn't match the naming scheme of anything else. * Makefile.am: Remove gmime-content-field.[ch] * camel.h: Remove gmime-content-field.h * camel-types.h: Add CamelContentType as a typedef for struct _header_content_type (especially for use outside of camel). * camel-multipart.c: * camel-mime-part.c: * camel-mime-message.c: * camel-folder-summary.c: * camel-folder-search.c: * camel-data-wrapper.[ch]: Use CamelContentType and header_content_type_* functions rather than the GMime stuff. * camel-mime-part-utils.c: * camel-medium.c: Remove unused gmime-content-field.h include. svn path=/trunk/; revision=7186
Diffstat (limited to 'camel/camel-data-wrapper.c')
-rw-r--r--camel/camel-data-wrapper.c32
1 files changed, 18 insertions, 14 deletions
diff --git a/camel/camel-data-wrapper.c b/camel/camel-data-wrapper.c
index 52cf60bd33..061e664b92 100644
--- a/camel/camel-data-wrapper.c
+++ b/camel/camel-data-wrapper.c
@@ -24,6 +24,8 @@
*/
#include <config.h>
#include "camel-data-wrapper.h"
+#include "camel-mime-utils.h"
+#include "camel-stream.h"
#include "camel-exception.h"
#include <errno.h>
@@ -40,8 +42,8 @@ static int construct_from_stream(CamelDataWrapper *, CamelStream *);
static int write_to_stream (CamelDataWrapper *data_wrapper, CamelStream *stream);
static void set_mime_type (CamelDataWrapper *data_wrapper, const gchar *mime_type);
static gchar *get_mime_type (CamelDataWrapper *data_wrapper);
-static GMimeContentField *get_mime_type_field (CamelDataWrapper *data_wrapper);
-static void set_mime_type_field (CamelDataWrapper *data_wrapper, GMimeContentField *mime_type);
+static CamelContentType *get_mime_type_field (CamelDataWrapper *data_wrapper);
+static void set_mime_type_field (CamelDataWrapper *data_wrapper, CamelContentType *mime_type);
static void
camel_data_wrapper_class_init (CamelDataWrapperClass *camel_data_wrapper_class)
@@ -63,7 +65,7 @@ camel_data_wrapper_init (gpointer object, gpointer klass)
{
CamelDataWrapper *camel_data_wrapper = CAMEL_DATA_WRAPPER (object);
- camel_data_wrapper->mime_type = gmime_content_field_new (NULL, NULL);
+ camel_data_wrapper->mime_type = header_content_type_new ("application", "octet-stream");
}
static void
@@ -72,7 +74,7 @@ camel_data_wrapper_finalize (CamelObject *object)
CamelDataWrapper *camel_data_wrapper = CAMEL_DATA_WRAPPER (object);
if (camel_data_wrapper->mime_type)
- gmime_content_field_unref (camel_data_wrapper->mime_type);
+ header_content_type_unref (camel_data_wrapper->mime_type);
if (camel_data_wrapper->stream)
camel_object_unref (CAMEL_OBJECT (camel_data_wrapper->stream));
@@ -173,8 +175,9 @@ camel_data_wrapper_construct_from_stream (CamelDataWrapper *data_wrapper,
static void
set_mime_type (CamelDataWrapper *data_wrapper, const gchar *mime_type)
{
- gmime_content_field_construct_from_string (data_wrapper->mime_type,
- mime_type);
+ if (data_wrapper->mime_type)
+ header_content_type_unref (data_wrapper->mime_type);
+ data_wrapper->mime_type = header_content_type_decode (mime_type);
}
/**
@@ -202,14 +205,15 @@ camel_data_wrapper_set_mime_type (CamelDataWrapper *data_wrapper,
static gchar *
get_mime_type (CamelDataWrapper *data_wrapper)
{
- return gmime_content_field_get_mime_type (data_wrapper->mime_type);
+ return header_content_type_format (data_wrapper->mime_type);
}
/**
* camel_data_wrapper_get_mime_type:
* @data_wrapper: a data wrapper
*
- * Return value: the text form of the data wrapper's MIME type
+ * Return value: the text form of the data wrapper's MIME type,
+ * which the caller must free.
**/
gchar *
camel_data_wrapper_get_mime_type (CamelDataWrapper *data_wrapper)
@@ -220,7 +224,7 @@ camel_data_wrapper_get_mime_type (CamelDataWrapper *data_wrapper)
}
-static GMimeContentField *
+static CamelContentType *
get_mime_type_field (CamelDataWrapper *data_wrapper)
{
return data_wrapper->mime_type;
@@ -232,7 +236,7 @@ get_mime_type_field (CamelDataWrapper *data_wrapper)
*
* Return value: the parsed form of the data wrapper's MIME type
**/
-GMimeContentField *
+CamelContentType *
camel_data_wrapper_get_mime_type_field (CamelDataWrapper *data_wrapper)
{
g_return_val_if_fail (CAMEL_IS_DATA_WRAPPER (data_wrapper), NULL);
@@ -250,21 +254,21 @@ camel_data_wrapper_get_mime_type_field (CamelDataWrapper *data_wrapper)
**/
static void
set_mime_type_field (CamelDataWrapper *data_wrapper,
- GMimeContentField *mime_type)
+ CamelContentType *mime_type)
{
g_return_if_fail (CAMEL_IS_DATA_WRAPPER (data_wrapper));
g_return_if_fail (mime_type != NULL);
if (data_wrapper->mime_type)
- gmime_content_field_unref (data_wrapper->mime_type);
+ header_content_type_unref (data_wrapper->mime_type);
data_wrapper->mime_type = mime_type;
if (mime_type)
- gmime_content_field_ref (data_wrapper->mime_type);
+ header_content_type_ref (data_wrapper->mime_type);
}
void
camel_data_wrapper_set_mime_type_field (CamelDataWrapper *data_wrapper,
- GMimeContentField *mime_type)
+ CamelContentType *mime_type)
{
CDW_CLASS (data_wrapper)->set_mime_type_field (data_wrapper, mime_type);
}