From fe5e063a3b226ef05d2920d534ffcdd027fa9753 Mon Sep 17 00:00:00 2001 From: Arturo Espinosa Date: Wed, 19 Jan 2000 20:08:55 +0000 Subject: More work More work svn path=/trunk/; revision=1595 --- mail/Makefile.am | 4 ++ mail/html-stream.c | 107 ++++++++++++++++++++++++++++++++++++++++++++++++++++ mail/html-stream.h | 26 +++++++++++++ mail/mail-display.h | 23 +++++++++++ mail/main.c | 3 ++ 5 files changed, 163 insertions(+) create mode 100644 mail/html-stream.c create mode 100644 mail/html-stream.h create mode 100644 mail/mail-display.h diff --git a/mail/Makefile.am b/mail/Makefile.am index 7c7e9a4af7..5b286d2907 100644 --- a/mail/Makefile.am +++ b/mail/Makefile.am @@ -9,6 +9,10 @@ INCLUDES = \ $(BONOBO_GNOME_CFLAGS) evolution_mail_SOURCES = \ + html-stream.c \ + html-stream.h \ + mail-display.h \ + mail-display.c \ main.c evolution_mail_LDADD = \ diff --git a/mail/html-stream.c b/mail/html-stream.c new file mode 100644 index 0000000000..250e98500a --- /dev/null +++ b/mail/html-stream.c @@ -0,0 +1,107 @@ +/* + * html-stream.c: A CamelStream class that feeds data into a GtkHTML widget + * + * Author: + * Miguel de Icaza (miguel@helixcode.com) + * + * (C) 2000 Helix Code, Inc. + */ +#include +#include "html-stream.h" +#include "e-util/e-util.h" + +#define PARENT_TYPE camel_stream_get_type () + +/* + * CamelStream::read method + * + * Return 0 bytes read, as this is a write-only stream + */ +static gint +html_stream_read (CamelStream *stream, gchar *buffer, gint n) +{ + return 0; +} + +/* + * CamelStream::write method + * + * Writes @buffer into the HTML widget + */ +static gint +html_stream_write (CamelStream *stream, const gchar *buffer, gint n) +{ + HTMLStream *html_stream = HTML_STREAM (stream); + + gtk_html_write (html_stream->gtk_html, html_stream->gtk_html_stream, buffer, n); +} + +/* + * CamelStream::available method + * + * Return 0, as this is only a write-stream + */ +static gint +html_stream_available (CamelStream *stream) +{ + return 0; +} + +/* + * CamelStream::eos method. + * + * We just return TRUE, as this is not a read-stream + */ +static +html_stream_eos (CamelStream *stream) +{ + return TRUE; +} + +static void +html_stream_close (CamelStream *stream) +{ + HTMLStream *html_stream = HTML_STREAM (stream); + + gtk_html_end (html_stream->gtk_html); +} + +static void +html_stream_class_init (GtkObjectClass *object_class) +{ + HTMLStreamClass *stream_class = (HTMLStreamClass *) object_class; + + html_stream_parent_class = gtk_type_class (PARENT_TYPE); + + object_class->destory = html_stream_destroy; + + stream_class->read = html_stream_read; + stream_class->write = html_stream_write; + stream_class->available = html_stream_available; + stream_class->eos = html_stream_eos; + stream_class->close = html_stream_close; +} + +CamelStream * +html_stream_new (GtkHTML *html) +{ + HTMLStream *html_stream; + + g_return_val_if_fail (html != NULL, NULL); + g_return_val_if_fail (GTK_IS_HTML (html), NULL); + + html_stream = gtk_type_new (html_stream_get_type ()); + + gtk_object_ref (GTK_OBJECT (html)); + + html_stream->gtk_html_stream = gtk_html_begin (html, NULL); + gtk_html_parse (html); + + html_stream->gtk_html = html; + + return CAMEL_STREAM (html_stream); +} + +E_MAKE_TYPE (html_stream, "HTMLStream", HTMLStream, html_stream_class_init, NULL, PARENT_TYPE); + + diff --git a/mail/html-stream.h b/mail/html-stream.h new file mode 100644 index 0000000000..a058f8357d --- /dev/null +++ b/mail/html-stream.h @@ -0,0 +1,26 @@ +#ifndef _HTML_STREAM_H_ +#define _HTML_STREAM_H_ 1 + +#include +#include "camel/camel-stream.h" + +#define HTML_STREAM_TYPE (html_stream_get_type ()) +#define HTML_STREAM(obj) (GTK_CHECK_CAST((obj), HTML_STREAM_TYPE, HTMLStream)) +#define HTML_STREAM_CLASS(k) (GTK_CHECK_CLASS_CAST ((k), HTML_STREAM_TYPE, HTMLStreamClass)) +#define IS_HTML_STREAM(o) (GTK_CHECK_TYPE((o), HTML_STREAM_TYPE)) + +typedef struct { + CamelStream parent_object; + GtkHTML *gtk_html; + GtkHTMLStreamHandle *gtk_html_stream; +} HTMLStream; + +typedef struct { + CamelStream parent_class; +} HTMLStreamClass; + + +GtkType html_stream_get_type (void); +CamelStream *html_stream_new (GtkHTML *html); + +#endif /* _HTML_STREAM_H_ */ diff --git a/mail/mail-display.h b/mail/mail-display.h new file mode 100644 index 0000000000..43d685142b --- /dev/null +++ b/mail/mail-display.h @@ -0,0 +1,23 @@ +#ifndef _MAIL_DISPLAY_H_ +#define _MAIL_DISPLAY_H_ + +#include + +#define MAIL_DISPLAY_TYPE (mail_display_get_type ()) +#define MAIL_DISPLAY(o) (GTK_CHECK_CAST ((o), MAIL_DISPLAY_TYPE, MailDisplay)) +#define MAIL_DISPLAY_CLASS(k) (GTK_CHECK_CLASS_CAST((k), MAIL_DISPLAY_TYPE, MailDisplayClass)) +#define IS_MAIL_DISPLAY(o) (GTK_CHECK_TYPE ((o), MAIL_DISPLAY_TYPE)) +#define IS_MAIL_DISPLAY_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), MAIL_DISPLAY_TYPE)) + +typedef struct { + GtkTable parent; + + GtkHTML *html; +} MailDisplay; + +typedef struct { + GtkTableClass parent_class; +} MailDisplayClass; + +GtkType mail_display_get_type (void); +#endif /* _MAIL_DISPLAY_H_ */ diff --git a/mail/main.c b/mail/main.c index f5be6543a2..b6b0f2e1bc 100644 --- a/mail/main.c +++ b/mail/main.c @@ -9,3 +9,6 @@ #include #include +main () +{ +} -- cgit v1.2.3