[gobject-introspection] Everything: add a boxed property to TestObj
- From: Andreas Rottmann <rotty src gnome org>
- To: svn-commits-list gnome org
- Subject: [gobject-introspection] Everything: add a boxed property to TestObj
- Date: Wed, 17 Jun 2009 12:15:27 -0400 (EDT)
commit 520315e331f187f5f1cd720b0a9fc5331872f977
Author: Andreas Rottmann <a rottmann gmx at>
Date: Wed Jun 17 18:11:16 2009 +0200
Everything: add a boxed property to TestObj
.topdeps | 1 +
.topmsg | 2 ++
gir/Everything-1.0-expected.gir | 6 ++++++
gir/everything.c | 29 ++++++++++++++++++++++++++++-
gir/everything.h | 3 +++
5 files changed, 40 insertions(+), 1 deletions(-)
---
diff --git a/.topdeps b/.topdeps
new file mode 100644
index 0000000..1f7391f
--- /dev/null
+++ b/.topdeps
@@ -0,0 +1 @@
+master
diff --git a/.topmsg b/.topmsg
new file mode 100644
index 0000000..33a72a5
--- /dev/null
+++ b/.topmsg
@@ -0,0 +1,2 @@
+From: Andreas Rottmann <a rottmann gmx at>
+Subject: [PATCH] Everything: add a boxed property to TestObj
diff --git a/gir/Everything-1.0-expected.gir b/gir/Everything-1.0-expected.gir
index daad5e2..e3b352d 100644
--- a/gir/Everything-1.0-expected.gir
+++ b/gir/Everything-1.0-expected.gir
@@ -176,12 +176,18 @@ case.">
<property name="bare" writable="1">
<type name="GObject.Object" c:type="GObject"/>
</property>
+ <property name="boxed" writable="1">
+ <type name="TestBoxed" c:type="TestBoxed"/>
+ </property>
<field name="parent_instance">
<type name="GObject.Object" c:type="GObject"/>
</field>
<field name="bare">
<type name="GObject.Object" c:type="GObject*"/>
</field>
+ <field name="boxed">
+ <type name="TestBoxed" c:type="TestBoxed*"/>
+ </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 705f8db..8b0d0fb 100644
--- a/gir/everything.c
+++ b/gir/everything.c
@@ -1159,7 +1159,8 @@ G_DEFINE_TYPE(TestObj, test_obj, G_TYPE_OBJECT);
enum
{
- PROP_TEST_OBJ_BARE = 1
+ PROP_TEST_OBJ_BARE = 1,
+ PROP_TEST_OBJ_BOXED
};
static void
@@ -1176,6 +1177,12 @@ test_obj_set_property (GObject *object,
test_obj_set_bare (self, g_value_get_object (value));
break;
+ case PROP_TEST_OBJ_BOXED:
+ if (self->boxed)
+ test_boxed_free (self->boxed);
+ self->boxed = g_value_dup_boxed (value);
+ break;
+
default:
/* We don't have any other property... */
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
@@ -1197,6 +1204,10 @@ test_obj_get_property (GObject *object,
g_value_set_object (value, self->bare);
break;
+ case PROP_TEST_OBJ_BOXED:
+ g_value_set_boxed (value, self->boxed);
+ break;
+
default:
/* We don't have any other property... */
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
@@ -1216,6 +1227,12 @@ test_obj_dispose (GObject *gobject)
self->bare = NULL;
}
+ if (self->boxed)
+ {
+ test_boxed_free (self->boxed);
+ self->boxed = NULL;
+ }
+
/* Chain up to the parent class */
G_OBJECT_CLASS (test_obj_parent_class)->dispose (gobject);
}
@@ -1271,6 +1288,15 @@ test_obj_class_init (TestObjClass *klass)
PROP_TEST_OBJ_BARE,
pspec);
+ pspec = g_param_spec_boxed ("boxed",
+ "Boxed property",
+ "A contained boxed struct",
+ TEST_TYPE_BOXED,
+ G_PARAM_READWRITE);
+ g_object_class_install_property (gobject_class,
+ PROP_TEST_OBJ_BOXED,
+ pspec);
+
klass->matrix = test_obj_default_matrix;
}
@@ -1278,6 +1304,7 @@ static void
test_obj_init (TestObj *obj)
{
obj->bare = NULL;
+ obj->boxed = NULL;
}
TestObj *
diff --git a/gir/everything.h b/gir/everything.h
index 186d219..2bbcf9e 100644
--- a/gir/everything.h
+++ b/gir/everything.h
@@ -186,6 +186,8 @@ GType test_simple_boxed_b_get_type (void);
TestSimpleBoxedB *test_simple_boxed_b_copy (TestSimpleBoxedB *b);
/* opaque boxed */
+#define TEST_TYPE_BOXED (test_boxed_get_type())
+
typedef struct _TestBoxed TestBoxed;
typedef struct _TestBoxedPrivate TestBoxedPrivate;
@@ -221,6 +223,7 @@ struct _TestObj
GObject parent_instance;
GObject *bare;
+ TestBoxed *boxed;
};
struct _TestObjClass
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]