diff options
author | Dan Winship <danw@src.gnome.org> | 2000-05-08 05:56:32 +0800 |
---|---|---|
committer | Dan Winship <danw@src.gnome.org> | 2000-05-08 05:56:32 +0800 |
commit | 580d885820e5319e5dbe4f4aa1a7464b9bde2034 (patch) | |
tree | 950f1b1f28eceb9174d58d729a3a65d378439e6b /camel | |
parent | 2faf6f059b79d069e25717819d676dfa2d5bf64f (diff) | |
download | gsoc2013-evolution-580d885820e5319e5dbe4f4aa1a7464b9bde2034.tar.gz gsoc2013-evolution-580d885820e5319e5dbe4f4aa1a7464b9bde2034.tar.zst gsoc2013-evolution-580d885820e5319e5dbe4f4aa1a7464b9bde2034.zip |
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
svn path=/trunk/; revision=2882
Diffstat (limited to 'camel')
69 files changed, 320 insertions, 240 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog index b8ce5fae1d..d66cb86975 100644 --- a/camel/ChangeLog +++ b/camel/ChangeLog @@ -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 diff --git a/camel/Makefile.am b/camel/Makefile.am index c3948235ed..c24113df45 100644 --- a/camel/Makefile.am +++ b/camel/Makefile.am @@ -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 \ diff --git a/camel/camel-address.c b/camel/camel-address.c index a190eb3f3e..8056c121c8 100644 --- a/camel/camel-address.c +++ b/camel/camel-address.c @@ -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; diff --git a/camel/camel-address.h b/camel/camel-address.h index 94466f351b..d035f20e00 100644 --- a/camel/camel-address.h +++ b/camel/camel-address.h @@ -21,17 +21,16 @@ #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 *); diff --git a/camel/camel-data-wrapper.c b/camel/camel-data-wrapper.c index e3edba1034..fb0a161300 100644 --- a/camel/camel-data-wrapper.c +++ b/camel/camel-data-wrapper.c @@ -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)); } diff --git a/camel/camel-data-wrapper.h b/camel/camel-data-wrapper.h index 0a3e0363a2..8daf7a84db 100644 --- a/camel/camel-data-wrapper.h +++ b/camel/camel-data-wrapper.h @@ -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, diff --git a/camel/camel-exception.h b/camel/camel-exception.h index bf361a032b..0f4772e7ce 100644 --- a/camel/camel-exception.h +++ b/camel/camel-exception.h @@ -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" diff --git a/camel/camel-folder-pt-proxy.c b/camel/camel-folder-pt-proxy.c index 8d8fda4ccf..65f74ecc4d 100644 --- a/camel/camel-folder-pt-proxy.c +++ b/camel/camel-folder-pt-proxy.c @@ -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; diff --git a/camel/camel-folder-pt-proxy.h b/camel/camel-folder-pt-proxy.h index e5ae322f33..7422786170 100644 --- a/camel/camel-folder-pt-proxy.h +++ b/camel/camel-folder-pt-proxy.h @@ -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 ()) diff --git a/camel/camel-folder-search.c b/camel/camel-folder-search.c index 8a58d9a6ef..e5110d1d1a 100644 --- a/camel/camel-folder-search.c +++ b/camel/camel-folder-search.c @@ -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; diff --git a/camel/camel-folder-search.h b/camel/camel-folder-search.h index ea00c2ef25..26fdb2ecc3 100644 --- a/camel/camel-folder-search.h +++ b/camel/camel-folder-search.h @@ -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> @@ -31,11 +31,10 @@ #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); diff --git a/camel/camel-folder-summary.c b/camel/camel-folder-summary.c index ee879b3f7f..de66646483 100644 --- a/camel/camel-folder-summary.c +++ b/camel/camel-folder-summary.c @@ -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 diff --git a/camel/camel-folder-summary.h b/camel/camel-folder-summary.h index 69045d6931..c8948a405c 100644 --- a/camel/camel-folder-summary.h +++ b/camel/camel-folder-summary.h @@ -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 *); diff --git a/camel/camel-folder.c b/camel/camel-folder.c index 6188c35866..ed78b42f51 100644 --- a/camel/camel-folder.c +++ b/camel/camel-folder.c @@ -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; diff --git a/camel/camel-folder.h b/camel/camel-folder.h index 5cc379be3b..c8ffdd52ac 100644 --- a/camel/camel-folder.h +++ b/camel/camel-folder.h @@ -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); diff --git a/camel/camel-internet-address.h b/camel/camel-internet-address.h index a0e6107e1b..14fbd5436a 100644 --- a/camel/camel-internet-address.h +++ b/camel/camel-internet-address.h @@ -21,14 +21,12 @@ #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 { diff --git a/camel/camel-medium.c b/camel/camel-medium.c index 68463eca40..dcc5d31d67 100644 --- a/camel/camel-medium.c +++ b/camel/camel-medium.c @@ -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; } diff --git a/camel/camel-medium.h b/camel/camel-medium.h index 6971117382..2b6f77f825 100644 --- a/camel/camel-medium.h +++ b/camel/camel-medium.h @@ -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 ()) diff --git a/camel/camel-mime-filter-basic.h b/camel/camel-mime-filter-basic.h index 57d9898fa6..f700997fd2 100644 --- a/camel/camel-mime-filter-basic.h +++ b/camel/camel-mime-filter-basic.h @@ -21,14 +21,12 @@ #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 { diff --git a/camel/camel-mime-filter-charset.h b/camel/camel-mime-filter-charset.h index 3e15e2e7c7..866a9fd6bf 100644 --- a/camel/camel-mime-filter-charset.h +++ b/camel/camel-mime-filter-charset.h @@ -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 { diff --git a/camel/camel-mime-filter-index.h b/camel/camel-mime-filter-index.h index f480fc55c7..7dcc76b8ea 100644 --- a/camel/camel-mime-filter-index.h +++ b/camel/camel-mime-filter-index.h @@ -21,16 +21,13 @@ #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 { diff --git a/camel/camel-mime-filter-save.h b/camel/camel-mime-filter-save.h index 970e849db6..eb6e448560 100644 --- a/camel/camel-mime-filter-save.h +++ b/camel/camel-mime-filter-save.h @@ -21,15 +21,12 @@ #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 { diff --git a/camel/camel-mime-filter.c b/camel/camel-mime-filter.c index de34a4c973..e402ba0ff2 100644 --- a/camel/camel-mime-filter.c +++ b/camel/camel-mime-filter.c @@ -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; diff --git a/camel/camel-mime-filter.h b/camel/camel-mime-filter.h index 51b63479de..4576596bab 100644 --- a/camel/camel-mime-filter.h +++ b/camel/camel-mime-filter.h @@ -23,18 +23,17 @@ #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, diff --git a/camel/camel-mime-message.h b/camel/camel-mime-message.h index c790138f70..f1e254da51 100644 --- a/camel/camel-mime-message.h +++ b/camel/camel-mime-message.h @@ -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> diff --git a/camel/camel-mime-parser.c b/camel/camel-mime-parser.c index 91b4f6cd6e..97a43e44d7 100644 --- a/camel/camel-mime-parser.c +++ b/camel/camel-mime-parser.c @@ -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; diff --git a/camel/camel-mime-parser.h b/camel/camel-mime-parser.h index 1a84cefa28..baefbfe67f 100644 --- a/camel/camel-mime-parser.h +++ b/camel/camel-mime-parser.h @@ -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 *); diff --git a/camel/camel-mime-part-utils.c b/camel/camel-mime-part-utils.c index adbc62d305..fc11665623 100644 --- a/camel/camel-mime-part-utils.c +++ b/camel/camel-mime-part-utils.c @@ -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); } } diff --git a/camel/camel-mime-part-utils.h b/camel/camel-mime-part-utils.h index a4e58ec2a2..1e1c3655aa 100644 --- a/camel/camel-mime-part-utils.h +++ b/camel/camel-mime-part-utils.h @@ -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); diff --git a/camel/camel-mime-part.c b/camel/camel-mime-part.c index fa22cf9dcb..7d08c6a5b1 100644 --- a/camel/camel-mime-part.c +++ b/camel/camel-mime-part.c @@ -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; } } diff --git a/camel/camel-mime-part.h b/camel/camel-mime-part.h index b2c87b8f9f..9360a96848 100644 --- a/camel/camel-mime-part.h +++ b/camel/camel-mime-part.h @@ -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> diff --git a/camel/camel-movemail.h b/camel/camel-movemail.h index a4b20141ac..ea75c82603 100644 --- a/camel/camel-movemail.h +++ b/camel/camel-movemail.h @@ -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); diff --git a/camel/camel-multipart.h b/camel/camel-multipart.h index 33b88d6500..709e73e51d 100644 --- a/camel/camel-multipart.h +++ b/camel/camel-multipart.h @@ -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)) diff --git a/camel/camel-news-address.h b/camel/camel-news-address.h index f472a7c7ef..e25f907351 100644 --- a/camel/camel-news-address.h +++ b/camel/camel-news-address.h @@ -21,13 +21,12 @@ #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 index 0000000000..3edce10d8a --- /dev/null +++ b/camel/camel-object.c @@ -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 index 0000000000..2c6b4d0d5c --- /dev/null +++ b/camel/camel-object.h @@ -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 */ diff --git a/camel/camel-op-queue.h b/camel/camel-op-queue.h index b96737eba5..49fdc152d3 100644 --- a/camel/camel-op-queue.h +++ b/camel/camel-op-queue.h @@ -33,7 +33,7 @@ extern "C" { #endif /* __cplusplus }*/ #include <glib.h> -#include "camel-marshal-utils.h" +#include <camel/camel-marshal-utils.h> diff --git a/camel/camel-provider.h b/camel/camel-provider.h index cac6e9d6cc..463f415d1b 100644 --- a/camel/camel-provider.h +++ b/camel/camel-provider.h @@ -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)) diff --git a/camel/camel-seekable-stream.h b/camel/camel-seekable-stream.h index fa6f58dddc..f9eb86636d 100644 --- a/camel/camel-seekable-stream.h +++ b/camel/camel-seekable-stream.h @@ -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)) diff --git a/camel/camel-seekable-substream.c b/camel/camel-seekable-substream.c index 5b01495be1..37d6acab9d 100644 --- a/camel/camel-seekable-substream.c +++ b/camel/camel-seekable-substream.c @@ -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); diff --git a/camel/camel-seekable-substream.h b/camel/camel-seekable-substream.h index 75a7a41cac..81e36b9fe2 100644 --- a/camel/camel-seekable-substream.h +++ b/camel/camel-seekable-substream.h @@ -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)) diff --git a/camel/camel-service.c b/camel/camel-service.c index edb71d2a78..ae3867643f 100644 --- a/camel/camel-service.c +++ b/camel/camel-service.c @@ -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); } diff --git a/camel/camel-service.h b/camel/camel-service.h index ffaf177543..c2f4f12020 100644 --- a/camel/camel-service.h +++ b/camel/camel-service.h @@ -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); diff --git a/camel/camel-session.c b/camel/camel-session.c index bddd22bfe2..55a466e404 100644 --- a/camel/camel-session.c +++ b/camel/camel-session.c @@ -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); } diff --git a/camel/camel-session.h b/camel/camel-session.h index 5adb72d65a..81f8a3da85 100644 --- a/camel/camel-session.h +++ b/camel/camel-session.h @@ -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; diff --git a/camel/camel-store.h b/camel/camel-store.h index d66e6344b5..7f1aa89d59 100644 --- a/camel/camel-store.h +++ b/camel/camel-store.h @@ -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)) diff --git a/camel/camel-stream-buffer.c b/camel/camel-stream-buffer.c index 64146d5b2e..7cc1754ad6 100644 --- a/camel/camel-stream-buffer.c +++ b/camel/camel-stream-buffer.c @@ -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. diff --git a/camel/camel-stream-buffer.h b/camel/camel-stream-buffer.h index a40b7957da..8f926cd231 100644 --- a/camel/camel-stream-buffer.h +++ b/camel/camel-stream-buffer.h @@ -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)) diff --git a/camel/camel-stream-filter.c b/camel/camel-stream-filter.c index e8f1098a12..500bf22846 100644 --- a/camel/camel-stream-filter.c +++ b/camel/camel-stream-filter.c @@ -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; diff --git a/camel/camel-stream-filter.h b/camel/camel-stream-filter.h index b63dae275a..0bc73732ec 100644 --- a/camel/camel-stream-filter.h +++ b/camel/camel-stream-filter.h @@ -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 { diff --git a/camel/camel-stream-fs.c b/camel/camel-stream-fs.c index ae46141e19..4bd506b143 100644 --- a/camel/camel-stream-fs.c +++ b/camel/camel-stream-fs.c @@ -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) { diff --git a/camel/camel-stream-fs.h b/camel/camel-stream-fs.h index d3e8f219c7..48428c58bd 100644 --- a/camel/camel-stream-fs.h +++ b/camel/camel-stream-fs.h @@ -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 */ diff --git a/camel/camel-stream-mem.c b/camel/camel-stream-mem.c index 837fa17560..e34b274380 100644 --- a/camel/camel-stream-mem.c +++ b/camel/camel-stream-mem.c @@ -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) { diff --git a/camel/camel-stream-mem.h b/camel/camel-stream-mem.h index 785fddad60..6d108f111f 100644 --- a/camel/camel-stream-mem.h +++ b/camel/camel-stream-mem.h @@ -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)) diff --git a/camel/camel-stream.c b/camel/camel-stream.c index bb8c6362ec..082789733d 100644 --- a/camel/camel-stream.c +++ b/camel/camel-stream.c @@ -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 * diff --git a/camel/camel-stream.h b/camel/camel-stream.h index 9a4e96122b..c2b91d0e6a 100644 --- a/camel/camel-stream.h +++ b/camel/camel-stream.h @@ -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 */ diff --git a/camel/camel-thread-proxy.h b/camel/camel-thread-proxy.h index 2608e08878..050d8ed598 100644 --- a/camel/camel-thread-proxy.h +++ b/camel/camel-thread-proxy.h @@ -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) diff --git a/camel/camel-transport.h b/camel/camel-transport.h index 1e41f4ac71..fc8f0e3076 100644 --- a/camel/camel-transport.h +++ b/camel/camel-transport.h @@ -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)) diff --git a/camel/camel-types.h b/camel/camel-types.h index cb7c9dea57..c8bbc874b4 100644 --- a/camel/camel-types.h +++ b/camel/camel-types.h @@ -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; diff --git a/camel/camel-url.h b/camel/camel-url.h index 60012cb90c..f2a4c645f5 100644 --- a/camel/camel-url.h +++ b/camel/camel-url.h @@ -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" { diff --git a/camel/camel.h b/camel/camel.h index 09ef8adc7e..9f2fba8119 100644 --- a/camel/camel.h +++ b/camel/camel.h @@ -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> diff --git a/camel/md5-utils.h b/camel/md5-utils.h index e4569dd54a..c911250d56 100644 --- a/camel/md5-utils.h +++ b/camel/md5-utils.h @@ -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]; diff --git a/camel/providers/mbox/camel-mbox-folder.c b/camel/providers/mbox/camel-mbox-folder.c index bc1913cb0d..a0a593a00f 100644 --- a/camel/providers/mbox/camel-mbox-folder.c +++ b/camel/providers/mbox/camel-mbox-folder.c @@ -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); diff --git a/camel/providers/nntp/camel-nntp-folder.c b/camel/providers/nntp/camel-nntp-folder.c index 0c4ba1691d..6fee4d2aac 100644 --- a/camel/providers/nntp/camel-nntp-folder.c +++ b/camel/providers/nntp/camel-nntp-folder.c @@ -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 diff --git a/camel/providers/nntp/camel-nntp-store.c b/camel/providers/nntp/camel-nntp-store.c index c1a721d96c..639e8fa9e0 100644 --- a/camel/providers/nntp/camel-nntp-store.c +++ b/camel/providers/nntp/camel-nntp-store.c @@ -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; diff --git a/camel/providers/pop3/camel-pop3-folder.c b/camel/providers/pop3/camel-pop3-folder.c index f47851a6a4..bb2c7de6e1 100644 --- a/camel/providers/pop3/camel-pop3-folder.c +++ b/camel/providers/pop3/camel-pop3-folder.c @@ -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; } diff --git a/camel/providers/pop3/camel-pop3-store.c b/camel/providers/pop3/camel-pop3-store.c index ff4ca265a1..9ae87ad420 100644 --- a/camel/providers/pop3/camel-pop3-store.c +++ b/camel/providers/pop3/camel-pop3-store.c @@ -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; diff --git a/camel/providers/sendmail/camel-sendmail-transport.c b/camel/providers/sendmail/camel-sendmail-transport.c index 15ba1f04e1..fad9d9681d 100644 --- a/camel/providers/sendmail/camel-sendmail-transport.c +++ b/camel/providers/sendmail/camel-sendmail-transport.c @@ -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) diff --git a/camel/providers/smtp/camel-smtp-transport.c b/camel/providers/smtp/camel-smtp-transport.c index 992948560e..b32936012a 100644 --- a/camel/providers/smtp/camel-smtp-transport.c +++ b/camel/providers/smtp/camel-smtp-transport.c @@ -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; |