From 9a310f9f166809569ea62e2383db8d3c24893e5a Mon Sep 17 00:00:00 2001 From: Guillaume Desmottes Date: Thu, 26 Sep 2013 14:41:05 +0200 Subject: [PATCH 4/4] simple-account: set 'parameters' as writable Some logger tests relies on this. --- tests/lib/simple-account.c | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/tests/lib/simple-account.c b/tests/lib/simple-account.c index eeead16..daa7575 100644 --- a/tests/lib/simple-account.c +++ b/tests/lib/simple-account.c @@ -75,6 +75,7 @@ struct _TpTestsSimpleAccountPrivate gchar *connection_path; gboolean enabled; GPtrArray *uri_schemes; + GHashTable *parameters; }; static void @@ -137,6 +138,8 @@ tp_tests_simple_account_init (TpTestsSimpleAccount *self) self->priv->uri_schemes = g_ptr_array_new_with_free_func (g_free); for (i = 0; uri_schemes[i] != NULL; i++) g_ptr_array_add (self->priv->uri_schemes, g_strdup (uri_schemes[i])); + + self->priv->parameters = g_hash_table_new (NULL, NULL); } static void @@ -171,7 +174,7 @@ tp_tests_simple_account_get_property (GObject *object, g_value_set_string (value, "badger"); break; case PROP_PARAMETERS: - g_value_take_boxed (value, g_hash_table_new (NULL, NULL)); + g_value_set_boxed (value, self->priv->parameters); break; case PROP_AUTOMATIC_PRESENCE: g_value_take_boxed (value, tp_value_array_build (3, @@ -278,6 +281,25 @@ tp_tests_simple_account_get_property (GObject *object, } static void +tp_tests_simple_account_set_property (GObject *object, + guint property_id, + const GValue *value, + GParamSpec *spec) +{ + TpTestsSimpleAccount *self = TP_TESTS_SIMPLE_ACCOUNT (object); + + switch (property_id) + { + case PROP_PARAMETERS: + self->priv->parameters = g_value_dup_boxed (value); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, spec); + break; + } +} + +static void tp_tests_simple_account_finalize (GObject *object) { TpTestsSimpleAccount *self = TP_TESTS_SIMPLE_ACCOUNT (object); @@ -287,6 +309,7 @@ tp_tests_simple_account_finalize (GObject *object) g_free (self->priv->connection_path); g_ptr_array_unref (self->priv->uri_schemes); + g_hash_table_unref (self->priv->parameters); G_OBJECT_CLASS (tp_tests_simple_account_parent_class)->finalize (object); } @@ -369,6 +392,7 @@ tp_tests_simple_account_class_init (TpTestsSimpleAccountClass *klass) g_type_class_add_private (klass, sizeof (TpTestsSimpleAccountPrivate)); object_class->get_property = tp_tests_simple_account_get_property; + object_class->set_property = tp_tests_simple_account_set_property; object_class->finalize = tp_tests_simple_account_finalize; param_spec = g_param_spec_boxed ("interfaces", "Extra D-Bus interfaces", @@ -410,7 +434,7 @@ tp_tests_simple_account_class_init (TpTestsSimpleAccountClass *klass) param_spec = g_param_spec_boxed ("parameters", "parameters", "Parameters property", TP_HASH_TYPE_STRING_VARIANT_MAP, - G_PARAM_READABLE | G_PARAM_STATIC_STRINGS); + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); g_object_class_install_property (object_class, PROP_PARAMETERS, param_spec); param_spec = g_param_spec_boxed ("automatic-presence", "automatic presence", -- 1.8.3.1