d3b4884c5caf3454c589d60ab07b63f3f9ae6023
[app.Builder.js] / tools / build_gtk_tree.js
1 //<script type="text/javascript">
2
3 // see if we can build the insertion tree for gtk - using introspection
4
5 // it should build the tree of feasible insertions, then we will have to manually prune it..
6
7 // it needs to know
8 // a) what the inherited types are
9 // b) what methods are available for each type, that include a reference to another type..
10
11 // let's start with types.. 
12 GIRepository = imports.gi.GIRepository;
13 GLib        = imports.gi.GLib;
14
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');
17
18
19 imports.searchPath.push('../../gnome.introspection-doc-generator');
20
21 XObject     = imports.XObject.XObject;
22 File        = imports.File.File; 
23  
24 // Introspecion specific..
25 NameSpace   = imports.Introspect.NameSpace.NameSpace; 
26 Link        = imports.Introspect.Link.Link; 
27
28 var ns_list = [ 'Gtk' ] ; //NameSpace.namespaces();
29  
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.");
33 ns_list.forEach(function(ns_name) {   
34     var  core = imports.gi[ns_name];
35 });
36
37
38 print("Looping throught namespaces");
39 var ns_idx = [];
40 ns_list.forEach(function(ns_name) 
41 {
42     
43     //if (ns_idx.length) {         return ;/* do one - for testing */ } 
44     
45     var  core = imports.gi[ns_name];
46     var idx = { name: ns_name}; 
47     print("START:" + ns_name);
48    
49     var ns = NameSpace.ns(ns_name);
50     
51     
52     var actions = {
53         'objects' : 'Class',
54         'interfaces' : 'Interface',
55         //'structs' : 'Struct',
56         //'unions' : 'Union',
57         //'enums' : 'Enum'
58         
59     };
60     
61     for (var i in actions) {
62         // we flag GLib as a GObject lib...
63        
64         ns[i].forEach( function(n) {
65             
66             print('NameSpace.factory(' + actions[i] +','+ns_name+','+n);
67             var odata =   NameSpace.factory(actions[i], ns_name, n);
68             print(odata);
69         }); 
70     }
71     
72     
73 });