diff options
author | Dan Winship <danw@src.gnome.org> | 2000-07-24 23:13:07 +0800 |
---|---|---|
committer | Dan Winship <danw@src.gnome.org> | 2000-07-24 23:13:07 +0800 |
commit | 34057bd1f00badee56d631c7c39f13b2731e08f5 (patch) | |
tree | 17c07fe0f886e60926b2d9d0d524819ac59d0b6d | |
parent | 1558154d52345cc759508e0d489c4a4e83d27fe4 (diff) | |
download | gsoc2013-evolution-34057bd1f00badee56d631c7c39f13b2731e08f5.tar.gz gsoc2013-evolution-34057bd1f00badee56d631c7c39f13b2731e08f5.tar.zst gsoc2013-evolution-34057bd1f00badee56d631c7c39f13b2731e08f5.zip |
Bye bye bye.
* camel-folder-pt-proxy.[ch], camel-arg-collector.c,
camel-marshal-utils.[ch]: Bye bye bye.
* Makefile.am: remove reference to camel-arg-collector.c
svn path=/trunk/; revision=4291
-rw-r--r-- | camel/ChangeLog | 7 | ||||
-rw-r--r-- | camel/Makefile.am | 4 | ||||
-rw-r--r-- | camel/camel-arg-collector.c | 186 | ||||
-rw-r--r-- | camel/camel-folder-pt-proxy.c | 809 | ||||
-rw-r--r-- | camel/camel-folder-pt-proxy.h | 92 | ||||
-rw-r--r-- | camel/camel-marshal-utils.c | 343 | ||||
-rw-r--r-- | camel/camel-marshal-utils.h | 102 |
7 files changed, 7 insertions, 1536 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog index d174136f6a..390686a5c7 100644 --- a/camel/ChangeLog +++ b/camel/ChangeLog @@ -1,3 +1,10 @@ +2000-07-24 Dan Winship <danw@helixcode.com> + + * camel-folder-pt-proxy.[ch], camel-arg-collector.c, + camel-marshal-utils.[ch]: Bye bye bye. + + * Makefile.am: remove reference to camel-arg-collector.c + 2000-07-23 Jeffrey Stedfast <fejj@helixcode.com> * providers/imap/camel-imap-store.c (imap_disconnect): Made it a diff --git a/camel/Makefile.am b/camel/Makefile.am index c398fb55f2..20d4193caa 100644 --- a/camel/Makefile.am +++ b/camel/Makefile.am @@ -106,13 +106,9 @@ libcamelinclude_HEADERS = \ camel-address.h \ camel-internet-address.h -libcamel_extra_sources = \ - camel-arg-collector.c - libcamel_la_LDFLAGS = -version-info 0:0:0 -rpath $(libdir) EXTRA_DIST = \ - $(libcamel_extra_sources) \ README #noinst_PROGRAMS = \ diff --git a/camel/camel-arg-collector.c b/camel/camel-arg-collector.c deleted file mode 100644 index 44b9e2d99b..0000000000 --- a/camel/camel-arg-collector.c +++ /dev/null @@ -1,186 +0,0 @@ -/* GTK - The GIMP Toolkit - * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -/* - * Modified by the GTK+ Team and others 1997-1999. See the AUTHORS - * file for a list of people on the GTK+ Team. See the ChangeLog - * files for a list of changes. These files are distributed with - * GTK+ at ftp://ftp.gtk.org/pub/gtk/. - */ - -/* - * included in camel because it is not exported - * by gtk - * - * Bertrand Guiheneuf <bertrand@helixcode.com> - */ - -/* collect a single argument value from a va_list. - * this is implemented as a huge macro <shrug>, because we can't - * pass va_list variables by reference on some systems. - * the corresponding prototype would be: - * static inline gchar* - * gtk_arg_collect_value (GtkArg *arg, - * va_list var_args); - */ -#define CAMEL_ARG_COLLECT_VALUE(arg, var_args, _error) \ -G_STMT_START { \ - gchar *error_msg; \ - GtkType fundamental_type; \ - \ - fundamental_type = GTK_FUNDAMENTAL_TYPE (arg->type); \ - if (fundamental_type > GTK_TYPE_FUNDAMENTAL_LAST) \ - { \ - fundamental_type = gtk_type_get_varargs_type (fundamental_type); \ - if (!fundamental_type) \ - fundamental_type = GTK_FUNDAMENTAL_TYPE (arg->type); \ - } \ - \ - error_msg = NULL; \ - switch (fundamental_type) \ - { \ - case GTK_TYPE_INVALID: \ - error_msg = g_strdup ("invalid untyped argument"); \ - break; \ - \ - case GTK_TYPE_NONE: \ - /* we just ignore this type, since it arithmetically just requires \ - * us to not move the var_args pointer any further. callers need to \ - * check for the validity of GTK_TYPE_NONE themselves. \ - * \ - * error_msg = g_strdup ("invalid argument type `void'"); \ - */ \ - break; \ - \ - /* everything smaller than an int is guarranteed to be \ - * passed as an int \ - */ \ - case GTK_TYPE_CHAR: \ - GTK_VALUE_CHAR (*arg) = va_arg (var_args, gint); \ - break; \ - case GTK_TYPE_UCHAR: \ - GTK_VALUE_UCHAR (*arg) = va_arg (var_args, guint); \ - break; \ - case GTK_TYPE_BOOL: \ - GTK_VALUE_BOOL (*arg) = va_arg (var_args, gint); \ - break; \ - case GTK_TYPE_INT: \ - GTK_VALUE_INT (*arg) = va_arg (var_args, gint); \ - break; \ - case GTK_TYPE_UINT: \ - GTK_VALUE_UINT (*arg) = va_arg (var_args, guint); \ - break; \ - case GTK_TYPE_ENUM: \ - GTK_VALUE_ENUM (*arg) = va_arg (var_args, gint); \ - break; \ - case GTK_TYPE_FLAGS: \ - GTK_VALUE_FLAGS (*arg) = va_arg (var_args, guint); \ - break; \ - \ - /* we collect longs as glongs since they differ in size with \ - * integers on some platforms \ - */ \ - case GTK_TYPE_LONG: \ - GTK_VALUE_LONG (*arg) = va_arg (var_args, glong); \ - break; \ - case GTK_TYPE_ULONG: \ - GTK_VALUE_ULONG (*arg) = va_arg (var_args, gulong); \ - break; \ - \ - /* floats are always passed as doubles \ - */ \ - case GTK_TYPE_FLOAT: \ - /* GTK_VALUE_FLOAT (*arg) = va_arg (var_args, gfloat); */ \ - GTK_VALUE_FLOAT (*arg) = va_arg (var_args, gdouble); \ - break; \ - case GTK_TYPE_DOUBLE: \ - GTK_VALUE_DOUBLE (*arg) = va_arg (var_args, gdouble); \ - break; \ - \ - /* collect pointer values \ - */ \ - case GTK_TYPE_STRING: \ - GTK_VALUE_STRING (*arg) = va_arg (var_args, gchar*); \ - break; \ - case GTK_TYPE_POINTER: \ - GTK_VALUE_POINTER (*arg) = va_arg (var_args, gpointer); \ - break; \ - case GTK_TYPE_BOXED: \ - GTK_VALUE_BOXED (*arg) = va_arg (var_args, gpointer); \ - break; \ - \ - /* structured types \ - */ \ - case GTK_TYPE_SIGNAL: \ - GTK_VALUE_SIGNAL (*arg).f = va_arg (var_args, GtkSignalFunc); \ - GTK_VALUE_SIGNAL (*arg).d = va_arg (var_args, gpointer); \ - break; \ - case GTK_TYPE_ARGS: \ - GTK_VALUE_ARGS (*arg).n_args = va_arg (var_args, gint); \ - GTK_VALUE_ARGS (*arg).args = va_arg (var_args, GtkArg*); \ - break; \ - case GTK_TYPE_FOREIGN: \ - GTK_VALUE_FOREIGN (*arg).data = va_arg (var_args, gpointer); \ - GTK_VALUE_FOREIGN (*arg).notify = va_arg (var_args, GtkDestroyNotify); \ - break; \ - case GTK_TYPE_CALLBACK: \ - GTK_VALUE_CALLBACK (*arg).marshal = va_arg (var_args, GtkCallbackMarshal); \ - GTK_VALUE_CALLBACK (*arg).data = va_arg (var_args, gpointer); \ - GTK_VALUE_CALLBACK (*arg).notify = va_arg (var_args, GtkDestroyNotify); \ - break; \ - case GTK_TYPE_C_CALLBACK: \ - GTK_VALUE_C_CALLBACK (*arg).func = va_arg (var_args, GtkFunction); \ - GTK_VALUE_C_CALLBACK (*arg).func_data = va_arg (var_args, gpointer); \ - break; \ - \ - /* we do some extra sanity checking when collecting objects, \ - * i.e. if the object pointer is not NULL, we check whether we \ - * actually got an object pointer within the desired class branch. \ - */ \ - case GTK_TYPE_OBJECT: \ - GTK_VALUE_OBJECT (*arg) = va_arg (var_args, GtkObject*); \ - if (GTK_VALUE_OBJECT (*arg) != NULL) \ - { \ - register GtkObject *object = GTK_VALUE_OBJECT (*arg); \ - \ - if (object->klass == NULL) \ - error_msg = g_strconcat ("invalid unclassed object pointer for argument type `", \ - gtk_type_name (arg->type), \ - "'", \ - NULL); \ - else if (!gtk_type_is_a (GTK_OBJECT_TYPE (object), arg->type)) \ - error_msg = g_strconcat ("invalid object `", \ - gtk_type_name (GTK_OBJECT_TYPE (object)), \ - "' for argument type `", \ - gtk_type_name (arg->type), \ - "'", \ - NULL); \ - } \ - break; \ - \ - default: \ - error_msg = g_strconcat ("unsupported argument type `", \ - gtk_type_name (arg->type), \ - "'", \ - NULL); \ - break; \ - } \ - \ - _error = error_msg; /* return error_msg; */ \ -} G_STMT_END diff --git a/camel/camel-folder-pt-proxy.c b/camel/camel-folder-pt-proxy.c deleted file mode 100644 index 65f74ecc4d..0000000000 --- a/camel/camel-folder-pt-proxy.c +++ /dev/null @@ -1,809 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* camel-folder-pt-proxy.c : proxy folder using posix threads */ - -/* - * - * Author : - * Bertrand Guiheneuf <bertrand@helixcode.com> - * - * Copyright 1999, 2000 Helix Code, Inc. (http://www.helixcode.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA - */ - - - -#include <config.h> -#include "camel-folder-pt-proxy.h" -#include "camel-marshal-utils.h" -#include "camel-exception.h" -#include <pthread.h> -#include <unistd.h> -#include <string.h> -#include <errno.h> - - -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) -#define CF_CLASS(so) CAMEL_FOLDER_CLASS (GTK_OBJECT(so)->klass) - - -enum CamelFolderFunc { - CAMEL_FOLDER_OPEN, - CAMEL_FOLDER_CLOSE, - CAMEL_FOLDER__LAST_FUNC -}; - -static CamelFuncDef _camel_func_def [CAMEL_FOLDER__LAST_FUNC]; - - -static void _init (CamelFolder *folder, CamelStore *parent_store, - CamelFolder *parent_folder, const gchar *name, - gchar separator, 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, - CamelException *ex); -static void _close (CamelFolder *folder, - gboolean expunge, - CamelException *ex); -static void _set_name (CamelFolder *folder, - const gchar *name, - CamelException *ex); - -static const gchar *_get_name (CamelFolder *folder, CamelException *ex); -static const gchar *_get_full_name (CamelFolder *folder, CamelException *ex); -static gboolean _can_hold_folders (CamelFolder *folder); -static gboolean _can_hold_messages(CamelFolder *folder); -static gboolean _exists (CamelFolder *folder, CamelException *ex); -static gboolean _is_open (CamelFolder *folder); -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); -static CamelFolder *_get_parent_folder (CamelFolder *folder, CamelException *ex); -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 GList *_expunge (CamelFolder *folder, CamelException *ex); -static CamelMimeMessage *_get_message_by_number (CamelFolder *folder, gint number, CamelException *ex); -static gint _get_message_count (CamelFolder *folder, CamelException *ex); -static void _append_message (CamelFolder *folder, CamelMimeMessage *message, CamelException *ex); -static const GList *_list_permanent_flags (CamelFolder *folder, CamelException *ex); -static void _copy_message_to (CamelFolder *folder, CamelMimeMessage *message, CamelFolder *dest_folder, CamelException *ex); - -static const gchar *_get_message_uid (CamelFolder *folder, CamelMimeMessage *message, CamelException *ex); -static CamelMimeMessage *_get_message_by_uid (CamelFolder *folder, const gchar *uid, CamelException *ex); -static GList *_get_uid_list (CamelFolder *folder, CamelException *ex); - -static void _finalize (GtkObject *object); - - -static void -camel_folder_pt_proxy_class_init (CamelFolderPtProxyClass *camel_folder_pt_proxy_class) -{ - GtkObjectClass *gtk_object_class = GTK_OBJECT_CLASS (camel_folder_pt_proxy_class); - CamelFolderClass *camel_folder_class = CAMEL_FOLDER_CLASS (camel_folder_pt_proxy_class); - CamelFolderPtProxyClass *proxy_class = camel_folder_pt_proxy_class; - - parent_class = gtk_type_class (camel_folder_get_type ()); - - /* virtual method definition */ - camel_folder_class->init = _init; - camel_folder_class->open = _open; - camel_folder_class->close = _close; -#ifdef FOLDER_ASYNC_TEST - camel_folder_class->open_async = _open_async; - camel_folder_class->close_async = _close_async; -#endif - 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_subfolder = _get_subfolder; - camel_folder_class->create = _create; - camel_folder_class->delete = _delete; - camel_folder_class->delete_messages = _delete_messages; - camel_folder_class->get_parent_folder = _get_parent_folder; - camel_folder_class->get_parent_store = _get_parent_store; - camel_folder_class->get_mode = _get_mode; - camel_folder_class->list_subfolders = _list_subfolders; - camel_folder_class->expunge = _expunge; - 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; - camel_folder_class->copy_message_to = _copy_message_to; - camel_folder_class->get_message_uid = _get_message_uid; - camel_folder_class->get_message_by_uid = _get_message_by_uid; - camel_folder_class->get_uid_list = _get_uid_list; - - /* virtual method overload */ - gtk_object_class->finalize = _finalize; - - /* function definition for proxying */ - proxy_class->open_func_def = - camel_func_def_new (camel_marshal_NONE__POINTER_INT_POINTER_POINTER, - 4, - GTK_TYPE_POINTER, - GTK_TYPE_INT, - GTK_TYPE_POINTER, - GTK_TYPE_POINTER); - proxy_class->open_cb_def = - camel_func_def_new (camel_marshal_NONE__POINTER_POINTER_POINTER, - 3, - GTK_TYPE_POINTER, - GTK_TYPE_POINTER, - GTK_TYPE_POINTER); - - proxy_class->close_func_def = - camel_func_def_new (camel_marshal_NONE__POINTER_BOOL_POINTER_POINTER, - 4, - GTK_TYPE_POINTER, - GTK_TYPE_BOOL, - GTK_TYPE_POINTER, - GTK_TYPE_POINTER); - proxy_class->close_cb_def = - camel_func_def_new (camel_marshal_NONE__POINTER_POINTER_POINTER, - 3, - GTK_TYPE_POINTER, - GTK_TYPE_POINTER, - GTK_TYPE_POINTER); - - proxy_class->set_name_func_def = - camel_func_def_new (camel_marshal_NONE__POINTER_BOOL_POINTER_POINTER, - 4, - GTK_TYPE_POINTER, - GTK_TYPE_BOOL, - GTK_TYPE_POINTER, - GTK_TYPE_POINTER); - proxy_class->set_name_cb_def = - camel_func_def_new (camel_marshal_NONE__POINTER_POINTER_POINTER, - 3, - GTK_TYPE_POINTER, - GTK_TYPE_POINTER, - GTK_TYPE_POINTER); - -} - - - - -static void -camel_folder_pt_proxy_init (CamelFolderPtProxy *folder_pt_proxy) -{ - folder_pt_proxy->thread_ex = camel_exception_new (); - folder_pt_proxy->pud = g_new (_ProxyCbUserData, 1); -} - - - - -GtkType -camel_folder_pt_proxy_get_type (void) -{ - static GtkType camel_folder_pt_proxy_type = 0; - - if (!camel_folder_pt_proxy_type) { - GtkTypeInfo camel_folder_pt_proxy_info = - { - "CamelFolderPtProxy", - sizeof (CamelFolderPtProxy), - sizeof (CamelFolderPtProxyClass), - (GtkClassInitFunc) camel_folder_pt_proxy_class_init, - (GtkObjectInitFunc) camel_folder_pt_proxy_init, - /* reserved_1 */ NULL, - /* reserved_2 */ NULL, - (GtkClassInitFunc) NULL, - }; - - camel_folder_pt_proxy_type = gtk_type_unique (camel_folder_get_type (), &camel_folder_pt_proxy_info); - } - - return camel_folder_pt_proxy_type; -} - - -static void -_finalize (GtkObject *object) -{ - CamelFolder *camel_folder = CAMEL_FOLDER (object); - CamelFolderPtProxy *camel_folder_pt_proxy = CAMEL_FOLDER_PT_PROXY (camel_folder); - - camel_exception_free (camel_folder_pt_proxy->thread_ex); - g_free (camel_folder_pt_proxy->pud); - GTK_OBJECT_CLASS (parent_class)->finalize (object); -} - - - - - - -/*********/ - -/**** Operations implementation ****/ - - - -static gpointer -_proxy_cb_user_data (_ProxyCbUserData *pud, - CamelFolderAsyncCallback real_callback, - CamelFolderPtProxy *proxy_folder, - CamelException *ex, - gpointer real_user_data) -{ - pud->real_callback = real_callback; - pud->proxy_folder = proxy_folder; - pud->ex = ex; - pud->real_user_data = real_user_data; - return (gpointer)pud; -} - - -/* ******** */ - -/* thread->init implementation */ -static void -_init (CamelFolder *folder, CamelStore *parent_store, - CamelFolder *parent_folder, const gchar *name, - gchar separator, CamelException *ex) -{ - - parent_class->init (folder, parent_store, parent_folder, - name, separator, ex); - if (ex->id != CAMEL_EXCEPTION_NONE) - return; -#warning use proxy store here - CF_CLASS (folder)->init (CAMEL_FOLDER_PT_PROXY (folder)->real_folder, - parent_store, parent_folder, name, - separator, ex); -} - - - -/* a little bit of explanation for the folder_class->open - * method implementation : - * - * the proxy object "open" method is called by the client - * program in the main thread. This method creates a - * CamelOp object containing all the necessary informations - * to call the corresponding "open" method on the real - * folder object in the child thread. This CamelOp object - * is thus pushed in a queue in the main thread (see the - * CamelThreadProxy structure for more details). - * The operations in this queue are executed one by one - * in a child thread. - * Once the "open" method of the real object is finished, - * it calls a callback. This callback is not the one supplied - * by the client object. Instead, the _folder_open_cb() - * function is called (in the child thread) which pushes - * the real callback function in another operation queue. - * The real callback is then called in the main thread. - */ - -/* folder->open implementation */ - -/* - * proxy callback. Called in the child thread by the - * real folder "open" method when it is completed - */ -static void -_folder_open_cb (CamelFolder *folder, - gpointer user_data, - CamelException *ex) -{ - CamelOp *cb; - _ProxyCbUserData *pud; - CamelFuncDef *cb_def; - - g_print ("%s: %s(): Bailing. This function is incredibly" - " broken; the \"*pud\" pointer isn't allocated" - " memory anywhere.\n"); - return; - - /* transfer the exception information from "ex" to the - * client supplied exception (kept in pud->ex) */ - camel_exception_xfer (pud->ex, ex); - - /* create an operation which will call the real client - * supplied callback in the main thread */ - cb_def = CAMEL_FOLDER_PT_PROXY_CLASS(pud->proxy_folder)->open_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); - -} - -static void -_open_async (CamelFolder *folder, - CamelFolderOpenMode mode, - CamelFolderAsyncCallback callback, - gpointer user_data, - CamelException *ex) -{ - CamelFolderPtProxy *proxy_folder; - CamelOp *op; - CamelFuncDef *func_def; - - proxy_folder = CAMEL_FOLDER_PT_PROXY (folder); - - /* create an operation corresponding to the "open" - * method of the real object. The operation definition - * is common to all instances of the CamelFolderPtProxy - * class so it is contained in the CamelFolderPtProxyClass - * structure. */ - 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_async, - proxy_folder->real_folder, - mode, - _folder_open_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)->open_async, - proxy_folder->real_folder, - mode, - NULL, - NULL, - NULL); - /* push the operation in the operation queue. This operation - * will be executed in a child thread but only one operation - * will be executed at a time, so that folder implementations - * don't have to be MultiThread safe. */ - camel_thread_proxy_push_op (proxy_folder->proxy_object, op); -} - - - -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 */ - -static void -_folder_close_cb (CamelFolder *folder, - gpointer user_data, - CamelException *ex) -{ - CamelOp *cb; - _ProxyCbUserData *pud; - CamelFuncDef *cb_def; - - g_print ("%s: %s(): Bailing. This function is incredibly" - " broken; the \"*pud\" pointer isn't allocated" - " memory anywhere.\n"); - return; - - camel_exception_xfer (pud->ex, ex); - cb_def = CAMEL_FOLDER_PT_PROXY_CLASS(pud->proxy_folder)->close_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); - -} - -static void -_close_async (CamelFolder *folder, - gboolean expunge, - 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)->close_async, - proxy_folder->real_folder, - expunge, - _folder_close_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)->close_async, - proxy_folder->real_folder, - expunge, - NULL, - NULL, - NULL); - camel_thread_proxy_push_op (proxy_folder->proxy_object, op); - -} - - -static void _close (CamelFolder *folder, - gboolean expunge, - CamelException *ex) -{ - CamelFolderPtProxy *proxy_folder; - - proxy_folder = CAMEL_FOLDER_PT_PROXY (folder); - CF_CLASS (proxy_folder->real_folder)-> - close (proxy_folder->real_folder, expunge, ex); -} - - -/* folder->get_name implementation */ -/* this one is not executed in a thread */ -static const gchar * -_get_name (CamelFolder *folder, CamelException *ex) -{ - CamelFolderPtProxy *proxy_folder; - - proxy_folder = CAMEL_FOLDER_PT_PROXY (folder); - return CF_CLASS (proxy_folder->real_folder)-> - get_name (proxy_folder->real_folder); -} - - - -/* folder->get_full_name implementation */ -/* this one is not executed in a thread */ - -static const gchar * -_get_full_name (CamelFolder *folder, CamelException *ex) -{ - CamelFolderPtProxy *proxy_folder; - - proxy_folder = CAMEL_FOLDER_PT_PROXY (folder); - return CF_CLASS (proxy_folder->real_folder)-> - get_full_name (proxy_folder->real_folder); -} - - - - -static gboolean -_can_hold_folders (CamelFolder *folder) -{ - CamelFolderPtProxy *proxy_folder; - - proxy_folder = CAMEL_FOLDER_PT_PROXY (folder); - return CF_CLASS (proxy_folder->real_folder)-> - can_hold_folders (proxy_folder->real_folder); -} - - - - -static gboolean -_can_hold_messages (CamelFolder *folder) -{ - CamelFolderPtProxy *proxy_folder; - - proxy_folder = CAMEL_FOLDER_PT_PROXY (folder); - return CF_CLASS (proxy_folder->real_folder)-> - can_hold_messages (proxy_folder->real_folder); -} - - - -static gboolean -_exists (CamelFolder *folder, CamelException *ex) -{ - CamelFolderPtProxy *proxy_folder; - - proxy_folder = CAMEL_FOLDER_PT_PROXY (folder); - return CF_CLASS (proxy_folder->real_folder)-> - exists (proxy_folder->real_folder, ex); -} - - - - -static gboolean -_is_open (CamelFolder *folder) -{ - CamelFolderPtProxy *proxy_folder; - - proxy_folder = CAMEL_FOLDER_PT_PROXY (folder); - return CF_CLASS (proxy_folder->real_folder)-> - is_open (proxy_folder->real_folder); -} - - - - - -static CamelFolder * -_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_subfolder (proxy_folder->real_folder, folder_name, ex); -} - - - - - - -static gboolean -_create(CamelFolder *folder, CamelException *ex) -{ - CamelFolderPtProxy *proxy_folder; - - proxy_folder = CAMEL_FOLDER_PT_PROXY (folder); - return CF_CLASS (proxy_folder->real_folder)-> - create (proxy_folder->real_folder, ex); -} - - - - - - - - -static gboolean -_delete (CamelFolder *folder, gboolean recurse, CamelException *ex) -{ - CamelFolderPtProxy *proxy_folder; - - proxy_folder = CAMEL_FOLDER_PT_PROXY (folder); - return CF_CLASS (proxy_folder->real_folder)-> - delete (proxy_folder->real_folder, recurse, ex); -} - - - - - - - -static gboolean -_delete_messages (CamelFolder *folder, CamelException *ex) -{ - CamelFolderPtProxy *proxy_folder; - - proxy_folder = CAMEL_FOLDER_PT_PROXY (folder); - return CF_CLASS (proxy_folder->real_folder)-> - delete_messages (proxy_folder->real_folder, ex); -} - - - - - - -static CamelFolder * -_get_parent_folder (CamelFolder *folder, CamelException *ex) -{ - CamelFolderPtProxy *proxy_folder; -#warning return proxy parent folder if any - proxy_folder = CAMEL_FOLDER_PT_PROXY (folder); - return CF_CLASS (proxy_folder->real_folder)-> - get_parent_folder (proxy_folder->real_folder, ex); -} - - - - - -static CamelStore * -_get_parent_store (CamelFolder *folder, CamelException *ex) -{ - CamelFolderPtProxy *proxy_folder; - - proxy_folder = CAMEL_FOLDER_PT_PROXY (folder); - return CF_CLASS (proxy_folder->real_folder)-> - get_parent_store (proxy_folder->real_folder, ex); -} - - - - -static CamelFolderOpenMode -_get_mode (CamelFolder *folder, CamelException *ex) -{ - CamelFolderPtProxy *proxy_folder; - - proxy_folder = CAMEL_FOLDER_PT_PROXY (folder); - return CF_CLASS (proxy_folder->real_folder)-> - get_mode (proxy_folder->real_folder, ex); -} - - - - -static GList * -_list_subfolders (CamelFolder *folder, CamelException *ex) -{ - CamelFolderPtProxy *proxy_folder; - - proxy_folder = CAMEL_FOLDER_PT_PROXY (folder); - return CF_CLASS (proxy_folder->real_folder)-> - list_subfolders (proxy_folder->real_folder, ex); -} - - - - -static GList * -_expunge (CamelFolder *folder, CamelException *ex) -{ - CamelFolderPtProxy *proxy_folder; - - proxy_folder = CAMEL_FOLDER_PT_PROXY (folder); - return CF_CLASS (proxy_folder->real_folder)-> - expunge (proxy_folder->real_folder, ex); -} - - - - -static CamelMimeMessage * -_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_by_number (proxy_folder->real_folder, number, ex); -} - - - - - -static gint -_get_message_count (CamelFolder *folder, CamelException *ex) -{ - CamelFolderPtProxy *proxy_folder; - - proxy_folder = CAMEL_FOLDER_PT_PROXY (folder); - return CF_CLASS (proxy_folder->real_folder)-> - get_message_count (proxy_folder->real_folder, ex); -} - - - - -static void -_append_message (CamelFolder *folder, CamelMimeMessage *message, CamelException *ex) -{ - CamelFolderPtProxy *proxy_folder; - - proxy_folder = CAMEL_FOLDER_PT_PROXY (folder); - CF_CLASS (proxy_folder->real_folder)-> - append_message (proxy_folder->real_folder, message, ex); -} - - - -static const GList * -_list_permanent_flags (CamelFolder *folder, CamelException *ex) -{ - CamelFolderPtProxy *proxy_folder; - - proxy_folder = CAMEL_FOLDER_PT_PROXY (folder); - return CF_CLASS (proxy_folder->real_folder)-> - list_permanent_flags (proxy_folder->real_folder, ex); -} - - - -static void -_copy_message_to (CamelFolder *folder, CamelMimeMessage *message, CamelFolder *dest_folder, CamelException *ex) -{ - CamelFolderPtProxy *proxy_folder; - - proxy_folder = CAMEL_FOLDER_PT_PROXY (folder); - CF_CLASS (proxy_folder->real_folder)-> - copy_message_to (proxy_folder->real_folder, message, dest_folder, ex); -} - - - - - - -/* UIDs stuff */ - - -static const gchar * -_get_message_uid (CamelFolder *folder, CamelMimeMessage *message, CamelException *ex) -{ - CamelFolderPtProxy *proxy_folder; - - proxy_folder = CAMEL_FOLDER_PT_PROXY (folder); - return CF_CLASS (proxy_folder->real_folder)-> - get_message_uid (proxy_folder->real_folder, message, ex); -} - - -/* the next two func are left there temporarily */ -#if 0 -static const gchar * -_get_message_uid_by_number (CamelFolder *folder, gint message_number, CamelException *ex) -{ - CamelFolderPtProxy *proxy_folder; - - proxy_folder = CAMEL_FOLDER_PT_PROXY (folder); - return CF_CLASS (proxy_folder->real_folder)-> - get_message_uid_by_number (proxy_folder->real_folder, message_number, ex); -} - -#endif - -static CamelMimeMessage * -_get_message_by_uid (CamelFolder *folder, const gchar *uid, CamelException *ex) -{ - CamelFolderPtProxy *proxy_folder; - - proxy_folder = CAMEL_FOLDER_PT_PROXY (folder); - return CF_CLASS (proxy_folder->real_folder)-> - get_message_by_uid (proxy_folder->real_folder, uid, ex); -} - - -static GList * -_get_uid_list (CamelFolder *folder, CamelException *ex) -{ - CamelFolderPtProxy *proxy_folder; - - proxy_folder = CAMEL_FOLDER_PT_PROXY (folder); - return CF_CLASS (proxy_folder->real_folder)-> - get_uid_list (proxy_folder->real_folder, ex); -} - - -/* **** */ - - - - - diff --git a/camel/camel-folder-pt-proxy.h b/camel/camel-folder-pt-proxy.h deleted file mode 100644 index 7422786170..0000000000 --- a/camel/camel-folder-pt-proxy.h +++ /dev/null @@ -1,92 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* camel-folder-pt-proxy.h : proxy folder using posix threads */ - -/* - * - * Author : - * Bertrand Guiheneuf <bertrand@helixcode.com> - * - * Copyright 1999, 2000 Helix Code, Inc. (http://www.helixcode.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA - */ - - - - - -#ifndef CAMEL_FOLDER_PT_PROXY_H -#define CAMEL_FOLDER_PT_PROXY_H 1 - - -#ifdef __cplusplus -extern "C" { -#pragma } -#endif /* __cplusplus }*/ - -#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 ()) -#define CAMEL_FOLDER_PT_PROXY(obj) (GTK_CHECK_CAST((obj), CAMEL_FOLDER_PT_PROXY_TYPE, CamelFolderPtProxy)) -#define CAMEL_FOLDER_PT_PROXY_CLASS(k) (GTK_CHECK_CLASS_CAST ((k), CAMEL_FOLDER_PT_PROXY_TYPE, CamelFolderPtProxyClass)) -#define CAMEL_IS_FOLDER_PT_PROXY(o) (GTK_CHECK_TYPE((o), CAMEL_FOLDER_PT_PROXY_TYPE)) - -typedef struct _CamelFolderPtProxy CamelFolderPtProxy; - -typedef struct { - CamelFolderAsyncCallback real_callback; - CamelFolderPtProxy *proxy_folder; - CamelException *ex; - gpointer real_user_data; -} _ProxyCbUserData; - -struct _CamelFolderPtProxy { - CamelFolder parent; - - /* private fields */ - CamelFolder *real_folder; - CamelThreadProxy *proxy_object; - CamelException *thread_ex; - _ProxyCbUserData *pud; - -}; - - - -typedef struct { - CamelFolderClass parent_class; - - /* functions and callbacks definition (for marshalling) */ - CamelFuncDef *open_func_def; - CamelFuncDef *open_cb_def; - CamelFuncDef *close_func_def; - CamelFuncDef *close_cb_def; - CamelFuncDef *set_name_func_def; - CamelFuncDef *set_name_cb_def; - -} CamelFolderPtProxyClass; - - -GtkType camel_folder_pt_proxy_get_type (void); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* CAMEL_FOLDER_PT_PROXY_H */ diff --git a/camel/camel-marshal-utils.c b/camel/camel-marshal-utils.c deleted file mode 100644 index a743f155d5..0000000000 --- a/camel/camel-marshal-utils.c +++ /dev/null @@ -1,343 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* camel-marshal-utils.c : marshal utils */ - -/* - * - * Author : - * Bertrand Guiheneuf <bertrand@helixcode.com> - * - * Copyright 1999, 2000 Helix Code, Inc. (http://www.helixcode.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA - */ - - - - -#include "config.h" -#include "camel-marshal-utils.h" -#include "camel-arg-collector.c" - - -#define NB_OP_CHUNKS 20 -static GMemChunk *op_chunk=NULL; -static GStaticMutex op_chunk_mutex = G_STATIC_MUTEX_INIT; - -CamelFuncDef * -camel_func_def_new (CamelMarshal marshal, guint n_params, ...) -{ - CamelFuncDef *func_def; - va_list args; - GtkType type; - int i; - - func_def = g_new (CamelFuncDef, 1); - func_def->marshal = marshal; - func_def->n_params = n_params; - func_def->params_type = g_new (GtkType, n_params); - - va_start (args, n_params); - for (i=0; i<n_params; i++) { - type = va_arg (args, GtkType); - func_def->params_type [i] = type; - } - va_end (args); - - return func_def; -} - - - - -static gboolean -_collect_params (GtkArg *params, - CamelFuncDef *func_def, - va_list var_args) -{ - int i; - gboolean failed = FALSE; - - - for (i=0; - i<func_def->n_params; - i++, params++) - { - gchar *error; - - params->name = NULL; - params->type = (func_def->params_type) [i]; - CAMEL_ARG_COLLECT_VALUE (params, - var_args, - error); - if (error) - { - failed = TRUE; - g_free (error); - } - } - return (failed); -} - - - -/** - * camel_marshal_create_op: create an operation - * @func_def: function definition object - * @func: function to call - * - * create a function ready to be executed. The - * vari - * - * - * Return value: operation ready to be executed - **/ -CamelOp * -camel_marshal_create_op (CamelFuncDef *func_def, CamelFunc func, ...) -{ - gboolean error; - CamelOp *op; - va_list args; - - g_assert (func_def); - - op = camel_op_new (func_def); - op->func = func; - - va_start (args, func); - error = _collect_params (op->params, func_def, args); - va_end (args); - - if (error) { - camel_op_free (op); - return NULL; - } else - return (op); -} - - - - -/** - * camel_op_new: return a new CamelOp object - * - * The obtained object must be destroyed with - * camel_op_free () - * - * Return value: the newly allocated CamelOp object - **/ -CamelOp * -camel_op_new (CamelFuncDef *func_def) -{ - CamelOp *op; - - g_static_mutex_lock (&op_chunk_mutex); - if (!op_chunk) - op_chunk = g_mem_chunk_create (CamelOp, - NB_OP_CHUNKS, - G_ALLOC_AND_FREE); - g_static_mutex_unlock (&op_chunk_mutex); - - op = g_chunk_new (CamelOp, op_chunk); - op->func_def = func_def; - op->params = g_new (GtkArg, func_def->n_params); - - return op; -} - -/** - * camel_op_free: free a CamelOp object allocated with camel_op_new - * @op: CamelOp object to free - * - * Free a CamelOp object allocated with camel_op_new () - * this routine won't work with CamelOp objects allocated - * with other allocators. - **/ -void -camel_op_free (CamelOp *op) -{ - g_free (op->params); - g_chunk_free (op, op_chunk); -} - - -/** - * camel_op_run: run an operation - * @op: the operation object - * - * run an operation - * - **/ -void -camel_op_run (CamelOp *op) -{ - g_assert (op); - g_assert (op->func_def); - g_assert (op->params); - - op->func_def->marshal (op->func, op->params); -} - - - - -/** - * camel_op_set_user_data: set the private field - * @op: operation - * @user_data: private field - * - * associate a field to an operation object - **/ -void -camel_op_set_user_data (CamelOp *op, gpointer user_data) -{ - g_assert (op); - op->user_data = user_data; -} - - -/** - * camel_op_get_user_data: return the private field - * @op: operation object - * - * return the private field associated to - * an operation object. - * - * Return value: - **/ -gpointer -camel_op_get_user_data (CamelOp *op) -{ - g_assert (op); - return op->user_data; -} - - - -/* misc marshaller */ - - -typedef void (*CamelMarshal_NONE__POINTER_INT) (gpointer arg1, - gint arg2); -void camel_marshal_NONE__POINTER_INT (CamelFunc func, - GtkArg *args) -{ - CamelMarshal_NONE__POINTER_INT rfunc; - - rfunc = (CamelMarshal_NONE__POINTER_INT) func; - (* rfunc) (GTK_VALUE_POINTER(args[0]), - GTK_VALUE_INT(args[1])); -} - - - - - -typedef void (*CamelMarshal_NONE__POINTER_INT_POINTER) (gpointer arg1, - gint arg2, - gpointer arg3); -void camel_marshal_NONE__POINTER_INT_POINTER (CamelFunc func, - GtkArg *args) -{ - CamelMarshal_NONE__POINTER_INT_POINTER rfunc; - - rfunc = (CamelMarshal_NONE__POINTER_INT_POINTER) func; - (* rfunc) (GTK_VALUE_POINTER(args[0]), - GTK_VALUE_INT(args[1]), - GTK_VALUE_POINTER(args[2])); -} - - -typedef void (*CamelMarshal_NONE__POINTER_BOOL_POINTER) (gpointer arg1, - gboolean arg2, - gpointer arg3); -void camel_marshal_NONE__POINTER_BOOL_POINTER (CamelFunc func, - GtkArg *args) -{ - CamelMarshal_NONE__POINTER_BOOL_POINTER rfunc; - - rfunc = (CamelMarshal_NONE__POINTER_BOOL_POINTER) func; - (* rfunc) (GTK_VALUE_POINTER(args[0]), - GTK_VALUE_BOOL(args[1]), - GTK_VALUE_POINTER(args[2])); -} - - -typedef void (*CamelMarshal_NONE__POINTER_INT_POINTER_POINTER) (gpointer arg1, - gint arg2, - gpointer arg3, - gpointer arg4); -void camel_marshal_NONE__POINTER_INT_POINTER_POINTER (CamelFunc func, - GtkArg *args) -{ - CamelMarshal_NONE__POINTER_INT_POINTER_POINTER rfunc; - - rfunc = (CamelMarshal_NONE__POINTER_INT_POINTER_POINTER) func; - (* rfunc) (GTK_VALUE_POINTER(args[0]), - GTK_VALUE_INT(args[1]), - GTK_VALUE_POINTER(args[2]), - GTK_VALUE_POINTER(args[3])); -} - - - -typedef void (*CamelMarshal_NONE__POINTER_BOOL_POINTER_POINTER) (gpointer arg1, - gboolean arg2, - gpointer arg3, - gpointer arg4); -void camel_marshal_NONE__POINTER_BOOL_POINTER_POINTER (CamelFunc func, - GtkArg *args) -{ - CamelMarshal_NONE__POINTER_BOOL_POINTER_POINTER rfunc; - - rfunc = (CamelMarshal_NONE__POINTER_BOOL_POINTER_POINTER) func; - (* rfunc) (GTK_VALUE_POINTER(args[0]), - GTK_VALUE_BOOL(args[1]), - GTK_VALUE_POINTER(args[2]), - GTK_VALUE_POINTER(args[3])); -} - - - -typedef void (*CamelMarshal_NONE__POINTER_POINTER_POINTER) (gpointer arg1, - gpointer arg2, - gpointer arg3); -void camel_marshal_NONE__POINTER_POINTER_POINTER (CamelFunc func, - GtkArg *args) -{ - CamelMarshal_NONE__POINTER_POINTER_POINTER rfunc; - - rfunc = (CamelMarshal_NONE__POINTER_POINTER_POINTER) func; - (* rfunc) (GTK_VALUE_POINTER(args[0]), - GTK_VALUE_POINTER(args[1]), - GTK_VALUE_POINTER(args[2])); -} - - -typedef void (*CamelMarshal_NONE__INT) (gint arg1); -void camel_marshal_NONE__INT (CamelFunc func, - GtkArg *args) -{ - CamelMarshal_NONE__INT rfunc; - - rfunc = (CamelMarshal_NONE__INT) func; - (* rfunc) (GTK_VALUE_INT (args[0])); -} - - - - - - diff --git a/camel/camel-marshal-utils.h b/camel/camel-marshal-utils.h deleted file mode 100644 index d33489d2a1..0000000000 --- a/camel/camel-marshal-utils.h +++ /dev/null @@ -1,102 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* camel-maeshal-utils.h : marshal utils */ - -/* - * - * Author : - * Bertrand Guiheneuf <bertrand@helixcode.com> - * - * Copyright 1999, 2000 Helix Code, Inc. (http://www.helixcode.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA - */ - - - -#ifndef CAMEL_MARSHAL_UTILS_H -#define CAMEL_MARSHAL_UTILS_H 1 - - -#ifdef __cplusplus -extern "C" { -#pragma } -#endif /* __cplusplus }*/ - -#include <gtk/gtk.h> - - -typedef void (*CamelFunc) (); - -typedef void ( *CamelMarshal) (CamelFunc func, - GtkArg *args); - - - - - -typedef struct { - - CamelMarshal marshal; - guint n_params; - GtkType *params_type; - -} CamelFuncDef; - - - -typedef struct { - CamelFuncDef *func_def; - CamelFunc func; - GtkArg *params; - gpointer user_data; -} CamelOp; - - -CamelFuncDef * -camel_func_def_new (CamelMarshal marshal, - guint n_params, - ...); - - -CamelOp *camel_op_new (CamelFuncDef *func_def); -void camel_op_free (CamelOp *op); -void camel_op_run (CamelOp *op); -void camel_op_run_and_free (CamelOp *op); -void camel_op_set_user_data (CamelOp *op, gpointer user_data); -gpointer camel_op_get_user_data (CamelOp *op); - -CamelOp *camel_marshal_create_op (CamelFuncDef *func_def, CamelFunc func, ...); - -/* marshallers */ -void camel_marshal_NONE__POINTER_INT_POINTER (CamelFunc func, - GtkArg *args); -void camel_marshal_NONE__POINTER_BOOL_POINTER (CamelFunc func, - GtkArg *args); -void camel_marshal_NONE__POINTER_INT_POINTER_POINTER (CamelFunc func, - GtkArg *args); -void camel_marshal_NONE__POINTER_BOOL_POINTER_POINTER (CamelFunc func, - GtkArg *args); -void camel_marshal_NONE__POINTER_POINTER_POINTER (CamelFunc func, - GtkArg *args); -void camel_marshal_NONE__INT (CamelFunc func, - GtkArg *args); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* CAMEL_MARSHAL_UTILS_H */ - |