summaryrefslogtreecommitdiff
path: root/gir
diff options
context:
space:
mode:
authorAndreas Rottmann <a.rottmann@gmx.at>2009-06-17 18:11:16 +0200
committerAndreas Rottmann <a.rottmann@gmx.at>2009-06-17 18:11:16 +0200
commit520315e331f187f5f1cd720b0a9fc5331872f977 (patch)
treedb2f3138ff49e447073e95771fc080fa91b0f0af /gir
parent511076d331a521a96218d5358f3f5ed58bffcb14 (diff)
downloadgobject-introspection-520315e331f187f5f1cd720b0a9fc5331872f977.tar.gz
Everything: add a boxed property to TestObj
Diffstat (limited to 'gir')
-rw-r--r--gir/Everything-1.0-expected.gir6
-rw-r--r--gir/everything.c29
-rw-r--r--gir/everything.h3
3 files changed, 37 insertions, 1 deletions
diff --git a/gir/Everything-1.0-expected.gir b/gir/Everything-1.0-expected.gir
index daad5e24..e3b352d2 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 705f8db3..8b0d0fb0 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 186d2195..2bbcf9e9 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