aboutsummaryrefslogtreecommitdiffstats
path: root/camel/providers/imap
diff options
context:
space:
mode:
authorPeter Williams <peterw@src.gnome.org>2000-08-11 01:30:50 +0800
committerPeter Williams <peterw@src.gnome.org>2000-08-11 01:30:50 +0800
commit8cb514d6dd9497893a35a089d07a132d51263ee7 (patch)
tree9f4e5d1f929da7e0be900919753d419fe4c9c61a /camel/providers/imap
parentbcbb63c59f80eb4e684036c5ef58ab141fb01b03 (diff)
downloadgsoc2013-evolution-8cb514d6dd9497893a35a089d07a132d51263ee7.tar
gsoc2013-evolution-8cb514d6dd9497893a35a089d07a132d51263ee7.tar.gz
gsoc2013-evolution-8cb514d6dd9497893a35a089d07a132d51263ee7.tar.bz2
gsoc2013-evolution-8cb514d6dd9497893a35a089d07a132d51263ee7.tar.lz
gsoc2013-evolution-8cb514d6dd9497893a35a089d07a132d51263ee7.tar.xz
gsoc2013-evolution-8cb514d6dd9497893a35a089d07a132d51263ee7.tar.zst
gsoc2013-evolution-8cb514d6dd9497893a35a089d07a132d51263ee7.zip
Merge with camel-async.
svn path=/trunk/; revision=4687
Diffstat (limited to 'camel/providers/imap')
-rw-r--r--camel/providers/imap/camel-imap-folder.c73
-rw-r--r--camel/providers/imap/camel-imap-folder.h11
-rw-r--r--camel/providers/imap/camel-imap-store.c84
-rw-r--r--camel/providers/imap/camel-imap-store.h12
-rw-r--r--camel/providers/imap/camel-imap-stream.c52
-rw-r--r--camel/providers/imap/camel-imap-stream.h10
6 files changed, 115 insertions, 127 deletions
diff --git a/camel/providers/imap/camel-imap-folder.c b/camel/providers/imap/camel-imap-folder.c
index 9ab729d218..87554b120d 100644
--- a/camel/providers/imap/camel-imap-folder.c
+++ b/camel/providers/imap/camel-imap-folder.c
@@ -55,7 +55,7 @@
#define d(x) x
-#define CF_CLASS(o) (CAMEL_FOLDER_CLASS (GTK_OBJECT (o)->klass))
+#define CF_CLASS(o) (CAMEL_FOLDER_CLASS (CAMEL_OBJECT_GET_CLASS(o)))
static CamelFolderClass *parent_class = NULL;
@@ -64,8 +64,6 @@ static void imap_init (CamelFolder *folder, CamelStore *parent_store,
gchar *separator, gboolean path_begns_with_sep,
CamelException *ex);
-static void imap_finalize (GtkObject *object);
-
static void imap_sync (CamelFolder *folder, gboolean expunge, CamelException *ex);
static void imap_expunge (CamelFolder *folder, CamelException *ex);
@@ -88,6 +86,8 @@ static const CamelMessageInfo *imap_get_message_info (CamelFolder *folder, const
static GPtrArray *imap_search_by_expression (CamelFolder *folder, const char *expression, CamelException *ex);
+static void imap_finalize (CamelObject *object);
+
/* flag methods */
static guint32 imap_get_message_flags (CamelFolder *folder, const char *uid);
static void imap_set_message_flags (CamelFolder *folder, const char *uid, guint32 flags, guint32 set);
@@ -100,9 +100,8 @@ static void
camel_imap_folder_class_init (CamelImapFolderClass *camel_imap_folder_class)
{
CamelFolderClass *camel_folder_class = CAMEL_FOLDER_CLASS (camel_imap_folder_class);
- GtkObjectClass *gtk_object_class = GTK_OBJECT_CLASS (camel_folder_class);
- parent_class = gtk_type_class (camel_folder_get_type ());
+ parent_class = CAMEL_FOLDER_CLASS(camel_type_get_global_classfuncs (camel_folder_get_type ()));
/* virtual method definition */
@@ -133,8 +132,6 @@ camel_imap_folder_class_init (CamelImapFolderClass *camel_imap_folder_class)
camel_folder_class->set_message_flags = imap_set_message_flags;
camel_folder_class->get_message_user_flag = imap_get_message_user_flag;
camel_folder_class->set_message_user_flag = imap_set_message_user_flag;
-
- gtk_object_class->finalize = imap_finalize;
}
static void
@@ -153,25 +150,19 @@ camel_imap_folder_init (gpointer object, gpointer klass)
imap_folder->lsub = NULL;
}
-GtkType
+CamelType
camel_imap_folder_get_type (void)
{
- static GtkType camel_imap_folder_type = 0;
-
- if (!camel_imap_folder_type) {
- GtkTypeInfo camel_imap_folder_info =
- {
- "CamelImapFolder",
- sizeof (CamelImapFolder),
- sizeof (CamelImapFolderClass),
- (GtkClassInitFunc) camel_imap_folder_class_init,
- (GtkObjectInitFunc) camel_imap_folder_init,
- /* reserved_1 */ NULL,
- /* reserved_2 */ NULL,
- (GtkClassInitFunc) NULL,
- };
-
- camel_imap_folder_type = gtk_type_unique (CAMEL_FOLDER_TYPE, &camel_imap_folder_info);
+ static CamelType camel_imap_folder_type = CAMEL_INVALID_TYPE;
+
+ if (camel_imap_folder_type == CAMEL_INVALID_TYPE) {
+ camel_imap_folder_type = camel_type_register (CAMEL_FOLDER_TYPE, "CamelImapFolder",
+ sizeof (CamelImapFolder),
+ sizeof (CamelImapFolderClass),
+ (CamelObjectClassInitFunc) camel_imap_folder_class_init,
+ NULL,
+ (CamelObjectInitFunc) camel_imap_folder_init,
+ (CamelObjectFinalizeFunc) imap_finalize);
}
return camel_imap_folder_type;
@@ -180,7 +171,7 @@ camel_imap_folder_get_type (void)
CamelFolder *
camel_imap_folder_new (CamelStore *parent, char *folder_name, CamelException *ex)
{
- CamelFolder *folder = CAMEL_FOLDER (gtk_object_new (camel_imap_folder_get_type (), NULL));
+ CamelFolder *folder = CAMEL_FOLDER (camel_object_new (camel_imap_folder_get_type ()));
CamelURL *url = CAMEL_SERVICE (parent)->url;
char *dir_sep;
@@ -238,7 +229,7 @@ imap_folder_summary_free (CamelImapFolder *imap_folder)
}
static void
-imap_finalize (GtkObject *object)
+imap_finalize (CamelObject *object)
{
/* TODO: do we need to do more cleanup here? */
CamelImapFolder *imap_folder = CAMEL_IMAP_FOLDER (object);
@@ -964,9 +955,9 @@ imap_get_message (CamelFolder *folder, const gchar *uid, CamelException *ex)
camel_stream_filter_remove (f_stream, id);
camel_stream_close (CAMEL_STREAM (f_stream));
#endif
- gtk_object_unref (GTK_OBJECT (msgstream));
- /*gtk_object_unref (GTK_OBJECT (f_stream));*/
-
+ camel_object_unref (CAMEL_OBJECT (msgstream));
+ /*camel_object_unref (CAMEL_OBJECT (f_stream));*/
+
d(fprintf (stderr, "*** We're returning... ***\n"));
return msg;
@@ -991,7 +982,7 @@ imap_get_message (CamelFolder *folder, const gchar *uid, CamelException *ex)
/* Temp hack - basically we read in the entire message instead of getting a part as it's needed */
msgstream = camel_stream_mem_new ();
camel_stream_write_to_stream (CAMEL_STREAM (imap_stream), msgstream);
- gtk_object_unref (GTK_OBJECT (imap_stream));
+ camel_object_unref (CAMEL_OBJECT (imap_stream));
f_stream = camel_stream_filter_new_with_stream (msgstream);
filter = camel_mime_filter_crlf_new (CAMEL_MIME_FILTER_CRLF_DECODE, CAMEL_MIME_FILTER_CRLF_MODE_CRLF_DOTS);
@@ -1005,13 +996,13 @@ imap_get_message (CamelFolder *folder, const gchar *uid, CamelException *ex)
camel_stream_filter_remove (f_stream, id);
camel_stream_close (CAMEL_STREAM (f_stream));
- gtk_object_unref (GTK_OBJECT (msgstream));
- gtk_object_unref (GTK_OBJECT (f_stream));
+ camel_object_unref (CAMEL_OBJECT (msgstream));
+ camel_object_unref (CAMEL_OBJECT (f_stream));
/*camel_data_wrapper_set_mime_type (cdw, "text/plain");*/
/*camel_medium_set_content_object (CAMEL_MEDIUM (msg), CAMEL_DATA_WRAPPER (cdw));*/
- /*gtk_object_unref (GTK_OBJECT (cdw));*/
+ /*camel_object_unref (CAMEL_OBJECT (cdw));*/
return msg;
#endif
@@ -1493,6 +1484,13 @@ imap_search_by_expression (CamelFolder *folder, const char *expression, CamelExc
}
static guint32
+imap_get_permanent_flags (CamelFolder *folder, CamelException *ex)
+{
+ /* return permamnant flags */
+ return folder->permanent_flags;
+}
+
+static guint32
imap_get_message_flags (CamelFolder *folder, const char *uid)
{
const CamelMessageInfo *info;
@@ -1513,7 +1511,8 @@ imap_set_message_flags (CamelFolder *folder, const char *uid, guint32 flags, gui
info->flags = (info->flags & ~flags) | (set & flags) | CAMEL_MESSAGE_FOLDER_FLAGGED;
- gtk_signal_emit_by_name (GTK_OBJECT (folder), "message_changed", uid);
+ /*gtk_signal_emit_by_name (GTK_OBJECT (folder), "message_changed", uid);*/
+ camel_object_trigger_event (CAMEL_OBJECT (folder), "message_changed", uid);
}
static gboolean
@@ -1525,7 +1524,8 @@ imap_get_message_user_flag (CamelFolder *folder, const char *uid, const char *na
static void
imap_set_message_user_flag (CamelFolder *folder, const char *uid, const char *name, gboolean value)
{
- gtk_signal_emit_by_name (GTK_OBJECT (folder), "message_changed", uid);
+ /*gtk_signal_emit_by_name (GTK_OBJECT (folder), "message_changed", uid);*/
+ camel_object_trigger_event (CAMEL_OBJECT (folder), "message_changed", uid);
}
void
@@ -1561,5 +1561,6 @@ camel_imap_folder_changed (CamelFolder *folder, gint recent, CamelException *ex)
}
}
- gtk_signal_emit_by_name (GTK_OBJECT (folder), "folder_changed", 0);
+ /*gtk_signal_emit_by_name (GTK_OBJECT (folder), "folder_changed", 0);*/
+ camel_object_trigger_event (CAMEL_OBJECT (folder), "folder_changed", GINT_TO_POINTER (0));
}
diff --git a/camel/providers/imap/camel-imap-folder.h b/camel/providers/imap/camel-imap-folder.h
index d87df24905..bd1647c300 100644
--- a/camel/providers/imap/camel-imap-folder.h
+++ b/camel/providers/imap/camel-imap-folder.h
@@ -33,14 +33,13 @@ extern "C" {
#pragma }
#endif /* __cplusplus }*/
-#include <gtk/gtk.h>
#include "camel-folder.h"
#include <camel/camel-folder-search.h>
#define CAMEL_IMAP_FOLDER_TYPE (camel_imap_folder_get_type ())
-#define CAMEL_IMAP_FOLDER(obj) (GTK_CHECK_CAST((obj), CAMEL_IMAP_FOLDER_TYPE, CamelImapFolder))
-#define CAMEL_IMAP_FOLDER_CLASS(k) (GTK_CHECK_CLASS_CAST ((k), CAMEL_IMAP_FOLDER_TYPE, CamelImapFolderClass))
-#define IS_CAMEL_IMAP_FOLDER(o) (GTK_CHECK_TYPE((o), CAMEL_IMAP_FOLDER_TYPE))
+#define CAMEL_IMAP_FOLDER(obj) (CAMEL_CHECK_CAST((obj), CAMEL_IMAP_FOLDER_TYPE, CamelImapFolder))
+#define CAMEL_IMAP_FOLDER_CLASS(k) (CAMEL_CHECK_CLASS_CAST ((k), CAMEL_IMAP_FOLDER_TYPE, CamelImapFolderClass))
+#define IS_CAMEL_IMAP_FOLDER(o) (CAMEL_CHECK_TYPE((o), CAMEL_IMAP_FOLDER_TYPE))
typedef struct {
CamelFolder parent_object;
@@ -68,8 +67,8 @@ CamelFolder *camel_imap_folder_new (CamelStore *parent, char *folder_name,
void camel_imap_folder_changed (CamelFolder *folder, gint recent, CamelException *ex);
-/* Standard Gtk function */
-GtkType camel_imap_folder_get_type (void);
+/* Standard Camel function */
+CamelType camel_imap_folder_get_type (void);
#ifdef __cplusplus
}
diff --git a/camel/providers/imap/camel-imap-store.c b/camel/providers/imap/camel-imap-store.c
index 2fc530f357..374107250d 100644
--- a/camel/providers/imap/camel-imap-store.c
+++ b/camel/providers/imap/camel-imap-store.c
@@ -56,7 +56,7 @@
static CamelServiceClass *service_class = NULL;
-static void finalize (GtkObject *object);
+static void finalize (CamelObject *object);
static gboolean imap_create (CamelFolder *folder, CamelException *ex);
static gboolean imap_connect (CamelService *service, CamelException *ex);
static gboolean imap_disconnect (CamelService *service, CamelException *ex);
@@ -74,18 +74,14 @@ static void
camel_imap_store_class_init (CamelImapStoreClass *camel_imap_store_class)
{
/* virtual method overload */
- GtkObjectClass *object_class =
- GTK_OBJECT_CLASS (camel_imap_store_class);
CamelServiceClass *camel_service_class =
CAMEL_SERVICE_CLASS (camel_imap_store_class);
CamelStoreClass *camel_store_class =
CAMEL_STORE_CLASS (camel_imap_store_class);
- service_class = gtk_type_class (camel_service_get_type ());
+ service_class = CAMEL_SERVICE_CLASS(camel_type_get_global_classfuncs (camel_service_get_type ()));
/* virtual method overload */
- object_class->finalize = finalize;
-
camel_service_class->connect = imap_connect;
camel_service_class->disconnect = imap_disconnect;
camel_service_class->query_auth_types = query_auth_types;
@@ -107,37 +103,31 @@ camel_imap_store_init (gpointer object, gpointer klass)
CAMEL_SERVICE_URL_ALLOW_PATH);
store->folders = g_hash_table_new (g_str_hash, g_str_equal);
- CAMEL_IMAP_STORE (store)->dir_sep = NULL;
+ CAMEL_IMAP_STORE (store)->dir_sep = g_strdup ("/"); /*default*/
CAMEL_IMAP_STORE (store)->current_folder = NULL;
CAMEL_IMAP_STORE (store)->timeout_id = 0;
}
-GtkType
+CamelType
camel_imap_store_get_type (void)
{
- static GtkType camel_imap_store_type = 0;
-
- if (!camel_imap_store_type) {
- GtkTypeInfo camel_imap_store_info =
- {
- "CamelImapStore",
- sizeof (CamelImapStore),
- sizeof (CamelImapStoreClass),
- (GtkClassInitFunc) camel_imap_store_class_init,
- (GtkObjectInitFunc) camel_imap_store_init,
- /* reserved_1 */ NULL,
- /* reserved_2 */ NULL,
- (GtkClassInitFunc) NULL,
- };
-
- camel_imap_store_type = gtk_type_unique (CAMEL_STORE_TYPE, &camel_imap_store_info);
+ static CamelType camel_imap_store_type = CAMEL_INVALID_TYPE;
+
+ if (camel_imap_store_type == CAMEL_INVALID_TYPE) {
+ camel_imap_store_type = camel_type_register (CAMEL_STORE_TYPE, "CamelImapStore",
+ sizeof (CamelImapStore),
+ sizeof (CamelImapStoreClass),
+ (CamelObjectClassInitFunc) camel_imap_store_class_init,
+ NULL,
+ (CamelObjectInitFunc) camel_imap_store_init,
+ (CamelObjectFinalizeFunc) finalize);
}
return camel_imap_store_type;
}
static void
-finalize (GtkObject *object)
+finalize (CamelObject *object)
{
CamelException ex;
@@ -239,11 +229,13 @@ imap_connect (CamelService *service, CamelException *ex)
gboolean authenticated = FALSE;
/* FIXME: do we really need this here? */
- if (store->timeout_id) {
- gtk_timeout_remove (store->timeout_id);
- store->timeout_id = 0;
- }
-
+ /*
+ *if (store->timeout_id) {
+ * gtk_timeout_remove (store->timeout_id);
+ * store->timeout_id = 0;
+ *}
+ */
+
h = camel_service_gethost (service, ex);
if (!h)
return FALSE;
@@ -399,7 +391,10 @@ imap_connect (CamelService *service, CamelException *ex)
g_free (result);
/* Lets add a timeout so that we can hopefully prevent getting disconnected */
- store->timeout_id = gtk_timeout_add (600000, imap_noop, store);
+ /* FIXME fast timeout */
+ store->timeout_id = camel_session_register_timeout (camel_service_get_session (service),
+ 10 * 60 * 1000, imap_noop, service);
+ /*store->timeout_id = gtk_timeout_add (600000, imap_noop, store);*/
return TRUE;
}
@@ -423,27 +418,28 @@ imap_disconnect (CamelService *service, CamelException *ex)
if (!service_class->disconnect (service, ex))
return FALSE;
-
+
if (store->istream) {
- gtk_object_unref (GTK_OBJECT (store->istream));
+ camel_object_unref (CAMEL_OBJECT (store->istream));
store->istream = NULL;
}
-
+
if (store->ostream) {
- gtk_object_unref (GTK_OBJECT (store->ostream));
+ camel_object_unref (CAMEL_OBJECT (store->ostream));
store->ostream = NULL;
}
-
+
g_free (store->dir_sep);
store->dir_sep = NULL;
-
+
store->current_folder = NULL;
-
+
if (store->timeout_id) {
- gtk_timeout_remove (store->timeout_id);
+ camel_session_remove_timeout (camel_service_get_session (CAMEL_SERVICE (store)),
+ store->timeout_id);
store->timeout_id = 0;
}
-
+
return TRUE;
}
@@ -466,6 +462,8 @@ imap_folder_exists (CamelFolder *folder)
dir_sep = CAMEL_IMAP_STORE (folder->parent_store)->dir_sep;
+ g_return_val_if_fail (dir_sep, FALSE);
+
if (url && url->path && *(url->path + 1) && strcmp (folder->full_name, "INBOX"))
folder_path = g_strdup_printf ("%s%s%s", url->path + 1, dir_sep, folder->full_name);
else
@@ -510,6 +508,8 @@ imap_create (CamelFolder *folder, CamelException *ex)
/* create the directory for the subfolder */
dir_sep = CAMEL_IMAP_STORE (folder->parent_store)->dir_sep;
+ g_return_val_if_fail (dir_sep, FALSE);
+
if (url && url->path && *(url->path + 1) && strcmp (folder->full_name, "INBOX"))
folder_path = g_strdup_printf ("%s%s%s", url->path + 1, dir_sep, folder->full_name);
else
@@ -581,7 +581,7 @@ get_folder (CamelStore *store, const char *folder_name, gboolean create, CamelEx
dir_sep = CAMEL_IMAP_STORE (store)->dir_sep;
/* if we're trying to get the top-level dir, we really want the namespace */
- if (!strcmp (folder_name, dir_sep))
+ if (!dir_sep || !strcmp (folder_name, dir_sep))
folder_path = g_strdup (url->path + 1);
else
folder_path = g_strdup (folder_name);
@@ -599,7 +599,7 @@ get_folder (CamelStore *store, const char *folder_name, gboolean create, CamelEx
return new_folder;
} else {
g_free (folder_path);
- gtk_object_unref (GTK_OBJECT (new_folder));
+ camel_object_unref (CAMEL_OBJECT (new_folder));
return NULL;
}
}
diff --git a/camel/providers/imap/camel-imap-store.h b/camel/providers/imap/camel-imap-store.h
index b8bb19f31c..a860fb84bd 100644
--- a/camel/providers/imap/camel-imap-store.h
+++ b/camel/providers/imap/camel-imap-store.h
@@ -32,13 +32,12 @@ extern "C" {
#pragma }
#endif /* __cplusplus }*/
-#include <gtk/gtk.h>
#include "camel-store.h"
#define CAMEL_IMAP_STORE_TYPE (camel_imap_store_get_type ())
-#define CAMEL_IMAP_STORE(obj) (GTK_CHECK_CAST((obj), CAMEL_IMAP_STORE_TYPE, CamelImapStore))
-#define CAMEL_IMAP_STORE_CLASS(k) (GTK_CHECK_CLASS_CAST ((k), CAMEL_IMAP_STORE_TYPE, CamelImapStoreClass))
-#define IS_CAMEL_IMAP_STORE(o) (GTK_CHECK_TYPE((o), CAMEL_IMAP_STORE_TYPE))
+#define CAMEL_IMAP_STORE(obj) (CAMEL_CHECK_CAST((obj), CAMEL_IMAP_STORE_TYPE, CamelImapStore))
+#define CAMEL_IMAP_STORE_CLASS(k) (CAMEL_CHECK_CLASS_CAST ((k), CAMEL_IMAP_STORE_TYPE, CamelImapStoreClass))
+#define IS_CAMEL_IMAP_STORE(o) (CAMEL_CHECK_TYPE((o), CAMEL_IMAP_STORE_TYPE))
typedef enum {
IMAP_LEVEL_UNKNOWN,
@@ -46,6 +45,7 @@ typedef enum {
IMAP_LEVEL_IMAP4REV1
} CamelImapServerLevel;
+
typedef struct {
CamelStore parent_object;
@@ -80,8 +80,8 @@ enum { CAMEL_IMAP_OK = 0, CAMEL_IMAP_NO, CAMEL_IMAP_BAD, CAMEL_IMAP_FAIL };
gint camel_imap_command (CamelImapStore *store, CamelFolder *folder, char **ret, char *fmt, ...);
gint camel_imap_command_extended (CamelImapStore *store, CamelFolder *folder, char **ret, char *fmt, ...);
-/* Standard Gtk function */
-GtkType camel_imap_store_get_type (void);
+/* Standard Camel function */
+CamelType camel_imap_store_get_type (void);
const gchar *camel_imap_store_get_toplevel_dir (CamelImapStore *store);
diff --git a/camel/providers/imap/camel-imap-stream.c b/camel/providers/imap/camel-imap-stream.c
index eb0a48a735..7b885437a2 100644
--- a/camel/providers/imap/camel-imap-stream.c
+++ b/camel/providers/imap/camel-imap-stream.c
@@ -30,30 +30,26 @@
static CamelStreamClass *parent_class = NULL;
/* Returns the class for a CamelImapStream */
-#define CIS_CLASS(so) CAMEL_IMAP_STREAM_CLASS (GTK_OBJECT(so)->klass)
+#define CIS_CLASS(so) CAMEL_IMAP_STREAM_CLASS (CAMEL_OBJECT_GET_CLASS(so))
static ssize_t stream_read (CamelStream *stream, char *buffer, size_t n);
static int stream_reset (CamelStream *stream);
static gboolean stream_eos (CamelStream *stream);
-static void finalize (GtkObject *object);
+static void finalize (CamelObject *object);
static void
camel_imap_stream_class_init (CamelImapStreamClass *camel_imap_stream_class)
{
CamelStreamClass *camel_stream_class =
CAMEL_STREAM_CLASS (camel_imap_stream_class);
- GtkObjectClass *gtk_object_class =
- GTK_OBJECT_CLASS (camel_imap_stream_class);
- parent_class = gtk_type_class (camel_stream_get_type ());
+ parent_class = CAMEL_STREAM_CLASS(camel_type_get_global_classfuncs (camel_stream_get_type ()));
/* virtual method overload */
camel_stream_class->read = stream_read;
camel_stream_class->reset = stream_reset;
camel_stream_class->eos = stream_eos;
-
- gtk_object_class->finalize = finalize;
}
static void
@@ -65,25 +61,19 @@ camel_imap_stream_init (gpointer object, gpointer klass)
imap_stream->cache_ptr = NULL;
}
-GtkType
+CamelType
camel_imap_stream_get_type (void)
{
- static GtkType camel_imap_stream_type = 0;
-
- if (!camel_imap_stream_type) {
- GtkTypeInfo camel_imap_stream_info =
- {
- "CamelImapStream",
- sizeof (CamelImapStream),
- sizeof (CamelImapStreamClass),
- (GtkClassInitFunc) camel_imap_stream_class_init,
- (GtkObjectInitFunc) camel_imap_stream_init,
- /* reserved_1 */ NULL,
- /* reserved_2 */ NULL,
- (GtkClassInitFunc) NULL,
- };
-
- camel_imap_stream_type = gtk_type_unique (camel_stream_get_type (), &camel_imap_stream_info);
+ static CamelType camel_imap_stream_type = CAMEL_INVALID_TYPE;
+
+ if (camel_imap_stream_type == CAMEL_INVALID_TYPE) {
+ camel_imap_stream_type = camel_type_register (camel_stream_get_type (), "CamelImapStream",
+ sizeof (CamelImapStream),
+ sizeof (CamelImapStreamClass),
+ (CamelObjectClassInitFunc) camel_imap_stream_class_init,
+ NULL,
+ (CamelObjectInitFunc) camel_imap_stream_init,
+ (CamelObjectFinalizeFunc) finalize);
}
return camel_imap_stream_type;
@@ -94,10 +84,10 @@ camel_imap_stream_new (CamelImapFolder *folder, char *command)
{
CamelImapStream *imap_stream;
- imap_stream = gtk_type_new (camel_imap_stream_get_type ());
+ imap_stream = CAMEL_IMAP_STREAM(camel_object_new (camel_imap_stream_get_type ()));
imap_stream->folder = folder;
- gtk_object_ref (GTK_OBJECT (imap_stream->folder));
+ camel_object_ref (CAMEL_OBJECT (imap_stream->folder));
imap_stream->command = g_strdup (command);
@@ -105,7 +95,7 @@ camel_imap_stream_new (CamelImapFolder *folder, char *command)
}
static void
-finalize (GtkObject *object)
+finalize (CamelObject *object)
{
CamelImapStream *imap_stream = CAMEL_IMAP_STREAM (object);
@@ -113,9 +103,7 @@ finalize (GtkObject *object)
g_free (imap_stream->command);
if (imap_stream->folder)
- gtk_object_unref (GTK_OBJECT (imap_stream->folder));
-
- GTK_OBJECT_CLASS (parent_class)->finalize (object);
+ camel_object_unref (CAMEL_OBJECT (imap_stream->folder));
}
static ssize_t
@@ -141,13 +129,13 @@ stream_read (CamelStream *stream, char *buffer, size_t n)
/* we got an error, dump this stuff */
g_free (result);
imap_stream->cache = NULL;
- gtk_object_unref (GTK_OBJECT (imap_stream->folder));
+ camel_object_unref (CAMEL_OBJECT (imap_stream->folder));
return -1;
}
/* we don't need the folder anymore... */
- gtk_object_unref (GTK_OBJECT (imap_stream->folder));
+ camel_object_unref (CAMEL_OBJECT (imap_stream->folder));
/* parse out the message part */
for (p = result; *p && *p != '{' && *p != '\n'; p++);
diff --git a/camel/providers/imap/camel-imap-stream.h b/camel/providers/imap/camel-imap-stream.h
index 2a6e2fc723..88881e7c1f 100644
--- a/camel/providers/imap/camel-imap-stream.h
+++ b/camel/providers/imap/camel-imap-stream.h
@@ -36,9 +36,9 @@ extern "C" {
#include <sys/types.h>
#define CAMEL_IMAP_STREAM_TYPE (camel_imap_stream_get_type ())
-#define CAMEL_IMAP_STREAM(obj) (GTK_CHECK_CAST((obj), CAMEL_IMAP_STREAM_TYPE, CamelImapStream))
-#define CAMEL_IMAP_STREAM_CLASS(k) (GTK_CHECK_CLASS_CAST ((k), CAMEL_IMAP_STREAM_TYPE, CamelImapStreamClass))
-#define CAMEL_IS_IMAP_STREAM(o) (GTK_CHECK_TYPE((o), CAMEL_IMAP_STREAM_TYPE))
+#define CAMEL_IMAP_STREAM(obj) (CAMEL_CHECK_CAST((obj), CAMEL_IMAP_STREAM_TYPE, CamelImapStream))
+#define CAMEL_IMAP_STREAM_CLASS(k) (CAMEL_CHECK_CLASS_CAST ((k), CAMEL_IMAP_STREAM_TYPE, CamelImapStreamClass))
+#define CAMEL_IS_IMAP_STREAM(o) (CAMEL_CHECK_TYPE((o), CAMEL_IMAP_STREAM_TYPE))
typedef struct _CamelImapStream CamelImapStream;
typedef struct _CamelImapStreamClass CamelImapStreamClass;
@@ -58,8 +58,8 @@ struct _CamelImapStreamClass {
/* Virtual methods */
};
-/* Standard Gtk function */
-GtkType camel_imap_stream_get_type (void);
+/* Standard Camel function */
+CamelType camel_imap_stream_get_type (void);
/* public methods */
CamelStream *camel_imap_stream_new (CamelImapFolder *folder, char *command);