Make camel not leak like a sieve.
authorDan Winship <danw@src.gnome.org>
Sun, 7 May 2000 21:56:32 +0000 (21:56 +0000)
committerDan Winship <danw@src.gnome.org>
Sun, 7 May 2000 21:56:32 +0000 (21:56 +0000)
* camel-object.c: New subclass of GtkObject which is now the base
of the Camel object hierarchy. Currently the only difference
between CamelObject and GtkObject is that CamelObjects don't start
out floating.

* *.h: Move a bunch of typedefs to camel-types.h. Standardize on
using <camel/foo.h> in header files rather than <foo.h>, "foo.h",
or "camel/foo.h". Remove some unneeded includes.

* camel-address.c, camel-data-wrapper.c, camel-folder-search.c,
camel-folder-summary.c, camel-folder.c, camel-mime-filter.c,
camel-mime-parser.c, camel-service.c, camel-session.c,
camel-stream.c: These are now subclasses of CamelObject.

* camel-data-wrapper.c (set_output_stream):
* camel-medium.c (set_content_object):
* camel-seekable-substream.c
(init_with_seekable_stream_and_bounds):
* providers/mbox/camel-mbox-folder.c (mbox_get_message_by_uid):
remove gtk_object_sink calls.

* camel-stream-buffer.c (init_vbuf):
* camel-stream-filter.c (camel_stream_filter_new_with_stream):
ref the original stream.

* camel-folder-summary.c (camel_folder_summary_finalise): unref
the filters when finalizing.

* camel-mime-part-utils.c
(simple_data_wrapper_construct_from_parser,
camel_mime_part_construct_content_from_parser):
* camel-mime-part.c (camel_mime_part_set_content): Unref objects
that are created only to be handed off to other objects. If
they're going to be needed later, they will have been additionally
ref'ed by the object that needs them.

* providers/pop3/camel-pop3-folder.c (get_message_by_number):
unref the message stream after creating the data from it.

* camel-stream.c, camel-stream-buffer.c, camel-stream-filter.c,
camel-stream-fs.c, camel-stream-mem.c: Remove camel_stream_close,
since its semantics are dubious (what happens when you close a
stream other people still have references on?).

* providers/nntp/camel-nntp-store.c:
* providers/smtp/camel-smtp-transport.c:
* providers/pop3/camel-pop3-store.c:
replace camel_stream_close calls with gtk_object_unref.

* providers/mbox/camel-mbox-folder.c:
* providers/nntp/camel-nntp-folder.c:
* providers/sendmail/camel-sendmail-transport.c:
replace camel_stream_close with camel_stream_flush +
gtk_object_unref

69 files changed:
camel/ChangeLog
camel/Makefile.am
camel/camel-address.c
camel/camel-address.h
camel/camel-data-wrapper.c
camel/camel-data-wrapper.h
camel/camel-exception.h
camel/camel-folder-pt-proxy.c
camel/camel-folder-pt-proxy.h
camel/camel-folder-search.c
camel/camel-folder-search.h
camel/camel-folder-summary.c
camel/camel-folder-summary.h
camel/camel-folder.c
camel/camel-folder.h
camel/camel-internet-address.h
camel/camel-medium.c
camel/camel-medium.h
camel/camel-mime-filter-basic.h
camel/camel-mime-filter-charset.h
camel/camel-mime-filter-index.h
camel/camel-mime-filter-save.h
camel/camel-mime-filter.c
camel/camel-mime-filter.h
camel/camel-mime-message.h
camel/camel-mime-parser.c
camel/camel-mime-parser.h
camel/camel-mime-part-utils.c
camel/camel-mime-part-utils.h
camel/camel-mime-part.c
camel/camel-mime-part.h
camel/camel-movemail.h
camel/camel-multipart.h
camel/camel-news-address.h
camel/camel-object.c [new file with mode: 0644]
camel/camel-object.h [new file with mode: 0644]
camel/camel-op-queue.h
camel/camel-provider.h
camel/camel-seekable-stream.h
camel/camel-seekable-substream.c
camel/camel-seekable-substream.h
camel/camel-service.c
camel/camel-service.h
camel/camel-session.c
camel/camel-session.h
camel/camel-store.h
camel/camel-stream-buffer.c
camel/camel-stream-buffer.h
camel/camel-stream-filter.c
camel/camel-stream-filter.h
camel/camel-stream-fs.c
camel/camel-stream-fs.h
camel/camel-stream-mem.c
camel/camel-stream-mem.h
camel/camel-stream.c
camel/camel-stream.h
camel/camel-thread-proxy.h
camel/camel-transport.h
camel/camel-types.h
camel/camel-url.h
camel/camel.h
camel/md5-utils.h
camel/providers/mbox/camel-mbox-folder.c
camel/providers/nntp/camel-nntp-folder.c
camel/providers/nntp/camel-nntp-store.c
camel/providers/pop3/camel-pop3-folder.c
camel/providers/pop3/camel-pop3-store.c
camel/providers/sendmail/camel-sendmail-transport.c
camel/providers/smtp/camel-smtp-transport.c

index b8ce5fa..d66cb86 100644 (file)
@@ -1,3 +1,62 @@
+2000-05-07  Dan Winship  <danw@helixcode.com>
+
+       Make camel not leak like a sieve.
+
+       * camel-object.c: New subclass of GtkObject which is now the base
+       of the Camel object hierarchy. Currently the only difference
+       between CamelObject and GtkObject is that CamelObjects don't start
+       out floating.
+
+       * *.h: Move a bunch of typedefs to camel-types.h. Standardize on
+       using <camel/foo.h> in header files rather than <foo.h>, "foo.h",
+       or "camel/foo.h". Remove some unneeded includes.
+
+       * camel-address.c, camel-data-wrapper.c, camel-folder-search.c,
+       camel-folder-summary.c, camel-folder.c, camel-mime-filter.c,
+       camel-mime-parser.c, camel-service.c, camel-session.c,
+       camel-stream.c: These are now subclasses of CamelObject.
+
+       * camel-data-wrapper.c (set_output_stream):
+       * camel-medium.c (set_content_object):
+       * camel-seekable-substream.c
+       (init_with_seekable_stream_and_bounds):
+       * providers/mbox/camel-mbox-folder.c (mbox_get_message_by_uid): 
+       remove gtk_object_sink calls.
+
+       * camel-stream-buffer.c (init_vbuf): 
+       * camel-stream-filter.c (camel_stream_filter_new_with_stream):
+       ref the original stream.
+
+       * camel-folder-summary.c (camel_folder_summary_finalise): unref
+       the filters when finalizing.
+
+       * camel-mime-part-utils.c
+       (simple_data_wrapper_construct_from_parser,
+       camel_mime_part_construct_content_from_parser):
+       * camel-mime-part.c (camel_mime_part_set_content): Unref objects
+       that are created only to be handed off to other objects. If
+       they're going to be needed later, they will have been additionally
+       ref'ed by the object that needs them.
+
+       * providers/pop3/camel-pop3-folder.c (get_message_by_number):
+       unref the message stream after creating the data from it.
+
+       * camel-stream.c, camel-stream-buffer.c, camel-stream-filter.c,
+       camel-stream-fs.c, camel-stream-mem.c: Remove camel_stream_close,
+       since its semantics are dubious (what happens when you close a
+       stream other people still have references on?).
+
+       * providers/nntp/camel-nntp-store.c:
+       * providers/smtp/camel-smtp-transport.c:
+       * providers/pop3/camel-pop3-store.c:
+       replace camel_stream_close calls with gtk_object_unref.
+
+       * providers/mbox/camel-mbox-folder.c:
+       * providers/nntp/camel-nntp-folder.c:
+       * providers/sendmail/camel-sendmail-transport.c:
+       replace camel_stream_close with camel_stream_flush +
+       gtk_object_unref
+
 2000-05-06  Dan Winship  <danw@helixcode.com>
 
        * providers/pop3/camel-pop3-store.c (query_auth_types): A machine
index c394823..c24113d 100644 (file)
@@ -45,6 +45,7 @@ libcamel_la_SOURCES =                                 \
        camel-mime-part-utils.c                 \
        camel-movemail.c                        \
        camel-multipart.c                       \
+       camel-object.c                          \
        camel-op-queue.c                        \
        camel-provider.c                        \
        camel-seekable-stream.c                 \
@@ -91,6 +92,7 @@ libcamelinclude_HEADERS =                     \
        camel-mime-part-utils.h                 \
        camel-movemail.h                        \
        camel-multipart.h                       \
+       camel-object.h                          \
        camel-op-queue.h                        \
        camel-provider.h                        \
        camel-seekable-stream.h                 \
index a190eb3..8056c12 100644 (file)
@@ -25,7 +25,7 @@ static void camel_address_class_init (CamelAddressClass *klass);
 static void camel_address_init       (CamelAddress *obj);
 static void camel_address_finalise   (GtkObject *obj);
 
-static GtkObjectClass *camel_address_parent;
+static CamelObjectClass *camel_address_parent;
 
 enum SIGNALS {
        LAST_SIGNAL
@@ -49,7 +49,7 @@ camel_address_get_type (void)
                        (GtkArgGetFunc) NULL
                };
                
-               type = gtk_type_unique (gtk_object_get_type (), &type_info);
+               type = gtk_type_unique (camel_object_get_type (), &type_info);
        }
        
        return type;
@@ -60,7 +60,7 @@ camel_address_class_init (CamelAddressClass *klass)
 {
        GtkObjectClass *object_class = (GtkObjectClass *) klass;
        
-       camel_address_parent = gtk_type_class (gtk_object_get_type ());
+       camel_address_parent = gtk_type_class (camel_object_get_type ());
 
        object_class->finalize = camel_address_finalise;
 
index 94466f3..d035f20 100644 (file)
 #ifndef _CAMEL_ADDRESS_H
 #define _CAMEL_ADDRESS_H
 
-#include <gtk/gtk.h>
+#include <camel/camel-object.h>
 
 #define CAMEL_ADDRESS(obj)         GTK_CHECK_CAST (obj, camel_address_get_type (), CamelAddress)
 #define CAMEL_ADDRESS_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, camel_address_get_type (), CamelAddressClass)
 #define IS_CAMEL_ADDRESS(obj)      GTK_CHECK_TYPE (obj, camel_address_get_type ())
 
-typedef struct _CamelAddress      CamelAddress;
 typedef struct _CamelAddressClass CamelAddressClass;
 
 struct _CamelAddress {
-       GtkObject parent;
+       CamelObject parent;
 
        GPtrArray *addresses;
 
@@ -39,7 +38,7 @@ struct _CamelAddress {
 };
 
 struct _CamelAddressClass {
-       GtkObjectClass parent_class;
+       CamelObjectClass parent_class;
 
        int   (*decode)         (CamelAddress *, const char *raw);
        char *(*encode)         (CamelAddress *);
index e3edba1..fb0a161 100644 (file)
@@ -29,7 +29,7 @@
 
 #define d(x)
 
-static GtkObjectClass *parent_class = NULL;
+static CamelObjectClass *parent_class = NULL;
 
 /* Returns the class for a CamelDataWrapper */
 #define CDW_CLASS(so) CAMEL_DATA_WRAPPER_CLASS (GTK_OBJECT (so)->klass)
@@ -56,7 +56,7 @@ camel_data_wrapper_class_init (CamelDataWrapperClass *camel_data_wrapper_class)
        GtkObjectClass *gtk_object_class =
                GTK_OBJECT_CLASS (camel_data_wrapper_class);
 
-       parent_class = gtk_type_class (gtk_object_get_type ());
+       parent_class = gtk_type_class (camel_object_get_type ());
 
        /* virtual method definition */
        camel_data_wrapper_class->write_to_stream = write_to_stream;
@@ -102,7 +102,7 @@ camel_data_wrapper_get_type (void)
                        (GtkClassInitFunc) NULL,
                };
 
-               camel_data_wrapper_type = gtk_type_unique (gtk_object_get_type (), &camel_data_wrapper_info);
+               camel_data_wrapper_type = gtk_type_unique (camel_object_get_type (), &camel_data_wrapper_info);
        }
 
        return camel_data_wrapper_type;
@@ -123,7 +123,7 @@ finalize (GtkObject *object)
        if (camel_data_wrapper->output_stream)
                gtk_object_unref (GTK_OBJECT (camel_data_wrapper->output_stream));
 
-       parent_class->finalize (object);
+       GTK_OBJECT_CLASS (parent_class)->finalize (object);
 }
 
 /**
@@ -147,10 +147,8 @@ set_output_stream (CamelDataWrapper *data_wrapper, CamelStream *stream)
                gtk_object_unref (GTK_OBJECT (data_wrapper->output_stream));
 
        data_wrapper->output_stream = stream;
-       if (stream) {
+       if (stream)
                gtk_object_ref (GTK_OBJECT (stream));
-               gtk_object_sink (GTK_OBJECT (stream));
-       }
        d(printf("data_wrapper:: set_output_stream(%p)\n", stream));
 }
 
index 0a3e036..8daf7a8 100644 (file)
@@ -34,9 +34,8 @@ extern "C" {
 #pragma }
 #endif /* __cplusplus }*/
 
-#include <gtk/gtk.h>
-#include "camel-types.h"
-#include "gmime-content-field.h"
+#include <camel/camel-object.h>
+#include <camel/gmime-content-field.h>
 
 #define CAMEL_DATA_WRAPPER_TYPE     (camel_data_wrapper_get_type ())
 #define CAMEL_DATA_WRAPPER(obj)     (GTK_CHECK_CAST((obj), CAMEL_DATA_WRAPPER_TYPE, CamelDataWrapper))
@@ -46,7 +45,7 @@ extern "C" {
 
 struct _CamelDataWrapper
 {
-       GtkObject parent_object;
+       CamelObject parent_object;
 
        CamelStream *input_stream;
        CamelStream *output_stream;
@@ -57,7 +56,7 @@ struct _CamelDataWrapper
 
 
 typedef struct {
-       GtkObjectClass parent_class;
+       CamelObjectClass parent_class;
 
        /* Virtual methods */
        void                (*set_output_stream)      (CamelDataWrapper *data_wrapper,
index bf361a0..0f4772e 100644 (file)
@@ -36,7 +36,7 @@ extern "C" {
 #endif /* __cplusplus }*/
 
 #include <glib.h>
-#include "camel-types.h"
+#include <camel/camel-types.h>
 
 typedef enum {
 #include "camel-exception-list.def"
index 8d8fda4..65f74ec 100644 (file)
@@ -36,7 +36,7 @@
 #include <errno.h>
 
 
-static CamelFolderClass *parent_class=NULL;
+static CamelFolderClass *parent_class = NULL;
 
 /* Returns the class for CamelFolderPtProxy and CamelFolder objects */
 #define CFPP_CLASS(so) CAMEL_FOLDER_PT_PROXY_CLASS (GTK_OBJECT(so)->klass)
@@ -222,7 +222,7 @@ camel_folder_pt_proxy_get_type (void)
                        (GtkClassInitFunc) NULL,
                };
                
-               camel_folder_pt_proxy_type = gtk_type_unique (gtk_object_get_type (), &camel_folder_pt_proxy_info);
+               camel_folder_pt_proxy_type = gtk_type_unique (camel_folder_get_type (), &camel_folder_pt_proxy_info);
        }
        
        return camel_folder_pt_proxy_type;
index e5ae322..7422786 100644 (file)
@@ -37,9 +37,9 @@ extern "C" {
 #pragma }
 #endif /* __cplusplus }*/
 
-#include "camel-folder.h"
-#include "camel-op-queue.h"
-#include "camel-thread-proxy.h"
+#include <camel/camel-folder.h>
+#include <camel/camel-op-queue.h>
+#include <camel/camel-thread-proxy.h>
 
 
 #define CAMEL_FOLDER_PT_PROXY_TYPE     (camel_folder_pt_proxy_get_type ())
index 8a58d9a..e5110d1 100644 (file)
@@ -47,7 +47,7 @@ static void camel_folder_search_class_init (CamelFolderSearchClass *klass);
 static void camel_folder_search_init       (CamelFolderSearch *obj);
 static void camel_folder_search_finalise   (GtkObject *obj);
 
-static GtkObjectClass *camel_folder_search_parent;
+static CamelObjectClass *camel_folder_search_parent;
 
 enum SIGNALS {
        LAST_SIGNAL
@@ -71,7 +71,7 @@ camel_folder_search_get_type (void)
                        (GtkArgGetFunc) NULL
                };
                
-               type = gtk_type_unique (gtk_object_get_type (), &type_info);
+               type = gtk_type_unique (camel_object_get_type (), &type_info);
        }
        
        return type;
@@ -82,7 +82,7 @@ camel_folder_search_class_init (CamelFolderSearchClass *klass)
 {
        GtkObjectClass *object_class = (GtkObjectClass *) klass;
        
-       camel_folder_search_parent = gtk_type_class (gtk_object_get_type ());
+       camel_folder_search_parent = gtk_type_class (camel_object_get_type ());
 
        object_class->finalize = camel_folder_search_finalise;
 
index ea00c2e..26fdb2e 100644 (file)
@@ -22,7 +22,7 @@
 #ifndef _CAMEL_FOLDER_SEARCH_H
 #define _CAMEL_FOLDER_SEARCH_H
 
-#include <gtk/gtk.h>
+#include <camel/camel-object.h>
 #include <e-util/e-sexp.h>
 #include <libibex/ibex.h>
 #include <camel/camel-folder.h>
 #define CAMEL_FOLDER_SEARCH_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, camel_folder_search_get_type (), CamelFolderSearchClass)
 #define IS_CAMEL_FOLDER_SEARCH(obj)      GTK_CHECK_TYPE (obj, camel_folder_search_get_type ())
 
-typedef struct _CamelFolderSearch      CamelFolderSearch;
 typedef struct _CamelFolderSearchClass CamelFolderSearchClass;
 
 struct _CamelFolderSearch {
-       GtkObject parent;
+       CamelObject parent;
 
        struct _CamelFolderSearchPrivate *priv;
 
@@ -50,7 +49,7 @@ struct _CamelFolderSearch {
 };
 
 struct _CamelFolderSearchClass {
-       GtkObjectClass parent_class;
+       CamelObjectClass parent_class;
 
        /* general bool/comparison options, usually these wont need to be set, unless it is compiling into another language */
        ESExpResult * (*and)(struct _ESExp *f, int argc, struct _ESExpTerm **argv, CamelFolderSearch *s);
index ee879b3..de66646 100644 (file)
@@ -84,7 +84,7 @@ static void camel_folder_summary_class_init (CamelFolderSummaryClass *klass);
 static void camel_folder_summary_init       (CamelFolderSummary *obj);
 static void camel_folder_summary_finalise   (GtkObject *obj);
 
-static GtkObjectClass *camel_folder_summary_parent;
+static CamelObjectClass *camel_folder_summary_parent;
 
 enum SIGNALS {
        LAST_SIGNAL
@@ -108,7 +108,7 @@ camel_folder_summary_get_type (void)
                        (GtkArgGetFunc) NULL
                };
                
-               type = gtk_type_unique (gtk_object_get_type (), &type_info);
+               type = gtk_type_unique (camel_object_get_type (), &type_info);
        }
        
        return type;
@@ -119,7 +119,7 @@ camel_folder_summary_class_init (CamelFolderSummaryClass *klass)
 {
        GtkObjectClass *object_class = (GtkObjectClass *) klass;
        
-       camel_folder_summary_parent = gtk_type_class (gtk_object_get_type ());
+       camel_folder_summary_parent = gtk_type_class (camel_object_get_type ());
 
        object_class->finalize = camel_folder_summary_finalise;
 
@@ -179,6 +179,15 @@ camel_folder_summary_finalise (GtkObject *obj)
        g_hash_table_destroy(p->filter_charset);
        g_free(p);
 
+       if (p->filter_index)
+               gtk_object_unref ((GtkObject *)p->filter_index);
+       if (p->filter_64)
+               gtk_object_unref ((GtkObject *)p->filter_64);
+       if (p->filter_qp)
+               gtk_object_unref ((GtkObject *)p->filter_qp);
+       if (p->filter_save)
+               gtk_object_unref ((GtkObject *)p->filter_save);
+
        ((GtkObjectClass *)(camel_folder_summary_parent))->finalize((GtkObject *)obj);
 }
 
@@ -1104,8 +1113,8 @@ int main(int argc, char **argv)
        camel_folder_summary_set_filename(s, "index.summary");
        camel_folder_summary_save(s);
 
-       gtk_object_unref(mp);
-       gtk_object_unref(s);
+       gtk_object_unref(GTK_OBJECT(mp));
+       gtk_object_unref(GTK_OBJECT(s));
 
        printf("summarised %d messages\n", camel_folder_summary_count(s));
 #if 0
index 69045d6..c8948a4 100644 (file)
@@ -22,7 +22,7 @@
 #ifndef _CAMEL_FOLDER_SUMMARY_H
 #define _CAMEL_FOLDER_SUMMARY_H
 
-#include <gtk/gtk.h>
+#include <camel/camel-object.h>
 #include <stdio.h>
 #include <time.h>
 #include <camel/camel-mime-parser.h>
@@ -88,7 +88,7 @@ enum _CamelFolderSummaryFlags {
 };
 
 struct _CamelFolderSummary {
-       GtkObject parent;
+       CamelObject parent;
 
        struct _CamelFolderSummaryPrivate *priv;
 
@@ -111,7 +111,7 @@ struct _CamelFolderSummary {
 };
 
 struct _CamelFolderSummaryClass {
-       GtkObjectClass parent_class;
+       CamelObjectClass parent_class;
 
        /* load/save the global info */
        int (*summary_header_load)(CamelFolderSummary *, FILE *);
index 6188c35..ed78b42 100644 (file)
@@ -30,7 +30,7 @@
 #include "camel-store.h"
 #include "string-utils.h"
 
-static GtkObjectClass *parent_class=NULL;
+static CamelObjectClass *parent_class = NULL;
 
 /* Returns the class for a CamelFolder */
 #define CF_CLASS(so) CAMEL_FOLDER_CLASS (GTK_OBJECT (so)->klass)
@@ -148,7 +148,7 @@ camel_folder_class_init (CamelFolderClass *camel_folder_class)
 {
        GtkObjectClass *gtk_object_class = GTK_OBJECT_CLASS (camel_folder_class);
        
-       parent_class = gtk_type_class (gtk_object_get_type ());
+       parent_class = gtk_type_class (camel_object_get_type ());
        
        /* virtual method definition */
        camel_folder_class->init = _init;
@@ -230,7 +230,7 @@ camel_folder_get_type (void)
                        (GtkClassInitFunc) NULL,
                };
                
-               camel_folder_type = gtk_type_unique (gtk_object_get_type (), &camel_folder_info);
+               camel_folder_type = gtk_type_unique (camel_object_get_type (), &camel_folder_info);
        }
        
        return camel_folder_type;
index 5cc379b..c8ffdd5 100644 (file)
@@ -34,9 +34,8 @@ extern "C" {
 #pragma }
 #endif /* __cplusplus }*/
 
-#include <gtk/gtk.h>
+#include <camel/camel-object.h>
 #include <time.h>
-#include "camel-types.h"
 
 #define CAMEL_FOLDER_TYPE     (camel_folder_get_type ())
 #define CAMEL_FOLDER(obj)     (GTK_CHECK_CAST((obj), CAMEL_FOLDER_TYPE, CamelFolder))
@@ -56,8 +55,6 @@ typedef enum {
 } CamelFolderOpenMode;
 
 
-#warning old summary stuff to be removed!
-
 typedef struct {
        gchar *name;
        gint nb_message;        /* ick, these should be renamed to something better */
@@ -104,7 +101,7 @@ typedef void (*CamelFolderAsyncCallback) ();
 
 struct _CamelFolder
 {
-       GtkObject parent_object;
+       CamelObject parent_object;
        
        CamelFolderOpenMode open_mode;
        CamelFolderState open_state;
@@ -125,7 +122,7 @@ struct _CamelFolder
 
 
 typedef struct {
-       GtkObjectClass parent_class;
+       CamelObjectClass parent_class;
 
        /* signals */
        void            (*folder_changed)       (CamelFolder *, int type);
index a0e6107..14fbd54 100644 (file)
 #ifndef _CAMEL_INTERNET_ADDRESS_H
 #define _CAMEL_INTERNET_ADDRESS_H
 
-#include <gtk/gtk.h>
 #include <camel/camel-address.h>
 
 #define CAMEL_INTERNET_ADDRESS(obj)         GTK_CHECK_CAST (obj, camel_internet_address_get_type (), CamelInternetAddress)
 #define CAMEL_INTERNET_ADDRESS_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, camel_internet_address_get_type (), CamelInternetAddressClass)
 #define IS_CAMEL_INTERNET_ADDRESS(obj)      GTK_CHECK_TYPE (obj, camel_internet_address_get_type ())
 
-typedef struct _CamelInternetAddress      CamelInternetAddress;
 typedef struct _CamelInternetAddressClass CamelInternetAddressClass;
 
 struct _CamelInternetAddress {
index 68463ec..dcc5d31 100644 (file)
@@ -254,7 +254,6 @@ set_content_object (CamelMedium *medium, CamelDataWrapper *content)
        if (medium->content)
                gtk_object_unref (GTK_OBJECT (medium->content));
        gtk_object_ref (GTK_OBJECT (content));
-       gtk_object_sink (GTK_OBJECT (content));
        medium->content = content;
 }
 
index 6971117..2b6f77f 100644 (file)
@@ -34,8 +34,6 @@ extern "C" {
 #pragma }
 #endif /* __cplusplus }*/
 
-#include <gtk/gtk.h>
-#include <camel/camel-types.h>
 #include <camel/camel-data-wrapper.h>
 
 #define CAMEL_MEDIUM_TYPE     (camel_medium_get_type ())
index 57d9898..f700997 100644 (file)
 #ifndef _CAMEL_MIME_FILTER_BASIC_H
 #define _CAMEL_MIME_FILTER_BASIC_H
 
-#include <gtk/gtk.h>
 #include <camel/camel-mime-filter.h>
 
 #define CAMEL_MIME_FILTER_BASIC(obj)         GTK_CHECK_CAST (obj, camel_mime_filter_basic_get_type (), CamelMimeFilterBasic)
 #define CAMEL_MIME_FILTER_BASIC_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, camel_mime_filter_basic_get_type (), CamelMimeFilterBasicClass)
 #define IS_CAMEL_MIME_FILTER_BASIC(obj)      GTK_CHECK_TYPE (obj, camel_mime_filter_basic_get_type ())
 
-typedef struct _CamelMimeFilterBasic      CamelMimeFilterBasic;
 typedef struct _CamelMimeFilterBasicClass CamelMimeFilterBasicClass;
 
 typedef enum {
index 3e15e2e..866a9fd 100644 (file)
@@ -21,7 +21,6 @@
 #ifndef _CAMEL_MIME_FILTER_CHARSET_H
 #define _CAMEL_MIME_FILTER_CHARSET_H
 
-#include <gtk/gtk.h>
 #include <camel/camel-mime-filter.h>
 #include <unicode.h>
 
@@ -29,7 +28,6 @@
 #define CAMEL_MIME_FILTER_CHARSET_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, camel_mime_filter_charset_get_type (), CamelMimeFilterCharsetClass)
 #define IS_CAMEL_MIME_FILTER_CHARSET(obj)      GTK_CHECK_TYPE (obj, camel_mime_filter_charset_get_type ())
 
-typedef struct _CamelMimeFilterCharset      CamelMimeFilterCharset;
 typedef struct _CamelMimeFilterCharsetClass CamelMimeFilterCharsetClass;
 
 struct _CamelMimeFilterCharset {
index f480fc5..7dcc76b 100644 (file)
 #ifndef _CAMEL_MIME_FILTER_INDEX_H
 #define _CAMEL_MIME_FILTER_INDEX_H
 
-#include <gtk/gtk.h>
-#include <libibex/ibex.h>
-
 #include <camel/camel-mime-filter.h>
+#include <libibex/ibex.h>
 
 #define CAMEL_MIME_FILTER_INDEX(obj)         GTK_CHECK_CAST (obj, camel_mime_filter_index_get_type (), CamelMimeFilterIndex)
 #define CAMEL_MIME_FILTER_INDEX_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, camel_mime_filter_index_get_type (), CamelMimeFilterIndexClass)
 #define IS_CAMEL_MIME_FILTER_INDEX(obj)      GTK_CHECK_TYPE (obj, camel_mime_filter_index_get_type ())
 
-typedef struct _CamelMimeFilterIndex      CamelMimeFilterIndex;
 typedef struct _CamelMimeFilterIndexClass CamelMimeFilterIndexClass;
 
 struct _CamelMimeFilterIndex {
index 970e849..eb6e448 100644 (file)
 #ifndef _CAMEL_MIME_FILTER_SAVE_H
 #define _CAMEL_MIME_FILTER_SAVE_H
 
-#include <gtk/gtk.h>
-
 #include <camel/camel-mime-filter.h>
 
 #define CAMEL_MIME_FILTER_SAVE(obj)         GTK_CHECK_CAST (obj, camel_mime_filter_save_get_type (), CamelMimeFilterSave)
 #define CAMEL_MIME_FILTER_SAVE_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, camel_mime_filter_save_get_type (), CamelMimeFilterSaveClass)
 #define IS_CAMEL_MIME_FILTER_SAVE(obj)      GTK_CHECK_TYPE (obj, camel_mime_filter_save_get_type ())
 
-typedef struct _CamelMimeFilterSave      CamelMimeFilterSave;
 typedef struct _CamelMimeFilterSaveClass CamelMimeFilterSaveClass;
 
 struct _CamelMimeFilterSave {
index de34a4c..e402ba0 100644 (file)
@@ -33,7 +33,7 @@ struct _CamelMimeFilterPrivate {
 static void camel_mime_filter_class_init (CamelMimeFilterClass *klass);
 static void camel_mime_filter_init       (CamelMimeFilter *obj);
 
-static GtkObjectClass *camel_mime_filter_parent;
+static CamelObjectClass *camel_mime_filter_parent;
 
 enum SIGNALS {
        LAST_SIGNAL
@@ -57,7 +57,7 @@ camel_mime_filter_get_type (void)
                        (GtkArgGetFunc) NULL
                };
                
-               type = gtk_type_unique (gtk_object_get_type (), &type_info);
+               type = gtk_type_unique (camel_object_get_type (), &type_info);
        }
        
        return type;
@@ -88,7 +88,7 @@ camel_mime_filter_class_init (CamelMimeFilterClass *klass)
 {
        GtkObjectClass *object_class = (GtkObjectClass *) klass;
        
-       camel_mime_filter_parent = gtk_type_class (gtk_object_get_type ());
+       camel_mime_filter_parent = gtk_type_class (camel_object_get_type ());
 
        object_class->finalize = finalise;
 
index 51b6347..4576596 100644 (file)
 #ifndef _CAMEL_MIME_FILTER_H
 #define _CAMEL_MIME_FILTER_H
 
-#include <gtk/gtk.h>
+#include <camel/camel-object.h>
 #include <sys/types.h>
 
 #define CAMEL_MIME_FILTER(obj)         GTK_CHECK_CAST (obj, camel_mime_filter_get_type (), CamelMimeFilter)
 #define CAMEL_MIME_FILTER_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, camel_mime_filter_get_type (), CamelMimeFilterClass)
 #define IS_CAMEL_MIME_FILTER(obj)      GTK_CHECK_TYPE (obj, camel_mime_filter_get_type ())
 
-typedef struct _CamelMimeFilter      CamelMimeFilter;
 typedef struct _CamelMimeFilterClass CamelMimeFilterClass;
 
 struct _CamelMimeFilter {
-       GtkObject parent;
+       CamelObject parent;
 
        struct _CamelMimeFilterPrivate *priv;
 
@@ -50,7 +49,7 @@ struct _CamelMimeFilter {
 };
 
 struct _CamelMimeFilterClass {
-       GtkObjectClass parent_class;
+       CamelObjectClass parent_class;
 
        /* virtual functions */
        void (*filter)(CamelMimeFilter *f,
index c790138..f1e254d 100644 (file)
@@ -32,8 +32,6 @@ extern "C" {
 #pragma }
 #endif /* __cplusplus }*/
 
-#include <gtk/gtk.h>
-#include <camel/camel-types.h>
 #include <camel/camel-mime-part.h>
 #include <camel/camel-mime-utils.h>
 #include <camel/camel-internet-address.h>
index 91b4f6c..97a43e4 100644 (file)
@@ -289,7 +289,7 @@ static char *states[] = {
        "HSCAN_MESSAGE_END",
 };
 
-static GtkObjectClass *camel_mime_parser_parent;
+static CamelObjectClass *camel_mime_parser_parent;
 
 enum SIGNALS {
        LAST_SIGNAL
@@ -313,7 +313,7 @@ camel_mime_parser_get_type (void)
                        (GtkArgGetFunc) NULL
                };
                
-               type = gtk_type_unique (gtk_object_get_type (), &type_info);
+               type = gtk_type_unique (camel_object_get_type (), &type_info);
        }
        
        return type;
@@ -334,7 +334,7 @@ camel_mime_parser_class_init (CamelMimeParserClass *klass)
 {
        GtkObjectClass *object_class = (GtkObjectClass *) klass;
        
-       camel_mime_parser_parent = gtk_type_class (gtk_object_get_type ());
+       camel_mime_parser_parent = gtk_type_class (camel_object_get_type ());
 
        object_class->finalize = finalise;
 
index 1a84cef..baefbfe 100644 (file)
@@ -21,7 +21,7 @@
 #ifndef _CAMEL_MIME_PARSER_H
 #define _CAMEL_MIME_PARSER_H
 
-#include <gtk/gtk.h>
+#include <camel/camel-object.h>
 
 #include <camel/camel-mime-utils.h>
 #include <camel/camel-mime-filter.h>
@@ -31,7 +31,6 @@
 #define CAMEL_MIME_PARSER_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, camel_mime_parser_get_type (), CamelMimeParserClass)
 #define IS_CAMEL_MIME_PARSER(obj)      GTK_CHECK_TYPE (obj, camel_mime_parser_get_type ())
 
-typedef struct _CamelMimeParser      CamelMimeParser;
 typedef struct _CamelMimeParserClass CamelMimeParserClass;
 
 /* NOTE: if you add more states, you may need to bump the
@@ -59,13 +58,13 @@ enum _header_state {
 };
 
 struct _CamelMimeParser {
-       GtkObject parent;
+       CamelObject parent;
 
        struct _CamelMimeParserPrivate *priv;
 };
 
 struct _CamelMimeParserClass {
-       GtkObjectClass parent_class;
+       CamelObjectClass parent_class;
 
        void (*message)(CamelMimeParser *, void *headers);
        void (*part)(CamelMimeParser *);
index adbc62d..fc11665 100644 (file)
@@ -126,6 +126,7 @@ simple_data_wrapper_construct_from_parser(CamelDataWrapper *dw, CamelMimeParser
                d(printf("Small message part, kept in memory!\n"));
                mem = camel_stream_mem_new_with_byte_array(buffer);
                camel_data_wrapper_set_output_stream (dw, mem);
+               gtk_object_unref ((GtkObject *)mem);
        } else {
                CamelStream *sub;
                CamelStreamFilter *filter;
@@ -145,9 +146,11 @@ simple_data_wrapper_construct_from_parser(CamelDataWrapper *dw, CamelMimeParser
                                camel_stream_filter_add(filter, fch);
                        }
                        camel_data_wrapper_set_output_stream (dw, (CamelStream *)filter);
+                       gtk_object_unref ((GtkObject *)filter);
                } else {
                        camel_data_wrapper_set_output_stream (dw, sub);
                }
+               gtk_object_unref ((GtkObject *)sub);
        }
 
        camel_mime_parser_filter_remove(mp, decid);
@@ -195,6 +198,7 @@ camel_mime_part_construct_content_from_parser(CamelMimePart *dw, CamelMimeParser
                        bodypart = (CamelDataWrapper *)camel_mime_part_new();
                        camel_mime_part_construct_from_parser((CamelMimePart *)bodypart, mp);
                        camel_multipart_add_part((CamelMultipart *)content, (CamelMimePart *)bodypart);
+                       gtk_object_unref ((GtkObject *)bodypart);
                }
 
                d(printf("Created multi-part\n"));
@@ -208,6 +212,7 @@ camel_mime_part_construct_content_from_parser(CamelMimePart *dw, CamelMimeParser
                camel_data_wrapper_set_mime_type_field (content, 
                                                        camel_mime_part_get_content_type ((CamelMimePart *)dw));
                camel_medium_set_content_object((CamelMedium *)dw, content);
+               gtk_object_unref ((GtkObject *)content);
        }
 }
 
index a4e58ec..1e1c365 100644 (file)
@@ -33,7 +33,7 @@ extern "C" {
 #pragma }
 #endif /* __cplusplus }*/
 
-#include "camel-mime-part.h"
+#include <camel/camel-mime-part.h>
 
 void camel_mime_part_construct_content_from_parser(CamelMimePart *, CamelMimeParser *mp);
 
index fa22cf9..7d08c6a 100644 (file)
@@ -656,14 +656,16 @@ camel_mime_part_set_content (CamelMimePart *camel_mime_part,
                CamelDataWrapper *dw;
                CamelStream *stream;
 
-               dw = camel_data_wrapper_new();
+               dw = camel_data_wrapper_new ();
                camel_data_wrapper_set_mime_type (dw, type);
                stream = camel_stream_mem_new_with_buffer (data, length);
                camel_data_wrapper_construct_from_stream (dw, stream);
+               gtk_object_unref (GTK_OBJECT (stream));
                camel_medium_set_content_object (medium, dw);
+               gtk_object_unref (GTK_OBJECT (dw));
        } else {
                if (medium->content)
-                       gtk_object_unref ( (GtkObject *)medium->content);
+                       gtk_object_unref (GTK_OBJECT (medium->content));
                medium->content = NULL;
        }
 }
index b2c87b8..9360a96 100644 (file)
@@ -34,9 +34,7 @@ extern "C" {
 #pragma }
 #endif /* __cplusplus }*/
 
-#include <gtk/gtk.h>
-#include "camel-types.h"
-#include "camel-medium.h"
+#include <camel/camel-medium.h>
 #include <camel/camel-mime-utils.h>
 #include <camel/camel-mime-parser.h>
 
index a4b2014..ea75c82 100644 (file)
@@ -33,7 +33,7 @@ extern "C" {
 #pragma }
 #endif /* __cplusplus }*/
 
-#include "camel-exception.h"
+#include <camel/camel-exception.h>
 
 int camel_movemail (const char *source, const char *dest, CamelException *ex);
 
index 33b88d6..709e73e 100644 (file)
@@ -34,9 +34,7 @@ extern "C" {
 #pragma }
 #endif /* __cplusplus }*/
 
-#include <gtk/gtk.h>
-#include "camel-types.h"
-#include "camel-data-wrapper.h"
+#include <camel/camel-data-wrapper.h>
 
 #define CAMEL_MULTIPART_TYPE     (camel_multipart_get_type ())
 #define CAMEL_MULTIPART(obj)     (GTK_CHECK_CAST((obj), CAMEL_MULTIPART_TYPE, CamelMultipart))
index f472a7c..e25f907 100644 (file)
 #ifndef _CAMEL_NEWS_ADDRESS_H
 #define _CAMEL_NEWS_ADDRESS_H
 
-#include <gtk/gtk.h>
+#include <camel/camel-address.h>
 
 #define CAMEL_NEWS_ADDRESS(obj)         GTK_CHECK_CAST (obj, camel_news_address_get_type (), CamelNewsAddress)
 #define CAMEL_NEWS_ADDRESS_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, camel_news_address_get_type (), CamelNewsAddressClass)
 #define IS_CAMEL_NEWS_ADDRESS(obj)      GTK_CHECK_TYPE (obj, camel_news_address_get_type ())
 
-typedef struct _CamelNewsAddress      CamelNewsAddress;
 typedef struct _CamelNewsAddressClass CamelNewsAddressClass;
 
 struct _CamelNewsAddress {
diff --git a/camel/camel-object.c b/camel/camel-object.c
new file mode 100644 (file)
index 0000000..3edce10
--- /dev/null
@@ -0,0 +1,57 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/* camel-object.c: Base class for Camel */
+
+/*
+ * Author:
+ *  Dan Winship <danw@helixcode.com>
+ *
+ * Copyright 2000 Helix Code, Inc. (http://www.helixcode.com)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ * USA
+ */
+
+#include <config.h>
+#include "camel-object.h"
+
+static void
+camel_object_init (gpointer object, gpointer klass)
+{
+       GTK_OBJECT_UNSET_FLAGS (object, GTK_FLOATING);
+}
+
+GtkType
+camel_object_get_type (void)
+{
+       static GtkType camel_object_type = 0;
+
+       if (!camel_object_type) {
+               GtkTypeInfo camel_object_info =
+               {
+                       "CamelObject",
+                       sizeof (CamelObject),
+                       sizeof (CamelObjectClass),
+                       (GtkClassInitFunc) NULL,
+                       (GtkObjectInitFunc) camel_object_init,
+                               /* reserved_1 */ NULL,
+                               /* reserved_2 */ NULL,
+                       (GtkClassInitFunc) NULL,
+               };
+
+               camel_object_type = gtk_type_unique (gtk_object_get_type (), &camel_object_info);
+       }
+
+       return camel_object_type;
+}
diff --git a/camel/camel-object.h b/camel/camel-object.h
new file mode 100644 (file)
index 0000000..2c6b4d0
--- /dev/null
@@ -0,0 +1,65 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/* camel-object.h: Base class for Camel */
+
+/*
+ * Author:
+ *  Dan Winship <danw@helixcode.com>
+ *
+ * Copyright 2000 Helix Code, Inc. (http://www.helixcode.com)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ * USA
+ */
+
+#ifndef CAMEL_OBJECT_H
+#define CAMEL_OBJECT_H 1
+
+
+#ifdef __cplusplus
+extern "C" {
+#pragma }
+#endif /* __cplusplus }*/
+
+#include <gtk/gtk.h>
+#include <camel/camel-types.h>
+
+#define CAMEL_OBJECT_TYPE     (camel_object_get_type ())
+#define CAMEL_OBJECT(obj)     (GTK_CHECK_CAST((obj), CAMEL_OBJECT_TYPE, CamelObject))
+#define CAMEL_OBJECT_CLASS(k) (GTK_CHECK_CLASS_CAST ((k), CAMEL_OBJECT_TYPE, CamelObjectClass))
+#define CAMEL_IS_OBJECT(o)    (GTK_CHECK_TYPE((o), CAMEL_OBJECT_TYPE))
+
+
+struct _CamelObject
+{
+       GtkObject parent_object;
+
+};
+
+
+typedef struct {
+       GtkObjectClass parent_class;
+
+} CamelObjectClass;
+
+
+/* Standard Gtk function */
+GtkType camel_object_get_type (void);
+
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* CAMEL_OBJECT_H */
index b96737e..49fdc15 100644 (file)
@@ -33,7 +33,7 @@ extern "C" {
 #endif /* __cplusplus }*/
 
 #include <glib.h>
-#include "camel-marshal-utils.h"
+#include <camel/camel-marshal-utils.h>
 
 
 
index cac6e9d..463f415 100644 (file)
@@ -35,7 +35,7 @@ extern "C" {
 #endif /* __cplusplus }*/
 
 #include <gtk/gtk.h>
-#include "camel-types.h"
+#include <camel/camel-types.h>
 
 #define CAMEL_PROVIDER(obj) ((CamelProvider *)(obj))
 
index fa6f58d..f9eb866 100644 (file)
@@ -34,11 +34,9 @@ extern "C" {
 #pragma }
 #endif /* __cplusplus }*/
 
-#include <gtk/gtk.h>
+#include <camel/camel-stream.h>
 #include <sys/types.h>
 #include <unistd.h>
-#include "camel-types.h"
-#include "camel-stream.h"
 
 #define CAMEL_SEEKABLE_STREAM_TYPE     (camel_seekable_stream_get_type ())
 #define CAMEL_SEEKABLE_STREAM(obj)     (GTK_CHECK_CAST((obj), CAMEL_SEEKABLE_STREAM_TYPE, CamelSeekableStream))
index 5b01495..37d6aca 100644 (file)
@@ -112,7 +112,6 @@ init_with_seekable_stream_and_bounds (CamelSeekableSubstream *seekable_substream
        /* Store the parent stream. */
        seekable_substream->parent_stream = parent_stream;
        gtk_object_ref (GTK_OBJECT (parent_stream));
-       gtk_object_sink (GTK_OBJECT (parent_stream));
 
        /* Set the bound of the substream. */
        camel_seekable_stream_set_bounds ((CamelSeekableStream *)seekable_substream, start, end);
index 75a7a41..81e36b9 100644 (file)
@@ -32,9 +32,7 @@ extern "C" {
 #pragma }
 #endif /* __cplusplus }*/
 
-#include <gtk/gtk.h>
-#include "camel-types.h"
-#include "camel-seekable-stream.h"
+#include <camel/camel-seekable-stream.h>
 
 #define CAMEL_SEEKABLE_SUBSTREAM_TYPE       (camel_seekable_substream_get_type ())
 #define CAMEL_SEEKABLE_SUBSTREAM(obj)       (GTK_CHECK_CAST((obj), CAMEL_SEEKABLE_SUBSTREAM_TYPE, CamelSeekableSubstream))
index edb71d2..ae38676 100644 (file)
@@ -30,7 +30,7 @@
 #include <ctype.h>
 #include <stdlib.h>
 
-static GtkObjectClass *parent_class=NULL;
+static CamelObjectClass *parent_class = NULL;
 
 /* Returns the class for a CamelService */
 #define CSERV_CLASS(so) CAMEL_SERVICE_CLASS (GTK_OBJECT(so)->klass)
@@ -52,7 +52,7 @@ camel_service_class_init (CamelServiceClass *camel_service_class)
        GtkObjectClass *gtk_object_class =
                GTK_OBJECT_CLASS (camel_service_class);
 
-       parent_class = gtk_type_class (gtk_object_get_type ());
+       parent_class = gtk_type_class (camel_object_get_type ());
        
        /* virtual method definition */
        camel_service_class->connect = _connect;
@@ -84,7 +84,7 @@ camel_service_get_type (void)
                        (GtkClassInitFunc) NULL,
                };
                
-               camel_service_type = gtk_type_unique (gtk_object_get_type (),
+               camel_service_type = gtk_type_unique (camel_object_get_type (),
                                                      &camel_service_info);
        }
        
index ffaf177..c2f4f12 100644 (file)
@@ -34,10 +34,9 @@ extern "C" {
 #pragma }
 #endif /* __cplusplus }*/
 
-#include <gtk/gtk.h>
+#include <camel/camel-object.h>
+#include <camel/camel-url.h>
 #include <netdb.h>
-#include "camel-types.h"
-#include "camel-url.h"
 
 #define CAMEL_SERVICE_TYPE     (camel_service_get_type ())
 #define CAMEL_SERVICE(obj)     (GTK_CHECK_CAST((obj), CAMEL_SERVICE_TYPE, CamelService))
@@ -45,9 +44,8 @@ extern "C" {
 #define CAMEL_IS_SERVICE(o)    (GTK_CHECK_TYPE((o), CAMEL_SERVICE_TYPE))
 
 
-
 struct _CamelService {
-       GtkObject parent_object;
+       CamelObject parent_object;
 
        CamelSession *session;
        gboolean connected;
@@ -57,9 +55,8 @@ struct _CamelService {
 };
 
 
-
 typedef struct {
-       GtkObjectClass parent_class;
+       CamelObjectClass parent_class;
 
        gboolean  (*connect)           (CamelService *service, 
                                        CamelException *ex);
index bddd22b..55a466e 100644 (file)
@@ -60,7 +60,7 @@ camel_session_get_type (void)
                        (GtkClassInitFunc) NULL,
                };
 
-               camel_session_type = gtk_type_unique (gtk_object_get_type (),
+               camel_session_type = gtk_type_unique (camel_object_get_type (),
                                                      &camel_session_info);
        }
 
index 5adb72d..81f8a3d 100644 (file)
@@ -34,9 +34,8 @@ extern "C" {
 #pragma }
 #endif /* __cplusplus }*/
 
-#include <gtk/gtk.h>
-#include "camel-types.h"
-#include "camel-provider.h"
+#include <camel/camel-object.h>
+#include <camel/camel-provider.h>
 
 #define CAMEL_SESSION_TYPE     (camel_session_get_type ())
 #define CAMEL_SESSION(obj)     (GTK_CHECK_CAST((obj), CAMEL_SESSION_TYPE, CamelSession))
@@ -50,7 +49,7 @@ typedef char *(*CamelAuthCallback) (char *prompt, gboolean secret,
 
 struct _CamelSession
 {
-       GtkObject parent_object;
+       CamelObject parent_object;
 
        CamelAuthCallback authenticator;
 
@@ -58,7 +57,7 @@ struct _CamelSession
 };
 
 typedef struct {
-       GtkObjectClass parent_class;
+       CamelObjectClass parent_class;
 
 } CamelSessionClass;
 
index d66e634..7f1aa89 100644 (file)
@@ -34,9 +34,7 @@ extern "C" {
 #pragma }
 #endif /* __cplusplus }*/
 
-#include <gtk/gtk.h>
-#include "camel-types.h"
-#include "camel-service.h"
+#include <camel/camel-service.h>
 
 #define CAMEL_STORE_TYPE     (camel_store_get_type ())
 #define CAMEL_STORE(obj)     (GTK_CHECK_CAST((obj), CAMEL_STORE_TYPE, CamelStore))
index 64146d5..7cc1754 100644 (file)
@@ -42,7 +42,6 @@ static gint stream_read (CamelStream *stream, gchar *buffer, gint n);
 static gint stream_write (CamelStream *stream, const gchar *buffer, gint n);
 static void stream_flush (CamelStream *stream);
 static gboolean stream_eos (CamelStream *stream);
-static void stream_close (CamelStream *stream);
 
 static void finalize (GtkObject *object);
 static void destroy (GtkObject *object);
@@ -67,7 +66,6 @@ camel_stream_buffer_class_init (CamelStreamBufferClass *camel_stream_buffer_clas
        camel_stream_class->write = stream_write;
        camel_stream_class->flush = stream_flush;
        camel_stream_class->eos = stream_eos;
-       camel_stream_class->close = stream_close;
 
        gtk_object_class->finalize = finalize;
        gtk_object_class->destroy = destroy;
@@ -164,6 +162,7 @@ init_vbuf(CamelStreamBuffer *sbf, CamelStream *s, CamelStreamBufferMode mode, ch
        if (sbf->stream)
                gtk_object_unref(GTK_OBJECT(sbf->stream));
        sbf->stream = s;
+       gtk_object_ref(GTK_OBJECT(sbf->stream));
 }
 
 static void
@@ -367,15 +366,6 @@ stream_eos (CamelStream *stream)
        return camel_stream_eos(sbf->stream) && sbf->ptr == sbf->end;
 }
 
-static void
-stream_close (CamelStream *stream)
-{
-       CamelStreamBuffer *sbf = CAMEL_STREAM_BUFFER (stream);
-
-       stream_flush(stream);
-       camel_stream_close(sbf->stream);
-}
-
 /**
  * camel_stream_buffer_gets:
  * @sbf: A CamelStreamBuffer.
index a40b795..8f926cd 100644 (file)
@@ -34,9 +34,8 @@ extern "C" {
 #pragma }
 #endif /* __cplusplus }*/
 
-#include <gtk/gtk.h>
+#include <camel/camel-seekable-stream.h>
 #include <stdio.h>
-#include "camel-seekable-stream.h"
 
 #define CAMEL_STREAM_BUFFER_TYPE     (camel_stream_buffer_get_type ())
 #define CAMEL_STREAM_BUFFER(obj)     (GTK_CHECK_CAST((obj), CAMEL_STREAM_BUFFER_TYPE, CamelStreamBuffer))
index e8f1098..500bf22 100644 (file)
@@ -49,7 +49,6 @@ static        gint      do_read       (CamelStream *stream, gchar *buffer, gint n);
 static gint      do_write      (CamelStream *stream, const gchar *buffer, gint n);
 static void      do_flush      (CamelStream *stream);
 static gboolean  do_eos        (CamelStream *stream);
-static void      do_close      (CamelStream *stream);
 static void      do_reset      (CamelStream *stream);
 
 static CamelStreamClass *camel_stream_filter_parent;
@@ -118,7 +117,6 @@ camel_stream_filter_class_init (CamelStreamFilterClass *klass)
        camel_stream_class->write = do_write;
        camel_stream_class->flush = do_flush;
        camel_stream_class->eos = do_eos; 
-       camel_stream_class->close = do_close;
        camel_stream_class->reset = do_reset;
 
        gtk_object_class_add_signals (object_class, signals, LAST_SIGNAL);
@@ -147,6 +145,8 @@ camel_stream_filter_new_with_stream(CamelStream *stream)
        CamelStreamFilter *new = CAMEL_STREAM_FILTER ( gtk_type_new (camel_stream_filter_get_type ()));
 
        new->source = stream;
+       gtk_object_ref ((GtkObject *)stream);
+
        return new;
 }
 
@@ -276,15 +276,6 @@ static     gboolean  do_eos        (CamelStream *stream)
        return camel_stream_eos(filter->source);
 }
 
-static void      do_close      (CamelStream *stream)
-{
-       CamelStreamFilter *filter = (CamelStreamFilter *)stream;
-       struct _CamelStreamFilterPrivate *p = _PRIVATE(filter);
-
-       p->filteredlen = 0;
-       camel_stream_close(filter->source);
-}
-
 static void      do_reset      (CamelStream *stream)
 {
        CamelStreamFilter *filter = (CamelStreamFilter *)stream;
index b63dae2..0bc7373 100644 (file)
@@ -21,8 +21,6 @@
 #ifndef _CAMEL_STREAM_FILTER_H
 #define _CAMEL_STREAM_FILTER_H
 
-#include <gtk/gtk.h>
-
 #include <camel/camel-stream.h>
 #include <camel/camel-mime-filter.h>
 
@@ -30,7 +28,6 @@
 #define CAMEL_STREAM_FILTER_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, camel_stream_filter_get_type (), CamelStreamFilterClass)
 #define IS_CAMEL_STREAM_FILTER(obj)      GTK_CHECK_TYPE (obj, camel_stream_filter_get_type ())
 
-typedef struct _CamelStreamFilter      CamelStreamFilter;
 typedef struct _CamelStreamFilterClass CamelStreamFilterClass;
 
 struct _CamelStreamFilter {
index ae46141..4bd506b 100644 (file)
@@ -39,7 +39,6 @@ static CamelSeekableStreamClass *parent_class=NULL;
 static gint stream_read (CamelStream *stream, gchar *buffer, gint n);
 static gint stream_write (CamelStream *stream, const gchar *buffer, gint n);
 static void stream_flush (CamelStream *stream);
-static void stream_close (CamelStream *stream);
 static off_t stream_seek (CamelSeekableStream *stream, off_t offset, CamelStreamSeekPolicy policy);
 
 static void finalize (GtkObject *object);
@@ -69,7 +68,6 @@ camel_stream_fs_class_init (CamelStreamFsClass *camel_stream_fs_class)
        camel_stream_class->read = stream_read;
        camel_stream_class->write = stream_write;
        camel_stream_class->flush = stream_flush;
-       camel_stream_class->close = stream_close;
 
        camel_seekable_stream_class->seek = stream_seek;
 
@@ -319,18 +317,6 @@ stream_flush (CamelStream *stream)
        fsync ((CAMEL_STREAM_FS (stream))->fd);
 }
 
-static void
-stream_close (CamelStream *stream)
-{
-       CamelStreamFs *fs = (CamelStreamFs *)stream;
-       if (fs->fd != -1) {
-               close (fs->fd);
-               fs->fd = -1;
-       } else {
-               g_warning("StreamFs::close() on a closed or failed stream");
-       }
-}
-
 static off_t
 stream_seek (CamelSeekableStream *stream, off_t offset, CamelStreamSeekPolicy policy)
 {
index d3e8f21..48428c5 100644 (file)
@@ -34,8 +34,6 @@ extern "C" {
 #pragma }
 #endif /* __cplusplus }*/
 
-#include <gtk/gtk.h>
-#include <camel/camel-types.h>
 #include <camel/camel-seekable-stream.h>
 
 /* for open flags */
index 837fa17..e34b274 100644 (file)
@@ -29,7 +29,7 @@
 #include <fcntl.h>
 #include <errno.h>
 
-static CamelStreamClass *parent_class=NULL;
+static CamelStreamClass *parent_class = NULL;
 
 /* Returns the class for a CamelStreamMEM */
 #define CSM_CLASS(so) CAMEL_STREAM_MEM_CLASS (GTK_OBJECT(so)->klass)
@@ -38,7 +38,6 @@ static gint stream_read (CamelStream *stream, gchar *buffer, gint n);
 static gint stream_write (CamelStream *stream, const gchar *buffer, gint n);
 static void stream_flush (CamelStream *stream);
 static gboolean stream_eos (CamelStream *stream);
-static void stream_close (CamelStream *stream);
 static off_t stream_seek (CamelSeekableStream *stream, off_t offset, CamelStreamSeekPolicy policy);
 
 static void finalize (GtkObject *object);
@@ -50,7 +49,7 @@ camel_stream_mem_class_init (CamelStreamMemClass *camel_stream_mem_class)
        CamelStreamClass *camel_stream_class = CAMEL_STREAM_CLASS (camel_stream_mem_class);
        GtkObjectClass *gtk_object_class = GTK_OBJECT_CLASS (camel_stream_mem_class);
        
-       parent_class = gtk_type_class (gtk_object_get_type ());
+       parent_class = gtk_type_class (camel_stream_get_type ());
        
        /* virtual method definition */
        
@@ -59,7 +58,6 @@ camel_stream_mem_class_init (CamelStreamMemClass *camel_stream_mem_class)
        camel_stream_class->write = stream_write;
        camel_stream_class->flush = stream_flush;
        camel_stream_class->eos = stream_eos;
-       camel_stream_class->close = stream_close;
 
        camel_seekable_stream_class->seek = stream_seek;
        
@@ -216,16 +214,6 @@ stream_eos (CamelStream *stream)
        return ((CamelStreamMem *)stream)->buffer->len <= ((CamelSeekableStream *)stream)->position;
 }
 
-static void
-stream_close (CamelStream *stream)
-{
-       CamelStreamMem *stream_mem = CAMEL_STREAM_MEM (stream);
-
-       if (stream_mem->buffer && stream_mem->owner)
-               g_byte_array_free (stream_mem->buffer, TRUE);
-       stream_mem->buffer = NULL;
-}
-
 static off_t
 stream_seek (CamelSeekableStream *stream, off_t offset, CamelStreamSeekPolicy policy)
 {
index 785fdda..6d108f1 100644 (file)
@@ -32,10 +32,8 @@ extern "C" {
 #pragma }
 #endif /* __cplusplus }*/
 
-#include <gtk/gtk.h>
+#include <camel/camel-seekable-stream.h>
 #include <sys/types.h>
-#include "camel-types.h"
-#include "camel-seekable-stream.h"
 
 #define CAMEL_STREAM_MEM_TYPE     (camel_stream_mem_get_type ())
 #define CAMEL_STREAM_MEM(obj)     (GTK_CHECK_CAST((obj), CAMEL_STREAM_MEM_TYPE, CamelStreamMem))
index bb8c636..0827897 100644 (file)
@@ -35,7 +35,7 @@ enum {
 
 static guint camel_stream_signals[LAST_SIGNAL] = { 0 };
 
-static GtkObjectClass *parent_class = NULL;
+static CamelObjectClass *parent_class = NULL;
 
 
 /* Returns the class for a CamelStream */
@@ -47,12 +47,6 @@ default_camel_flush (CamelStream *stream)
        /* nothing */
 }
 
-static void
-default_camel_close (CamelStream *stream)
-{
-       /* nothing */
-}
-
 static gboolean
 eos (CamelStream *stream)
 {
@@ -65,15 +59,13 @@ 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 ());
+       parent_class = gtk_type_class (camel_object_get_type ());
 
        /* virtual method definition */
        camel_stream_class->read = NULL;
        camel_stream_class->write = NULL;
        camel_stream_class->flush = default_camel_flush;
        camel_stream_class->eos = eos;
-       camel_stream_class->close = default_camel_close;
-       camel_stream_class->close = NULL;
 
        /* virtual method overload */
        
@@ -108,7 +100,7 @@ camel_stream_get_type (void)
                        (GtkClassInitFunc) NULL,
                };
                
-               camel_stream_type = gtk_type_unique (gtk_object_get_type (), &camel_stream_info);
+               camel_stream_type = gtk_type_unique (camel_object_get_type (), &camel_stream_info);
        }
        
        return camel_stream_type;
@@ -177,18 +169,6 @@ camel_stream_eos (CamelStream *stream)
 
 
 /**
- * camel_stram_close: 
- * @stream: a CamelStream object.
- * 
- * Close the @stream object.
- **/
-void
-camel_stream_close (CamelStream *stream)
-{
-       CS_CLASS (stream)->close (stream);
-}
-
-/**
  * camel_stream_reset: reset a stream
  * @stream: the stream object
  * 
index 9a4e961..c2b91d0 100644 (file)
@@ -34,8 +34,7 @@ extern "C" {
 #pragma }
 #endif /* __cplusplus }*/
 
-#include <gtk/gtk.h>
-#include "camel-types.h"
+#include <camel/camel-object.h>
 
 #define CAMEL_STREAM_TYPE     (camel_stream_get_type ())
 #define CAMEL_STREAM(obj)     (GTK_CHECK_CAST((obj), CAMEL_STREAM_TYPE, CamelStream))
@@ -44,13 +43,13 @@ extern "C" {
 
 struct _CamelStream
 {
-       GtkObject parent_object;
+       CamelObject parent_object;
 
        gboolean eos;           /* end of stream indicator, for use by implementing classes */
 };
 
 typedef struct {
-       GtkObjectClass parent_class;
+       CamelObjectClass parent_class;
        
        /* Virtual methods */   
        
@@ -60,7 +59,6 @@ typedef struct {
        gint      (*write)      (CamelStream *stream, const gchar *buffer, gint n);
        void      (*flush)      (CamelStream *stream);
        gboolean  (*eos)        (CamelStream *stream);
-       void      (*close)      (CamelStream *stream);
        void      (*reset)      (CamelStream *stream);
 } CamelStreamClass;
 
@@ -72,7 +70,6 @@ gint       camel_stream_read      (CamelStream *stream, gchar *buffer, gint n);
 gint       camel_stream_write     (CamelStream *stream, const gchar *buffer, gint n);
 void       camel_stream_flush     (CamelStream *stream);
 gboolean   camel_stream_eos       (CamelStream *stream);
-void       camel_stream_close     (CamelStream *stream);
 void       camel_stream_reset     (CamelStream *stream);
 
 /* utility macros and funcs */
index 2608e08..050d8ed 100644 (file)
@@ -36,7 +36,7 @@ extern "C" {
 #pragma }
 #endif /* __cplusplus }*/
 
-#include "camel-op-queue.h"
+#include <camel/camel-op-queue.h>
 
 #define CAMEL_THREAD_PROXY(o)  (CamelThreadProxy *)(o)
 
index 1e41f4a..fc8f0e3 100644 (file)
@@ -34,9 +34,7 @@ extern "C" {
 #pragma }
 #endif /* __cplusplus }*/
 
-#include <gtk/gtk.h>
-#include "camel-types.h"
-#include "camel-service.h"
+#include <camel/camel-service.h>
 
 #define CAMEL_TRANSPORT_TYPE     (camel_transport_get_type ())
 #define CAMEL_TRANSPORT(obj)     (GTK_CHECK_CAST((obj), CAMEL_TRANSPORT_TYPE, CamelTransport))
index cb7c9de..c8bbc87 100644 (file)
@@ -27,14 +27,25 @@ extern "C" {
 #pragma }
 #endif /* __cplusplus }*/
 
+typedef struct _CamelAddress CamelAddress;
 typedef struct _CamelDataWrapper CamelDataWrapper;
 typedef struct _CamelException CamelException;
 typedef struct _CamelFolder CamelFolder;
+typedef struct _CamelFolderSearch CamelFolderSearch;
 typedef struct _CamelFolderSummary CamelFolderSummary;
+typedef struct _CamelInternetAddress CamelInternetAddress;
 typedef struct _CamelMedium CamelMedium;
+typedef struct _CamelMimeFilter CamelMimeFilter;
+typedef struct _CamelMimeFilterBasic CamelMimeFilterBasic;
+typedef struct _CamelMimeFilterCharset CamelMimeFilterCharset;
+typedef struct _CamelMimeFilterIndex CamelMimeFilterIndex;
+typedef struct _CamelMimeFilterSave CamelMimeFilterSave;
 typedef struct _CamelMimeMessage CamelMimeMessage;
+typedef struct _CamelMimeParser CamelMimeParser;
 typedef struct _CamelMimePart CamelMimePart;
 typedef struct _CamelMultipart CamelMultipart;
+typedef struct _CamelNewsAddress CamelNewsAddress;
+typedef struct _CamelObject CamelObject;
 typedef struct _CamelSeekableStream CamelSeekableStream;
 typedef struct _CamelSeekableSubstream CamelSeekableSubstream;
 typedef struct _CamelService CamelService;
@@ -45,6 +56,7 @@ typedef struct _CamelStore CamelStore;
 typedef struct _CamelStream CamelStream;
 typedef struct _CamelStreamBuffer CamelStreamBuffer;
 typedef struct _CamelStreamDataWrapper CamelStreamDataWrapper;
+typedef struct _CamelStreamFilter CamelStreamFilter;
 typedef struct _CamelStreamFs CamelStreamFs;
 typedef struct _CamelStreamMem CamelStreamMem;
 typedef struct _CamelTransport CamelTransport;
index 60012cb..f2a4c64 100644 (file)
@@ -29,7 +29,7 @@
 #define CAMEL_URL_H 1
 
 #include <glib.h>
-#include "camel-types.h"
+#include <camel/camel-types.h>
 
 #ifdef __cplusplus
 extern "C" {
index 09ef8ad..9f2fba8 100644 (file)
@@ -33,7 +33,6 @@ extern "C" {
 #pragma }
 #endif /* __cplusplus }*/
 
-#include <gtk/gtk.h>
 #include <camel/camel-data-wrapper.h>
 #include <camel/camel-exception.h>
 #include <camel/camel-folder-pt-proxy.h>
index e4569dd..c911250 100644 (file)
@@ -27,7 +27,7 @@
 #define MD5_UTILS_H
 
 #include <glib.h>
-#include "camel-stream.h"
+#include <camel/camel-stream.h>
 
 typedef struct {
        guint32 buf[4];
index bc1913c..a0a593a 100644 (file)
@@ -804,11 +804,11 @@ mbox_append_message (CamelFolder *folder, CamelMimeMessage *message, CamelExcept
        camel_stream_write_string (output_stream, "From - \n");
        /* FIXME: does this return an error?   IT HAS TO FOR THIS TO BE RELIABLE */
        camel_data_wrapper_write_to_stream (CAMEL_DATA_WRAPPER (message), output_stream);
-       camel_stream_close (output_stream);
 
        /* TODO: update the summary so it knows a new message is there to summarise/index */
        /* This is only a performance improvement, the summary is *only* a cache */
 
+       camel_stream_flush (output_stream);
        gtk_object_unref (GTK_OBJECT (output_stream));
 }
 
@@ -901,8 +901,6 @@ mbox_get_message_by_uid (CamelFolder *folder, const gchar *uid, CamelException *
        message_stream = camel_stream_fs_new_with_name_and_bounds (mbox_folder->folder_file_path, O_RDONLY, 0,
                                                                   ((CamelMboxMessageContentInfo *)info->info.content)->pos,
                                                                   ((CamelMboxMessageContentInfo *)info->info.content)->endpos);
-       gtk_object_ref((GtkObject *)message_stream);
-       gtk_object_sink((GtkObject *)message_stream);
        message = camel_mime_message_new();
        if (camel_data_wrapper_construct_from_stream((CamelDataWrapper *)message, message_stream) == -1) {
                gtk_object_unref((GtkObject *)message);
index 0c4ba16..6fee4d2 100644 (file)
@@ -469,7 +469,7 @@ _append_message (CamelFolder *folder, CamelMimeMessage *message, CamelException
                camel_stream_write_string (output_stream, "From - \n");
                camel_data_wrapper_write_to_stream (CAMEL_DATA_WRAPPER (message), output_stream);
        }
-       camel_stream_close (output_stream);
+       camel_stream_flush (output_stream);
        gtk_object_unref (GTK_OBJECT (output_stream));
 
        /* at this point we have saved the message to a
index c1a721d..639e8fa 100644 (file)
@@ -232,11 +232,8 @@ nntp_disconnect (CamelService *service, CamelException *ex)
        if (!service_class->disconnect (service, ex))
                return FALSE;
 
-       /* Closing the buffered write stream will close the
-        * unbuffered read stream wrapped inside it as well.
-        */
-       camel_stream_close (store->ostream);
        gtk_object_unref (GTK_OBJECT (store->ostream));
+       gtk_object_unref (GTK_OBJECT (store->istream));
        store->ostream = NULL;
        store->istream = NULL;
        return TRUE;
index f47851a..bb2c7de 100644 (file)
@@ -209,6 +209,7 @@ get_message_by_number (CamelFolder *folder, gint number, CamelException *ex)
        msg = camel_mime_message_new ();
        camel_data_wrapper_construct_from_stream (CAMEL_DATA_WRAPPER (msg),
                                                  msgstream);
+       gtk_object_unref (GTK_OBJECT (msgstream));
 
        return msg;
 }
index ff4ca26..9ae87ad 100644 (file)
@@ -382,8 +382,8 @@ pop3_connect (CamelService *service, CamelException *ex)
                                     "Could not read greeting from POP "
                                     "server.");
                return FALSE;
-               camel_stream_close (store->ostream);
-               camel_stream_close (store->istream);
+               gtk_object_unref (GTK_OBJECT (store->ostream));
+               gtk_object_unref (GTK_OBJECT (store->istream));
        }
        apoptime = strchr (buf, '<');
        apopend = apoptime ? strchr (apoptime, '>') : NULL;
@@ -418,8 +418,8 @@ pop3_connect (CamelService *service, CamelException *ex)
                                              "server. Error sending username:"
                                              " %s", msg ? msg : "(Unknown)");
                        g_free (msg);
-                       camel_stream_close (store->ostream);
-                       camel_stream_close (store->istream);
+                       gtk_object_unref (GTK_OBJECT (store->ostream));
+                       gtk_object_unref (GTK_OBJECT (store->istream));
                        return FALSE;
                }
 
@@ -433,8 +433,8 @@ pop3_connect (CamelService *service, CamelException *ex)
                                      "server. Error sending password:"
                                      " %s", msg ? msg : "(Unknown)");
                g_free (msg);
-               camel_stream_close (store->ostream);
-               camel_stream_close (store->istream);
+               gtk_object_unref (GTK_OBJECT (store->ostream));
+               gtk_object_unref (GTK_OBJECT (store->istream));
                return FALSE;
        }
 
@@ -453,11 +453,8 @@ pop3_disconnect (CamelService *service, CamelException *ex)
        if (!service_class->disconnect (service, ex))
                return FALSE;
 
-       /* Closing the buffered write stream will close the
-        * unbuffered read stream wrapped inside it as well.
-        */
-       camel_stream_close (store->ostream);
        gtk_object_unref (GTK_OBJECT (store->ostream));
+       gtk_object_unref (GTK_OBJECT (store->istream));
        store->ostream = NULL;
        store->istream = NULL;
        return TRUE;
index 15ba1f0..fad9d96 100644 (file)
@@ -140,7 +140,8 @@ _send_internal (CamelMedium *message, char **argv, CamelException *ex)
        close (fd[0]);
        out = camel_stream_fs_new_with_fd (fd[1]);
        camel_data_wrapper_write_to_stream (CAMEL_DATA_WRAPPER (message), out);
-       camel_stream_close (out);
+       camel_stream_flush (out);
+       gtk_object_unref (GTK_OBJECT (out));
 
        /* Wait for sendmail to exit. */
        while (waitpid (pid, &wstat, 0) == -1 && errno == EINTR)
index 9929485..b329360 100644 (file)
@@ -198,11 +198,8 @@ smtp_disconnect (CamelService *service, CamelException *ex)
        if (!service_class->disconnect (service, ex))
                return FALSE;
 
-       /* Closing the buffered write stream will close the
-        * unbuffered read stream wrapped inside it as well.
-        */
-       camel_stream_close (transport->ostream);
        gtk_object_unref (GTK_OBJECT (transport->ostream));
+       gtk_object_unref (GTK_OBJECT (transport->istream));
        transport->ostream = NULL;
        transport->istream = NULL;