aboutsummaryrefslogtreecommitdiffstats
path: root/camel/providers
diff options
context:
space:
mode:
Diffstat (limited to 'camel/providers')
-rw-r--r--camel/providers/cache/camel-cache-folder.c90
-rw-r--r--camel/providers/cache/camel-cache-folder.h10
-rw-r--r--camel/providers/cache/camel-cache-provider.c3
-rw-r--r--camel/providers/cache/camel-cache-store.c46
-rw-r--r--camel/providers/cache/camel-cache-store.h10
5 files changed, 69 insertions, 90 deletions
diff --git a/camel/providers/cache/camel-cache-folder.c b/camel/providers/cache/camel-cache-folder.c
index 0d24fb58bb..0e91e02a8b 100644
--- a/camel/providers/cache/camel-cache-folder.c
+++ b/camel/providers/cache/camel-cache-folder.c
@@ -67,8 +67,7 @@
#include <camel/camel-exception.h>
#include <camel/camel-medium.h>
-static CamelFolderClass *parent_class;
-#define CF_CLASS(so) CAMEL_FOLDER_CLASS (GTK_OBJECT(so)->klass)
+#define CF_CLASS(so) CAMEL_FOLDER_CLASS (CAMEL_OBJECT_GET_CLASS(so))
static void init (CamelFolder *folder, CamelStore *parent_store,
CamelFolder *parent_folder, const gchar *name,
@@ -83,7 +82,7 @@ static void expunge (CamelFolder *folder, CamelException *ex);
static gint get_message_count (CamelFolder *folder);
static void append_message (CamelFolder *folder, CamelMimeMessage *message,
- guint32 flags, CamelException *ex);
+ const CamelMessageInfo *info, CamelException *ex);
static guint32 get_message_flags (CamelFolder *folder, const char *uid);
static void set_message_flags (CamelFolder *folder, const char *uid,
@@ -109,17 +108,13 @@ static GPtrArray *search_by_expression (CamelFolder *folder,
static const CamelMessageInfo *get_message_info (CamelFolder *folder,
const char *uid);
-static void finalize (GtkObject *object);
+static void finalize (CamelObject *object);
static void
camel_cache_folder_class_init (CamelCacheFolderClass *camel_cache_folder_class)
{
CamelFolderClass *camel_folder_class =
CAMEL_FOLDER_CLASS (camel_cache_folder_class);
- GtkObjectClass *gtk_object_class =
- GTK_OBJECT_CLASS (camel_cache_folder_class);
-
- parent_class = gtk_type_class (camel_folder_get_type ());
/* virtual method overload */
camel_folder_class->init = init;
@@ -140,29 +135,22 @@ camel_cache_folder_class_init (CamelCacheFolderClass *camel_cache_folder_class)
camel_folder_class->free_subfolder_names = free_subfolder_names;
camel_folder_class->search_by_expression = search_by_expression;
camel_folder_class->get_message_info = get_message_info;
-
- gtk_object_class->finalize = finalize;
}
-GtkType
+CamelType
camel_cache_folder_get_type (void)
{
- static GtkType camel_cache_folder_type = 0;
+ static CamelType camel_cache_folder_type = CAMEL_INVALID_TYPE;
- if (!camel_cache_folder_type) {
- GtkTypeInfo camel_cache_folder_info =
- {
- "CamelCacheFolder",
+ if (camel_cache_folder_type == CAMEL_INVALID_TYPE) {
+ camel_cache_folder_type = camel_type_register (
+ CAMEL_FOLDER_TYPE, "CamelCacheFolder",
sizeof (CamelCacheFolder),
sizeof (CamelCacheFolderClass),
- (GtkClassInitFunc) camel_cache_folder_class_init,
- (GtkObjectInitFunc) NULL,
- /* reserved_1 */ NULL,
- /* reserved_2 */ NULL,
- (GtkClassInitFunc) NULL,
- };
-
- camel_cache_folder_type = gtk_type_unique (CAMEL_FOLDER_TYPE, &camel_cache_folder_info);
+ (CamelObjectClassInitFunc) camel_cache_folder_class_init,
+ NULL,
+ NULL,
+ (CamelObjectFinalizeFunc) finalize);
}
return camel_cache_folder_type;
@@ -188,7 +176,7 @@ cache_free_summary (CamelCacheFolder *cache_folder)
}
static void
-finalize (GtkObject *object)
+finalize (CamelObject *object)
{
CamelCacheFolder *cache_folder = CAMEL_CACHE_FOLDER (object);
@@ -202,12 +190,10 @@ finalize (GtkObject *object)
if (cache_folder->uidmap)
camel_cache_map_destroy (cache_folder->uidmap);
- gtk_object_unref (GTK_OBJECT (cache_folder->local));
- gtk_object_unref (GTK_OBJECT (cache_folder->remote));
+ camel_object_unref (CAMEL_OBJECT (cache_folder->local));
+ camel_object_unref (CAMEL_OBJECT (cache_folder->remote));
g_free (cache_folder->mapfile);
-
- GTK_OBJECT_CLASS (parent_class)->finalize (object);
}
@@ -318,21 +304,23 @@ init (CamelFolder *folder, CamelStore *parent_store,
* update the summary, and propagate the signal.
*/
static void
-remote_folder_changed (CamelFolder *remote_folder, int type, gpointer data)
+remote_folder_changed (CamelObject *remote_folder, gpointer type,
+ gpointer user_data)
{
- CamelCacheFolder *cache_folder = data;
+ CamelCacheFolder *cache_folder = user_data;
update (cache_folder, NULL);
- gtk_signal_emit_by_name (GTK_OBJECT (cache_folder), "folder_changed",
- type);
+ camel_object_trigger_event (CAMEL_OBJECT (cache_folder),
+ "folder_changed", type);
}
/* If the local folder changes, it's because we just cached a message
* or expunged messages. Look for new messages and update the UID maps.
*/
static void
-local_folder_changed (CamelFolder *local_folder, int type, gpointer data)
+local_folder_changed (CamelObject *local, gpointer type, gpointer data)
{
+ CamelFolder *local_folder = CAMEL_FOLDER (local);
CamelCacheFolder *cache_folder = data;
CamelMimeMessage *msg;
GPtrArray *new_luids;
@@ -407,7 +395,7 @@ get_message_count (CamelFolder *folder)
/* DONE */
static void
append_message (CamelFolder *folder, CamelMimeMessage *message,
- guint32 flags, CamelException *ex)
+ const CamelMessageInfo *info, CamelException *ex)
{
CamelCacheFolder *cache_folder = (CamelCacheFolder *)folder;
@@ -415,7 +403,7 @@ append_message (CamelFolder *folder, CamelMimeMessage *message,
* 100% reliable way to determine the UID assigned to the
* remote message, so we can't.
*/
- camel_folder_append_message (cache_folder->remote, message, flags, ex);
+ camel_folder_append_message (cache_folder->remote, message, info, ex);
}
/* DONE */
@@ -480,7 +468,7 @@ get_message (CamelFolder *folder, const gchar *uid, CamelException *ex)
{
CamelCacheFolder *cache_folder = (CamelCacheFolder *)folder;
CamelMimeMessage *msg;
- guint32 flags;
+ const CamelMessageInfo *info;
const char *luid;
/* Check if we have it cached first. */
@@ -499,7 +487,7 @@ get_message (CamelFolder *folder, const gchar *uid, CamelException *ex)
msg = camel_folder_get_message (cache_folder->remote, uid, ex);
if (!msg)
return NULL;
- flags = camel_folder_get_message_flags (cache_folder->remote, uid);
+ info = camel_folder_get_message_info (cache_folder->remote, uid);
/* Add a header giving the remote UID and append it to the
* local folder. (This should eventually invoke
@@ -508,7 +496,7 @@ get_message (CamelFolder *folder, const gchar *uid, CamelException *ex)
*/
camel_medium_add_header (CAMEL_MEDIUM (msg), "X-Evolution-Remote-UID",
uid);
- camel_folder_append_message (cache_folder->local, msg, flags, NULL);
+ camel_folder_append_message (cache_folder->local, msg, info, NULL);
return msg;
}
@@ -608,20 +596,18 @@ camel_cache_folder_new (CamelStore *store, CamelFolder *parent,
CamelCacheFolder *cache_folder;
CamelFolder *folder;
- cache_folder = gtk_type_new (CAMEL_CACHE_FOLDER_TYPE);
+ cache_folder = CAMEL_CACHE_FOLDER (camel_object_new (CAMEL_CACHE_FOLDER_TYPE));
folder = (CamelFolder *)cache_folder;
cache_folder->local = local;
- gtk_object_ref (GTK_OBJECT (local));
- gtk_signal_connect (GTK_OBJECT (local), "folder_changed",
- GTK_SIGNAL_FUNC (local_folder_changed),
- cache_folder);
+ camel_object_ref (CAMEL_OBJECT (local));
+ camel_object_hook_event (CAMEL_OBJECT (local), "folder_changed",
+ local_folder_changed, cache_folder);
cache_folder->remote = remote;
- gtk_object_ref (GTK_OBJECT (remote));
- gtk_signal_connect (GTK_OBJECT (remote), "folder_changed",
- GTK_SIGNAL_FUNC (remote_folder_changed),
- cache_folder);
+ camel_object_ref (CAMEL_OBJECT (remote));
+ camel_object_hook_event (CAMEL_OBJECT (remote), "folder_changed",
+ remote_folder_changed, cache_folder);
/* XXX */
@@ -634,7 +620,7 @@ camel_cache_folder_sync (CamelCacheFolder *cache_folder, CamelException *ex)
CamelMimeMessage *msg;
const char *ruid, *luid;
int lsize, i;
- guint32 flags;
+ const CamelMessageInfo *info;
lsize = camel_folder_get_message_count (cache_folder->local);
@@ -652,13 +638,13 @@ camel_cache_folder_sync (CamelCacheFolder *cache_folder, CamelException *ex)
ruid, ex);
if (camel_exception_is_set (ex))
return;
- flags = camel_folder_get_message_flags (cache_folder->remote,
- ruid);
+ info = camel_folder_get_message_info (cache_folder->remote,
+ ruid);
camel_medium_add_header (CAMEL_MEDIUM (msg),
"X-Evolution-Remote-UID", ruid);
camel_folder_append_message (cache_folder->local, msg,
- flags, ex);
+ info, ex);
if (camel_exception_is_set (ex))
return;
}
diff --git a/camel/providers/cache/camel-cache-folder.h b/camel/providers/cache/camel-cache-folder.h
index 4f30c701b2..c4eadd56b7 100644
--- a/camel/providers/cache/camel-cache-folder.h
+++ b/camel/providers/cache/camel-cache-folder.h
@@ -35,9 +35,9 @@ extern "C" {
#include "camel-cache-map.h"
#define CAMEL_CACHE_FOLDER_TYPE (camel_cache_folder_get_type ())
-#define CAMEL_CACHE_FOLDER(obj) (GTK_CHECK_CAST((obj), CAMEL_CACHE_FOLDER_TYPE, CamelCacheFolder))
-#define CAMEL_CACHE_FOLDER_CLASS(k) (GTK_CHECK_CLASS_CAST ((k), CAMEL_CACHE_FOLDER_TYPE, CamelCacheFolderClass))
-#define IS_CAMEL_CACHE_FOLDER(o) (GTK_CHECK_TYPE((o), CAMEL_CACHE_FOLDER_TYPE))
+#define CAMEL_CACHE_FOLDER(obj) (CAMEL_CHECK_CAST((obj), CAMEL_CACHE_FOLDER_TYPE, CamelCacheFolder))
+#define CAMEL_CACHE_FOLDER_CLASS(k) (CAMEL_CHECK_CLASS_CAST ((k), CAMEL_CACHE_FOLDER_TYPE, CamelCacheFolderClass))
+#define IS_CAMEL_CACHE_FOLDER(o) (CAMEL_CHECK_TYPE((o), CAMEL_CACHE_FOLDER_TYPE))
typedef struct {
@@ -77,8 +77,8 @@ CamelFolder *camel_cache_folder_new (CamelStore *store, CamelFolder *parent,
void camel_cache_folder_sync (CamelCacheFolder *cache_folder,
CamelException *ex);
-/* Standard Gtk function */
-GtkType camel_cache_folder_get_type (void);
+/* Standard Camel function */
+CamelType camel_cache_folder_get_type (void);
#ifdef __cplusplus
}
diff --git a/camel/providers/cache/camel-cache-provider.c b/camel/providers/cache/camel-cache-provider.c
index 2d17a62df4..94d38a2243 100644
--- a/camel/providers/cache/camel-cache-provider.c
+++ b/camel/providers/cache/camel-cache-provider.c
@@ -32,12 +32,13 @@ static CamelProvider cache_provider = {
"cache",
"Cache",
- "For caching remote mail into a local store."
+ "For caching remote mail into a local store.",
"cache",
0,
+ { 0, 0 },
{ 0, 0 }
};
diff --git a/camel/providers/cache/camel-cache-store.c b/camel/providers/cache/camel-cache-store.c
index ce34a0e716..b779b4ca55 100644
--- a/camel/providers/cache/camel-cache-store.c
+++ b/camel/providers/cache/camel-cache-store.c
@@ -46,15 +46,15 @@
static CamelServiceClass *service_class = NULL;
-static void finalize (GtkObject *object);
+static void finalize (CamelObject *object);
static gboolean cache_connect (CamelService *service, CamelException *ex);
static gboolean cache_disconnect (CamelService *service, CamelException *ex);
static CamelFolder *get_folder (CamelStore *store, const char *folder_name,
gboolean create, CamelException *ex);
-static CamelFolder *delete_folder (CamelStore *store, const char *folder_name,
- CamelException *ex);
+static void delete_folder (CamelStore *store, const char *folder_name,
+ CamelException *ex);
static char *get_folder_name (CamelStore *store, const char *folder_name,
CamelException *ex);
static char *get_root_folder_name (CamelStore *store, CamelException *ex);
@@ -64,18 +64,14 @@ static char *get_default_folder_name (CamelStore *store, CamelException *ex);
static void
camel_cache_store_class_init (CamelCacheStoreClass *camel_cache_store_class)
{
- GtkObjectClass *object_class =
- GTK_OBJECT_CLASS (camel_cache_store_class);
CamelServiceClass *camel_service_class =
CAMEL_SERVICE_CLASS (camel_cache_store_class);
CamelStoreClass *camel_store_class =
CAMEL_STORE_CLASS (camel_cache_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 = cache_connect;
camel_service_class->disconnect = cache_disconnect;
@@ -90,44 +86,38 @@ camel_cache_store_class_init (CamelCacheStoreClass *camel_cache_store_class)
static void
camel_cache_store_init (gpointer object, gpointer klass)
{
- CamelCacheStore *cache_store = CAMEL_CACHE_STORE (object);
CamelService *service = CAMEL_SERVICE (object);
service->url_flags = CAMEL_SERVICE_URL_NEED_PATH;
}
-GtkType
+CamelType
camel_cache_store_get_type (void)
{
- static GtkType camel_cache_store_type = 0;
+ static CamelType camel_cache_store_type = CAMEL_INVALID_TYPE;
- if (!camel_cache_store_type) {
- GtkTypeInfo camel_cache_store_info =
- {
- "CamelCacheStore",
+ if (camel_cache_store_type == CAMEL_INVALID_TYPE) {
+ camel_cache_store_type = camel_type_register (
+ CAMEL_STORE_TYPE, "CamelCacheStore",
sizeof (CamelCacheStore),
sizeof (CamelCacheStoreClass),
- (GtkClassInitFunc) camel_cache_store_class_init,
- (GtkObjectInitFunc) camel_cache_store_init,
- /* reserved_1 */ NULL,
- /* reserved_2 */ NULL,
- (GtkClassInitFunc) NULL,
- };
-
- camel_cache_store_type = gtk_type_unique (CAMEL_STORE_TYPE, &camel_cache_store_info);
+ (CamelObjectClassInitFunc) camel_cache_store_class_init,
+ NULL,
+ (CamelObjectInitFunc) camel_cache_store_init,
+ (CamelObjectFinalizeFunc) finalize);
}
return camel_cache_store_type;
}
static void
-finalize (GtkObject *object)
+finalize (CamelObject *object)
{
CamelCacheStore *cache_store = CAMEL_CACHE_STORE (object);
- gtk_object_unref (GTK_OBJECT (cache_store->local));
- gtk_object_unref (GTK_OBJECT (cache_store->remote));
+ camel_object_unref (CAMEL_OBJECT (cache_store->local));
+ camel_object_unref (CAMEL_OBJECT (cache_store->remote));
}
@@ -152,7 +142,8 @@ cache_connect (CamelService *service, CamelException *ex)
if (!camel_service_connect (CAMEL_SERVICE (cache_store->remote), ex))
return FALSE;
if (!camel_service_connect (CAMEL_SERVICE (cache_store->local), ex)) {
- camel_service_disconnect (CAMEL_SERVICE (store->remote), NULL);
+ camel_service_disconnect (CAMEL_SERVICE (cache_store->remote),
+ NULL);
return FALSE;
}
@@ -186,6 +177,7 @@ get_folder (CamelStore *store, const char *folder_name,
lf = camel_store_get_folder (cache_store->local, folder_name,
TRUE, ex);
if (!lf) {
+ camel_object_unref (CAMEL_OBJECT (rf));
camel_exception_setv (ex, camel_exception_get_id (ex),
"Could not create cache folder:\n%s",
camel_exception_get_description (ex));
diff --git a/camel/providers/cache/camel-cache-store.h b/camel/providers/cache/camel-cache-store.h
index d85f759640..f02c987c47 100644
--- a/camel/providers/cache/camel-cache-store.h
+++ b/camel/providers/cache/camel-cache-store.h
@@ -34,9 +34,9 @@ extern "C" {
#include <camel/camel-store.h>
#define CAMEL_CACHE_STORE_TYPE (camel_cache_store_get_type ())
-#define CAMEL_CACHE_STORE(obj) (GTK_CHECK_CAST((obj), CAMEL_CACHE_STORE_TYPE, CamelCacheStore))
-#define CAMEL_CACHE_STORE_CLASS(k) (GTK_CHECK_CLASS_CAST ((k), CAMEL_CACHE_STORE_TYPE, CamelCacheStoreClass))
-#define IS_CAMEL_CACHE_STORE(o) (GTK_CHECK_TYPE((o), CAMEL_CACHE_STORE_TYPE))
+#define CAMEL_CACHE_STORE(obj) (CAMEL_CHECK_CAST((obj), CAMEL_CACHE_STORE_TYPE, CamelCacheStore))
+#define CAMEL_CACHE_STORE_CLASS(k) (CAMEL_CHECK_CLASS_CAST ((k), CAMEL_CACHE_STORE_TYPE, CamelCacheStoreClass))
+#define IS_CAMEL_CACHE_STORE(o) (CAMEL_CHECK_TYPE((o), CAMEL_CACHE_STORE_TYPE))
typedef struct {
CamelStore parent_object;
@@ -55,8 +55,8 @@ typedef struct {
/* support functions */
void camel_cache_store_sync (CamelCacheStore *store);
-/* Standard Gtk function */
-GtkType camel_cache_store_get_type (void);
+/* Standard Camel function */
+CamelType camel_cache_store_get_type (void);
#ifdef __cplusplus
}