X-Git-Url: http://git.roojs.org/?a=blobdiff_plain;f=src%2FBuilder4%2FDialogNewComponent.vala;h=ff65b70a029881df656953a32c53b7e8a5c863ae;hb=7e857d8072408ca9f7a3384f2bff241200b5991c;hp=640cf8eef9e1ac12826820c0a489d3bfd8c4a3b7;hpb=84f81bf1e0dbededfb5b89ec6ff10f1aa989ac32;p=app.Builder.js diff --git a/src/Builder4/DialogNewComponent.vala b/src/Builder4/DialogNewComponent.vala index 640cf8eef..ff65b70a0 100644 --- a/src/Builder4/DialogNewComponent.vala +++ b/src/Builder4/DialogNewComponent.vala @@ -19,6 +19,8 @@ public class Xcls_DialogNewComponent : Object public Xcls_permname permname; public Xcls_modOrder modOrder; public Xcls_build_module build_module; + public Xcls_dbcellrenderer dbcellrenderer; + public Xcls_dbmodel dbmodel; // my vars (def) public signal void success (Project.Project pr, JsRender.JsRender file); @@ -43,10 +45,10 @@ public class Xcls_DialogNewComponent : Object var child_0 = new Xcls_VBox2( _this ); child_0.ref(); this.el.get_content_area().add ( child_0.el ); - var child_1 = new Xcls_Button18( _this ); + var child_1 = new Xcls_Button20( _this ); child_1.ref(); this.el.add_action_widget ( child_1.el , 0 ); - var child_2 = new Xcls_Button19( _this ); + var child_2 = new Xcls_Button21( _this ); child_2.ref(); this.el.add_action_widget ( child_2.el , 1 ); @@ -174,6 +176,20 @@ public class Xcls_DialogNewComponent : Object if (_this.file.name.length > 0 && _this.file.name != _this.name.el.get_text()) { _this.file.renameTo(_this.name.el.get_text()); } + // store the module... + _this.file.build_module = ""; + Gtk.TreeIter iter; + if (_this.build_module.el.get_active_iter (out iter)) { + Value vfname; + this.dbmodel.el.get_value (iter, 0, out vfname); + if (((string)vfname).length > 0) { + _this.file.build_module = (string)vfname; + } + + } + + + } public void show (JsRender.JsRender c) @@ -196,6 +212,26 @@ public class Xcls_DialogNewComponent : Object } else { this.el.set_title("Create New File"); } + + var ar = new Gee.ArrayList(); + _this.dbmodel.loadData(ar,""); + // load the modules... if relivant.. + if (this.project.xtype == "Gtk") { + var p = (Project.Gtk)c.project; + var cg = p.compilegroups; + + var iter = cg.map_iterator(); + while(iter.next()) { + var key = iter.get_key(); + if (key == "_default_") { + continue; + } + ar.add(key); + }; + _this.dbmodel.loadData(ar, c.build_module); + + } + _this.file = c; //console.log('show all'); @@ -615,12 +651,100 @@ public class Xcls_DialogNewComponent : Object // my vars (dec) + // set gobject values + var child_0 = new Xcls_dbcellrenderer( _this ); + child_0.ref(); + this.el.pack_start ( child_0.el , true ); + var child_1 = new Xcls_dbmodel( _this ); + child_1.ref(); + this.el.set_model ( child_1.el ); + + // init method + + this.el.add_attribute(_this.dbcellrenderer.el , "markup", 1 ); + } + + // user defined functions + } + public class Xcls_dbcellrenderer : Object + { + public Gtk.CellRendererText el; + private Xcls_DialogNewComponent _this; + + + // my vars (def) + + // ctor + public Xcls_dbcellrenderer(Xcls_DialogNewComponent _owner ) + { + _this = _owner; + _this.dbcellrenderer = this; + this.el = new Gtk.CellRendererText(); + + // my vars (dec) + // set gobject values } // user defined functions } - public class Xcls_Button18 : Object + public class Xcls_dbmodel : Object + { + public Gtk.ListStore el; + private Xcls_DialogNewComponent _this; + + + // my vars (def) + + // ctor + public Xcls_dbmodel(Xcls_DialogNewComponent _owner ) + { + _this = _owner; + _this.dbmodel = this; + this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) ); + + // my vars (dec) + + // set gobject values + } + + // user defined functions + public void loadData (Gee.ArrayList data, string cur) { + this.el.clear(); + Gtk.TreeIter iter; + var el = this.el; + + /// el.append(out iter); + + + // el.set_value(iter, 0, ""); + // el.set_value(iter, 1, "aaa - Just add Element - aaa"); + + el.append(out iter); + + + el.set_value(iter, 0, ""); + el.set_value(iter, 1, "-- select a module --"); + _this.build_module.el.set_active_iter(iter); + + for (var i = 0; i < data.size;i++) { + + + el.append(out iter); + + el.set_value(iter, 0, data.get(i)); + el.set_value(iter, 1, data.get(i)); + + if (data.get(i) == cur) { + _this.build_module.el.set_active_iter(iter); + } + + } + this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING); + + } + } + public class Xcls_Button20 : Object { public Gtk.Button el; private Xcls_DialogNewComponent _this; @@ -629,7 +753,7 @@ public class Xcls_DialogNewComponent : Object // my vars (def) // ctor - public Xcls_Button18(Xcls_DialogNewComponent _owner ) + public Xcls_Button20(Xcls_DialogNewComponent _owner ) { _this = _owner; this.el = new Gtk.Button(); @@ -642,7 +766,7 @@ public class Xcls_DialogNewComponent : Object // user defined functions } - public class Xcls_Button19 : Object + public class Xcls_Button21 : Object { public Gtk.Button el; private Xcls_DialogNewComponent _this; @@ -651,7 +775,7 @@ public class Xcls_DialogNewComponent : Object // my vars (def) // ctor - public Xcls_Button19(Xcls_DialogNewComponent _owner ) + public Xcls_Button21(Xcls_DialogNewComponent _owner ) { _this = _owner; this.el = new Gtk.Button();