Test.GtkWriter.vala.c
[app.Builder.js] / Builder4 / RooProjectProperties.js
index 3f90768..c70e895 100644 (file)
@@ -11,116 +11,76 @@ console = imports.console;
 XObject = imports.XObject.XObject;
 RooProjectProperties=new XObject({
     xtype: Gtk.Dialog,
-    modal : true,
-    show : function() {
-        // get the active project.
-        var file = this.get('/Window.LeftTree').getActiveFile();
-        if (!file) {
-            this.get('/StandardErrorDialog').show("No file is currently active");
-            return;
-        }
-        var project = this.get('/Window.LeftTree').getActiveFile().project;
-        //print (project.fn);
-        project.runhtml = project.runhtml || '';
-        this.get('view').el.get_buffer().set_text(project.runhtml, project.runhtml.length);
-        this.get('dbcon').el.set_text(project.dbcon || '');
-        print("project db: " + project.dbcon);
-        this.el.show_all();
-    },
-    default_width : 500,
     listeners : {
-        delete_event : function (self, event) {
-            this.el.hide()
-            return true;
+        delete_event : (self, event) => {
+            this.el.hide();
+             return true;
         },
-        response : function (self, response_id) {
-           print(response_id);
-           if (!response_id) {
+        response : (self, response_id)  => {
+           //print(response_id);
+           if (response_id< 1 ) {
               this.el.hide();
             
               return;
            }
-           var buf =    this.get('view').el.get_buffer()
            
-            var e = {};
-            var s = {};                             
-            buf.get_start_iter(s);
-            buf.get_end_iter(e);
-            
-            var str = buf.get_text(s.iter,e.iter,false);
-            //print(str);
+           var buf =    view.el.get_buffer();
+           Gtk.TextIter s;
+             Gtk.TextIter e;
+            buf.get_start_iter(out s);
+            buf.get_end_iter(out e);
+            var str = buf.get_text(s,e,true);
             // ideally we should syntax check it.. but it's html!?
             
-           var project = this.get('/Window.LeftTree').getActiveFile().project;
-           
-           
-           project.runhtml = str;
+           //var project = this.get('/Window.LeftTree').getActiveFile().project;
            
-           project.dbcon = this.get('dbcon').el.get_text();
            
+           _this.project.runhtml = str;
+           _this.project.save();
            
-           imports.ProjectManager.ProjectManager.saveConfig();
+          // imports.Builder.Provider.ProjectManager.ProjectManager.saveConfig();
         //   print (str);
            //    this.get('view').el.get_buffer().get_text(project.runjs, project.runjs.length);
            // ok pressed..
            this.el.hide();
         }
     },
+    default_width : 500,
+    modal : true,
+    'void:show' : (Project.Project project) {
+        _this.project = project;
+        // get the active project.
+        
+        //print (project.fn);
+        //project.runhtml = project.runhtml || '';
+        _this.view.el.get_buffer().set_text(project.runhtml);
+        
+        this.el.show_all();
+    },
     items : [
         {
             xtype: Gtk.VBox,
-            pack : function(p,e) {
-                        p.el.get_content_area().add(e.el);
-                        e.border_width  =5;
-                    },
+            border_width : 5,
+            pack : get_content_area().add,
             items : [
                 {
-                    xtype: Gtk.HBox,
-                    pack : "pack_start,false,true,3",
+                    xtype: Gtk.Label,
+                    pack : "pack_start,false,false,0",
+                    label : "HTML To insert at end of <HEAD>"
+                },
+                {
+                    xtype: Gtk.ScrolledWindow,
+                    pack : "pack_end,true,true,0",
                     items : [
-                                
-                        
-                       {
-                           xtype: Gtk.Label,
-                           pack : "pack_start,false,false,0",
-                           label : "Database Name"
-                       },
-                       {
-                            xtype: Gtk.Entry,
-                            id : "dbcon",
+                        {
+                            xtype: GtkSource.View,
                             pack : "add",
-                            visible : true
-                        },
+                            id : "view"
+                        }
                     ]
-                },
-        
-               {
-                   xtype: Gtk.Label,
-                   pack : "pack_start,false,false,0",
-                   label : "HTML To insert at end of <HEAD>"
-               },
-               {
-                   xtype: Gtk.ScrolledWindow,
-                   pack : "pack_end,true,true,0",
-                   items : [
-                       {
-                           xtype: GtkSource.View,
-                           pack : "add",
-                           id : "view"
-                       }
-                   ]
-               }
-                 
-                
-                
-                
-                
+                }
             ]
         },
-        
-        
-       
-        
         {
             xtype: Gtk.Button,
             pack : "add_action_widget,1",