aboutsummaryrefslogtreecommitdiffstats
path: root/camel/camel-simple-data-wrapper.c
diff options
context:
space:
mode:
authorEttore Perazzoli <ettore@src.gnome.org>1999-11-17 22:39:25 +0800
committerEttore Perazzoli <ettore@src.gnome.org>1999-11-17 22:39:25 +0800
commitca7044930f42a698fd88f914c2512a20e2eeaae9 (patch)
tree522962a77005d741097713e87de1d50353b17768 /camel/camel-simple-data-wrapper.c
parent16de3313b700cb56ab9e829d1e9b7e7d2c81241b (diff)
downloadgsoc2013-evolution-ca7044930f42a698fd88f914c2512a20e2eeaae9.tar
gsoc2013-evolution-ca7044930f42a698fd88f914c2512a20e2eeaae9.tar.gz
gsoc2013-evolution-ca7044930f42a698fd88f914c2512a20e2eeaae9.tar.bz2
gsoc2013-evolution-ca7044930f42a698fd88f914c2512a20e2eeaae9.tar.lz
gsoc2013-evolution-ca7044930f42a698fd88f914c2512a20e2eeaae9.tar.xz
gsoc2013-evolution-ca7044930f42a698fd88f914c2512a20e2eeaae9.tar.zst
gsoc2013-evolution-ca7044930f42a698fd88f914c2512a20e2eeaae9.zip
Added streaming capability to CamelDataWrapper. This makes it possible, for
example, to build multipart messages out of files that are on disk without loading them in memory. svn path=/trunk/; revision=1394
Diffstat (limited to 'camel/camel-simple-data-wrapper.c')
-rw-r--r--camel/camel-simple-data-wrapper.c34
1 files changed, 28 insertions, 6 deletions
diff --git a/camel/camel-simple-data-wrapper.c b/camel/camel-simple-data-wrapper.c
index 073561a1a1..fb1c682814 100644
--- a/camel/camel-simple-data-wrapper.c
+++ b/camel/camel-simple-data-wrapper.c
@@ -25,7 +25,9 @@
* USA
*/
#include <config.h>
+
#include "camel-simple-data-wrapper.h"
+#include "camel-simple-data-wrapper-stream.h"
#include "camel-log.h"
static CamelDataWrapperClass *parent_class=NULL;
@@ -36,6 +38,7 @@ static CamelDataWrapperClass *parent_class=NULL;
static void _construct_from_stream (CamelDataWrapper *data_wrapper, CamelStream *stream);
static void _write_to_stream (CamelDataWrapper *data_wrapper, CamelStream *stream);
static void _finalize (GtkObject *object);
+static CamelStream *_get_stream (CamelDataWrapper *data_wrapper);
static void
camel_simple_data_wrapper_class_init (CamelSimpleDataWrapperClass *camel_simple_data_wrapper_class)
@@ -50,13 +53,17 @@ camel_simple_data_wrapper_class_init (CamelSimpleDataWrapperClass *camel_simple_
camel_data_wrapper_class->write_to_stream = _write_to_stream;
camel_data_wrapper_class->construct_from_stream = _construct_from_stream;
+ camel_data_wrapper_class->get_stream = _get_stream;
+
gtk_object_class->finalize = _finalize;
}
-
-
-
+static void
+camel_simple_data_wrapper_init (CamelSimpleDataWrapper *wrapper)
+{
+ wrapper->stream = NULL;
+}
GtkType
camel_simple_data_wrapper_get_type (void)
@@ -70,7 +77,7 @@ camel_simple_data_wrapper_get_type (void)
sizeof (CamelSimpleDataWrapper),
sizeof (CamelSimpleDataWrapperClass),
(GtkClassInitFunc) camel_simple_data_wrapper_class_init,
- (GtkObjectInitFunc) NULL,
+ (GtkObjectInitFunc) camel_simple_data_wrapper_init,
/* reserved_1 */ NULL,
/* reserved_2 */ NULL,
(GtkClassInitFunc) NULL,
@@ -134,8 +141,6 @@ _write_to_stream (CamelDataWrapper *data_wrapper, CamelStream *stream)
}
-
-
#define _CMSDW_TMP_BUF_SIZE 100
static void
_construct_from_stream (CamelDataWrapper *data_wrapper, CamelStream *stream)
@@ -206,3 +211,20 @@ camel_simple_data_wrapper_set_text (CamelSimpleDataWrapper *simple_data_wrapper,
CAMEL_LOG_FULL_DEBUG ("CamelSimpleDataWrapper:: Entering set_text\n");
}
+
+
+static CamelStream *
+_get_stream (CamelDataWrapper *data_wrapper)
+{
+ CamelSimpleDataWrapper *simple_data_wrapper;
+
+ simple_data_wrapper = CAMEL_SIMPLE_DATA_WRAPPER (data_wrapper);
+ if (simple_data_wrapper->stream == NULL) {
+ CamelStream *s;
+
+ s = camel_simple_data_wrapper_stream_new (simple_data_wrapper);
+ simple_data_wrapper->stream = s;
+ }
+
+ return simple_data_wrapper->stream;
+}