diff options
-rw-r--r-- | camel/camel-folder-pt-proxy.c | 130 | ||||
-rw-r--r-- | camel/camel-folder.c | 28 | ||||
-rw-r--r-- | camel/camel-folder.h | 62 |
3 files changed, 121 insertions, 99 deletions
diff --git a/camel/camel-folder-pt-proxy.c b/camel/camel-folder-pt-proxy.c index b9a143abb2..83f7af3b93 100644 --- a/camel/camel-folder-pt-proxy.c +++ b/camel/camel-folder-pt-proxy.c @@ -56,20 +56,24 @@ static CamelFuncDef _camel_func_def [CAMEL_FOLDER__LAST_FUNC]; static void _init_with_store (CamelFolder *folder, CamelStore *parent_store, CamelException *ex); +static void _open_async (CamelFolder *folder, + CamelFolderOpenMode mode, + CamelFolderAsyncCallback callback, + gpointer user_data, + CamelException *ex); +static void _close_async (CamelFolder *folder, + gboolean expunge, + CamelFolderAsyncCallback callback, + gpointer user_data, + CamelException *ex); static void _open (CamelFolder *folder, CamelFolderOpenMode mode, - CamelFolderAsyncCallback callback, - gpointer user_data, CamelException *ex); static void _close (CamelFolder *folder, gboolean expunge, - CamelFolderAsyncCallback callback, - gpointer user_data, CamelException *ex); static void _set_name (CamelFolder *folder, const gchar *name, - CamelFolderAsyncCallback callback, - gpointer user_data, CamelException *ex); static const gchar *_get_name (CamelFolder *folder, CamelException *ex); @@ -78,7 +82,7 @@ static gboolean _can_hold_folders (CamelFolder *folder, CamelException *ex); static gboolean _can_hold_messages(CamelFolder *folder, CamelException *ex); static gboolean _exists (CamelFolder *folder, CamelException *ex); static gboolean _is_open (CamelFolder *folder, CamelException *ex); -static CamelFolder *_get_folder (CamelFolder *folder, const gchar *folder_name, CamelException *ex); +static CamelFolder *_get_subfolder (CamelFolder *folder, const gchar *folder_name, CamelException *ex); static gboolean _create (CamelFolder *folder, CamelException *ex); static gboolean _delete (CamelFolder *folder, gboolean recurse, CamelException *ex); static gboolean _delete_messages (CamelFolder *folder, CamelException *ex); @@ -87,7 +91,7 @@ static CamelStore *_get_parent_store (CamelFolder *folder, CamelException *ex); static CamelFolderOpenMode _get_mode (CamelFolder *folder, CamelException *ex); static GList *_list_subfolders (CamelFolder *folder, CamelException *ex); static void _expunge (CamelFolder *folder, CamelException *ex); -static CamelMimeMessage *_get_message (CamelFolder *folder, gint number, CamelException *ex); +static CamelMimeMessage *_get_message_by_number (CamelFolder *folder, gint number, CamelException *ex); static gint _get_message_count (CamelFolder *folder, CamelException *ex); static gint _append_message (CamelFolder *folder, CamelMimeMessage *message, CamelException *ex); static const GList *_list_permanent_flags (CamelFolder *folder, CamelException *ex); @@ -113,13 +117,15 @@ camel_folder_pt_proxy_class_init (CamelFolderPtProxyClass *camel_folder_pt_proxy camel_folder_class->init_with_store = _init_with_store; camel_folder_class->open = _open; camel_folder_class->close = _close; + camel_folder_class->open_async = _open_async; + camel_folder_class->close_async = _close_async; camel_folder_class->set_name = _set_name; camel_folder_class->get_name = _get_name; camel_folder_class->can_hold_folders = _can_hold_folders; camel_folder_class->can_hold_messages = _can_hold_messages; camel_folder_class->exists = _exists; camel_folder_class->is_open = _is_open; - camel_folder_class->get_folder = _get_folder; + camel_folder_class->get_subfolder = _get_subfolder; camel_folder_class->create = _create; camel_folder_class->delete = _delete; camel_folder_class->delete_messages = _delete_messages; @@ -128,7 +134,7 @@ camel_folder_pt_proxy_class_init (CamelFolderPtProxyClass *camel_folder_pt_proxy camel_folder_class->get_mode = _get_mode; camel_folder_class->list_subfolders = _list_subfolders; camel_folder_class->expunge = _expunge; - camel_folder_class->get_message = _get_message; + camel_folder_class->get_message_by_number = _get_message_by_number; camel_folder_class->get_message_count = _get_message_count; camel_folder_class->append_message = _append_message; camel_folder_class->list_permanent_flags = _list_permanent_flags; @@ -335,13 +341,12 @@ _folder_open_cb (CamelFolder *folder, } - static void -_open (CamelFolder *folder, - CamelFolderOpenMode mode, - CamelFolderAsyncCallback callback, - gpointer user_data, - CamelException *ex) +_open_async (CamelFolder *folder, + CamelFolderOpenMode mode, + CamelFolderAsyncCallback callback, + gpointer user_data, + CamelException *ex) { CamelFolderPtProxy *proxy_folder; CamelOp *op; @@ -357,7 +362,7 @@ _open (CamelFolder *folder, func_def = CAMEL_FOLDER_PT_PROXY_CLASS(proxy_folder)->open_func_def; if (callback) op = camel_marshal_create_op (func_def, - CAMEL_FOLDER_CLASS (proxy_folder->real_folder)->open, + CAMEL_FOLDER_CLASS (proxy_folder->real_folder)->open_async, proxy_folder->real_folder, mode, _folder_open_cb, @@ -365,7 +370,7 @@ _open (CamelFolder *folder, proxy_folder->thread_ex); else op = camel_marshal_create_op (func_def, - CAMEL_FOLDER_CLASS (proxy_folder->real_folder)->open, + CAMEL_FOLDER_CLASS (proxy_folder->real_folder)->open_async, proxy_folder->real_folder, mode, NULL, @@ -380,6 +385,17 @@ _open (CamelFolder *folder, +static void _open (CamelFolder *folder, + CamelFolderOpenMode mode, + CamelException *ex) +{ + CamelFolderPtProxy *proxy_folder; + + proxy_folder = CAMEL_FOLDER_PT_PROXY (folder); + CF_CLASS (proxy_folder->real_folder)-> + open (proxy_folder->real_folder, mode, ex); +} + /* folder->close implementation */ @@ -405,11 +421,11 @@ _folder_close_cb (CamelFolder *folder, } static void -_close (CamelFolder *folder, - gboolean expunge, - CamelFolderAsyncCallback callback, - gpointer user_data, - CamelException *ex) +_close_async (CamelFolder *folder, + gboolean expunge, + CamelFolderAsyncCallback callback, + gpointer user_data, + CamelException *ex) { CamelFolderPtProxy *proxy_folder; CamelOp *op; @@ -420,7 +436,7 @@ _close (CamelFolder *folder, func_def = CAMEL_FOLDER_PT_PROXY_CLASS(proxy_folder)->close_func_def; if (callback) op = camel_marshal_create_op (func_def, - CAMEL_FOLDER_CLASS (proxy_folder->real_folder)->close, + CAMEL_FOLDER_CLASS (proxy_folder->real_folder)->close_async, proxy_folder->real_folder, expunge, _folder_close_cb, @@ -428,7 +444,7 @@ _close (CamelFolder *folder, proxy_folder->thread_ex); else op = camel_marshal_create_op (func_def, - CAMEL_FOLDER_CLASS (proxy_folder->real_folder)->close, + CAMEL_FOLDER_CLASS (proxy_folder->real_folder)->close_async, proxy_folder->real_folder, expunge, NULL, @@ -439,59 +455,33 @@ _close (CamelFolder *folder, } - - -/* folder->set_name implementation */ -static void -_folder_set_name_cb (CamelFolder *folder, - gpointer user_data, - CamelException *ex) +static void _close (CamelFolder *folder, + gboolean expunge, + CamelException *ex) { - CamelOp *cb; - _ProxyCbUserData *pud; - CamelFuncDef *cb_def; + CamelFolderPtProxy *proxy_folder; - camel_exception_xfer (pud->ex, ex); - cb_def = CAMEL_FOLDER_PT_PROXY_CLASS(pud->proxy_folder)->set_name_cb_def; - cb = camel_marshal_create_op (cb_def, - pud->real_callback, - pud->proxy_folder, - pud->real_user_data, - pud->ex); - camel_thread_proxy_push_cb (pud->proxy_folder->proxy_object, cb); + proxy_folder = CAMEL_FOLDER_PT_PROXY (folder); + CF_CLASS (proxy_folder->real_folder)-> + close (proxy_folder->real_folder, expunge, ex); } + + + + +/* folder->set_name implementation */ + static void _set_name (CamelFolder *folder, const gchar *name, - CamelFolderAsyncCallback callback, - gpointer user_data, CamelException *ex) { CamelFolderPtProxy *proxy_folder; - CamelOp *op; - CamelFuncDef *func_def; proxy_folder = CAMEL_FOLDER_PT_PROXY (folder); - - func_def = CAMEL_FOLDER_PT_PROXY_CLASS(proxy_folder)->close_func_def; - if (callback) - op = camel_marshal_create_op (func_def, - CAMEL_FOLDER_CLASS (proxy_folder->real_folder)->set_name, - proxy_folder->real_folder, - name, - _folder_set_name_cb, - _proxy_cb_user_data (proxy_folder->pud, callback, proxy_folder, ex, user_data), - proxy_folder->thread_ex); - else - op = camel_marshal_create_op (func_def, - CAMEL_FOLDER_CLASS (proxy_folder->real_folder)->set_name, - proxy_folder->real_folder, - name, - NULL, - NULL, - NULL); - camel_thread_proxy_push_op (proxy_folder->proxy_object, op); + CF_CLASS (proxy_folder->real_folder)-> + set_name (proxy_folder->real_folder, name, ex); } @@ -579,13 +569,13 @@ _is_open (CamelFolder *folder, CamelException *ex) static CamelFolder * -_get_folder (CamelFolder *folder, const gchar *folder_name, CamelException *ex) +_get_subfolder (CamelFolder *folder, const gchar *folder_name, CamelException *ex) { CamelFolderPtProxy *proxy_folder; proxy_folder = CAMEL_FOLDER_PT_PROXY (folder); return CF_CLASS (proxy_folder->real_folder)-> - get_folder (proxy_folder->real_folder, folder_name, ex); + get_subfolder (proxy_folder->real_folder, folder_name, ex); } @@ -708,13 +698,13 @@ _expunge (CamelFolder *folder, CamelException *ex) static CamelMimeMessage * -_get_message (CamelFolder *folder, gint number, CamelException *ex) +_get_message_by_number (CamelFolder *folder, gint number, CamelException *ex) { CamelFolderPtProxy *proxy_folder; proxy_folder = CAMEL_FOLDER_PT_PROXY (folder); return CF_CLASS (proxy_folder->real_folder)-> - get_message (proxy_folder->real_folder, number, ex); + get_message_by_number (proxy_folder->real_folder, number, ex); } diff --git a/camel/camel-folder.c b/camel/camel-folder.c index 9f4f7f6e4d..84dc229dc6 100644 --- a/camel/camel-folder.c +++ b/camel/camel-folder.c @@ -79,15 +79,15 @@ static gboolean _delete (CamelFolder *folder, gboolean recurse, CamelException * static GList *_list_subfolders (CamelFolder *folder, CamelException *ex); -static CamelFolder *_get_folder (CamelFolder *folder, +static CamelFolder *_get_subfolder (CamelFolder *folder, const gchar *folder_name, CamelException *ex); static CamelFolder *_get_parent_folder (CamelFolder *folder, CamelException *ex); static CamelStore * _get_parent_store (CamelFolder *folder, CamelException *ex); -static CamelMimeMessage *_get_message (CamelFolder *folder, - gint number, - CamelException *ex); +static CamelMimeMessage *_get_message_by_number (CamelFolder *folder, + gint number, + CamelException *ex); static gint _get_message_count (CamelFolder *folder, CamelException *ex); @@ -136,7 +136,7 @@ camel_folder_class_init (CamelFolderClass *camel_folder_class) camel_folder_class->can_hold_messages = _can_hold_messages; camel_folder_class->exists = _exists; camel_folder_class->is_open = _is_open; - camel_folder_class->get_folder = _get_folder; + camel_folder_class->get_subfolder = _get_subfolder; camel_folder_class->create = _create; camel_folder_class->delete = _delete; camel_folder_class->delete_messages = _delete_messages; @@ -145,7 +145,7 @@ camel_folder_class_init (CamelFolderClass *camel_folder_class) camel_folder_class->get_mode = _get_mode; camel_folder_class->list_subfolders = _list_subfolders; camel_folder_class->expunge = _expunge; - camel_folder_class->get_message = _get_message; + camel_folder_class->get_message_by_number = _get_message_by_number; camel_folder_class->get_message_count = _get_message_count; camel_folder_class->append_message = _append_message; camel_folder_class->list_permanent_flags = _list_permanent_flags; @@ -582,7 +582,9 @@ _is_open (CamelFolder *folder, CamelException *ex) static CamelFolder * -_get_folder (CamelFolder *folder, const gchar *folder_name, CamelException *ex) +_get_subfolder (CamelFolder *folder, + const gchar *folder_name, + CamelException *ex) { CamelFolder *new_folder; gchar *full_name; @@ -607,7 +609,7 @@ _get_folder (CamelFolder *folder, const gchar *folder_name, CamelException *ex) /** - * camel_folder_get_folder: return the (sub)folder object that is specified + * camel_folder_get_subfolder: return the (sub)folder object that is specified * @folder: the folder * @folder_name: subfolder path * @@ -619,9 +621,9 @@ _get_folder (CamelFolder *folder, const gchar *folder_name, CamelException *ex) * Return value: Required folder. NULL if the subfolder object could not be obtained **/ CamelFolder * -camel_folder_get_folder (CamelFolder *folder, gchar *folder_name, CamelException *ex) +camel_folder_get_subfolder (CamelFolder *folder, gchar *folder_name, CamelException *ex) { - return (CF_CLASS(folder)->get_folder(folder,folder_name, ex)); + return (CF_CLASS(folder)->get_subfolder(folder,folder_name, ex)); } @@ -1013,7 +1015,7 @@ camel_folder_expunge (CamelFolder *folder, gboolean want_list, CamelException *e static CamelMimeMessage * -_get_message (CamelFolder *folder, gint number, CamelException *ex) +_get_message_by_number (CamelFolder *folder, gint number, CamelException *ex) { return NULL; } @@ -1031,7 +1033,7 @@ _get_message (CamelFolder *folder, gint number, CamelException *ex) * Return value: A pointer on the corresponding message or NULL if no corresponding message exists **/ CamelMimeMessage * -camel_folder_get_message (CamelFolder *folder, gint number, CamelException *ex) +camel_folder_get_message_by_number (CamelFolder *folder, gint number, CamelException *ex) { #warning this code has nothing to do here. CamelMimeMessage *a_message; @@ -1063,7 +1065,7 @@ camel_folder_get_message (CamelFolder *folder, gint number, CamelException *ex) CAMEL_LOG_FULL_DEBUG ("CamelFolder::get_message message node = %p\n", message_node); } - if (!new_message) new_message = CF_CLASS (folder)->get_message (folder, number, ex); + if (!new_message) new_message = CF_CLASS (folder)->get_message_by_number (folder, number, ex); if (!new_message) return NULL; /* if the message has not been already put in diff --git a/camel/camel-folder.h b/camel/camel-folder.h index cc9eaeb5ed..c4ddf71276 100644 --- a/camel/camel-folder.h +++ b/camel/camel-folder.h @@ -139,9 +139,9 @@ typedef struct { gboolean (*is_open) (CamelFolder *folder, CamelException *ex); - CamelFolder * (*get_folder) (CamelFolder *folder, - const gchar *folder_name, - CamelException *ex); + CamelFolder * (*get_subfolder) (CamelFolder *folder, + const gchar *folder_name, + CamelException *ex); gboolean (*create) (CamelFolder *folder, CamelException *ex); @@ -168,9 +168,9 @@ typedef struct { void (*expunge) (CamelFolder *folder, CamelException *ex); - CamelMimeMessage * (*get_message) (CamelFolder *folder, - gint number, - CamelException *ex); + CamelMimeMessage * (*get_message_by_number) (CamelFolder *folder, + gint number, + CamelException *ex); gint (*get_message_count) (CamelFolder *folder, CamelException *ex); @@ -207,7 +207,10 @@ GtkType camel_folder_get_type (void); /* public methods */ -CamelFolder *camel_folder_get_folder (CamelFolder *folder, + + + +CamelFolder *camel_folder_get_subfolder (CamelFolder *folder, gchar *folder_name, CamelException *ex); @@ -228,36 +231,63 @@ void camel_folder_close_async (CamelFolder *folder, CamelException *ex); gboolean camel_folder_create (CamelFolder *folder, CamelException *ex); -gboolean camel_folder_delete (CamelFolder *folder, gboolean recurse, CamelException *ex); -gboolean camel_folder_delete_messages (CamelFolder *folder, CamelException *ex); CamelFolder *camel_folder_get_parent_folder (CamelFolder *folder, CamelException *ex); CamelStore *camel_folder_get_parent_store (CamelFolder *folder, CamelException *ex); -CamelFolderOpenMode camel_folder_get_mode (CamelFolder *folder, CamelException *ex); GList *camel_folder_list_subfolders (CamelFolder *folder, CamelException *ex); + + +/* delete operations */ +gboolean camel_folder_delete (CamelFolder *folder, gboolean recurse, CamelException *ex); +gboolean camel_folder_delete_messages (CamelFolder *folder, CamelException *ex); GList *camel_folder_expunge (CamelFolder *folder, gboolean want_list, CamelException *ex); + + +/* folder name manipulation operations */ void camel_folder_set_name (CamelFolder *folder, const gchar *name, CamelException *ex); - const gchar *camel_folder_get_name (CamelFolder *folder, CamelException *ex); -/* void camel_folder_set_full_name (CamelFolder *folder, const gchar *name); */ const gchar *camel_folder_get_full_name (CamelFolder *folder, CamelException *ex); -CamelMimeMessage *camel_folder_get_message (CamelFolder *folder, gint number, CamelException *ex); + + +/* various properties accessors */ gboolean camel_folder_exists (CamelFolder *folder, CamelException *ex); -gint camel_folder_get_message_count (CamelFolder *folder, CamelException *ex); -gint camel_folder_append_message (CamelFolder *folder, CamelMimeMessage *message, CamelException *ex); const GList *camel_folder_list_permanent_flags (CamelFolder *folder, CamelException *ex); -void camel_folder_copy_message_to (CamelFolder *folder, CamelMimeMessage *message, CamelFolder *dest_folder, CamelException *ex); +CamelFolderOpenMode camel_folder_get_mode (CamelFolder *folder, CamelException *ex); + + + +/* message manipulation */ +gint camel_folder_append_message (CamelFolder *folder, + CamelMimeMessage *message, CamelException *ex); +void camel_folder_copy_message_to (CamelFolder *folder, + CamelMimeMessage *message, + CamelFolder *dest_folder, + CamelException *ex); + +/* summary related operations */ gboolean camel_folder_has_summary_capability (CamelFolder *folder, CamelException *ex); CamelFolderSummary *camel_folder_get_summary (CamelFolder *folder, CamelException *ex); +/* number based access operations */ +CamelMimeMessage *camel_folder_get_message_by_number (CamelFolder *folder, + gint number, CamelException *ex); +gint camel_folder_get_message_count (CamelFolder *folder, CamelException *ex); + + +/* uid based access operations */ gboolean camel_folder_has_uid_capability (CamelFolder *folder, CamelException *ex); const gchar * camel_folder_get_message_uid (CamelFolder *folder, CamelMimeMessage *message, CamelException *ex); CamelMimeMessage *camel_folder_get_message_by_uid (CamelFolder *folder, const gchar *uid, CamelException *ex); GList *camel_folder_get_uid_list (CamelFolder *folder, CamelException *ex); + + + + + #ifdef __cplusplus } #endif /* __cplusplus */ |