summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristoph Reiter <reiter.christoph@gmail.com>2017-03-28 17:50:11 +0200
committerChristoph Reiter <creiter@src.gnome.org>2017-03-28 18:12:14 +0200
commit01018a78de0fe47cb9f4b7f27b3c8c1c20b1693d (patch)
tree95439d7d6f3c476fbac78868c004190a702cfd2f
parentd95834ca0e5ccaa00ea2d28129ca8e89d37641f7 (diff)
downloadgobject-introspection-01018a78de0fe47cb9f4b7f27b3c8c1c20b1693d.tar.gz
gimarshallingtests: Add a flags and enum property
These will be used by pygobject in https://bugzilla.gnome.org/show_bug.cgi?id=726484 https://bugzilla.gnome.org/show_bug.cgi?id=780652
-rw-r--r--tests/gimarshallingtests.c30
-rw-r--r--tests/gimarshallingtests.h2
2 files changed, 32 insertions, 0 deletions
diff --git a/tests/gimarshallingtests.c b/tests/gimarshallingtests.c
index 568492c0..54702a35 100644
--- a/tests/gimarshallingtests.c
+++ b/tests/gimarshallingtests.c
@@ -5352,6 +5352,8 @@ enum
SOME_VARIANT_PROPERTY,
SOME_BOXED_GLIST_PROPERTY,
SOME_OBJECT_PROPERTY,
+ SOME_FLAGS_PROPERTY,
+ SOME_ENUM_PROPERTY,
};
G_DEFINE_TYPE (GIMarshallingTestsPropertiesObject, gi_marshalling_tests_properties_object, G_TYPE_OBJECT);
@@ -5430,6 +5432,12 @@ gi_marshalling_tests_properties_object_get_property (GObject *object,
case SOME_OBJECT_PROPERTY:
g_value_set_object (value, self->some_object);
break;
+ case SOME_FLAGS_PROPERTY:
+ g_value_set_flags (value, self->some_flags);
+ break;
+ case SOME_ENUM_PROPERTY:
+ g_value_set_enum (value, self->some_enum);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
@@ -5501,6 +5509,12 @@ gi_marshalling_tests_properties_object_set_property (GObject *object,
g_object_unref (self->some_object);
self->some_object = g_value_dup_object (value);
break;
+ case SOME_FLAGS_PROPERTY:
+ self->some_flags = g_value_get_flags (value);
+ break;
+ case SOME_ENUM_PROPERTY:
+ self->some_enum = g_value_get_enum (value);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
@@ -5631,6 +5645,22 @@ static void gi_marshalling_tests_properties_object_class_init (GIMarshallingTest
"some-object",
G_TYPE_OBJECT,
G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT));
+
+ g_object_class_install_property (object_class, SOME_FLAGS_PROPERTY,
+ g_param_spec_flags ("some-flags",
+ "some-flags",
+ "some-flags",
+ GI_MARSHALLING_TESTS_TYPE_FLAGS,
+ GI_MARSHALLING_TESTS_FLAGS_VALUE1,
+ G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT));
+
+ g_object_class_install_property (object_class, SOME_ENUM_PROPERTY,
+ g_param_spec_enum ("some-enum",
+ "some-enum",
+ "some-enum",
+ GI_MARSHALLING_TESTS_TYPE_GENUM,
+ GI_MARSHALLING_TESTS_GENUM_VALUE1,
+ G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT));
}
GIMarshallingTestsPropertiesObject *
diff --git a/tests/gimarshallingtests.h b/tests/gimarshallingtests.h
index cd1aac3a..25af019b 100644
--- a/tests/gimarshallingtests.h
+++ b/tests/gimarshallingtests.h
@@ -1972,6 +1972,8 @@ struct _GIMarshallingTestsPropertiesObject {
GList* some_boxed_glist;
GVariant *some_variant;
GObject *some_object;
+ GIMarshallingTestsFlags some_flags;
+ GIMarshallingTestsGEnum some_enum;
};
struct _GIMarshallingTestsPropertiesObjectClass {