2 //<Script type="text/javascript">
5 * takes a gtk project directory, and turns it into an application!
6 * by compling the files into JS files..
8 * Initially developed for runtime testing. (the vte runner)
10 * Might be the way to go for full runtime
14 * gtkrun.js /path/to/myproject
17 * a) load dependancies.. (eg. gi's..) - derived later?
20 * loop the files (find .bjs)
21 * - comple to js (if not exist // or force enabled..)
22 * b) load all the files
31 Pango = imports.gi.Pango;
32 GLib = imports.gi.GLib;
34 GObject = imports.gi.GObject;
35 GtkSource = imports.gi.GtkSource;
36 WebKit = imports.gi.WebKit;
39 GtkClutter = imports.gi.GtkClutter;
41 GtkClutter.init(Seed.argv);
44 File = imports.File.File;
46 XObject = imports.XObject.XObject;
47 //XObject.debug = true;
49 imports.searchPath.push('/'); // allow global paths..
50 // error checking todo..
51 var files = File.list(Seed.argv[2]);
54 var gtkbuilder = false;
55 files.forEach(function(f) {
56 var fp = Seed.argv[2] + '/' + f;
57 if (!fp.match(/\.bjs$/)) {
60 var js = fp.replace(/\.bjs$/, '.js');
61 if (File.isFile(js)) {
62 // check file time.. = bjs is less than compiled file..
63 if (File.mtime(fp) < File.mtime(js)) {
64 print ("LOADING" + js);
65 olist.push(imports[js]);
71 var gtkbuilder = new imports.Builder.Provider.File.Gtk.Gtk({ path : fp });
72 gtkbuilder.loadItems(function() { });
73 print ("COMPILING" + js);
74 var fn = gtkbuilder.saveJS();
75 if (fn === false) { // skip files that do not contain anythng!
78 olist.push(imports[fn]);