~~~~~testfile.vala.c
authorAlan Knowles <alan@roojs.com>
Tue, 28 Apr 2015 08:49:15 +0000 (16:49 +0800)
committerAlan Knowles <alan@roojs.com>
Tue, 28 Apr 2015 08:49:15 +0000 (16:49 +0800)
src/Builder4/Editor.bjs
src/Builder4/Editor.vala
src/Makefile.am
src/Palete/ValaSource.vala
src/Resources.vala

index d8484e6..02a05f6 100644 (file)
          "listeners" : {
           "changed" : " () => {\n    // check syntax??\n        if(this.checkSyntax()) {\n        _this.save_button.el.sensitive = true;\n    }\n   // print(\"EDITOR CHANGED\");\n    _this.dirty = true;\n\n    // this.get('/LeftPanel.model').changed(  str , false);\n    return ;\n}\n\n \n"
          },
+         "bool check_queued" : false,
          "id" : "buffer",
          "int error_line" : "-1",
          "|   string toString" : "  () {\n    \n    Gtk.TextIter s;\n    Gtk.TextIter e;\n    this.el.get_start_iter(out s);\n    this.el.get_end_iter(out e);\n    var ret = this.el.get_text(s,e,true);\n    //print(\"TO STRING? \" + ret);\n    return ret;\n}\n ",
-         "|   bool checkSyntax" : " () {\n \n    if (this.check_running) {\n        // then add a flag to say it's queued..\n        if (this.check_queued) {\n            return;\n        }\n        \n        this.check_queued = true;\n        GLib.Timeout.add_seconds(1,  ()  =>{\n            this.check_false = false;\n             this.checkSyntax(); \n             return false; // cancel timeout..\n         });\n        \n    \n        return true;\n    }\n    \n    this.check_running = true;\n    var p = Palete.factory(_this.file.xtype);   \n    \n    var str = this.toString();\n    \n    string res = \"\";\n    \n    if (this.error_line > 0) {\n         Gtk.TextIter start;\n         Gtk.TextIter end;     \n        this.el.get_bounds (out start, out end);\n\n        this.el.remove_source_marks (start, end, null);\n    }\n    \n    \n    \n    \n    p.validateCode.begin(\n        str, \n         _this.key, \n        _this.ptype,\n        _this.file,\n        _this.node,\n        (obj, res) => {\n            this.check_running = false;\n            var validate_res = p.validateCode.end(res);\n            this.error_line = validate_res.size;\n\n            if (this.error_line < 1) {\n                  return;\n            }\n            var tlines = this.el.get_line_count ();\n            Gtk.TextIter iter;\n            var valiter = validate_res.map_iterator();\n            while (valiter.next()) {\n            \n        //        print(\"get inter\\n\");\n                var eline = valiter.get_key();\n                if (eline > tlines) {\n                    continue;\n                }\n                this.el.get_iter_at_line( out iter, eline);\n                //print(\"mark line\\n\");\n                this.el.create_source_mark(valiter.get_value(), \"error\", iter);\n            }   \n            \n        }\n        \n    );\n     \n    \n    \n    //print(\"done mark line\\n\");\n     \n    return true; // at present allow saving - even if it's invalid..\n}\n",
+         "|   bool checkSyntax" : " () {\n \n    if (this.check_running) {\n        return true;\n    }\n    this.check_running = true;\n    var p = Palete.factory(_this.file.xtype);   \n    \n    var str = this.toString();\n    \n    string res = \"\";\n    \n    if (this.error_line > 0) {\n         Gtk.TextIter start;\n         Gtk.TextIter end;     \n        this.el.get_bounds (out start, out end);\n\n        this.el.remove_source_marks (start, end, null);\n    }\n    \n    \n    \n    \n    p.validateCode.begin(\n        str, \n         _this.key, \n        _this.ptype,\n        _this.file,\n        _this.node,\n        (obj, res) => {\n            this.check_running = false;\n            var validate_res = p.validateCode.end(res);\n            this.error_line = validate_res.size;\n\n            if (this.error_line < 1) {\n                  return;\n            }\n            var tlines = this.el.get_line_count ();\n            Gtk.TextIter iter;\n            var valiter = validate_res.map_iterator();\n            while (valiter.next()) {\n            \n        //        print(\"get inter\\n\");\n                var eline = valiter.get_key();\n                if (eline > tlines) {\n                    continue;\n                }\n                this.el.get_iter_at_line( out iter, eline);\n                //print(\"mark line\\n\");\n                this.el.create_source_mark(valiter.get_value(), \"error\", iter);\n            }   \n            \n        }\n        \n    );\n     \n    \n    \n    //print(\"done mark line\\n\");\n     \n    return true; // at present allow saving - even if it's invalid..\n}\n",
          "* pack" : "set_buffer",
          "xtype" : "Buffer",
          "bool check_running" : false,
-         "$ xns" : "GtkSource",
-         "bool XXX" : true
+         "$ xns" : "GtkSource"
         }
        ]
       }
index c762a36..e9c3d3a 100644 (file)
@@ -333,9 +333,9 @@ public class Editor : Object
 
 
             // my vars (def)
+        public bool check_queued;
         public int error_line;
         public bool check_running;
-        public bool XXX;
 
         // ctor 
         public Xcls_buffer(Editor _owner )
@@ -345,9 +345,9 @@ public class Editor : Object
             this.el = new Gtk.SourceBuffer( null );
 
             // my vars (dec)
+            this.check_queued = false;
             this.error_line = -1;
             this.check_running = false;
-            this.XXX = true;
 
             // set gobject values
 
@@ -379,22 +379,8 @@ public class Editor : Object
         public   bool checkSyntax () {
          
             if (this.check_running) {
-                // then add a flag to say it's queued..
-                if (this.check_queued) {
-                    return;
-                }
-                
-                this.check_queued = true;
-                GLib.Timeout.add_seconds(1,  ()  =>{
-                    this.check_false = false;
-                     this.checkSyntax(); 
-                     return false; // cancel timeout..
-                 });
-                
-            
                 return true;
             }
-            
             this.check_running = true;
             var p = Palete.factory(_this.file.xtype);   
             
index 0575730..19925df 100644 (file)
@@ -21,11 +21,11 @@ endif
 
 
 if HAVE_GDA5
-builder_LIBGDA = --pkg libgda-5.0
+builder_GDA = --pkg libgda-5.0
 endif
 
 if HAVE_GDA4
-builder_LIBGDA = --pkg libgda-4.0
+builder_GDA = --pkg libgda-4.0
 endif
 
 
@@ -51,7 +51,7 @@ endif
  
 # - not sure if needed....  
 
-AM_CPPFLAGS = $(BUILDER_CFLAGS) $(WEBKIT_CFLAGS) $(LIBGDA_CFLAGS) $(LIBVALA_CFLAGS) $(JAVASCRIPTCOREGTK_CFLAGS) $(VTE_CFLAGS)
+AM_CPPFLAGS = $(BUILDER_CFLAGS) $(WEBKIT_CFLAGS) $(GDA_CFLAGS) $(LIBVALA_CFLAGS) $(JAVASCRIPTCOREGTK_CFLAGS) $(VTE_CFLAGS)
 
 
 bin_PROGRAMS = builder4
@@ -71,7 +71,7 @@ builder4_PKGS = \
                --pkg libsoup-2.4 \
                --pkg javascriptcore \
                $(builder_LIBVALA) \
-               $(builder_LIBGDA) \
+               $(builder_GDA) \
                $(builder_WEBKKIT) \
                $(builder_JAVASCRIPTCOREGTK) \
                $(builder_VTE) \
@@ -131,7 +131,7 @@ builder4_SOURCES = \
 builder4_VALAFLAGS = \
         --thread  --target-glib=2.32 --vapidir=$(srcdir)/vapi -g  $(builder4_PKGS)
 
-builder4_LDADD =  $(BUILDER_LIBS) $(LIBVALA_LIBS) $(LIBGDA_LIBS) $(WEBKIT_LIBS) $(VTE_LIBS) $(JAVASCRIPTCOREGTK_LIBS)
+builder4_LDADD =  $(BUILDER_LIBS) $(LIBVALA_LIBS) $(GDA_LIBS) $(WEBKIT_LIBS) $(VTE_LIBS) $(JAVASCRIPTCOREGTK_LIBS)
 
 
 
index 883d275..f35a18d 100644 (file)
@@ -244,12 +244,17 @@ namespace Palete {
                                
                        }
                        
-                       context.codegen = new GDBusServerModule ();
+                       context.codegen = new Vala.GDBusServerModule ();
                        
                         
                        context.output = "/tmp/testbuild";
                        context.codegen.emit (context);
                        
+                       var ccompiler = new Vala.CCodeCompiler ();
+                       var cc_command = Environment.get_variable ("CC");
+                       var pkg_config_command = Environment.get_variable ("PKG_CONFIG");
+                       ccompiler.compile (context, cc_command, new string[] { }, pkg_config_command);
+                       
                        Vala.CodeContext.pop ();
 
                        print("ALL OK?\n");
index 41670be..296f91a 100644 (file)
@@ -157,7 +157,7 @@ public class Resources : Object
                        "roo.builder.js",
                        "roodata.json",
                        "RooUsage.txt"
-               }
+               };
 
                for (var i = 0; i <  required.length; i++ ) {