diff options
-rw-r--r-- | telepathy-glib/base-channel.c | 4 | ||||
-rw-r--r-- | telepathy-glib/base-connection.c | 11 | ||||
-rw-r--r-- | telepathy-glib/channel-manager-request.c | 13 | ||||
-rw-r--r-- | telepathy-glib/exportable-channel.c | 18 | ||||
-rw-r--r-- | tests/dbus/channel.c | 14 | ||||
-rw-r--r-- | tests/dbus/dbus-tube.c | 10 | ||||
-rw-r--r-- | tests/dbus/file-transfer-channel.c | 6 | ||||
-rw-r--r-- | tests/dbus/stream-tube.c | 10 | ||||
-rw-r--r-- | tests/dbus/text-channel.c | 10 | ||||
-rw-r--r-- | tests/lib/simple-conn.c | 21 |
10 files changed, 75 insertions, 42 deletions
diff --git a/telepathy-glib/base-channel.c b/telepathy-glib/base-channel.c index 8d7bd90a2..e8eecb89b 100644 --- a/telepathy-glib/base-channel.c +++ b/telepathy-glib/base-channel.c @@ -304,6 +304,7 @@ #include <dbus/dbus-glib-lowlevel.h> +#include <telepathy-glib/asv.h> #include <telepathy-glib/channel-iface.h> #include <telepathy-glib/dbus.h> #include <telepathy-glib/exportable-channel.h> @@ -885,7 +886,8 @@ tp_base_channel_get_property (GObject *object, if (klass->fill_immutable_properties) klass->fill_immutable_properties (chan, properties); - g_value_take_boxed (value, properties); + g_value_set_variant (value, tp_asv_to_vardict (properties)); + g_hash_table_unref (properties); } break; default: diff --git a/telepathy-glib/base-connection.c b/telepathy-glib/base-connection.c index 4d8c716c7..ce8480813 100644 --- a/telepathy-glib/base-connection.c +++ b/telepathy-glib/base-connection.c @@ -561,15 +561,18 @@ get_channel_details (GObject *obj) { GValueArray *structure; GHashTable *table; + GVariant *variant; gchar *object_path; g_assert (TP_IS_EXPORTABLE_CHANNEL (obj)); g_object_get (obj, "object-path", &object_path, - "channel-properties", &table, + "channel-properties", &variant, NULL); + table = tp_asv_from_vardict (variant); + structure = tp_value_array_build (2, DBUS_TYPE_G_OBJECT_PATH, object_path, TP_HASH_TYPE_QUALIFIED_PROPERTY_VALUE_MAP, table, @@ -577,6 +580,7 @@ get_channel_details (GObject *obj) g_free (object_path); g_hash_table_unref (table); + g_variant_unref (variant); return structure; } @@ -667,6 +671,7 @@ manager_new_channel_cb (TpChannelManager *manager, TpBaseConnection *self) { gchar *path; + GVariant *variant; GHashTable *props; g_assert (TP_IS_CHANNEL_MANAGER (manager)); @@ -677,14 +682,16 @@ manager_new_channel_cb (TpChannelManager *manager, g_object_get (channel, "object-path", &path, - "channel-properties", &props, + "channel-properties", &variant, NULL); + props = tp_asv_from_vardict (variant); tp_svc_connection_interface_requests_emit_new_channel (self, path, props); g_free (path); g_hash_table_unref (props); + g_variant_unref (variant); } diff --git a/telepathy-glib/channel-manager-request.c b/telepathy-glib/channel-manager-request.c index e2ece2e30..65b9ddcbd 100644 --- a/telepathy-glib/channel-manager-request.c +++ b/telepathy-glib/channel-manager-request.c @@ -143,7 +143,7 @@ _tp_channel_manager_request_satisfy (TpChannelManagerRequest *self, TpExportableChannel *channel) { gchar *object_path; - GHashTable *properties; + GVariant *properties; g_return_if_fail (TP_IS_EXPORTABLE_CHANNEL (channel)); g_return_if_fail (self->context != NULL); @@ -160,13 +160,14 @@ _tp_channel_manager_request_satisfy (TpChannelManagerRequest *self, switch (self->method) { case TP_CHANNEL_MANAGER_REQUEST_METHOD_CREATE_CHANNEL: - tp_svc_connection_interface_requests_return_from_create_channel ( - self->context, object_path, properties); + g_dbus_method_invocation_return_value (self->context, + g_variant_new ("(o@a{sv})", object_path, properties)); break; case TP_CHANNEL_MANAGER_REQUEST_METHOD_ENSURE_CHANNEL: - tp_svc_connection_interface_requests_return_from_ensure_channel ( - self->context, self->yours, object_path, properties); + g_dbus_method_invocation_return_value (self->context, + g_variant_new ("(bo@a{sv})", self->yours, object_path, + properties)); break; default: @@ -176,7 +177,7 @@ _tp_channel_manager_request_satisfy (TpChannelManagerRequest *self, self->context = NULL; g_free (object_path); - g_hash_table_unref (properties); + g_variant_unref (properties); } void diff --git a/telepathy-glib/exportable-channel.c b/telepathy-glib/exportable-channel.c index 2fb2edbda..a765595f8 100644 --- a/telepathy-glib/exportable-channel.c +++ b/telepathy-glib/exportable-channel.c @@ -88,7 +88,7 @@ exportable_channel_base_init (gpointer klass) * * The D-Bus properties to be announced in the NewChannels signal * and in the Channels property, as a map from - * interface.name.propertyname to GValue. + * interface.name.propertyname to variant. * * A channel's immutable properties are constant for its lifetime on the * bus, so this property should only change when the closed signal is @@ -105,16 +105,14 @@ exportable_channel_base_init (gpointer klass) * * <informalexample><programlisting> * case PROP_CHANNEL_PROPERTIES: - * g_value_take_boxed (value, - * tp_dbus_properties_mixin_make_properties_hash (object, + * { + * GHashTable *hash = tp_dbus_properties_mixin_make_properties_hash (object, * // The spec says these properties MUST be included: * TP_IFACE_CHANNEL, "TargetHandle", * TP_IFACE_CHANNEL, "TargetEntityType", * TP_IFACE_CHANNEL, "ChannelType", * TP_IFACE_CHANNEL, "TargetID", * TP_IFACE_CHANNEL, "Requested", - * // These aren't mandatory as of spec 0.17.17 - * // (but they should be): * TP_IFACE_CHANNEL, "InitiatorHandle", * TP_IFACE_CHANNEL, "InitiatorID", * TP_IFACE_CHANNEL, "Interfaces", @@ -122,13 +120,17 @@ exportable_channel_base_init (gpointer klass) * TP_IFACE_CHANNEL_INTERFACE_MESSAGES, "SupportedContentTypes", * // etc. * NULL)); + * + * g_value_set_variant (value, tp_asv_to_vardict (hash)); + * g_hash_table_unref (hash); + * } * break; * </programlisting></informalexample> */ - param_spec = g_param_spec_boxed ("channel-properties", + param_spec = g_param_spec_variant ("channel-properties", "Channel properties", - "The channel properties", - TP_HASH_TYPE_QUALIFIED_PROPERTY_VALUE_MAP, + "The channel's immutable properties", + G_VARIANT_TYPE_VARDICT, NULL, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS); g_object_interface_install_property (klass, param_spec); diff --git a/tests/dbus/channel.c b/tests/dbus/channel.c index c3da0f69a..1de49ca36 100644 --- a/tests/dbus/channel.c +++ b/tests/dbus/channel.c @@ -46,7 +46,7 @@ create_contact_chan (Test *test) { gchar *chan_path; TpHandle handle; - GHashTable *props; + GVariant *props; tp_clear_object (&test->chan_contact_service); tp_clear_object (&test->chan_room_service); @@ -76,20 +76,21 @@ create_contact_chan (Test *test) "channel-properties", &props, NULL); - test->channel_contact = tp_tests_channel_new_from_properties (test->connection, + test->channel_contact = tp_client_factory_ensure_channel ( + tp_proxy_get_factory (test->connection), test->connection, chan_path, props, &test->error); g_assert_no_error (test->error); g_free (chan_path); - g_hash_table_unref (props); + g_variant_unref (props); } static void create_room_chan (Test *test) { gchar *chan_path; - GHashTable *props; + GVariant *props; tp_clear_object (&test->chan_room_service); @@ -111,7 +112,8 @@ create_room_chan (Test *test) "channel-properties", &props, NULL); - test->channel_room = tp_tests_channel_new_from_properties (test->connection, + test->channel_room = tp_client_factory_ensure_channel ( + tp_proxy_get_factory (test->connection), test->connection, chan_path, props, &test->error); g_assert_no_error (test->error); @@ -120,7 +122,7 @@ create_room_chan (Test *test) g_free (chan_path); - g_hash_table_unref (props); + g_variant_unref (props); } static void diff --git a/tests/dbus/dbus-tube.c b/tests/dbus/dbus-tube.c index 1c2486755..fd72421a6 100644 --- a/tests/dbus/dbus-tube.c +++ b/tests/dbus/dbus-tube.c @@ -86,7 +86,7 @@ create_tube_service (Test *test, { gchar *chan_path; TpHandle handle, alf_handle; - GHashTable *props; + GVariant *props; GType type; TpClientFactory *factory; @@ -136,18 +136,20 @@ create_tube_service (Test *test, NULL); /* Create client-side tube channel object */ - g_object_get (test->tube_chan_service, "channel-properties", &props, NULL); + g_object_get (test->tube_chan_service, + "channel-properties", &props, + NULL); factory = tp_proxy_get_factory (test->connection); test->tube = (TpDBusTubeChannel *) tp_client_factory_ensure_channel ( - factory, test->connection, chan_path, tp_asv_to_vardict (props), + factory, test->connection, chan_path, props, &test->error); g_assert (TP_IS_DBUS_TUBE_CHANNEL (test->tube)); g_assert_no_error (test->error); g_free (chan_path); - g_hash_table_unref (props); + g_variant_unref (props); } /* Test Basis */ diff --git a/tests/dbus/file-transfer-channel.c b/tests/dbus/file-transfer-channel.c index cd56b1ebf..4c946c07c 100644 --- a/tests/dbus/file-transfer-channel.c +++ b/tests/dbus/file-transfer-channel.c @@ -158,7 +158,7 @@ create_file_transfer_channel (Test *test, TpClientFactory *factory; gchar *chan_path; TpHandle handle, alf_handle; - GHashTable *props; + GVariant *props; GHashTable *sockets; GHashTable *metadata; GQuark features[] = { TP_FILE_TRANSFER_CHANNEL_FEATURE_CORE, 0}; @@ -217,7 +217,7 @@ create_file_transfer_channel (Test *test, factory = tp_proxy_get_factory (test->connection); test->channel = TP_FILE_TRANSFER_CHANNEL (tp_client_factory_ensure_channel ( - factory, test->connection, chan_path, tp_asv_to_vardict (props), + factory, test->connection, chan_path, props, &test->error)); g_assert_no_error (test->error); g_assert (TP_IS_FILE_TRANSFER_CHANNEL (test->channel)); @@ -231,7 +231,7 @@ create_file_transfer_channel (Test *test, g_free (chan_path); g_hash_table_unref (metadata); - g_hash_table_unref (props); + g_variant_unref (props); g_hash_table_unref (sockets); } diff --git a/tests/dbus/stream-tube.c b/tests/dbus/stream-tube.c index a384297b6..a52b4136d 100644 --- a/tests/dbus/stream-tube.c +++ b/tests/dbus/stream-tube.c @@ -152,7 +152,7 @@ create_tube_service (Test *test, TpClientFactory *factory; gchar *chan_path; TpHandle handle, alf_handle; - GHashTable *props; + GVariant *props; GHashTable *sockets; GType type; @@ -218,17 +218,19 @@ create_tube_service (Test *test, NULL); /* Create client-side tube channel object */ - g_object_get (test->tube_chan_service, "channel-properties", &props, NULL); + g_object_get (test->tube_chan_service, + "channel-properties", &props, + NULL); factory = tp_proxy_get_factory (test->connection); test->tube = TP_STREAM_TUBE_CHANNEL (tp_client_factory_ensure_channel ( - factory, test->connection, chan_path, tp_asv_to_vardict (props), + factory, test->connection, chan_path, props, &test->error)); g_assert_no_error (test->error); g_assert (TP_IS_STREAM_TUBE_CHANNEL (test->tube)); g_free (chan_path); - g_hash_table_unref (props); + g_variant_unref (props); g_hash_table_unref (sockets); } diff --git a/tests/dbus/text-channel.c b/tests/dbus/text-channel.c index 3466cc004..0bde7871f 100644 --- a/tests/dbus/text-channel.c +++ b/tests/dbus/text-channel.c @@ -54,7 +54,7 @@ create_contact_chan (Test *test) { TpClientFactory *factory; gchar *chan_path; - GHashTable *props; + GVariant *props; tp_clear_object (&test->chan_service); tp_clear_object (&test->sms_chan_service); @@ -84,12 +84,12 @@ create_contact_chan (Test *test) factory = tp_proxy_get_factory (test->connection); test->channel = TP_TEXT_CHANNEL (tp_client_factory_ensure_channel (factory, - test->connection, chan_path, tp_asv_to_vardict (props), &test->error)); + test->connection, chan_path, props, &test->error)); g_assert_no_error (test->error); g_assert (TP_IS_TEXT_CHANNEL (test->channel)); g_free (chan_path); - g_hash_table_unref (props); + g_variant_unref (props); /* Register channel implementing SMS */ chan_path = g_strdup_printf ("%s/ChannelSMS", @@ -108,13 +108,13 @@ create_contact_chan (Test *test) NULL); test->sms_channel = TP_TEXT_CHANNEL (tp_client_factory_ensure_channel ( - factory, test->connection, chan_path, tp_asv_to_vardict (props), + factory, test->connection, chan_path, props, &test->error)); g_assert_no_error (test->error); g_assert (TP_IS_TEXT_CHANNEL (test->sms_channel)); g_free (chan_path); - g_hash_table_unref (props); + g_variant_unref (props); } static void diff --git a/tests/lib/simple-conn.c b/tests/lib/simple-conn.c index be1934de7..6b2f4923c 100644 --- a/tests/lib/simple-conn.c +++ b/tests/lib/simple-conn.c @@ -335,7 +335,15 @@ tp_tests_simple_connection_ensure_text_chan (TpTestsSimpleConnection *self, g_object_get (chan, "object-path", &chan_path, NULL); if (props != NULL) - g_object_get (chan, "channel-properties", props, NULL); + { + GVariant *tmp; + + g_object_get (chan, + "channel-properties", &tmp, + NULL); + *props = tp_asv_from_vardict (tmp); + g_variant_unref (tmp); + } return chan_path; } @@ -379,8 +387,15 @@ tp_tests_simple_connection_ensure_room_list_chan (TpTestsSimpleConnection *self, } if (props != NULL) - g_object_get (self->priv->room_list_chan, - "channel-properties", props, NULL); + { + GVariant *tmp; + + g_object_get (self->priv->room_list_chan, + "channel-properties", &tmp, + NULL); + *props = tp_asv_from_vardict (tmp); + g_variant_unref (tmp); + } return chan_path; } |