<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"/>
enum
{
- PROP_TEST_OBJ_BARE = 1
+ PROP_TEST_OBJ_BARE = 1,
+ PROP_TEST_OBJ_BOXED
};
static void
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);
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);
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);
}
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;
}
test_obj_init (TestObj *obj)
{
obj->bare = NULL;
+ obj->boxed = NULL;
}
TestObj *
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;
GObject parent_instance;
GObject *bare;
+ TestBoxed *boxed;
};
struct _TestObjClass