src/Builder4/About.vala.c
[app.Builder.js] / src / Palete / ValaSource.vala
index a74e22b..33d6be3 100644 (file)
@@ -51,7 +51,7 @@ namespace Palete {
                //      return this.checkString(JsRender.NodeToVala.mungeFile(this.file));
                //}
 
-               public void checkFileWithNodePropChange(
+               public bool checkFileWithNodePropChange(
                  
                                        JsRender.JsRender file,
                                        JsRender.Node node, 
@@ -63,17 +63,16 @@ namespace Palete {
                        this.file = file;
                        
                        if (this.compiler != null) {
-                               return;
+                               return false;
                        }
                        
-                       Gee.HashMap<int,string> ret = new Gee.HashMap<int,string> ();
+                        
                        var hash = ptype == "listener" ? node.listeners : node.props;
                        
                        // untill we get a smarter renderer..
                        // we have some scenarios where changing the value does not work
                        if (prop == "* xns" || prop == "xtype") {
-                               this.compiled(new Json.Object());
-                               return ;
+                               return  false;
                        }
                                
                        
@@ -94,7 +93,7 @@ namespace Palete {
                        
                        //this.dumpCode(tmpstring);
                        //print("offset %d\n", offset);
-                       this.checkStringSpawn(tmpstring );
+                       return this.checkStringSpawn(tmpstring );
                        
                        // modify report
                        
@@ -103,13 +102,13 @@ namespace Palete {
                }
                Spawn compiler;
                 
-               public void checkStringSpawn(
-                                       string contents 
-                               )
+               public bool checkStringSpawn(
+                               string contents 
+                       )
                {
                        
                        if (this.compiler != null) {
-                               return;
+                               return false;
                        }
                        
                        FileIOStream iostream;
@@ -126,11 +125,8 @@ namespace Palete {
                        
                                valafn = regex.replace(this.file.path,this.file.path.length , 0 , ".vala");
                         } catch (GLib.RegexError e) {
-                               var ret = new Json.Object();
-                               ret.set_boolean_member("success", false);
-                               ret.set_string_member("message", e.message);
-                           this.compiled(ret);
-                           return;
+                                
+                           return false;
                        }   
                        
                        string[] args = {};
@@ -152,20 +148,20 @@ namespace Palete {
                        try {
                                this.compiler.run(); 
                        } catch (GLib.SpawnError e) {
-                               var ret = new Json.Object();
-                               ret.set_boolean_member("success", false);
-                               ret.set_string_member("message", e.message);
-                           this.compiled(ret);
-                           this.compiler = null;
+                               GLib.debug(e.message);
+                               this.compiler = null;
+                               return false;
+
                        }
+                       return true;
                         
                }
                
-               public void checkFileSpawn(JsRender.JsRender file )
+               public bool checkFileSpawn(JsRender.JsRender file )
                {
                        // race condition..
                        if (this.compiler != null) { 
-                               return;
+                               return false;
                        }
                        
                        this.file = file;
@@ -180,29 +176,31 @@ namespace Palete {
                         
                         
                        
-                       this.compiler = new Spawn("/tmp", args);
-                       this.compiler.complete.connect(spawnResult);
                        
                        try {
-                               this.compiler.run(); 
-                       } catch (GLib.SpawnError e) {
-                               var ret = new Json.Object();
-                               ret.set_boolean_member("success", false);
-                               ret.set_string_member("message", e.message);
-                           this.compiled(ret);
+                           this.compiler = new Spawn("/tmp", args);
+                           this.compiler.complete.connect(spawnResult);
+                       
+                           this.compiler.run(); 
+                       
+                        
+                       } catch (GLib.Error e) {
+                           GLib.debug(e.message);
                            this.compiler = null;
-                       }
+                           return false;
+                       }
+                       return true;
                         
                }
                /**
                * Used to compile a non builder file..
                */
                 
-               public void checkPlainFileSpawn(  JsRender.JsRender file, string contents )
+               public bool checkPlainFileSpawn(  JsRender.JsRender file, string contents )
                {
                        // race condition..
                        if (this.compiler != null) { 
-                               return;
+                               return false;
                        }
                        var pr = (Project.Gtk)(file.project);
                        
@@ -215,11 +213,14 @@ namespace Palete {
                            if (path == file.path) {
                                foundit = true;
                                break;
-                           }
+                                       }
                        
                        }
                        if (!foundit) {
-                           return; // do not run the compile..
+                         
+                           this.compiler = null;
+                       
+                           return false; // do not run the compile..
                        }
                        // is the file in the module?
                        
@@ -248,18 +249,18 @@ namespace Palete {
                        args += file.path;
                         
                        
-                       this.compiler = new Spawn("/tmp", args);
-                       this.compiler.complete.connect(spawnResult);
+                       
                        
                        try {
-                               this.compiler.run(); 
-                       } catch (GLib.SpawnError e) {
-                               var ret = new Json.Object();
-                               ret.set_boolean_member("success", false);
-                               ret.set_string_member("message", e.message);
-                           this.compiled(ret);
+                           this.compiler = new Spawn("/tmp", args);
+                           this.compiler.complete.connect(spawnResult);
+                           this.compiler.run(); 
+                       } catch (GLib.Error e) {
+                           
                            this.compiler = null;
+                           return false;
                        }
+                       return true;
                         
                }
                
@@ -269,7 +270,7 @@ namespace Palete {
                         
                                
                        try { 
-                               GLib.debug("GOT output %s", output);
+                               //GLib.debug("GOT output %s", output);
                                
                                var pa = new Json.Parser();
                                pa.load_from_data(output);
@@ -292,7 +293,7 @@ namespace Palete {
                                this.compiled(ret);
                                
                                
-                       } catch (Error e) {
+                       } catch (GLib.Error e) {
                                var ret = new Json.Object();
                                ret.set_boolean_member("success", false);
                                ret.set_string_member("message", e.message);