diff options
author | Not Zed <NotZed@Ximian.com> | 2004-11-04 13:34:05 +0800 |
---|---|---|
committer | Michael Zucci <zucchi@src.gnome.org> | 2004-11-04 13:34:05 +0800 |
commit | 0b736de5187a40f7e2c1414387cc8251e8d5ac9a (patch) | |
tree | 7daaedce122b86bda5dc333808c705e67e40c0f6 /camel/camel-store.c | |
parent | 584ff682e56b90d2a20dc77250ab691a525a2873 (diff) | |
download | gsoc2013-evolution-0b736de5187a40f7e2c1414387cc8251e8d5ac9a.tar gsoc2013-evolution-0b736de5187a40f7e2c1414387cc8251e8d5ac9a.tar.gz gsoc2013-evolution-0b736de5187a40f7e2c1414387cc8251e8d5ac9a.tar.bz2 gsoc2013-evolution-0b736de5187a40f7e2c1414387cc8251e8d5ac9a.tar.lz gsoc2013-evolution-0b736de5187a40f7e2c1414387cc8251e8d5ac9a.tar.xz gsoc2013-evolution-0b736de5187a40f7e2c1414387cc8251e8d5ac9a.tar.zst gsoc2013-evolution-0b736de5187a40f7e2c1414387cc8251e8d5ac9a.zip |
check interfaces for events too. (camel_object_trigger_event): check
2004-11-02 Not Zed <NotZed@Ximian.com>
* camel-object.c (camel_object_hook_event): check interfaces for
events too.
(camel_object_trigger_event): check interfaces for events too.
(camel_object_class_add_event): more checks for interfaces vs
normal object classes.
(camel_object_class_add_interface): add an interface to a class.
(camel_object_get_interface): query for interfaces on an object.
(camel_object_get_type): register the interface type.
svn path=/trunk/; revision=27834
Diffstat (limited to 'camel/camel-store.c')
-rw-r--r-- | camel/camel-store.c | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/camel/camel-store.c b/camel/camel-store.c index 4075170eb8..3ae83bdbca 100644 --- a/camel/camel-store.c +++ b/camel/camel-store.c @@ -1204,3 +1204,58 @@ camel_store_folder_uri_equal (CamelStore *store, const char *uri0, const char *u return equal; } + +/* subscriptions interface */ + +static void +cis_interface_init (CamelISubscribe *cis) +{ + camel_object_class_add_event((CamelType)cis, "subscribed", NULL); + camel_object_class_add_event((CamelType)cis, "unsubscribed", NULL); +} + +CamelType camel_isubscribe_get_type (void) +{ + static CamelType camel_isubscribe_type = CAMEL_INVALID_TYPE; + + if (camel_isubscribe_type == CAMEL_INVALID_TYPE) { + camel_isubscribe_type = camel_interface_register (CAMEL_INTERFACE_TYPE, "CamelISubscribe", + sizeof (CamelISubscribe), + (CamelObjectClassInitFunc) cis_interface_init, + NULL); + } + + return camel_isubscribe_type; +} + +gboolean camel_isubscribe_subscribed(CamelStore *store, const char *name) +{ + CamelISubscribe *iface = camel_object_get_interface(store, camel_isubscribe_get_type()); + + if (iface && iface->subscribed) + return iface->subscribed(store, name); + + g_warning("Trying to invoke unimplemented subscribed method on a store"); + return FALSE; +} + +void camel_isubscribe_subscribe(CamelStore *store, const char *folder_name, CamelException *ex) +{ + CamelISubscribe *iface = camel_object_get_interface(store, camel_isubscribe_get_type()); + + if (iface && iface->subscribe) + return iface->subscribe(store, folder_name, ex); + + g_warning("Trying to invoke unimplemented subscribe method on a store"); +} + +void camel_isubscribe_unsubscribe(CamelStore *store, const char *folder_name, CamelException *ex) +{ + CamelISubscribe *iface = camel_object_get_interface(store, camel_isubscribe_get_type()); + + if (iface && iface->unsubscribe) + return iface->unsubscribe(store, folder_name, ex); + + g_warning("Trying to invoke unimplemented unsubscribe method on a store"); +} + |