diff options
-rw-r--r-- | camel/ChangeLog | 9 | ||||
-rw-r--r-- | camel/camel-object.c | 20 | ||||
-rw-r--r-- | camel/camel-object.h | 8 |
3 files changed, 25 insertions, 12 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog index d08438822d..b7e8038082 100644 --- a/camel/ChangeLog +++ b/camel/ChangeLog @@ -1,3 +1,11 @@ +2002-06-27 Not Zed <NotZed@Ximian.com> + + * camel-object.c (camel_object_hook_event): Take a void object arg. + (camel_object_remove_event): " + (camel_object_unhook_event): " + (camel_object_trigger_event): ", also, execute events in the same + order they were added, i.e. reverse hook-list order. + 2002-06-28 Jeffrey Stedfast <fejj@ximian.com> * camel-gpg-context.c (gpg_ctx_get_argv): Don't use @@ -62,6 +70,7 @@ * providers/local/camel-local-provider.c (camel_provider_module_init): Removed spoold provider. The spool provider does it now. + (): Spoold doesn't exist anymore, remove its header. 2002-06-25 Not Zed <NotZed@Ximian.com> diff --git a/camel/camel-object.c b/camel/camel-object.c index 5e7eac7504..6e3b5ef54b 100644 --- a/camel/camel-object.c +++ b/camel/camel-object.c @@ -694,15 +694,16 @@ static CamelHookList *camel_object_get_hooks(CamelObject *o) #endif unsigned int -camel_object_hook_event(CamelObject * obj, const char * name, CamelObjectEventHookFunc func, void *data) +camel_object_hook_event(void *vo, const char * name, CamelObjectEventHookFunc func, void *data) { + CamelObject *obj = vo; CamelHookPair *pair, *hook; CamelHookList *hooks; int id; - g_return_val_if_fail (CAMEL_IS_OBJECT (obj), 0); - g_return_val_if_fail (name != NULL, 0); - g_return_val_if_fail (func != NULL, 0); + g_return_val_if_fail(CAMEL_IS_OBJECT (obj), 0); + g_return_val_if_fail(name != NULL, 0); + g_return_val_if_fail(func != NULL, 0); hook = obj->klass->hooks; while (hook) { @@ -736,8 +737,9 @@ setup: } void -camel_object_remove_event(CamelObject * obj, unsigned int id) +camel_object_remove_event(void *vo, unsigned int id) { + CamelObject *obj = vo; CamelHookList *hooks; CamelHookPair *pair, *parent; @@ -778,8 +780,9 @@ camel_object_remove_event(CamelObject * obj, unsigned int id) } void -camel_object_unhook_event(CamelObject * obj, const char * name, CamelObjectEventHookFunc func, void *data) +camel_object_unhook_event(void *vo, const char * name, CamelObjectEventHookFunc func, void *data) { + CamelObject *obj = vo; CamelHookList *hooks; CamelHookPair *pair, *parent; @@ -823,8 +826,9 @@ camel_object_unhook_event(CamelObject * obj, const char * name, CamelObjectEvent } void -camel_object_trigger_event (CamelObject * obj, const char * name, void *event_data) +camel_object_trigger_event(void *vo, const char * name, void *event_data) { + CamelObject *obj = vo; CamelHookList *hooks; CamelHookPair *pair, **pairs, *parent, *hook; int i, size; @@ -872,7 +876,7 @@ trigger: } /* now execute the events we have, if they haven't been removed during our calls */ - for (i=0;i<size;i++) { + for (i=size-1;i>=0;i--) { pair = pairs[i]; if ((pair->flags & CAMEL_HOOK_PAIR_REMOVED) == 0) (pair->func.event) (obj, event_data, pair->data); diff --git a/camel/camel-object.h b/camel/camel-object.h index d6b3a64575..f35d5873d3 100644 --- a/camel/camel-object.h +++ b/camel/camel-object.h @@ -201,10 +201,10 @@ void camel_object_unref(void *); #endif /* hooks */ -CamelObjectHookID camel_object_hook_event(CamelObject *obj, const char *name, CamelObjectEventHookFunc hook, void *data); -void camel_object_remove_event(CamelObject *obj, CamelObjectHookID id); -void camel_object_unhook_event(CamelObject *obj, const char *name, CamelObjectEventHookFunc hook, void *data); -void camel_object_trigger_event(CamelObject *obj, const char *name, void *event_data); +CamelObjectHookID camel_object_hook_event(void *obj, const char *name, CamelObjectEventHookFunc hook, void *data); +void camel_object_remove_event(void *obj, CamelObjectHookID id); +void camel_object_unhook_event(void *obj, const char *name, CamelObjectEventHookFunc hook, void *data); +void camel_object_trigger_event(void *obj, const char *name, void *event_data); /* get/set methods */ int camel_object_set(void *obj, struct _CamelException *ex, ...); |