diff options
author | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2009-06-10 15:20:08 +0100 |
---|---|---|
committer | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2009-06-10 15:21:59 +0100 |
commit | 30c621196a9a5ed32d9cfbd4697f52c27a398ade (patch) | |
tree | e0318db6a8b56932dd254dfcfd8a5170039aeb66 /telepathy-glib/channel-dispatcher.c | |
parent | c85d9262108a830d0dee3b42ef73e9691e3ecdac (diff) | |
download | telepathy-glib-30c621196a9a5ed32d9cfbd4697f52c27a398ade.tar.gz |
spec 0.17.26 classes: make safe to extend
Diffstat (limited to 'telepathy-glib/channel-dispatcher.c')
-rw-r--r-- | telepathy-glib/channel-dispatcher.c | 37 |
1 files changed, 32 insertions, 5 deletions
diff --git a/telepathy-glib/channel-dispatcher.c b/telepathy-glib/channel-dispatcher.c index 7ec49d866..d688b8746 100644 --- a/telepathy-glib/channel-dispatcher.c +++ b/telepathy-glib/channel-dispatcher.c @@ -100,7 +100,6 @@ tp_channel_dispatcher_constructed (GObject *object) static void tp_channel_dispatcher_class_init (TpChannelDispatcherClass *klass) { - GType tp_type = TP_TYPE_CHANNEL_DISPATCHER; TpProxyClass *proxy_class = (TpProxyClass *) klass; GObjectClass *object_class = (GObjectClass *) klass; @@ -109,10 +108,38 @@ tp_channel_dispatcher_class_init (TpChannelDispatcherClass *klass) object_class->constructed = tp_channel_dispatcher_constructed; proxy_class->interface = TP_IFACE_QUARK_CHANNEL_DISPATCHER; - tp_proxy_or_subclass_hook_on_interface_add (tp_type, - tp_cli_channel_dispatcher_add_signals); - tp_proxy_subclass_add_error_mapping (tp_type, - TP_ERROR_PREFIX, TP_ERRORS, TP_TYPE_ERROR); + tp_channel_dispatcher_init_known_interfaces (); +} + +/** + * tp_channel_dispatcher_init_known_interfaces: + * + * Ensure that the known interfaces for TpChannelDispatcher have been set up. + * This is done automatically when necessary, but for correct + * overriding of library interfaces by local extensions, you should + * call this function before calling + * tp_proxy_or_subclass_hook_on_interface_add() with first argument + * %TP_TYPE_CHANNEL_DISPATCHER. + * + * Since: 0.7.UNRELEASED + */ +void +tp_channel_dispatcher_init_known_interfaces (void) +{ + static gsize once = 0; + + if (g_once_init_enter (&once)) + { + GType tp_type = TP_TYPE_CHANNEL_DISPATCHER; + + tp_proxy_init_known_interfaces (); + tp_proxy_or_subclass_hook_on_interface_add (tp_type, + tp_cli_channel_dispatcher_add_signals); + tp_proxy_subclass_add_error_mapping (tp_type, + TP_ERROR_PREFIX, TP_ERRORS, TP_TYPE_ERROR); + + g_once_init_leave (&once, 1); + } } /** |