]> git.draconx.ca Git - upkg.git/blobdiff - src/upkg.c
uobject: Add a helper function to load objects from packages.
[upkg.git] / src / upkg.c
index 5766e8ba4bed90d2152074ffcb0560c39df1db3a..c13a867f7b1dfd8cbdbf21977c537ccc89d8da19 100644 (file)
@@ -279,19 +279,12 @@ static int object_info(GTypeModule *pkg, unsigned long idx)
        if (verbose >= 1) {
                GParamSpec **props;
                GObject *obj;
        if (verbose >= 1) {
                GParamSpec **props;
                GObject *obj;
-               GType type;
                unsigned n;
 
                unsigned n;
 
-               type = u_object_module_get_class(package, class);
-               if (!type) {
-                       printf("  (unknown class)\n");
-                       return 0;
-               }
-
-               obj = g_object_new(type, NULL);
-
-               if (u_object_deserialize(obj, upkg, idx) != 0) {
-                       g_object_unref(obj);
+               obj = u_object_new_from_package(upkg, idx);
+               if (!obj) {
+                       fprintf(stderr, "%s: failed to load object.\n",
+                                       progname);
                        return -1;
                }
 
                        return -1;
                }