[gobject-introspection] Add properties to Everything.TestObj for testing more types
- From: Tomeu Vizoso <tomeuv src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gobject-introspection] Add properties to Everything.TestObj for testing more types
- Date: Fri, 20 Aug 2010 12:54:05 +0000 (UTC)
commit 292d83be7145e80b1c4d3ec1baba263a7913bd82
Author: Tomeu Vizoso <tomeu vizoso collabora co uk>
Date: Fri Aug 20 14:50:41 2010 +0200
Add properties to Everything.TestObj for testing more types
gir/Everything-1.0-expected.gir | 24 ++++++++++
gir/everything.c | 90 +++++++++++++++++++++++++++++++++++++++
gir/everything.h | 4 ++
3 files changed, 118 insertions(+), 0 deletions(-)
---
diff --git a/gir/Everything-1.0-expected.gir b/gir/Everything-1.0-expected.gir
index aa7de3b..91550a9 100644
--- a/gir/Everything-1.0-expected.gir
+++ b/gir/Everything-1.0-expected.gir
@@ -472,17 +472,29 @@ case.</doc>
<property name="boxed" writable="1" transfer-ownership="none">
<type name="TestBoxed" c:type="TestBoxed"/>
</property>
+ <property name="double" writable="1" transfer-ownership="none">
+ <type name="double" c:type="gdouble"/>
+ </property>
+ <property name="float" writable="1" transfer-ownership="none">
+ <type name="float" c:type="gfloat"/>
+ </property>
<property name="hash-table" writable="1" transfer-ownership="container">
<type name="GLib.HashTable" c:type="GHashTable">
<type name="utf8"/>
<type name="int8"/>
</type>
</property>
+ <property name="int" writable="1" transfer-ownership="none">
+ <type name="int" c:type="gint"/>
+ </property>
<property name="list" writable="1" transfer-ownership="none">
<type name="GLib.List" c:type="gpointer">
<type name="utf8"/>
</type>
</property>
+ <property name="string" writable="1" transfer-ownership="none">
+ <type name="utf8" c:type="gchararray"/>
+ </property>
<field name="parent_instance">
<type name="GObject.Object" c:type="GObject"/>
</field>
@@ -500,6 +512,18 @@ case.</doc>
<type name="any" c:type="gpointer"/>
</type>
</field>
+ <field name="some_int8">
+ <type name="int8" c:type="gint8"/>
+ </field>
+ <field name="some_float">
+ <type name="float" c:type="float"/>
+ </field>
+ <field name="some_double">
+ <type name="double" c:type="double"/>
+ </field>
+ <field name="string">
+ <type name="utf8" c:type="char*"/>
+ </field>
<glib:signal name="test">
<return-value transfer-ownership="full">
<type name="none" c:type="void"/>
diff --git a/gir/everything.c b/gir/everything.c
index 5af755a..6aa6635 100644
--- a/gir/everything.c
+++ b/gir/everything.c
@@ -1530,6 +1530,10 @@ enum
PROP_TEST_OBJ_BOXED,
PROP_TEST_OBJ_HASH_TABLE,
PROP_TEST_OBJ_LIST,
+ PROP_TEST_OBJ_INT,
+ PROP_TEST_OBJ_FLOAT,
+ PROP_TEST_OBJ_DOUBLE,
+ PROP_TEST_OBJ_STRING,
};
static void
@@ -1571,6 +1575,22 @@ test_obj_set_property (GObject *object,
self->list = g_list_append (self->list, g_strdup (list->data));
break;
+ case PROP_TEST_OBJ_INT:
+ self->some_int8 = g_value_get_int (value);
+ break;
+
+ case PROP_TEST_OBJ_FLOAT:
+ self->some_float = g_value_get_float (value);
+ break;
+
+ case PROP_TEST_OBJ_DOUBLE:
+ self->some_double = g_value_get_double (value);
+ break;
+
+ case PROP_TEST_OBJ_STRING:
+ self->string = g_value_dup_string (value);
+ break;
+
default:
/* We don't have any other property... */
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
@@ -1605,6 +1625,22 @@ test_obj_get_property (GObject *object,
case PROP_TEST_OBJ_LIST:
g_value_set_pointer (value, self->list);
break;
+
+ case PROP_TEST_OBJ_INT:
+ g_value_set_int (value, self->some_int8);
+ break;
+
+ case PROP_TEST_OBJ_FLOAT:
+ g_value_set_float (value, self->some_float);
+ break;
+
+ case PROP_TEST_OBJ_DOUBLE:
+ g_value_set_double (value, self->some_double);
+ break;
+
+ case PROP_TEST_OBJ_STRING:
+ g_value_set_string (value, self->string);
+ break;
default:
/* We don't have any other property... */
@@ -1723,6 +1759,60 @@ test_obj_class_init (TestObjClass *klass)
g_object_class_install_property (gobject_class,
PROP_TEST_OBJ_LIST,
pspec);
+
+ /**
+ * TestObj:int:
+ */
+ pspec = g_param_spec_int ("int",
+ "int property",
+ "A contained int",
+ G_MININT,
+ G_MAXINT,
+ 0,
+ G_PARAM_READWRITE);
+ g_object_class_install_property (gobject_class,
+ PROP_TEST_OBJ_INT,
+ pspec);
+
+ /**
+ * TestObj:float:
+ */
+ pspec = g_param_spec_float ("float",
+ "float property",
+ "A contained float",
+ G_MINFLOAT,
+ G_MAXFLOAT,
+ 1.0f,
+ G_PARAM_READWRITE);
+ g_object_class_install_property (gobject_class,
+ PROP_TEST_OBJ_FLOAT,
+ pspec);
+
+ /**
+ * TestObj:double:
+ */
+ pspec = g_param_spec_double ("double",
+ "double property",
+ "A contained double",
+ G_MINDOUBLE,
+ G_MAXDOUBLE,
+ 1.0f,
+ G_PARAM_READWRITE);
+ g_object_class_install_property (gobject_class,
+ PROP_TEST_OBJ_DOUBLE,
+ pspec);
+
+ /**
+ * TestObj:string:
+ */
+ pspec = g_param_spec_string ("string",
+ "string property",
+ "A contained string",
+ NULL,
+ G_PARAM_READWRITE);
+ g_object_class_install_property (gobject_class,
+ PROP_TEST_OBJ_STRING,
+ pspec);
klass->matrix = test_obj_default_matrix;
}
diff --git a/gir/everything.h b/gir/everything.h
index 55b26cd..97b2c2e 100644
--- a/gir/everything.h
+++ b/gir/everything.h
@@ -270,6 +270,10 @@ struct _TestObj
TestBoxed *boxed;
GHashTable *hash_table;
GList *list;
+ gint8 some_int8;
+ float some_float;
+ double some_double;
+ char* string;
};
struct _TestObjClass
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]