resources/RooUsage.txt
[app.Builder.js] / src / Builder4 / ProjectSettings.vala
index 986b08f..2989045 100644 (file)
@@ -2,7 +2,7 @@ static Xcls_ProjectSettings  _ProjectSettings;
 
 public class Xcls_ProjectSettings : Object 
 {
-    public Gtk.VBox el;
+    public Gtk.Box el;
     private Xcls_ProjectSettings  _this;
 
     public static Xcls_ProjectSettings singleton()
@@ -32,13 +32,14 @@ public class Xcls_ProjectSettings : Object
     public Xcls_ProjectSettings()
     {
         _this = this;
-        this.el = new Gtk.VBox( false, 0 );
+        this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
 
         // my vars (dec)
 
         // set gobject values
+        this.el.homogeneous = false;
         this.el.border_width = 5;
-        var child_0 = new Xcls_HBox2( _this );
+        var child_0 = new Xcls_Box2( _this );
         child_0.ref();
         this.el.pack_start (  child_0.el , false,false,0 );
         var child_1 = new Xcls_Notebook5( _this );
@@ -64,8 +65,11 @@ public class Xcls_ProjectSettings : Object
            
         _this.rootURL.el.set_text( _this.project.rootURL );
         _this.base_template.el.set_text(_this.project.base_template);    
-       
-        
+         var js = _this.project;
+        _this.database_DBTYPE.el.set_text(     js.get_string_member("DBTYPE") );
+        _this.database_DBNAME.el.set_text(    js.get_string_member("DBNAME") );
+        _this.database_DBUSERNAME.el.set_text(    js.get_string_member("DBUSERNAME") );
+        _this.database_DBPASSWORD.el.set_text(    js.get_string_member("DBPASSWORD") );
         //this.el.show_all();
     }
     public void save ()
@@ -80,25 +84,37 @@ public class Xcls_ProjectSettings : Object
         _this.project.rootURL = _this.rootURL.el.get_text();
         _this.project.base_template = _this.base_template.el.get_text();    
         
+        var js = _this.project.json_project_data;
+        js.set_string_member("DBTYPE", _this.database_DBTYPE.el.get_text());
+       js.set_string_member("DBNAME", _this.database_DBNAME.el.get_text());
+        js.set_string_member("DBUSERNAME", _this.database_DBUSERNAME.el.get_text());
+        js.set_string_member("DBPASSWORD", _this.database_DBPASSWORD.el.get_text());
+    //    _this.project.set_string_member("DBHOST", _this.DBTYPE.el.get_text());    
+        
+        // need to re-init the database 
+        
+        _this.project.initRooDatabase();
+         
         
     }
-    public class Xcls_HBox2 : Object 
+    public class Xcls_Box2 : Object 
     {
-        public Gtk.HBox el;
+        public Gtk.Box el;
         private Xcls_ProjectSettings  _this;
 
 
             // my vars (def)
 
         // ctor 
-        public Xcls_HBox2(Xcls_ProjectSettings _owner )
+        public Xcls_Box2(Xcls_ProjectSettings _owner )
         {
             _this = _owner;
-            this.el = new Gtk.HBox( true, 0 );
+            this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
 
             // my vars (dec)
 
             // set gobject values
+            this.el.homogeneous = true;
             this.el.expand = false;
             this.el.vexpand = false;
             var child_0 = new Xcls_Button3( _this );
@@ -192,10 +208,10 @@ public class Xcls_ProjectSettings : Object
             child_0.ref();
             var child_1 = new Xcls_label_database( _this );
             child_1.ref();
-            var child_2 = new Xcls_VBox8( _this );
+            var child_2 = new Xcls_Box8( _this );
             child_2.ref();
             this.el.append_page (  child_2.el , _this.label_global.el );
-            var child_3 = new Xcls_VBox19( _this );
+            var child_3 = new Xcls_Box19( _this );
             child_3.ref();
             this.el.append_page (  child_3.el , _this.label_database.el );
         }
@@ -246,30 +262,31 @@ public class Xcls_ProjectSettings : Object
 
         // user defined functions 
     }
-    public class Xcls_VBox8 : Object 
+    public class Xcls_Box8 : Object 
     {
-        public Gtk.VBox el;
+        public Gtk.Box el;
         private Xcls_ProjectSettings  _this;
 
 
             // my vars (def)
 
         // ctor 
-        public Xcls_VBox8(Xcls_ProjectSettings _owner )
+        public Xcls_Box8(Xcls_ProjectSettings _owner )
         {
             _this = _owner;
-            this.el = new Gtk.VBox( false, 0 );
+            this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
 
             // my vars (dec)
 
             // set gobject values
+            this.el.homogeneous = false;
             var child_0 = new Xcls_path( _this );
             child_0.ref();
             this.el.pack_start (  child_0.el , false,false,0 );
-            var child_1 = new Xcls_HBox10( _this );
+            var child_1 = new Xcls_Box10( _this );
             child_1.ref();
             this.el.pack_start (  child_1.el , false,false,0 );
-            var child_2 = new Xcls_HBox13( _this );
+            var child_2 = new Xcls_Box13( _this );
             child_2.ref();
             this.el.pack_start (  child_2.el , false,false,0 );
             var child_3 = new Xcls_Label16( _this );
@@ -306,23 +323,24 @@ public class Xcls_ProjectSettings : Object
 
         // user defined functions 
     }
-    public class Xcls_HBox10 : Object 
+    public class Xcls_Box10 : Object 
     {
-        public Gtk.HBox el;
+        public Gtk.Box el;
         private Xcls_ProjectSettings  _this;
 
 
             // my vars (def)
 
         // ctor 
-        public Xcls_HBox10(Xcls_ProjectSettings _owner )
+        public Xcls_Box10(Xcls_ProjectSettings _owner )
         {
             _this = _owner;
-            this.el = new Gtk.HBox( false, 0 );
+            this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
 
             // my vars (dec)
 
             // set gobject values
+            this.el.homogeneous = false;
             this.el.expand = false;
             var child_0 = new Xcls_Label11( _this );
             child_0.ref();
@@ -378,23 +396,24 @@ public class Xcls_ProjectSettings : Object
 
         // user defined functions 
     }
-    public class Xcls_HBox13 : Object 
+    public class Xcls_Box13 : Object 
     {
-        public Gtk.HBox el;
+        public Gtk.Box el;
         private Xcls_ProjectSettings  _this;
 
 
             // my vars (def)
 
         // ctor 
-        public Xcls_HBox13(Xcls_ProjectSettings _owner )
+        public Xcls_Box13(Xcls_ProjectSettings _owner )
         {
             _this = _owner;
-            this.el = new Gtk.HBox( false, 0 );
+            this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
 
             // my vars (dec)
 
             // set gobject values
+            this.el.homogeneous = false;
             this.el.expand = false;
             var child_0 = new Xcls_Label14( _this );
             child_0.ref();
@@ -512,8 +531,6 @@ public class Xcls_ProjectSettings : Object
 
             // my vars (dec)
 
-            // set gobject values
-
             // init method 
 
             var description =   Pango.FontDescription.from_string("monospace");
@@ -546,23 +563,24 @@ public class Xcls_ProjectSettings : Object
 
         // user defined functions 
     }
-    public class Xcls_VBox19 : Object 
+    public class Xcls_Box19 : Object 
     {
-        public Gtk.VBox el;
+        public Gtk.Box el;
         private Xcls_ProjectSettings  _this;
 
 
             // my vars (def)
 
         // ctor 
-        public Xcls_VBox19(Xcls_ProjectSettings _owner )
+        public Xcls_Box19(Xcls_ProjectSettings _owner )
         {
             _this = _owner;
-            this.el = new Gtk.VBox( false, 0 );
+            this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
 
             // my vars (dec)
 
             // set gobject values
+            this.el.homogeneous = false;
             var child_0 = new Xcls_Label20( _this );
             child_0.ref();
             this.el.pack_start (  child_0.el , false,false,0 );
@@ -637,6 +655,18 @@ public class Xcls_ProjectSettings : Object
             // my vars (dec)
 
             // set gobject values
+
+            // listeners 
+            this.el.key_press_event.connect( (ev) => {
+            
+                if (ev.keyval == Gdk.Key.Tab) {
+                    _this.database_DBNAME.el.grab_focus();
+                    return true;
+                }
+            
+            
+                return false;
+            });
         }
 
         // user defined functions 
@@ -681,6 +711,18 @@ public class Xcls_ProjectSettings : Object
             // my vars (dec)
 
             // set gobject values
+
+            // listeners 
+            this.el.key_press_event.connect( (ev) => {
+            
+                if (ev.keyval == Gdk.Key.Tab) {
+                    _this.database_DBUSERNAME.el.grab_focus();
+                    return true;
+                }
+            
+            
+                return false;
+            });
         }
 
         // user defined functions 
@@ -725,6 +767,18 @@ public class Xcls_ProjectSettings : Object
             // my vars (dec)
 
             // set gobject values
+
+            // listeners 
+            this.el.key_press_event.connect( (ev) => {
+            
+                if (ev.keyval == Gdk.Key.Tab) {
+                    _this.database_DBPASSWORD.el.grab_focus();
+                    return true;
+                }
+            
+            
+                return false;
+            });
         }
 
         // user defined functions 
@@ -797,23 +851,26 @@ public class Xcls_ProjectSettings : Object
             
             
               _this.database_ERROR.el.label    = "";
-                
+                Gda.Connection cnc;
                 try {
                     // assumes localhost...
-                     var cnc = Gda.Connection.open_from_string (
+                     cnc = Gda.Connection.open_from_string (
                                _this.database_DBTYPE.el.get_text(),
                                "DB_NAME=" + _this.database_DBNAME.el.get_text(), 
                                "USERNAME=" + _this.database_DBUSERNAME.el.get_text() + 
                                ";PASSWORD=" + _this.database_DBPASSWORD.el.get_text(),
                                Gda.ConnectionOptions.NONE
                        );
-               } catch (ConnectionError ce) { 
-                  _this.database_ERROR.el.label = ce.message;        
-               } catch(Error ue) {
+               //} catch (Gda.ConnectionError ce) { 
+               //   _this.database_ERROR.el.label = ce.message;        
+               } catch(Gda.ConnectionError ue) {
+                  _this.database_ERROR.el.label = ue.message;
+                    return;
+               }  catch(Gda.ConfigError ue) {
                   _this.database_ERROR.el.label = ue.message;
                     return;
                }
-                     _this.database_ERROR.el.label = "Connection Succeeded";
+              _this.database_ERROR.el.label = "Connection Succeeded";
                cnc.close();
             });
         }