gobject-introspection r1027 - in trunk: . giscanner tests/scanner
- From: johan svn gnome org
- To: svn-commits-list gnome org
- Subject: gobject-introspection r1027 - in trunk: . giscanner tests/scanner
- Date: Tue, 13 Jan 2009 00:02:24 +0000 (UTC)
Author: johan
Date: Tue Jan 13 00:02:24 2009
New Revision: 1027
URL: http://svn.gnome.org/viewvc/gobject-introspection?rev=1027&view=rev
Log:
2009-01-12 Johan Dahlin <jdahlin async com br>
Bug 562467 â Property annotation
* giscanner/annotationparser.py:
* tests/scanner/annotation-1.0-expected.gir:
* tests/scanner/annotation-1.0-expected.tgir:
* tests/scanner/annotation.c (annotation_object_set_property),
(annotation_object_get_property), (annotation_object_class_init):
Annotations are parsed for properties.
Modified:
trunk/ChangeLog
trunk/giscanner/annotationparser.py
trunk/tests/scanner/annotation-1.0-expected.gir
trunk/tests/scanner/annotation-1.0-expected.tgir
trunk/tests/scanner/annotation.c
Modified: trunk/giscanner/annotationparser.py
==============================================================================
--- trunk/giscanner/annotationparser.py (original)
+++ trunk/giscanner/annotationparser.py Tue Jan 13 00:02:24 2009
@@ -228,7 +228,7 @@
self._parse_constructors(class_.constructors)
self._parse_methods(class_.methods)
self._parse_methods(class_.static_methods)
- self._parse_properties(class_.properties)
+ self._parse_properties(class_, class_.properties)
self._parse_signals(class_, class_.signals)
self._parse_fields(class_, class_.fields)
@@ -236,7 +236,7 @@
block = self._blocks.get(interface.name)
self._parse_version(interface, block)
self._parse_methods(interface.methods)
- self._parse_properties(interface.properties)
+ self._parse_properties(interface, interface.properties)
self._parse_signals(interface, interface.signals)
self._parse_fields(interface, interface.fields)
@@ -273,9 +273,9 @@
for field in fields:
self._parse_field(parent, field)
- def _parse_properties(self, properties):
+ def _parse_properties(self, parent, properties):
for prop in properties:
- self._parse_property(property)
+ self._parse_property(parent, prop)
def _parse_methods(self, methods):
for method in methods:
@@ -285,8 +285,10 @@
for signal in signals:
self._parse_signal(parent, signal)
- def _parse_property(self, prop):
- pass
+ def _parse_property(self, parent, prop):
+ block = self._blocks.get('%s:%s' % (parent.type_name, prop.name))
+ self._parse_version(prop, block)
+ self._parse_deprecated(prop, block)
def _parse_callback(self, callback):
block = self._blocks.get(callback.ctype)
Modified: trunk/tests/scanner/annotation-1.0-expected.gir
==============================================================================
--- trunk/tests/scanner/annotation-1.0-expected.gir (original)
+++ trunk/tests/scanner/annotation-1.0-expected.gir Tue Jan 13 00:02:24 2009
@@ -314,6 +314,14 @@
<type name="GObject.Object" c:type="GObject*"/>
</return-value>
</method>
+ <property name="string-property"
+ version="1.0"
+ deprecated="Use better-string-property instead"
+ deprecated-version="1.2"
+ writable="1"
+ construct="1">
+ <type name="utf8" c:type="gchararray"/>
+ </property>
<field name="parent_instance">
<type name="GObject.Object" c:type="GObject"/>
</field>
Modified: trunk/tests/scanner/annotation-1.0-expected.tgir
==============================================================================
--- trunk/tests/scanner/annotation-1.0-expected.tgir (original)
+++ trunk/tests/scanner/annotation-1.0-expected.tgir Tue Jan 13 00:02:24 2009
@@ -297,6 +297,9 @@
<type name="GObject.Object"/>
</return-value>
</method>
+ <property name="string-property" writable="1" construct="1">
+ <type name="utf8"/>
+ </property>
<glib:signal name="string-signal" when="LAST">
<return-value transfer-ownership="full">
<type name="none"/>
Modified: trunk/tests/scanner/annotation.c
==============================================================================
--- trunk/tests/scanner/annotation.c (original)
+++ trunk/tests/scanner/annotation.c Tue Jan 13 00:02:24 2009
@@ -5,6 +5,11 @@
G_DEFINE_TYPE (AnnotationObject, annotation_object, G_TYPE_OBJECT);
enum {
+ PROP_0,
+ PROP_STRING_PROPERTY,
+};
+
+enum {
STRING_SIGNAL,
LAST_SIGNAL
};
@@ -12,12 +17,47 @@
static guint annotation_object_signals[LAST_SIGNAL] = { 0 };
static void
+annotation_object_set_property (GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ switch (prop_id)
+ {
+ case PROP_STRING_PROPERTY:
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+ }
+}
+
+static void
+annotation_object_get_property (GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ switch (prop_id)
+ {
+ case PROP_STRING_PROPERTY:
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+ }
+}
+
+static void
annotation_object_class_init (AnnotationObjectClass *klass)
{
GObjectClass *gobject_class;
gobject_class = G_OBJECT_CLASS (klass);
+ gobject_class->set_property = annotation_object_set_property;
+ gobject_class->get_property = annotation_object_get_property;
+
/**
* AnnotationObject::string-signal:
* @annotation: the annotation object
@@ -38,6 +78,23 @@
(GSignalCMarshaller)g_cclosure_marshal_VOID__POINTER,
G_TYPE_NONE, 1, G_TYPE_POINTER);
+
+ /**
+ * AnnotationObject:string-property:
+ *
+ * This is a property which is a string
+ *
+ * Since: 1.0
+ * Deprecated: 1.2: Use better-string-property instead
+ */
+ g_object_class_install_property (gobject_class,
+ PROP_STRING_PROPERTY,
+ g_param_spec_string ("string-property",
+ "String property",
+ "This property is a string",
+ NULL,
+ G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
+
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]