#include <glib-object.h>
#include <uobject/uobject.h>
+#include <uobject/module.h>
#include "upkg.h"
#include "pack.h"
return rc;
}
+GObject *u_object_new_from_package(struct upkg *upkg, unsigned long idx)
+{
+ const struct upkg_export *export;
+ const char *class, *package;
+ GObject *obj = NULL;
+ GType type;
+
+ class = upkg_export_class(upkg, idx, &package);
+
+ type = u_object_module_get_class(package, class);
+ if (type) {
+ obj = g_object_new(type, NULL);
+ if (u_object_deserialize(obj, upkg, idx) != 0) {
+ g_object_unref(obj);
+ return NULL;
+ }
+ }
+
+ return obj;
+}
+
static void u_object_init(UObject *o)
{
o->pkg = NULL;