diff options
author | Not Zed <NotZed@Ximian.com> | 2002-06-03 10:56:35 +0800 |
---|---|---|
committer | Michael Zucci <zucchi@src.gnome.org> | 2002-06-03 10:56:35 +0800 |
commit | d0a6ed17b65560ed07ed005b38fab449dc507aef (patch) | |
tree | 11288ede158ffadd5a00ac0e3c6f527deb99221c /camel/camel-object.c | |
parent | aa3bfbe4224ff1c99d358aeac464ce7e9f0963a8 (diff) | |
download | gsoc2013-evolution-d0a6ed17b65560ed07ed005b38fab449dc507aef.tar.gz gsoc2013-evolution-d0a6ed17b65560ed07ed005b38fab449dc507aef.tar.zst gsoc2013-evolution-d0a6ed17b65560ed07ed005b38fab449dc507aef.zip |
setup/free the mech string.
2002-06-02 Not Zed <NotZed@Ximian.com>
* camel-sasl.c (camel_sasl_new):
(camel_sasl_finalize): setup/free the mech string.
* camel-sasl.h: Added 'mech' mechanism string.
2002-06-01 Not Zed <NotZed@Ximian.com>
* providers/imap/camel-imap-folder.c (imap_getv): Implement. Only
the object_description arg.
(camel_imap_folder_get_type): Init parent_class holder.
* providers/local/camel-local-folder.c (local_getv): Implement,
object_description arg.
* camel-folder.c (folder_getv): Implement, add a bunch of args you
can get -> camel_folder_get_unread_count etc will be going RSN i
hope.
(camel_folder_finalize): Free cached description string.
* camel-object.c (cobject_getv): Implement
CAMEL_OBJECT_ARG_DESCRIPTION, just return the classname of the
object.
(camel_object_getv):
(camel_object_get):
(camel_object_setv):
(camel_object_set): Take object = void *, to simplify usage.
(camel_object_setv): Removed unecessary locals.
(camel_object_getv): Same.
(camel_object_free): New method, free an arg, upto implementations
whether args are static/const or not.
(cobject_free): Implement a dummy do nothing free.
2002-05-31 Not Zed <NotZed@Ximian.com>
* camel-vee-folder.c (camel_vee_folder_get_location): new function
to get the real location (folder) (and uid) of a vfolder object.
Using the folderinfo, since we already have it, maybe it should
use the uid.
svn path=/trunk/; revision=17073
Diffstat (limited to 'camel/camel-object.c')
-rw-r--r-- | camel/camel-object.c | 64 |
1 files changed, 55 insertions, 9 deletions
diff --git a/camel/camel-object.c b/camel/camel-object.c index 48a77971f7..eebcbf35d2 100644 --- a/camel/camel-object.c +++ b/camel/camel-object.c @@ -202,6 +202,21 @@ cobject_finalise(CamelObject *o) static int cobject_getv(CamelObject *o, CamelException *ex, CamelArgGetV *args) { + int i; + guint32 tag; + + for (i=0;i<args->argc;i++) { + CamelArgGet *arg = &args->argv[i]; + + tag = arg->tag; + + switch (tag & CAMEL_ARG_TAG) { + case CAMEL_OBJECT_ARG_DESCRIPTION: + *arg->ca_str = (char *)o->klass->name; + break; + } + } + /* could have flags or stuff here? */ return 0; } @@ -214,12 +229,19 @@ cobject_setv(CamelObject *o, CamelException *ex, CamelArgV *args) } static void +cobject_free(CamelObject *o, guint32 tag, void *value) +{ + /* do nothing */ +} + +static void cobject_class_init(CamelObjectClass *klass) { klass->magic = CAMEL_OBJECT_CLASS_MAGIC; klass->getv = cobject_getv; klass->setv = cobject_setv; + klass->free = cobject_free; camel_object_class_add_event(klass, "finalize", NULL); } @@ -871,9 +893,10 @@ trigger: } /* get/set arg methods */ -int camel_object_set(CamelObject *o, CamelException *ex, ...) +int camel_object_set(void *vo, CamelException *ex, ...) { CamelArgV args; + CamelObject *o = vo; CamelObjectClass *klass = o->klass; int ret = 0; @@ -891,15 +914,16 @@ int camel_object_set(CamelObject *o, CamelException *ex, ...) return ret; } -int camel_object_setv(CamelObject *o, CamelException *ex, CamelArgV *args) +int camel_object_setv(void *vo, CamelException *ex, CamelArgV *args) { - g_return_val_if_fail(CAMEL_IS_OBJECT(o), -1); + g_return_val_if_fail(CAMEL_IS_OBJECT(vo), -1); - return o->klass->setv(o, ex, args); + return ((CamelObject *)vo)->klass->setv(vo, ex, args); } -int camel_object_get(CamelObject *o, CamelException *ex, ...) +int camel_object_get(void *vo, CamelException *ex, ...) { + CamelObject *o = vo; CamelArgGetV args; CamelObjectClass *klass = o->klass; int ret = 0; @@ -918,13 +942,35 @@ int camel_object_get(CamelObject *o, CamelException *ex, ...) return ret; } -int camel_object_getv(CamelObject *o, CamelException *ex, CamelArgGetV *args) +int camel_object_getv(void *vo, CamelException *ex, CamelArgGetV *args) { - CamelObjectClass *klass = o->klass; + g_return_val_if_fail(CAMEL_IS_OBJECT(vo), -1); - g_return_val_if_fail(CAMEL_IS_OBJECT(o), -1); + return ((CamelObject *)vo)->klass->getv(vo, ex, args); +} + +/* free an arg object, you can only free objects 1 at a time */ +void camel_object_free(void *vo, guint32 tag, void *value) +{ + g_return_if_fail(CAMEL_IS_OBJECT(vo)); + + /* We could also handle freeing of args differently + + Add a 'const' bit to the arg type field, + specifying that the object should not be freed. + + And, add free handlers for any pointer objects which are + not const. The free handlers would be hookpairs off of the + class. + + Then we handle the basic types OBJ,STR here, and pass PTR + types to their appropriate handler, without having to pass + through the invocation heirarchy of the free method. + + This would also let us copy and do other things with args + we can't do, but i can't see a use for that yet ... */ - return klass->getv(o, ex, args); + ((CamelObject *)vo)->klass->free(vo, tag, value); } static void |