summaryrefslogtreecommitdiff
path: root/tests/gimarshallingtests.c
diff options
context:
space:
mode:
authorMartin Pitt <martinpitt@gnome.org>2012-11-14 07:27:50 +0100
committerMartin Pitt <martinpitt@gnome.org>2012-11-14 07:40:01 +0100
commit91d5c783c9bf73e94c1ad050bd8ef1e260d2291c (patch)
tree3d2de28341543292be2073d9c68e50ebd551d5ca /tests/gimarshallingtests.c
parentabc95859d05edc9d167ef967652327091422b682 (diff)
downloadgobject-introspection-91d5c783c9bf73e94c1ad050bd8ef1e260d2291c.tar.gz
GIMarshallingTests: Add GVariant property
Diffstat (limited to 'tests/gimarshallingtests.c')
-rw-r--r--tests/gimarshallingtests.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/gimarshallingtests.c b/tests/gimarshallingtests.c
index 04261324..c92dd10f 100644
--- a/tests/gimarshallingtests.c
+++ b/tests/gimarshallingtests.c
@@ -4624,6 +4624,7 @@ enum {
SOME_DOUBLE_PROPERTY,
SOME_STRV_PROPERTY,
SOME_BOXED_STRUCT_PROPERTY,
+ SOME_VARIANT_PROPERTY,
};
G_DEFINE_TYPE (GIMarshallingTestsPropertiesObject, gi_marshalling_tests_properties_object, G_TYPE_OBJECT);
@@ -4684,6 +4685,9 @@ gi_marshalling_tests_properties_object_get_property (GObject * object, guint pro
case SOME_BOXED_STRUCT_PROPERTY:
g_value_set_boxed (value, self->some_boxed_struct);
break;
+ case SOME_VARIANT_PROPERTY:
+ g_value_set_variant (value, self->some_variant);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
@@ -4737,6 +4741,13 @@ gi_marshalling_tests_properties_object_set_property (GObject * object, guint pro
gi_marshalling_tests_boxed_struct_free (self->some_boxed_struct);
self->some_boxed_struct = gi_marshalling_tests_boxed_struct_copy (g_value_get_boxed (value));
break;
+ case SOME_VARIANT_PROPERTY:
+ if (self->some_variant != NULL)
+ g_variant_unref (self->some_variant);
+ self->some_variant = g_value_get_variant (value);
+ if (self->some_variant != NULL)
+ g_variant_ref (self->some_variant);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
@@ -4804,6 +4815,11 @@ gi_marshalling_tests_properties_object_class_init (GIMarshallingTestsPropertiesO
g_param_spec_boxed ("some-boxed-struct", "some-boxed-struct", "some-boxed-struct",
gi_marshalling_tests_boxed_struct_get_type(),
G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT));
+
+ g_object_class_install_property (object_class, SOME_VARIANT_PROPERTY,
+ g_param_spec_variant ("some-variant", "some-variant", "some-variant",
+ G_VARIANT_TYPE_ANY, NULL,
+ G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT));
}
GIMarshallingTestsPropertiesObject*