+
+GType module_get_class(const char *package, const char *class)
+{
+ char buf[strlen(package) + strlen(class) + 1];
+ GTypeModule search = { .name = str_cpy_lower(buf, package) };
+
+ GTypeModule *mod = avl_find(package_tree, &search);
+ if (!mod) {
+ void **p;
+
+ mod = G_TYPE_MODULE(upkg_module_new(package));
+ if (!mod) {
+ return 0;
+ }
+
+ p = avl_probe(package_tree, mod);
+ if (!p) {
+ g_object_unref(mod);
+ return 0;
+ }
+ }
+
+ if (!g_type_module_use(mod))
+ return 0;
+
+ str_cpy_lower(buf+strlen(package), class);
+ buf[0] = toupper(buf[0]);
+ buf[strlen(package)] = toupper(buf[strlen(package)]);
+ return g_type_from_name(buf);
+}