summaryrefslogtreecommitdiff
path: root/tests/scanner/annotation.c
diff options
context:
space:
mode:
authorJohan Dahlin <jdahlin@litl.com>2010-05-10 19:00:14 -0300
committerJohan Dahlin <johan@gnome.org>2010-05-27 10:13:33 -0300
commite0d017ac04190d8f5dac65005b69132bbeeb35dd (patch)
tree70a9b41c8fb1961794e1de303f0767788c7696f0 /tests/scanner/annotation.c
parent15cfa49be6976c0d8a5574164feca6b0212a7f4a (diff)
downloadgobject-introspection-e0d017ac04190d8f5dac65005b69132bbeeb35dd.tar.gz
Add type annotation for properties
Add type annotation syntax for GObject properties. This makes it possible to override the type of a property. For instance, this will allow function pointers with a G_TYPE_POINTER type set to be used from a language binding which reads the typelib information in addition g_object_class_find_property. https://bugzilla.gnome.org/show_bug.cgi?id=618318
Diffstat (limited to 'tests/scanner/annotation.c')
-rw-r--r--tests/scanner/annotation.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/scanner/annotation.c b/tests/scanner/annotation.c
index e1376e4c..29e8b370 100644
--- a/tests/scanner/annotation.c
+++ b/tests/scanner/annotation.c
@@ -7,6 +7,7 @@ G_DEFINE_TYPE (AnnotationObject, annotation_object, G_TYPE_OBJECT);
enum {
PROP_0,
PROP_STRING_PROPERTY,
+ PROP_FUNCTION_PROPERTY
};
enum {
@@ -28,6 +29,8 @@ annotation_object_set_property (GObject *object,
{
case PROP_STRING_PROPERTY:
break;
+ case PROP_FUNCTION_PROPERTY:
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@@ -44,6 +47,8 @@ annotation_object_get_property (GObject *object,
{
case PROP_STRING_PROPERTY:
break;
+ case PROP_FUNCTION_PROPERTY:
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@@ -128,6 +133,17 @@ annotation_object_class_init (AnnotationObjectClass *klass)
"This property is a string",
NULL,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
+ /**
+ * AnnotationObject:function-property:
+ *
+ * Type: AnnotationCallback
+ */
+ g_object_class_install_property (gobject_class,
+ PROP_FUNCTION_PROPERTY,
+ g_param_spec_pointer ("function-property",
+ "Function property",
+ "This property is a function pointer",
+ G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
}