*/
Object *container_get(Object *root, const char *path);
+/**
+ * object_property_add_new_container:
+ * @obj: the parent object
+ * @name: the name of the parent object's property to add
+ *
+ * Add a newly created container object to a parent object.
+ *
+ * Returns: the newly created container object. Its reference count is 1,
+ * and the reference is owned by the parent object.
+ */
+Object *object_property_add_new_container(Object *obj, const char *name);
+
/**
* object_property_help:
* @name: the name of the property
type_register_static(&container_info);
}
+Object *object_property_add_new_container(Object *obj, const char *name)
+{
+ Object *child = object_new(TYPE_CONTAINER);
+
+ object_property_add_child(obj, name, child);
+ object_unref(child);
+
+ return child;
+}
+
Object *container_get(Object *root, const char *path)
{
Object *obj, *child;
for (i = 1; parts[i] != NULL; i++, obj = child) {
child = object_resolve_path_component(obj, parts[i]);
if (!child) {
- child = object_new(TYPE_CONTAINER);
- object_property_add_child(obj, parts[i], child);
- object_unref(child);
+ child = object_property_add_new_container(obj, parts[i]);
}
}