* Modified the maximum size of the entries of the edit msg window
[modest] / src / modest-tny-stream-gtkhtml.c
index 6c77c63..c92cc68 100644 (file)
@@ -31,6 +31,7 @@
 /* modest-tny-stream-gtkhtml.c */
 
 #include "modest-tny-stream-gtkhtml.h"
+#include <tny-stream.h>
 #include <gtkhtml/gtkhtml-stream.h>
 #include <gtkhtml/gtkhtml-search.h>
 
@@ -76,6 +77,7 @@ modest_tny_stream_gtkhtml_get_type (void)
                        sizeof(ModestTnyStreamGtkhtml),
                        1,              /* n_preallocs */
                        (GInstanceInitFunc) modest_tny_stream_gtkhtml_init,
+                       NULL
                };
 
                static const GInterfaceInfo iface_info = {
@@ -88,7 +90,7 @@ modest_tny_stream_gtkhtml_get_type (void)
                                                  "ModestTnyStreamGtkhtml",
                                                  &my_info, 0);
 
-               g_type_add_interface_static (my_type, TNY_TYPE_STREAM_IFACE,
+               g_type_add_interface_static (my_type, TNY_TYPE_STREAM,
                                             &iface_info);
 
        }
@@ -146,25 +148,25 @@ modest_tny_stream_gtkhtml_new (GtkHTMLStream *stream)
 
 
 static ssize_t
-gtkhtml_read (TnyStreamIface *self, char *buffer, size_t n)
+gtkhtml_read (TnyStream *self, char *buffer, size_t n)
 {
        return -1; /* we cannot read */
 }
 
 
 static ssize_t
-gtkhtml_write (TnyStreamIface *self, const char *buffer, size_t n)
+gtkhtml_write (TnyStream *self, const char *buffer, size_t n)
 {
        ModestTnyStreamGtkhtmlPrivate *priv;
        
        priv = MODEST_TNY_STREAM_GTKHTML_GET_PRIVATE(self);
 
        if (!priv->stream) {
-               g_warning ("cannot write to closed stream");
+               g_print ("modest: cannot write to closed stream\n");
                return 0;
        }
 
-       if (n == 0)
+       if (n == 0 || !buffer)
                return 0;
                
        gtk_html_stream_write (priv->stream, buffer, n);
@@ -173,14 +175,14 @@ gtkhtml_write (TnyStreamIface *self, const char *buffer, size_t n)
 
        
 static gint
-gtkhtml_flush (TnyStreamIface *self)
+gtkhtml_flush (TnyStream *self)
 {
        return 0;
 }
        
 
 static gint
-gtkhtml_close (TnyStreamIface *self)
+gtkhtml_close (TnyStream *self)
 {
        ModestTnyStreamGtkhtmlPrivate *priv;
        g_return_val_if_fail (self, 0);
@@ -194,7 +196,7 @@ gtkhtml_close (TnyStreamIface *self)
 
 
 static gboolean
-gtkhtml_eos (TnyStreamIface *self)
+gtkhtml_is_eos (TnyStream *self)
 {
        return TRUE;
 }
@@ -202,14 +204,14 @@ gtkhtml_eos (TnyStreamIface *self)
 
        
 static gint
-gtkhtml_reset (TnyStreamIface *self)
+gtkhtml_reset (TnyStream *self)
 {
        return 0;
 }
 
        
 static ssize_t
-gtkhtml_write_to_stream (TnyStreamIface *self, TnyStreamIface *output)
+gtkhtml_write_to_stream (TnyStream *self, TnyStream *output)
 {
        return 0;
 }
@@ -218,17 +220,17 @@ gtkhtml_write_to_stream (TnyStreamIface *self, TnyStreamIface *output)
 static void
 modest_tny_stream_gtkhml_iface_init (gpointer g_iface, gpointer iface_data)
 {
-        TnyStreamIfaceClass *klass;
+        TnyStreamIface *klass;
        
        g_return_if_fail (g_iface);
 
-       klass = (TnyStreamIfaceClass *)g_iface;
+       klass = (TnyStreamIface*) g_iface;
        
-        klass->read_func  = gtkhtml_read;
-        klass->write_func = gtkhtml_write;
-        klass->flush_func = gtkhtml_flush;
-        klass->close_func = gtkhtml_close;
-       klass->eos_func   = gtkhtml_eos;
-       klass->reset_func = gtkhtml_reset;
+        klass->read_func            = gtkhtml_read;
+        klass->write_func           = gtkhtml_write;
+        klass->flush_func           = gtkhtml_flush;
+        klass->close_func           = gtkhtml_close;
+       klass->is_eos_func          = gtkhtml_is_eos;
+       klass->reset_func           = gtkhtml_reset;
        klass->write_to_stream_func = gtkhtml_write_to_stream;
 }