1 //<script type="text/javascript">
3 // see if we can build the insertion tree for gtk - using introspection
5 // it should build the tree of feasible insertions, then we will have to manually prune it..
8 // a) what the inherited types are
9 // b) what methods are available for each type, that include a reference to another type..
11 // let's start with types..
12 GIRepository = imports.gi.GIRepository;
13 GLib = imports.gi.GLib;
15 // we add this in, as it appears to get lost sometimes if we set it using the ENV. variable in builder.sh
16 GIRepository.IRepository.prepend_search_path(GLib.get_home_dir() + '/.Builder/girepository-1.1');
19 imports.searchPath.push('../../gnome.introspection-doc-generator');
21 XObject = imports.XObject.XObject;
22 File = imports.File.File;
24 // Introspecion specific..
25 NameSpace = imports.Introspect.NameSpace.NameSpace;
26 Link = imports.Introspect.Link.Link;
28 var ns_list = [ 'Gtk' ] ; //NameSpace.namespaces();
30 ns_list = ns_list.sort();
31 // let's try and load them, so we find out early what will fail.
32 print("loading library to make sure it works.");
36 ns_list.forEach(function(ns_name) {
37 var core = imports.gi[ns_name];
38 var ns = NameSpace.ns(ns_name); // fetch all the elements in namespace...
39 ns['objects'].forEach( function(n) {
40 var odata = NameSpace.factory('Class', ns_name, n);
41 classes[odata.alias] = odata;
44 ns['interfaces'].forEach( function(n) {
45 NameSpace.factory('Interface', ns_name, n);
46 classes[odata.alias] = odata;
51 print("Looping throught namespaces");
53 var implementations = {};
54 ns_list.forEach(function(ns_name)
57 //if (ns_idx.length) { return ;/* do one - for testing */ }
59 var core = imports.gi[ns_name];
60 var idx = { name: ns_name};
61 print("START:" + ns_name);
63 var ns = NameSpace.ns(ns_name); // fetch all the elements in namespace...
64 // as a type => list of them..
73 ns['objects'].forEach( function(n) {
76 var odata = classes[ns_name+'.'+n];
77 implementations[odata.alias] = odata.childClasses;
78 //print(JSON.stringify(odata.childClasses,null,4));
80 ns['interfaces'].forEach( function(n) {
83 var odata = classes[ns_name+'.'+n];
84 implementations[odata.alias] = odata.implementedBy;
85 //print(JSON.stringify(odata.implementedBy,null,4));
87 // what we are interested in..
93 print(JSON.stringify(implementations,null,4));