From c85d9262108a830d0dee3b42ef73e9691e3ecdac Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Wed, 10 Jun 2009 15:19:47 +0100 Subject: TpConnectionManager, TpDBusDaemon, media interfaces: make safe to extend As with TpChannel, a function like tp_connection_manager_init_known_interfaces needs to be called before you add signals, to ensure that extensions correctly override code in telepathy-glib itself. --- telepathy-glib/dbus.c | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) (limited to 'telepathy-glib/dbus.c') diff --git a/telepathy-glib/dbus.c b/telepathy-glib/dbus.c index 7ae06ba93..1e1bc3bf8 100644 --- a/telepathy-glib/dbus.c +++ b/telepathy-glib/dbus.c @@ -1264,20 +1264,47 @@ tp_dbus_daemon_dispose (GObject *object) G_OBJECT_CLASS (tp_dbus_daemon_parent_class)->dispose (object); } +/** + * tp_dbus_daemon_init_known_interfaces: + * + * Ensure that the known interfaces for TpDBusDaemon 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_DBUS_DAEMON. + * + * Since: 0.7.UNRELEASED + */ +void +tp_dbus_daemon_init_known_interfaces (void) +{ + static gsize once = 0; + + if (g_once_init_enter (&once)) + { + tp_proxy_init_known_interfaces (); + tp_proxy_or_subclass_hook_on_interface_add (TP_TYPE_DBUS_DAEMON, + tp_cli_dbus_daemon_add_signals); + + g_once_init_leave (&once, 1); + } +} + static void tp_dbus_daemon_class_init (TpDBusDaemonClass *klass) { TpProxyClass *proxy_class = (TpProxyClass *) klass; GObjectClass *object_class = (GObjectClass *) klass; + tp_dbus_daemon_init_known_interfaces (); + g_type_class_add_private (klass, sizeof (TpDBusDaemonPrivate)); object_class->constructor = tp_dbus_daemon_constructor; object_class->dispose = tp_dbus_daemon_dispose; proxy_class->interface = TP_IFACE_QUARK_DBUS_DAEMON; - tp_proxy_or_subclass_hook_on_interface_add (TP_TYPE_DBUS_DAEMON, - tp_cli_dbus_daemon_add_signals); } /* Auto-generated implementation of _tp_register_dbus_glib_marshallers */ -- cgit v1.2.1