aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog18
-rw-r--r--camel/camel-data-wrapper.c47
-rw-r--r--camel/camel-data-wrapper.h26
-rw-r--r--camel/camel-stream.c21
-rw-r--r--camel/camel-stream.h3
5 files changed, 107 insertions, 8 deletions
diff --git a/ChangeLog b/ChangeLog
index 2d131c88a7..764ddd3379 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+2000-01-24 bertrand <bertrand@helixcode.com>
+
+ * camel/camel-data-wrapper.h:
+ * camel/camel-data-wrapper.c
+ (_set_input_stream):
+ (_get_input_stream):
+ (_set_output_stream):
+ (_get_output_stream):
+ The CamelDataWrapper can now be provided with input and
+ output streams, so that nothing has to be kept in memory.
+
+ * camel/camel-stream.c (camel_stream_class_init):
+ added the "data_available" signal.
+
+
2000-01-24 Federico Mena Quintero <federico@helixcode.com>
* configure.in: Added the gnome-pilot and capplet checks; they
@@ -10,7 +25,8 @@
* camel/camel-seekable-stream.c:
* camel/camel-seekable-stream.h:
-
+ new files.
+
* camel/camel-simple-data-wrapper-stream.h: parent class is now
CamelSeekableStream
* camel/camel-stream-buffered-fs.h: idem
diff --git a/camel/camel-data-wrapper.c b/camel/camel-data-wrapper.c
index 061225b03a..4b9683b2d1 100644
--- a/camel/camel-data-wrapper.c
+++ b/camel/camel-data-wrapper.c
@@ -35,6 +35,12 @@ static GtkObjectClass *parent_class=NULL;
/* Returns the class for a CamelDataWrapper */
#define CDW_CLASS(so) CAMEL_DATA_WRAPPER_CLASS (GTK_OBJECT(so)->klass)
+
+static void _set_input_stream (CamelDataWrapper *data_wrapper, CamelStream *stream);
+static CamelStream *_get_input_stream (CamelDataWrapper *data_wrapper);
+static void _set_output_stream (CamelDataWrapper *data_wrapper, CamelStream *stream);
+CamelStream *_get_output_stream (CamelDataWrapper *data_wrapper);
+
static void _construct_from_stream (CamelDataWrapper *data_wrapper, CamelStream *stream);
static void _write_to_stream (CamelDataWrapper *data_wrapper, CamelStream *stream);
static void _set_mime_type (CamelDataWrapper *data_wrapper, gchar *mime_type);
@@ -120,6 +126,47 @@ _finalize (GtkObject *object)
}
+
+
+
+
+void
+_set_input_stream (CamelDataWrapper *data_wrapper, CamelStream *stream)
+{
+ g_assert (data_wrapper);
+ data_wrapper->input_stream;
+}
+
+
+CamelStream *
+_get_input_stream (CamelDataWrapper *data_wrapper)
+{
+ g_assert (data_wrapper);
+ return (data_wrapper->input_stream);
+}
+
+
+void
+_set_output_stream (CamelDataWrapper *data_wrapper, CamelStream *stream)
+{
+ g_assert (data_wrapper);
+ data_wrapper->output_stream;
+}
+
+
+CamelStream *
+_get_output_stream (CamelDataWrapper *data_wrapper)
+{
+ g_assert (data_wrapper);
+ return (data_wrapper->output_stream);
+}
+
+
+
+
+
+
+
/**
* _write_to_stream: write data content in a byte stream
* @data_wrapper: the data wrapper object
diff --git a/camel/camel-data-wrapper.h b/camel/camel-data-wrapper.h
index 90d0cb4ad4..c9f8e8b65c 100644
--- a/camel/camel-data-wrapper.h
+++ b/camel/camel-data-wrapper.h
@@ -51,6 +51,9 @@ typedef struct
{
GtkObject parent_object;
+ CamelStream *input_stream;
+ CamelStream *output_stream;
+
GMimeContentField *mime_type;
} CamelDataWrapper;
@@ -60,13 +63,20 @@ typedef struct {
GtkObjectClass parent_class;
/* Virtual methods */
- void (*write_to_stream) (CamelDataWrapper *data_wrapper, CamelStream *stream);
- void (*construct_from_stream) (CamelDataWrapper *data_wrapper, CamelStream *stream);
- void (*set_mime_type) (CamelDataWrapper *data_wrapper, gchar * mime_type);
- gchar * (*get_mime_type) (CamelDataWrapper *data_wrapper);
- GMimeContentField * (*get_mime_type_field) (CamelDataWrapper *data_wrapper);
- void (*set_mime_type_field) (CamelDataWrapper *data_wrapper, GMimeContentField *mime_type_field);
- CamelStream * (*get_stream) (CamelDataWrapper *data_wrapper);
+ void (*set_input_stream) (CamelDataWrapper *data_wrapper, CamelStream *stream);
+ CamelStream * (*get_input_stream) (CamelDataWrapper *data_wrapper);
+ void (*set_output_stream) (CamelDataWrapper *data_wrapper, CamelStream *stream);
+ CamelStream * (*get_output_stream) (CamelDataWrapper *data_wrapper);
+
+ /* deprecated method */
+ void (*write_to_stream) (CamelDataWrapper *data_wrapper, CamelStream *stream);
+ void (*construct_from_stream) (CamelDataWrapper *data_wrapper, CamelStream *stream);
+
+ void (*set_mime_type) (CamelDataWrapper *data_wrapper, gchar * mime_type);
+ gchar * (*get_mime_type) (CamelDataWrapper *data_wrapper);
+ GMimeContentField * (*get_mime_type_field) (CamelDataWrapper *data_wrapper);
+ void (*set_mime_type_field) (CamelDataWrapper *data_wrapper, GMimeContentField *mime_type_field);
+ CamelStream * (*get_stream) (CamelDataWrapper *data_wrapper);
} CamelDataWrapperClass;
@@ -77,6 +87,8 @@ GtkType camel_data_wrapper_get_type (void);
/* public methods */
+
+
void camel_data_wrapper_write_to_stream (CamelDataWrapper *data_wrapper, CamelStream *stream);
void camel_data_wrapper_construct_from_stream (CamelDataWrapper *data_wrapper, CamelStream *stream);
void camel_data_wrapper_set_mime_type (CamelDataWrapper *data_wrapper, gchar *mime_type);
diff --git a/camel/camel-stream.c b/camel/camel-stream.c
index 5128d0309c..0a18ed1ee5 100644
--- a/camel/camel-stream.c
+++ b/camel/camel-stream.c
@@ -27,6 +27,14 @@
#include <config.h>
#include "camel-stream.h"
+
+enum {
+ DATA_AVAILABLE,
+ LAST_SIGNAL
+};
+
+static guint camel_stream_signals[LAST_SIGNAL] = { 0 };
+
static GtkObjectClass *parent_class = NULL;
@@ -49,6 +57,7 @@ default_camel_close (CamelStream *stream)
static void
camel_stream_class_init (CamelStreamClass *camel_stream_class)
{
+ GtkObjectClass *gtk_object_class = GTK_OBJECT_CLASS (camel_stream_class);
parent_class = gtk_type_class (gtk_object_get_type ());
@@ -61,6 +70,18 @@ camel_stream_class_init (CamelStreamClass *camel_stream_class)
camel_stream_class->close = default_camel_close;
/* virtual method overload */
+
+ /* signal definition */
+ camel_stream_signals[DATA_AVAILABLE] =
+ gtk_signal_new ("data_available",
+ GTK_RUN_LAST,
+ gtk_object_class->type,
+ GTK_SIGNAL_OFFSET (CamelStreamClass, data_available),
+ gtk_marshal_NONE__NONE,
+ GTK_TYPE_NONE, 0);
+
+ gtk_object_class_add_signals (gtk_object_class, camel_stream_signals, LAST_SIGNAL);
+
}
GtkType
diff --git a/camel/camel-stream.h b/camel/camel-stream.h
index 73b4c31082..d0327971af 100644
--- a/camel/camel-stream.h
+++ b/camel/camel-stream.h
@@ -54,6 +54,9 @@ typedef struct {
GtkObjectClass parent_class;
/* Virtual methods */
+
+ void (*data_available) (CamelStream *stream); /* default "data_available" signal handler */
+
gint (*read) (CamelStream *stream, gchar *buffer, gint n);
gint (*write) (CamelStream *stream, const gchar *buffer, gint n);
void (*flush) (CamelStream *stream);