3 Pango = imports.gi.Pango;
4 GLib = imports.gi.GLib;
6 GObject = imports.gi.GObject;
7 GtkSource = imports.gi.GtkSource;
8 WebKit = imports.gi.WebKit;
10 console = imports.console;
11 XObject = imports.XObject.XObject;
12 DialogNewComponent=new XObject({
15 delete_event : (self, event) => {
20 response : (self, response_id) => {
22 if (response_id < 1) { // cancel!
27 if (_this.name.el.get_text().length < 1) {
28 StandardErrorDialog.show(
29 "You have to set Project name "
36 var isNew = _this.file.name.length > 0 ? false : true;
38 if (_this.file.name.length > 0 && this.file.name != _this.name.el.get_text()) {
39 StandardErrorDialog.show(
40 "Sorry changing names does not work yet. "
46 // FIXME - this may be more complicated...
47 //for (var i in this.def) {
48 // this.file[i] = this.get(i).el.get_text();
58 var dir = _this.project.firstPath();
60 //for (var i in this.project.paths) {
68 if (GLib.FileUtil.test(_this.file.name + ".bjs", GLib.FileTest.EXISTS)) {
69 StandardErrorDialog.show(
70 "That file already exists"
77 //var tmpl = this.project.loadFileOnly(DialogNewComponent.get('template').getValue());
79 var nf = _this.project.create(dir + "/" + _this.file.name + ".bjs");
80 //for (var i in this.file) {
81 // nf[i] = this.file[i];
83 _this.success(_this.project, nf);
86 -- fixme -- needs to be a signal..
87 if (DialogNewComponent.success != null) {
88 DialogNewComponent.success(_this.project, nf);
99 id : "DialogNewComponent",
100 title : "New Component",
103 'void:show' : (JsRender.JsRender c)
105 this.project = c.project;
120 _this.name.el.set_text(c.name);
121 _this.title.el.set_text(c.title);
122 _this.parent.el.set_text(c.parent);
123 _this.region.el.set_text(c.region);
124 _this.modOrder.el.set_text(c.modOrder);
125 _this.permname.el.set_text(c.permname);
127 if (c.path.length > 0) {
128 this.el.set_title("Edit File Details - " + c.name);
130 this.el.set_title("Create New File");
134 //console.log('show all');
137 //this.success = c.success;
144 pack : function(p,e) {
145 p.el.get_content_area().add(e.el)
152 pack : "pack_start,false,false,0",
157 label : "Component Name",
161 justify : Gtk.Justification.RIGHT
175 justify : Gtk.Justification.RIGHT,
188 tooltip_text : "center, north, south, east, west",
191 justify : Gtk.Justification.RIGHT,
202 label : "Parent Name",
206 justify : Gtk.Justification.RIGHT,
217 label : "Permission Name",
221 justify : Gtk.Justification.RIGHT,
232 label : "Order (for tabs)",
236 justify : Gtk.Justification.RIGHT,
251 pack : "add_action_widget,0",
256 pack : "add_action_widget,1",
261 DialogNewComponent.init();
262 XObject.cache['/DialogNewComponent'] = DialogNewComponent;