Add typelib unloading support
Submitted by Alexandre Mazari
Link to original bug (#645784)
Description
In its current incarnation GIR do not provide a way to unload a typelib that was previously added to it context.
When looking up for a type introspection data within all the available typelibs/namspaces, such an API would be handy to keep the memory consumption at it minimum by discarding the unmatched typelibs.
Two of my current projects expose this use-case, and I am sure more will show up:
-
exposition of an arbitrary GObject instance in a Webkit WebFrame js context. Current implementation forces the developer to explicitly provide the GIR namespace where the object type is defined. In a perfect world, we would guess it from the GType by looking up in the available typelibs, discarding the unrelated one from the GIR repository.
-
generation of dynamic glade (the editor) catalogs from GIR infos. Again, the idea is to search in the currently installed typelibs the types that are GtkWidget-derived and non abstract. Of course, we dont need to keep non-widget-declaring typelibs loaded.
Would such an API go against the design choices regarding GIR ?
If no-one more knowledgable can spend time on that, I'd gladly give it a try.
Thanks !