diff options
author | Andreas Rottmann <a.rottmann@gmx.at> | 2009-06-17 18:11:16 +0200 |
---|---|---|
committer | Andreas Rottmann <a.rottmann@gmx.at> | 2009-06-17 18:11:16 +0200 |
commit | 520315e331f187f5f1cd720b0a9fc5331872f977 (patch) | |
tree | db2f3138ff49e447073e95771fc080fa91b0f0af | |
parent | 511076d331a521a96218d5358f3f5ed58bffcb14 (diff) | |
download | gobject-introspection-520315e331f187f5f1cd720b0a9fc5331872f977.tar.gz |
Everything: add a boxed property to TestObj
-rw-r--r-- | .topdeps | 1 | ||||
-rw-r--r-- | .topmsg | 2 | ||||
-rw-r--r-- | gir/Everything-1.0-expected.gir | 6 | ||||
-rw-r--r-- | gir/everything.c | 29 | ||||
-rw-r--r-- | gir/everything.h | 3 |
5 files changed, 40 insertions, 1 deletions
diff --git a/.topdeps b/.topdeps new file mode 100644 index 00000000..1f7391f9 --- /dev/null +++ b/.topdeps @@ -0,0 +1 @@ +master diff --git a/.topmsg b/.topmsg new file mode 100644 index 00000000..33a72a5f --- /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 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 |