diff options
-rw-r--r-- | telepathy-glib/connection-manager.c | 38 | ||||
-rw-r--r-- | telepathy-glib/connection-manager.h | 2 | ||||
-rw-r--r-- | telepathy-glib/dbus.c | 31 | ||||
-rw-r--r-- | telepathy-glib/dbus.h | 10 | ||||
-rw-r--r-- | telepathy-glib/media-interfaces.c | 74 | ||||
-rw-r--r-- | telepathy-glib/media-interfaces.h | 3 |
6 files changed, 137 insertions, 21 deletions
diff --git a/telepathy-glib/connection-manager.c b/telepathy-glib/connection-manager.c index 6de496c6e..e6cf70539 100644 --- a/telepathy-glib/connection-manager.c +++ b/telepathy-glib/connection-manager.c @@ -1383,14 +1383,46 @@ tp_connection_manager_set_property (GObject *object, } } +/** + * tp_connection_manager_init_known_interfaces: + * + * Ensure that the known interfaces for TpConnectionManager 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_CONNECTION_MANAGER. + * + * Since: 0.7.UNRELEASED + */ +void +tp_connection_manager_init_known_interfaces (void) +{ + static gsize once = 0; + + if (g_once_init_enter (&once)) + { + GType tp_type = TP_TYPE_CONNECTION_MANAGER; + + tp_proxy_init_known_interfaces (); + tp_proxy_or_subclass_hook_on_interface_add (tp_type, + tp_cli_connection_manager_add_signals); + tp_proxy_subclass_add_error_mapping (tp_type, + TP_ERROR_PREFIX, TP_ERRORS, TP_TYPE_ERROR); + + g_once_init_leave (&once, 1); + } +} + static void tp_connection_manager_class_init (TpConnectionManagerClass *klass) { - GType tp_type = TP_TYPE_CONNECTION_MANAGER; TpProxyClass *proxy_class = (TpProxyClass *) klass; GObjectClass *object_class = (GObjectClass *) klass; GParamSpec *param_spec; + tp_connection_manager_init_known_interfaces (); + g_type_class_add_private (klass, sizeof (TpConnectionManagerPrivate)); object_class->constructor = tp_connection_manager_constructor; @@ -1400,10 +1432,6 @@ tp_connection_manager_class_init (TpConnectionManagerClass *klass) object_class->finalize = tp_connection_manager_finalize; proxy_class->interface = TP_IFACE_QUARK_CONNECTION_MANAGER; - tp_proxy_or_subclass_hook_on_interface_add (tp_type, - tp_cli_connection_manager_add_signals); - tp_proxy_subclass_add_error_mapping (tp_type, - TP_ERROR_PREFIX, TP_ERRORS, TP_TYPE_ERROR); /** * TpConnectionManager:info-source: diff --git a/telepathy-glib/connection-manager.h b/telepathy-glib/connection-manager.h index 5cadfd7a7..d8a97fa18 100644 --- a/telepathy-glib/connection-manager.h +++ b/telepathy-glib/connection-manager.h @@ -166,6 +166,8 @@ gboolean tp_connection_manager_param_is_dbus_property ( gboolean tp_connection_manager_param_get_default ( const TpConnectionManagerParam *param, GValue *value); +void tp_connection_manager_init_known_interfaces (void); + G_END_DECLS #include <telepathy-glib/_gen/tp-cli-connection-manager.h> 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 */ diff --git a/telepathy-glib/dbus.h b/telepathy-glib/dbus.h index 966cc8dc4..702e6601f 100644 --- a/telepathy-glib/dbus.h +++ b/telepathy-glib/dbus.h @@ -54,6 +54,8 @@ TpDBusDaemon *tp_dbus_daemon_dup (GError **error); TpDBusDaemon *tp_dbus_daemon_new (DBusGConnection *connection); +void tp_dbus_daemon_init_known_interfaces (void); + typedef void (*TpDBusDaemonNameOwnerChangedCb) (TpDBusDaemon *bus_daemon, const gchar *name, const gchar *new_owner, gpointer user_data); @@ -160,12 +162,12 @@ tp_asv_get_strv (const GHashTable *asv, const gchar *key); void tp_asv_set_strv (GHashTable *asv, const gchar *key, gchar **value); void tp_asv_dump (GHashTable *asv); -G_END_DECLS - -#include <telepathy-glib/_gen/tp-cli-dbus-daemon.h> - #ifndef TP_DISABLE_DEPRECATED DBusGProxy * tp_get_bus_proxy (void) G_GNUC_DEPRECATED; #endif +G_END_DECLS + +#include <telepathy-glib/_gen/tp-cli-dbus-daemon.h> + #endif /* __TELEPATHY_DBUS_H__ */ diff --git a/telepathy-glib/media-interfaces.c b/telepathy-glib/media-interfaces.c index 296a370cc..0dcfd9c9b 100644 --- a/telepathy-glib/media-interfaces.c +++ b/telepathy-glib/media-interfaces.c @@ -79,15 +79,11 @@ tp_media_stream_handler_init (TpMediaStreamHandler *self) static void tp_media_stream_handler_class_init (TpMediaStreamHandlerClass *klass) { - GType tp_type = TP_TYPE_MEDIA_STREAM_HANDLER; TpProxyClass *proxy_class = (TpProxyClass *) klass; proxy_class->must_have_unique_name = TRUE; proxy_class->interface = TP_IFACE_QUARK_MEDIA_STREAM_HANDLER; - tp_proxy_or_subclass_hook_on_interface_add (tp_type, - tp_cli_media_stream_handler_add_signals); - tp_proxy_subclass_add_error_mapping (tp_type, - TP_ERROR_PREFIX, TP_ERRORS, TP_TYPE_ERROR); + tp_media_stream_handler_init_known_interfaces (); } /** @@ -167,15 +163,11 @@ tp_media_session_handler_init (TpMediaSessionHandler *self) static void tp_media_session_handler_class_init (TpMediaSessionHandlerClass *klass) { - GType tp_type = TP_TYPE_MEDIA_SESSION_HANDLER; TpProxyClass *proxy_class = (TpProxyClass *) klass; proxy_class->must_have_unique_name = TRUE; proxy_class->interface = TP_IFACE_QUARK_MEDIA_SESSION_HANDLER; - tp_proxy_or_subclass_hook_on_interface_add (tp_type, - tp_cli_media_session_handler_add_signals); - tp_proxy_subclass_add_error_mapping (tp_type, - TP_ERROR_PREFIX, TP_ERRORS, TP_TYPE_ERROR); + tp_media_session_handler_init_known_interfaces (); } /** @@ -216,3 +208,65 @@ tp_media_session_handler_new (TpDBusDaemon *dbus, finally: return ret; } + +/** + * tp_media_stream_handler_init_known_interfaces: + * + * Ensure that the known interfaces for TpMediaStreamHandler 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_MEDIA_STREAM_HANDLER. + * + * Since: 0.7.UNRELEASED + */ +void +tp_media_stream_handler_init_known_interfaces (void) +{ + static gsize once = 0; + + if (g_once_init_enter (&once)) + { + GType tp_type = TP_TYPE_MEDIA_STREAM_HANDLER; + + tp_proxy_init_known_interfaces (); + tp_proxy_or_subclass_hook_on_interface_add (tp_type, + tp_cli_media_stream_handler_add_signals); + tp_proxy_subclass_add_error_mapping (tp_type, + TP_ERROR_PREFIX, TP_ERRORS, TP_TYPE_ERROR); + + g_once_init_leave (&once, 1); + } +} + +/** + * tp_media_session_handler_init_known_interfaces: + * + * Ensure that the known interfaces for TpMediaSessionHandler 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_MEDIA_SESSION_HANDLER. + * + * Since: 0.7.UNRELEASED + */ +void +tp_media_session_handler_init_known_interfaces (void) +{ + static gsize once = 0; + + if (g_once_init_enter (&once)) + { + GType tp_type = TP_TYPE_MEDIA_SESSION_HANDLER; + + tp_proxy_init_known_interfaces (); + tp_proxy_or_subclass_hook_on_interface_add (tp_type, + tp_cli_media_session_handler_add_signals); + tp_proxy_subclass_add_error_mapping (tp_type, + TP_ERROR_PREFIX, TP_ERRORS, TP_TYPE_ERROR); + + g_once_init_leave (&once, 1); + } +} diff --git a/telepathy-glib/media-interfaces.h b/telepathy-glib/media-interfaces.h index 6b441aa8b..497af8a51 100644 --- a/telepathy-glib/media-interfaces.h +++ b/telepathy-glib/media-interfaces.h @@ -77,6 +77,9 @@ TpMediaSessionHandler *tp_media_session_handler_new (TpDBusDaemon *dbus, TpMediaStreamHandler *tp_media_stream_handler_new (TpDBusDaemon *dbus, const gchar *unique_name, const gchar *object_path, GError **error); +void tp_media_session_handler_init_known_interfaces (void); +void tp_media_stream_handler_init_known_interfaces (void); + G_END_DECLS #include <telepathy-glib/_gen/tp-cli-media-session-handler.h> |