diff options
author | Peter Williams <peterw@src.gnome.org> | 2000-08-11 01:30:50 +0800 |
---|---|---|
committer | Peter Williams <peterw@src.gnome.org> | 2000-08-11 01:30:50 +0800 |
commit | 8cb514d6dd9497893a35a089d07a132d51263ee7 (patch) | |
tree | 9f4e5d1f929da7e0be900919753d419fe4c9c61a /camel/providers/mh | |
parent | bcbb63c59f80eb4e684036c5ef58ab141fb01b03 (diff) | |
download | gsoc2013-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/mh')
-rw-r--r-- | camel/providers/mh/camel-mh-folder.c | 64 | ||||
-rw-r--r-- | camel/providers/mh/camel-mh-folder.h | 11 | ||||
-rw-r--r-- | camel/providers/mh/camel-mh-store.c | 44 | ||||
-rw-r--r-- | camel/providers/mh/camel-mh-store.h | 11 | ||||
-rw-r--r-- | camel/providers/mh/camel-mh-summary.c | 44 | ||||
-rw-r--r-- | camel/providers/mh/camel-mh-summary.h | 9 |
6 files changed, 77 insertions, 106 deletions
diff --git a/camel/providers/mh/camel-mh-folder.c b/camel/providers/mh/camel-mh-folder.c index b10c8b1a65..e20b3fabb5 100644 --- a/camel/providers/mh/camel-mh-folder.c +++ b/camel/providers/mh/camel-mh-folder.c @@ -49,9 +49,9 @@ static CamelFolderClass *parent_class = NULL; /* Returns the class for a CamelMhFolder */ -#define CMHF_CLASS(so) CAMEL_MH_FOLDER_CLASS (GTK_OBJECT(so)->klass) -#define CF_CLASS(so) CAMEL_FOLDER_CLASS (GTK_OBJECT(so)->klass) -#define CMHS_CLASS(so) CAMEL_STORE_CLASS (GTK_OBJECT(so)->klass) +#define CMHF_CLASS(so) CAMEL_MH_FOLDER_CLASS (CAMEL_OBJECT_GET_CLASS(so)) +#define CF_CLASS(so) CAMEL_FOLDER_CLASS (CAMEL_OBJECT_GET_CLASS(so)) +#define CMHS_CLASS(so) CAMEL_STORE_CLASS (CAMEL_OBJECT_GET_CLASS(so)) static void mh_init(CamelFolder * folder, CamelStore * parent_store, CamelFolder * parent_folder, const gchar * name, @@ -78,14 +78,13 @@ static void mh_set_message_flags(CamelFolder * folder, const char *uid, guint32 static gboolean mh_get_message_user_flag(CamelFolder * folder, const char *uid, const char *name); static void mh_set_message_user_flag(CamelFolder * folder, const char *uid, const char *name, gboolean value); -static void mh_finalize(GtkObject * object); +static void mh_finalize(CamelObject * object); -static void camel_mh_folder_class_init(CamelMhFolderClass * camel_mh_folder_class) +static void camel_mh_folder_class_init(CamelObjectClass * camel_mh_folder_class) { CamelFolderClass *camel_folder_class = CAMEL_FOLDER_CLASS(camel_mh_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 */ @@ -114,11 +113,9 @@ static void camel_mh_folder_class_init(CamelMhFolderClass * camel_mh_folder_clas camel_folder_class->set_message_flags = mh_set_message_flags; camel_folder_class->get_message_user_flag = mh_get_message_user_flag; camel_folder_class->set_message_user_flag = mh_set_message_user_flag; - - gtk_object_class->finalize = mh_finalize; } -static void mh_finalize(GtkObject * object) +static void mh_finalize(CamelObject * object) { CamelMhFolder *mh_folder = CAMEL_MH_FOLDER(object); @@ -126,27 +123,20 @@ static void mh_finalize(GtkObject * object) g_free(mh_folder->summary_file_path); g_free(mh_folder->folder_dir_path); g_free(mh_folder->index_file_path); - - GTK_OBJECT_CLASS(parent_class)->finalize(object); } -GtkType camel_mh_folder_get_type(void) +CamelType camel_mh_folder_get_type(void) { - static GtkType camel_mh_folder_type = 0; - - if (!camel_mh_folder_type) { - GtkTypeInfo camel_mh_folder_info = { - "CamelMhFolder", - sizeof(CamelMhFolder), - sizeof(CamelMhFolderClass), - (GtkClassInitFunc) camel_mh_folder_class_init, - (GtkObjectInitFunc) NULL, - /* reserved_1 */ NULL, - /* reserved_2 */ NULL, - (GtkClassInitFunc) NULL, - }; - - camel_mh_folder_type = gtk_type_unique(CAMEL_FOLDER_TYPE, &camel_mh_folder_info); + static CamelType camel_mh_folder_type = CAMEL_INVALID_TYPE; + + if (camel_mh_folder_type == CAMEL_INVALID_TYPE) { + camel_mh_folder_type = camel_type_register(CAMEL_FOLDER_TYPE, "CamelMhFolder", + sizeof(CamelMhFolder), + sizeof(CamelMhFolderClass), + (CamelObjectClassInitFunc) camel_mh_folder_class_init, + NULL, + (CamelObjectInitFunc) NULL, + (CamelObjectFinalizeFunc) mh_finalize); } return camel_mh_folder_type; @@ -238,7 +228,7 @@ static void mh_expunge(CamelFolder * folder, CamelException * ex) camel_mh_summary_sync(mh->summary, TRUE, ex); /* TODO: check it actually changed */ - gtk_signal_emit_by_name(GTK_OBJECT(folder), "folder_changed", 0); + camel_object_trigger_event(CAMEL_OBJECT(folder), "folder_changed", GINT_TO_POINTER (0)); } static gint mh_get_message_count(CamelFolder * folder) @@ -301,6 +291,7 @@ static void mh_append_message(CamelFolder * folder, CamelMimeMessage * message, /* index/summarise the message. Yes this re-reads it, its just simpler */ camel_mh_summary_add(mh_folder->summary, uid, TRUE); + if (info && (newinfo = camel_folder_summary_uid(CAMEL_FOLDER_SUMMARY(mh_folder->summary), uid))) { CamelFlag *flag = info->user_flags; @@ -316,7 +307,8 @@ static void mh_append_message(CamelFolder * folder, CamelMimeMessage * message, tag = tag->next; } } - gtk_signal_emit_by_name(GTK_OBJECT(folder), "folder_changed", 0); + + camel_object_trigger_event(CAMEL_OBJECT(folder), "folder_changed", GPOINTER_TO_INT (0)); g_free(name); g_free(uid); return; @@ -330,7 +322,7 @@ fail: "Cannot append message to mh file: %s", g_strerror(errno)); } if (output_stream) - gtk_object_unref(GTK_OBJECT(output_stream)); + camel_object_unref(CAMEL_OBJECT(output_stream)); if (name) { unlink(name); g_free(name); @@ -394,7 +386,7 @@ static CamelMimeMessage *mh_get_message(CamelFolder * folder, const gchar * uid, errno = EINVAL; goto fail; } - gtk_object_unref(GTK_OBJECT(message_stream)); + camel_object_unref(CAMEL_OBJECT(message_stream)); g_free(name); return message; @@ -404,10 +396,10 @@ fail: name, g_strerror(errno)); if (message_stream) - gtk_object_unref(GTK_OBJECT(message_stream)); + camel_object_unref(CAMEL_OBJECT(message_stream)); if (message) - gtk_object_unref(GTK_OBJECT(message)); + camel_object_unref(CAMEL_OBJECT(message)); g_free(name); @@ -478,7 +470,7 @@ static void mh_set_message_flags(CamelFolder * folder, const char *uid, guint32 info->flags = (info->flags & ~flags) | (set & flags) | CAMEL_MESSAGE_FOLDER_FLAGGED; camel_folder_summary_touch(CAMEL_FOLDER_SUMMARY(mf->summary)); - gtk_signal_emit_by_name(GTK_OBJECT(folder), "message_changed", uid); + camel_object_trigger_event (CAMEL_OBJECT(folder), "message_changed", uid); } static gboolean mh_get_message_user_flag(CamelFolder * folder, const char *uid, const char *name) @@ -503,5 +495,5 @@ static void mh_set_message_user_flag(CamelFolder * folder, const char *uid, cons camel_flag_set(&info->user_flags, name, value); info->flags |= CAMEL_MESSAGE_FOLDER_FLAGGED; camel_folder_summary_touch(CAMEL_FOLDER_SUMMARY(mf->summary)); - gtk_signal_emit_by_name(GTK_OBJECT(folder), "message_changed", uid); + camel_object_trigger_event (CAMEL_OBJECT(folder), "message_changed", uid); } diff --git a/camel/providers/mh/camel-mh-folder.h b/camel/providers/mh/camel-mh-folder.h index e014197442..37ff133c9e 100644 --- a/camel/providers/mh/camel-mh-folder.h +++ b/camel/providers/mh/camel-mh-folder.h @@ -31,16 +31,15 @@ extern "C" { #pragma } #endif /* __cplusplus } */ -#include <gtk/gtk.h> #include <camel/camel-folder.h> #include <camel/camel-folder-search.h> #include <libibex/ibex.h> #include "camel-mh-summary.h" #define CAMEL_MH_FOLDER_TYPE (camel_mh_folder_get_type ()) -#define CAMEL_MH_FOLDER(obj) (GTK_CHECK_CAST((obj), CAMEL_MH_FOLDER_TYPE, CamelMhFolder)) -#define CAMEL_MH_FOLDER_CLASS(k) (GTK_CHECK_CLASS_CAST ((k), CAMEL_MH_FOLDER_TYPE, CamelMhFolderClass)) -#define IS_CAMEL_MH_FOLDER(o) (GTK_CHECK_TYPE((o), CAMEL_MH_FOLDER_TYPE)) +#define CAMEL_MH_FOLDER(obj) (CAMEL_CHECK_CAST((obj), CAMEL_MH_FOLDER_TYPE, CamelMhFolder)) +#define CAMEL_MH_FOLDER_CLASS(k) (CAMEL_CHECK_CLASS_CAST ((k), CAMEL_MH_FOLDER_TYPE, CamelMhFolderClass)) +#define IS_CAMEL_MH_FOLDER(o) (CAMEL_CHECK_TYPE((o), CAMEL_MH_FOLDER_TYPE)) typedef struct { CamelFolder parent_object; @@ -64,8 +63,8 @@ typedef struct { /* public methods */ -/* Standard Gtk function */ -GtkType camel_mh_folder_get_type(void); +/* Standard Camel function */ +CamelType camel_mh_folder_get_type(void); #ifdef __cplusplus } diff --git a/camel/providers/mh/camel-mh-store.c b/camel/providers/mh/camel-mh-store.c index 42f3b474f6..c720cb1c91 100644 --- a/camel/providers/mh/camel-mh-store.c +++ b/camel/providers/mh/camel-mh-store.c @@ -36,9 +36,9 @@ #include "camel-url.h" /* Returns the class for a CamelMhStore */ -#define CMHS_CLASS(so) CAMEL_MH_STORE_CLASS (GTK_OBJECT(so)->klass) -#define CF_CLASS(so) CAMEL_FOLDER_CLASS (GTK_OBJECT(so)->klass) -#define CMHF_CLASS(so) CAMEL_MH_FOLDER_CLASS (GTK_OBJECT(so)->klass) +#define CMHS_CLASS(so) CAMEL_MH_STORE_CLASS (CAMEL_OBJECT_GET_CLASS(so)) +#define CF_CLASS(so) CAMEL_FOLDER_CLASS (CAMEL_OBJECT_GET_CLASS(so)) +#define CMHF_CLASS(so) CAMEL_MH_FOLDER_CLASS (CAMEL_OBJECT_GET_CLASS(so)) static char *get_name(CamelService * service, gboolean brief); static CamelFolder *get_folder(CamelStore * store, const char *folder_name, gboolean create, CamelException * ex); @@ -46,7 +46,7 @@ static void delete_folder(CamelStore * store, const char *folder_name, CamelExce static void rename_folder(CamelStore *store, const char *old_name, const char *new_name, CamelException *ex); static char *get_folder_name(CamelStore * store, const char *folder_name, CamelException * ex); -static void camel_mh_store_class_init(CamelMhStoreClass * camel_mh_store_class) +static void camel_mh_store_class_init(CamelObjectClass * camel_mh_store_class) { CamelStoreClass *camel_store_class = CAMEL_STORE_CLASS(camel_mh_store_class); CamelServiceClass *camel_service_class = CAMEL_SERVICE_CLASS(camel_mh_store_class); @@ -60,7 +60,7 @@ static void camel_mh_store_class_init(CamelMhStoreClass * camel_mh_store_class) camel_store_class->get_folder_name = get_folder_name; } -static void camel_mh_store_init(gpointer object, gpointer klass) +static void camel_mh_store_init(CamelObject * object) { CamelService *service = CAMEL_SERVICE(object); CamelStore *store = CAMEL_STORE(object); @@ -71,23 +71,18 @@ static void camel_mh_store_init(gpointer object, gpointer klass) store->folders = g_hash_table_new(g_str_hash, g_str_equal); } -GtkType camel_mh_store_get_type(void) +CamelType camel_mh_store_get_type(void) { - static GtkType camel_mh_store_type = 0; - - if (!camel_mh_store_type) { - GtkTypeInfo camel_mh_store_info = { - "CamelMhStore", - sizeof(CamelMhStore), - sizeof(CamelMhStoreClass), - (GtkClassInitFunc) camel_mh_store_class_init, - (GtkObjectInitFunc) camel_mh_store_init, - /* reserved_1 */ NULL, - /* reserved_2 */ NULL, - (GtkClassInitFunc) NULL, - }; - - camel_mh_store_type = gtk_type_unique(CAMEL_STORE_TYPE, &camel_mh_store_info); + static CamelType camel_mh_store_type = CAMEL_INVALID_TYPE; + + if (camel_mh_store_type == CAMEL_INVALID_TYPE) { + camel_mh_store_type = camel_type_register(CAMEL_STORE_TYPE, "CamelMhStore", + sizeof(CamelMhStore), + sizeof(CamelMhStoreClass), + (CamelObjectClassInitFunc) camel_mh_store_class_init, + NULL, + (CamelObjectInitFunc) camel_mh_store_init, + NULL); } return camel_mh_store_type; @@ -109,10 +104,9 @@ static CamelFolder *get_folder(CamelStore * store, const char *folder_name, gboo name = g_strdup_printf("%s%s", CAMEL_SERVICE(store)->url->path, folder_name); - printf("getting folder: %s\n", name); + printf("getting folder: %s\n", name); if (stat(name, &st) == -1) { - printf("doesn't exist ...\n"); - + printf("doesn't exist ...\n"); if (errno != ENOENT) { camel_exception_setv(ex, CAMEL_EXCEPTION_SYSTEM, "Could not open folder `%s':" "\n%s", folder_name, g_strerror(errno)); @@ -137,7 +131,7 @@ static CamelFolder *get_folder(CamelStore * store, const char *folder_name, gboo goto done; } - new_folder = gtk_type_new(CAMEL_MH_FOLDER_TYPE); + new_folder = CAMEL_FOLDER (camel_object_new(CAMEL_MH_FOLDER_TYPE)); CF_CLASS(new_folder)->init(new_folder, store, NULL, folder_name, "/", TRUE, ex); done: diff --git a/camel/providers/mh/camel-mh-store.h b/camel/providers/mh/camel-mh-store.h index 7040b27ffe..e2e2bbb656 100644 --- a/camel/providers/mh/camel-mh-store.h +++ b/camel/providers/mh/camel-mh-store.h @@ -30,12 +30,11 @@ extern "C" { #pragma } #endif /* __cplusplus } */ -#include <gtk/gtk.h> #include "camel-store.h" #define CAMEL_MH_STORE_TYPE (camel_mh_store_get_type ()) -#define CAMEL_MH_STORE(obj) (GTK_CHECK_CAST((obj), CAMEL_MH_STORE_TYPE, CamelMhStore)) -#define CAMEL_MH_STORE_CLASS(k) (GTK_CHECK_CLASS_CAST ((k), CAMEL_MH_STORE_TYPE, CamelMhStoreClass)) -#define IS_CAMEL_MH_STORE(o) (GTK_CHECK_TYPE((o), CAMEL_MH_STORE_TYPE)) +#define CAMEL_MH_STORE(obj) (CAMEL_CHECK_CAST((obj), CAMEL_MH_STORE_TYPE, CamelMhStore)) +#define CAMEL_MH_STORE_CLASS(k) (CAMEL_CHECK_CLASS_CAST ((k), CAMEL_MH_STORE_TYPE, CamelMhStoreClass)) +#define IS_CAMEL_MH_STORE(o) (CAMEL_CHECK_TYPE((o), CAMEL_MH_STORE_TYPE)) typedef struct { CamelStore parent_object; @@ -49,8 +48,8 @@ typedef struct { /* public methods */ -/* Standard Gtk function */ -GtkType camel_mh_store_get_type(void); +/* Standard Camel function */ +CamelType camel_mh_store_get_type(void); const gchar *camel_mh_store_get_toplevel_dir(CamelMhStore * store); diff --git a/camel/providers/mh/camel-mh-summary.c b/camel/providers/mh/camel-mh-summary.c index 36bfd2f2cf..dff025b258 100644 --- a/camel/providers/mh/camel-mh-summary.c +++ b/camel/providers/mh/camel-mh-summary.c @@ -18,8 +18,6 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include <gtk/gtk.h> - #include "camel-mh-summary.h" #include <camel/camel-mime-message.h> @@ -43,7 +41,7 @@ static CamelMessageInfo *message_info_new(CamelFolderSummary *, struct _header_r static void camel_mh_summary_class_init (CamelMhSummaryClass *class); static void camel_mh_summary_init (CamelMhSummary *gspaper); -static void camel_mh_summary_finalise (GtkObject *obj); +static void camel_mh_summary_finalise (CamelObject *obj); #define _PRIVATE(x) (((CamelMhSummary *)(x))->priv) @@ -53,23 +51,19 @@ struct _CamelMhSummaryPrivate { static CamelFolderSummaryClass *parent_class; -guint +CamelType camel_mh_summary_get_type (void) { - static guint type = 0; + static CamelType type = CAMEL_INVALID_TYPE; - if (!type) { - GtkTypeInfo type_info = { - "CamelMhSummary", - sizeof(CamelMhSummary), - sizeof(CamelMhSummaryClass), - (GtkClassInitFunc)camel_mh_summary_class_init, - (GtkObjectInitFunc)camel_mh_summary_init, - (GtkArgSetFunc)NULL, - (GtkArgGetFunc)NULL - }; - - type = gtk_type_unique(camel_folder_summary_get_type (), &type_info); + if (type == CAMEL_INVALID_TYPE) { + type = camel_type_register(camel_folder_summary_get_type (), "CamelMhSummary", + sizeof(CamelMhSummary), + sizeof(CamelMhSummaryClass), + (CamelObjectClassInitFunc)camel_mh_summary_class_init, + NULL, + (CamelObjectInitFunc)camel_mh_summary_init, + (CamelObjectFinalizeFunc)camel_mh_summary_finalise); } return type; @@ -78,17 +72,12 @@ camel_mh_summary_get_type (void) static void camel_mh_summary_class_init (CamelMhSummaryClass *class) { - GtkObjectClass *object_class; CamelFolderSummaryClass *sklass = (CamelFolderSummaryClass *) class; - object_class = (GtkObjectClass *)class; - parent_class = gtk_type_class(camel_folder_summary_get_type ()); - - object_class->finalize = camel_mh_summary_finalise; + parent_class = CAMEL_FOLDER_SUMMARY_CLASS (camel_type_get_global_classfuncs(camel_folder_summary_get_type ())); /* override methods */ sklass->message_info_new = message_info_new; - } static void @@ -103,13 +92,12 @@ camel_mh_summary_init (CamelMhSummary *o) } static void -camel_mh_summary_finalise(GtkObject *obj) +camel_mh_summary_finalise(CamelObject *obj) { CamelMhSummary *o = (CamelMhSummary *)obj; g_free(o->mh_path); - - ((GtkObjectClass *)(parent_class))->finalize(obj); + g_free(o->priv); } /** @@ -121,7 +109,7 @@ camel_mh_summary_finalise(GtkObject *obj) **/ CamelMhSummary *camel_mh_summary_new (const char *filename, const char *mhdir, ibex *index) { - CamelMhSummary *o = (CamelMhSummary *)gtk_type_new(camel_mh_summary_get_type ()); + CamelMhSummary *o = (CamelMhSummary *)camel_object_new(camel_mh_summary_get_type ()); camel_folder_summary_set_build_content((CamelFolderSummary *)o, TRUE); camel_folder_summary_set_filename((CamelFolderSummary *)o, filename); @@ -181,7 +169,7 @@ int camel_mh_summary_add(CamelMhSummary * mhs, const char *name, int forceindex } mhs->priv->current_uid = (char *)name; camel_folder_summary_add_from_parser((CamelFolderSummary *)mhs, mp); - gtk_object_unref((GtkObject *)mp); + camel_object_unref((CamelObject *)mp); mhs->priv->current_uid = NULL; camel_folder_summary_set_index((CamelFolderSummary *)mhs, NULL); g_free(filename); diff --git a/camel/providers/mh/camel-mh-summary.h b/camel/providers/mh/camel-mh-summary.h index b7c8867959..28376c5d9b 100644 --- a/camel/providers/mh/camel-mh-summary.h +++ b/camel/providers/mh/camel-mh-summary.h @@ -21,14 +21,13 @@ #ifndef _CAMEL_MH_SUMMARY_H #define _CAMEL_MH_SUMMARY_H -#include <gtk/gtk.h> #include <camel/camel-folder-summary.h> #include <camel/camel-exception.h> #include <libibex/ibex.h> -#define CAMEL_MH_SUMMARY(obj) GTK_CHECK_CAST (obj, camel_mh_summary_get_type (), CamelMhSummary) -#define CAMEL_MH_SUMMARY_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, camel_mh_summary_get_type (), CamelMhSummaryClass) -#define IS_CAMEL_MH_SUMMARY(obj) GTK_CHECK_TYPE (obj, camel_mh_summary_get_type ()) +#define CAMEL_MH_SUMMARY(obj) CAMEL_CHECK_CAST (obj, camel_mh_summary_get_type (), CamelMhSummary) +#define CAMEL_MH_SUMMARY_CLASS(klass) CAMEL_CHECK_CLASS_CAST (klass, camel_mh_summary_get_type (), CamelMhSummaryClass) +#define IS_CAMEL_MH_SUMMARY(obj) CAMEL_CHECK_TYPE (obj, camel_mh_summary_get_type ()) typedef struct _CamelMhSummary CamelMhSummary; typedef struct _CamelMhSummaryClass CamelMhSummaryClass; @@ -49,7 +48,7 @@ struct _CamelMhSummaryClass { /* signals */ }; -guint camel_mh_summary_get_type (void); +CamelType camel_mh_summary_get_type (void); CamelMhSummary *camel_mh_summary_new (const char *filename, const char *mhdir, ibex *index); /* methods */ |