Test.GtkWriter.vala.c
[app.Builder.js] / Builder4 / DialogNewComponent.vala
index 97e9ea9..2b30a10 100644 (file)
@@ -32,6 +32,7 @@ public class Xcls_DialogNewComponent
         // my vars
     public JsRender.JsRender file;
     public Project.Project project;
+    public signal void success(Project.Project pr, JsRender.JsRender file);
 
         // ctor 
     public Xcls_DialogNewComponent()
@@ -58,11 +59,10 @@ public class Xcls_DialogNewComponent
         // listeners 
         this.el.delete_event.connect( (self, event) => {
             this.el.hide();
-            return true;
+            return true;   
         }
-        
-         );
-        this.el.response.connect(   (self, response_id) =>  {
+          );
+        this.el.response.connect(  (self, response_id) =>  { 
           
                if (response_id < 1) { // cancel!
                     this.el.hide();
@@ -110,7 +110,7 @@ public class Xcls_DialogNewComponent
          
                 
                 // what about .js ?
-                if (GLib.FileUtil.test(_this.file.name + ".bjs", GLib.FileTest.EXISTS)) {
+                if (GLib.FileUtils.test(_this.file.name + ".bjs", GLib.FileTest.EXISTS)) {
                     StandardErrorDialog.show(
                         "That file already exists"
                     ); 
@@ -125,7 +125,9 @@ public class Xcls_DialogNewComponent
                 //for (var i in this.file) {
                 //    nf[i] = this.file[i];
                 //}
+                _this.success(_this.project, nf);
                 /*
+        
                 -- fixme -- needs to be a signal..
                 if (DialogNewComponent.success != null) {
                     DialogNewComponent.success(_this.project, nf);
@@ -134,6 +136,7 @@ public class Xcls_DialogNewComponent
         } );
         this.el.show.connect( (self)  => {
           this.el.show_all();
+          
         } );
     }
 
@@ -145,6 +148,8 @@ public class Xcls_DialogNewComponent
 
     // skip .Project.Project:project - already used 
 
+    // skip .signal:void:success - already used 
+
     // skip default_height - already used 
 
     // skip default_width - already used 
@@ -161,32 +166,29 @@ public class Xcls_DialogNewComponent
     public void show(JsRender.JsRender c) 
         {
             this.project = c.project;
-            if (!this.el) {
+            
+            //if (!this.el) {
                 //this.init();
-            }
-            this.def =  { 
-                name : '' , 
-                title : '' ,
-                region : '' ,
-                parent: '',
-              //  disable: '',
-                modOrder : '0',
-                permname : ''
-            };
-            for (var i in this.def) {
-                c[i] = c[i] || this.def[i];
-                this.get(i).el.set_text(c[i]);
-            }
-            if (c.name) {
+             //}
+            
+            _this.name.el.set_text(c.name);
+            _this.title.el.set_text(c.title);
+            _this.parent.el.set_text(c.parent);    
+            _this.region.el.set_text(c.region);
+            _this.modOrder.el.set_text(c.modOrder);
+             _this.permname.el.set_text(c.permname);
+            
+            if (c.path.length > 0) {
                 this.el.set_title("Edit File Details - " + c.name);
             } else {
                 this.el.set_title("Create New File");
             }
              
-            this.file = c;
-            console.log('show all');
+            _this.file = c;
+            //console.log('show all');
             this.el.show_all();
-            this.success = c.success;
+            
+            //this.success = c.success;
             
             
         }
@@ -243,14 +245,11 @@ public class Xcls_DialogNewComponent
             // ctor 
         public Xcls_Table3()
         {
-            this.el = new Gtk.Table();
+            this.el = new Gtk.Table( 3, 2, false );
 
             // my vars
 
             // set gobject values
-            this.el.homogeneous = false;
-            this.el.n_columns = 2;
-            this.el.n_rows = 3;
             var child_0 = new Xcls_Label4();
             this.el.add (  child_0.el  );
             var child_1 = new Xcls_name();
@@ -308,14 +307,13 @@ public class Xcls_DialogNewComponent
             // ctor 
         public Xcls_Label4()
         {
-            this.el = new Gtk.Label();
+            this.el = new Gtk.Label( "Component Name" );
 
             // my vars
 
             // set gobject values
             this.el.justify = Gtk.Justification.RIGHT;
-            this.el.label = "Component Name";
-            this.el.xalign = 0.9;
+            this.el.xalign = 0.9f;
         }
 
         // userdefined functions 
@@ -385,15 +383,14 @@ public class Xcls_DialogNewComponent
             // ctor 
         public Xcls_Label6()
         {
-            this.el = new Gtk.Label();
+            this.el = new Gtk.Label( "Title" );
 
             // my vars
 
             // set gobject values
             this.el.justify = Gtk.Justification.RIGHT;
-            this.el.label = "Title";
             this.el.visible = true;
-            this.el.xalign = 0.9;
+            this.el.xalign = 0.9f;
         }
 
         // userdefined functions 
@@ -465,16 +462,15 @@ public class Xcls_DialogNewComponent
             // ctor 
         public Xcls_Label8()
         {
-            this.el = new Gtk.Label();
+            this.el = new Gtk.Label( "Region" );
 
             // my vars
 
             // set gobject values
             this.el.justify = Gtk.Justification.RIGHT;
-            this.el.label = "Region";
             this.el.tooltip_text = "center, north, south, east, west";
             this.el.visible = true;
-            this.el.xalign = 0.9;
+            this.el.xalign = 0.9f;
         }
 
         // userdefined functions 
@@ -548,15 +544,14 @@ public class Xcls_DialogNewComponent
             // ctor 
         public Xcls_Label10()
         {
-            this.el = new Gtk.Label();
+            this.el = new Gtk.Label( "Parent Name" );
 
             // my vars
 
             // set gobject values
             this.el.justify = Gtk.Justification.RIGHT;
-            this.el.label = "Parent Name";
             this.el.visible = true;
-            this.el.xalign = 0.9;
+            this.el.xalign = 0.9f;
         }
 
         // userdefined functions 
@@ -628,15 +623,14 @@ public class Xcls_DialogNewComponent
             // ctor 
         public Xcls_Label12()
         {
-            this.el = new Gtk.Label();
+            this.el = new Gtk.Label( "Permission Name" );
 
             // my vars
 
             // set gobject values
             this.el.justify = Gtk.Justification.RIGHT;
-            this.el.label = "Permission Name";
             this.el.visible = true;
-            this.el.xalign = 0.9;
+            this.el.xalign = 0.9f;
         }
 
         // userdefined functions 
@@ -708,15 +702,14 @@ public class Xcls_DialogNewComponent
             // ctor 
         public Xcls_Label14()
         {
-            this.el = new Gtk.Label();
+            this.el = new Gtk.Label( "Order (for tabs)" );
 
             // my vars
 
             // set gobject values
             this.el.justify = Gtk.Justification.RIGHT;
-            this.el.label = "Order (for tabs)";
             this.el.visible = true;
-            this.el.xalign = 0.9;
+            this.el.xalign = 0.9f;
         }
 
         // userdefined functions