Commit 580d8858 authored by Dan Winship's avatar Dan Winship

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
parent 2faf6f05
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
......
......@@ -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 \
......
......@@ -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;
......
......@@ -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 *);
......
......@@ -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));
}
......
......@@ -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,
......
......@@ -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"
......
......@@ -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;
......
......@@ -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 ())
......
......@@ -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;
......
......@@ -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);
......
......@@ -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
......
......@@ -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 *);
......
......@@ -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;
......
......@@ -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);
......
......@@ -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 {
......
......@@ -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;
}
......
......@@ -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 ())
......
......@@ -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 {
......
......@@ -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 {
......
......@@ -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 {
......
......@@ -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 {
......
......@@ -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;
......
......@@ -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,
......
......@@ -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>
......
......@@ -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;
......
......@@ -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 *);
......
......@@ -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);
}
}
......@@ -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);
......
......@@ -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)