From 72c03f380dc87050809af32f817f64f7a64e17f5 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Fri, 2 Mar 2012 18:18:56 +0000 Subject: [PATCH] Don't use the deprecated TpBaseChannelClass.interfaces property Bug: https://bugs.freedesktop.org/show_bug.cgi?id=48547 --- examples/cm/call/call-channel.c | 17 ++++++++++++----- examples/cm/channelspecific/room.c | 17 +++++++++++------ examples/cm/echo-message-parts/chan.c | 20 ++++++++++++++------ telepathy-glib/contact-list-channel.c | 15 +++++++++++---- tests/lib/dbus-tube-chan.c | 15 +++++++++++---- tests/lib/echo-chan.c | 15 +++++++++++---- tests/lib/file-transfer-chan.c | 4 ---- tests/lib/stream-tube-chan.c | 15 +++++++++++---- tests/lib/textchan-group.c | 17 ++++++++++++----- 9 files changed, 93 insertions(+), 42 deletions(-) diff --git a/examples/cm/call/call-channel.c b/examples/cm/call/call-channel.c index 677c495..1e67bc1 100644 --- a/examples/cm/call/call-channel.c +++ b/examples/cm/call/call-channel.c @@ -77,10 +77,17 @@ struct _ExampleCallChannelPrivate gboolean closed; }; -static const char * example_call_channel_interfaces[] = { - TP_IFACE_CHANNEL_INTERFACE_HOLD, - NULL -}; +static GPtrArray * +example_call_channel_get_interfaces (TpBaseChannel *self) +{ + GPtrArray *interfaces; + + interfaces = TP_BASE_CHANNEL_CLASS ( + example_call_channel_parent_class)->get_interfaces (self); + + g_ptr_array_add (interfaces, TP_IFACE_CHANNEL_INTERFACE_HOLD); + return interfaces; +} /* In practice you need one for audio, plus one per video (e.g. a * presentation might have separate video contents for the slides @@ -333,7 +340,7 @@ example_call_channel_class_init (ExampleCallChannelClass *klass) call_class->hangup = call_hangup; base_class->target_handle_type = TP_HANDLE_TYPE_CONTACT; - base_class->interfaces = example_call_channel_interfaces; + base_class->get_interfaces = example_call_channel_get_interfaces; base_class->close = close_channel; object_class->constructed = constructed; diff --git a/examples/cm/channelspecific/room.c b/examples/cm/channelspecific/room.c index c55d929..6e78d11 100644 --- a/examples/cm/channelspecific/room.c +++ b/examples/cm/channelspecific/room.c @@ -38,13 +38,18 @@ struct _ExampleCSHRoomChannelPrivate guint simulation_delay; }; +static GPtrArray * +example_csh_room_channel_get_interfaces (TpBaseChannel *self) +{ + GPtrArray *interfaces; -static const char * example_csh_room_channel_interfaces[] = { - TP_IFACE_CHANNEL_INTERFACE_GROUP, - TP_IFACE_CHANNEL_INTERFACE_MESSAGES, - NULL -}; + interfaces = TP_BASE_CHANNEL_CLASS (example_csh_room_channel_parent_class)-> + get_interfaces (self); + g_ptr_array_add (interfaces, TP_IFACE_CHANNEL_INTERFACE_GROUP); + g_ptr_array_add (interfaces, TP_IFACE_CHANNEL_INTERFACE_MESSAGES); + return interfaces; +}; static void example_csh_room_channel_init (ExampleCSHRoomChannel *self) @@ -392,7 +397,7 @@ example_csh_room_channel_class_init (ExampleCSHRoomChannelClass *klass) base_class->channel_type = TP_IFACE_CHANNEL_TYPE_TEXT; base_class->target_handle_type = TP_HANDLE_TYPE_ROOM; - base_class->interfaces = example_csh_room_channel_interfaces; + base_class->get_interfaces = example_csh_room_channel_get_interfaces; base_class->close = example_csh_room_channel_close; diff --git a/examples/cm/echo-message-parts/chan.c b/examples/cm/echo-message-parts/chan.c index 591692c..320f428 100644 --- a/examples/cm/echo-message-parts/chan.c +++ b/examples/cm/echo-message-parts/chan.c @@ -37,11 +37,19 @@ G_DEFINE_TYPE_WITH_CODE (ExampleEcho2Channel, /* type definition stuff */ -static const char * example_echo_2_channel_interfaces[] = { - TP_IFACE_CHANNEL_INTERFACE_MESSAGES, - TP_IFACE_CHANNEL_INTERFACE_DESTROYABLE, - TP_IFACE_CHANNEL_INTERFACE_SMS, - NULL }; +static GPtrArray * +example_echo_2_channel_get_interfaces (TpBaseChannel *self) +{ + GPtrArray *interfaces; + + interfaces = TP_BASE_CHANNEL_CLASS (example_echo_2_channel_parent_class)-> + get_interfaces (self); + + g_ptr_array_add (interfaces, TP_IFACE_CHANNEL_INTERFACE_MESSAGES); + g_ptr_array_add (interfaces, TP_IFACE_CHANNEL_INTERFACE_DESTROYABLE); + g_ptr_array_add (interfaces, TP_IFACE_CHANNEL_INTERFACE_SMS); + return interfaces; +}; enum { @@ -315,7 +323,7 @@ example_echo_2_channel_class_init (ExampleEcho2ChannelClass *klass) base_class->channel_type = TP_IFACE_CHANNEL_TYPE_TEXT; base_class->target_handle_type = TP_HANDLE_TYPE_CONTACT; - base_class->interfaces = example_echo_2_channel_interfaces; + base_class->get_interfaces = example_echo_2_channel_get_interfaces; base_class->close = example_echo_2_channel_close; base_class->fill_immutable_properties = example_echo_2_channel_fill_immutable_properties; diff --git a/telepathy-glib/contact-list-channel.c b/telepathy-glib/contact-list-channel.c index 2c7144b..cd5db35 100644 --- a/telepathy-glib/contact-list-channel.c +++ b/telepathy-glib/contact-list-channel.c @@ -58,9 +58,16 @@ G_DEFINE_TYPE_WITH_CODE (TpContactGroupChannel, _tp_contact_group_channel, group_group_iface_init); G_IMPLEMENT_INTERFACE (TP_TYPE_SVC_CHANNEL, group_channel_iface_init)) -static const gchar *contact_list_interfaces[] = { - TP_IFACE_CHANNEL_INTERFACE_GROUP, - NULL +static GPtrArray * +base_contact_list_get_interfaces (TpBaseChannel *self) +{ + GPtrArray *interfaces; + + interfaces = TP_BASE_CHANNEL_CLASS ( + _tp_base_contact_list_channel_parent_class)->get_interfaces (self); + + g_ptr_array_add (interfaces, TP_IFACE_CHANNEL_INTERFACE_GROUP); + return interfaces; }; enum @@ -282,7 +289,7 @@ _tp_base_contact_list_channel_class_init (TpBaseContactListChannelClass *cls) base_class->channel_type = TP_IFACE_CHANNEL_TYPE_CONTACT_LIST; base_class->target_handle_type = 0; /* placeholder, set in subclass */ - base_class->interfaces = contact_list_interfaces; + base_class->get_interfaces = base_contact_list_get_interfaces; base_class->close = stub_close; /* placeholder, not called */ g_object_class_install_property (object_class, PROP_MANAGER, diff --git a/tests/lib/dbus-tube-chan.c b/tests/lib/dbus-tube-chan.c index 7c615c8..96e16f2 100644 --- a/tests/lib/dbus-tube-chan.c +++ b/tests/lib/dbus-tube-chan.c @@ -111,9 +111,16 @@ G_DEFINE_ABSTRACT_TYPE_WITH_CODE (TpTestsDBusTubeChannel, /* type definition stuff */ -static const char * tp_tests_dbus_tube_channel_interfaces[] = { - TP_IFACE_CHANNEL_INTERFACE_TUBE, - NULL +static GPtrArray * +tp_tests_dbus_tube_channel_get_interfaces (TpBaseChannel *self) +{ + GPtrArray *interfaces; + + interfaces = TP_BASE_CHANNEL_CLASS ( + tp_tests_dbus_tube_channel_parent_class)->get_interfaces (self); + + g_ptr_array_add (interfaces, TP_IFACE_CHANNEL_INTERFACE_TUBE); + return interfaces; }; static void @@ -226,7 +233,7 @@ tp_tests_dbus_tube_channel_class_init (TpTestsDBusTubeChannelClass *klass) object_class->dispose = dispose; base_class->channel_type = TP_IFACE_CHANNEL_TYPE_DBUS_TUBE; - base_class->interfaces = tp_tests_dbus_tube_channel_interfaces; + base_class->get_interfaces = tp_tests_dbus_tube_channel_get_interfaces; base_class->close = channel_close; base_class->fill_immutable_properties = fill_immutable_properties; diff --git a/tests/lib/echo-chan.c b/tests/lib/echo-chan.c index 92901b9..a8f8cca 100644 --- a/tests/lib/echo-chan.c +++ b/tests/lib/echo-chan.c @@ -32,9 +32,16 @@ G_DEFINE_TYPE_WITH_CODE (TpTestsEchoChannel, /* type definition stuff */ -static const char * tp_tests_echo_channel_interfaces[] = { - TP_IFACE_CHANNEL_INTERFACE_DESTROYABLE, - NULL +static GPtrArray * +tp_tests_echo_channel_get_interfaces (TpBaseChannel *self) +{ + GPtrArray *interfaces; + + interfaces = TP_BASE_CHANNEL_CLASS (tp_tests_echo_channel_parent_class)-> + get_interfaces (self); + + g_ptr_array_add (interfaces, TP_IFACE_CHANNEL_INTERFACE_DESTROYABLE); + return interfaces; }; static void @@ -125,7 +132,7 @@ tp_tests_echo_channel_class_init (TpTestsEchoChannelClass *klass) base_class->channel_type = TP_IFACE_CHANNEL_TYPE_TEXT; base_class->target_handle_type = TP_HANDLE_TYPE_CONTACT; - base_class->interfaces = tp_tests_echo_channel_interfaces; + base_class->get_interfaces = tp_tests_echo_channel_get_interfaces; base_class->close = channel_close; tp_text_mixin_class_init (object_class, diff --git a/tests/lib/file-transfer-chan.c b/tests/lib/file-transfer-chan.c index e2e950d..06705d7 100644 --- a/tests/lib/file-transfer-chan.c +++ b/tests/lib/file-transfer-chan.c @@ -33,9 +33,6 @@ G_DEFINE_TYPE_WITH_CODE (TpTestsFileTransferChannel, NULL); ) -static const char * -tp_tests_file_transfer_channel_interfaces[] = { NULL }; - enum /* properties */ { PROP_AVAILABLE_SOCKET_TYPES = 1, @@ -603,7 +600,6 @@ tp_tests_file_transfer_channel_class_init ( base_class->channel_type = TP_IFACE_CHANNEL_TYPE_FILE_TRANSFER; base_class->target_handle_type = TP_HANDLE_TYPE_CONTACT; - base_class->interfaces = tp_tests_file_transfer_channel_interfaces; base_class->close = channel_close; base_class->fill_immutable_properties = fill_immutable_properties; diff --git a/tests/lib/stream-tube-chan.c b/tests/lib/stream-tube-chan.c index 0d1ec27..96c1019 100644 --- a/tests/lib/stream-tube-chan.c +++ b/tests/lib/stream-tube-chan.c @@ -149,9 +149,16 @@ G_DEFINE_ABSTRACT_TYPE_WITH_CODE (TpTestsStreamTubeChannel, /* type definition stuff */ -static const char * tp_tests_stream_tube_channel_interfaces[] = { - TP_IFACE_CHANNEL_INTERFACE_TUBE, - NULL +static GPtrArray * +tp_tests_stream_tube_channel_get_interfaces (TpBaseChannel *self) +{ + GPtrArray *interfaces; + + interfaces = TP_BASE_CHANNEL_CLASS ( + tp_tests_stream_tube_channel_parent_class)->get_interfaces (self); + + g_ptr_array_add (interfaces, TP_IFACE_CHANNEL_INTERFACE_TUBE); + return interfaces; }; static void @@ -262,7 +269,7 @@ tp_tests_stream_tube_channel_class_init (TpTestsStreamTubeChannelClass *klass) object_class->dispose = dispose; base_class->channel_type = TP_IFACE_CHANNEL_TYPE_STREAM_TUBE; - base_class->interfaces = tp_tests_stream_tube_channel_interfaces; + base_class->get_interfaces = tp_tests_stream_tube_channel_get_interfaces; base_class->close = channel_close; base_class->fill_immutable_properties = fill_immutable_properties; diff --git a/tests/lib/textchan-group.c b/tests/lib/textchan-group.c index fa31f93..f8c1445 100644 --- a/tests/lib/textchan-group.c +++ b/tests/lib/textchan-group.c @@ -34,10 +34,17 @@ G_DEFINE_TYPE_WITH_CODE (TpTestsTextChannelGroup, G_IMPLEMENT_INTERFACE (TP_TYPE_SVC_DBUS_PROPERTIES, tp_dbus_properties_mixin_iface_init)) -static const char *text_channel_group_interfaces[] = { - TP_IFACE_CHANNEL_INTERFACE_GROUP, - TP_IFACE_CHANNEL_INTERFACE_PASSWORD, - NULL +static GPtrArray * +text_channel_group_get_interfaces (TpBaseChannel *self) +{ + GPtrArray *interfaces; + + interfaces = TP_BASE_CHANNEL_CLASS ( + tp_tests_text_channel_group_parent_class)->get_interfaces (self); + + g_ptr_array_add (interfaces, TP_IFACE_CHANNEL_INTERFACE_GROUP); + g_ptr_array_add (interfaces, TP_IFACE_CHANNEL_INTERFACE_PASSWORD); + return interfaces; }; /* type definition stuff */ @@ -271,7 +278,7 @@ tp_tests_text_channel_group_class_init (TpTestsTextChannelGroupClass *klass) base_class->channel_type = TP_IFACE_CHANNEL_TYPE_TEXT; base_class->target_handle_type = TP_HANDLE_TYPE_NONE; - base_class->interfaces = text_channel_group_interfaces; + base_class->get_interfaces = text_channel_group_get_interfaces; base_class->close = channel_close; param_spec = g_param_spec_boolean ("detailed", -- 1.7.9.5