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) => {
19 response : (self, response_id) => {
21 if (response_id < 1) { // cancel!
26 if (_this.name.el.get_text().length < 1) {
27 StandardErrorDialog.show(
28 "You have to set Project name "
35 var isNew = _this.file.name.length > 0 ? false : true;
37 if (_this.file.name.length > 0 && this.file.name != _this.name.el.get_text()) {
38 StandardErrorDialog.show(
39 "Sorry changing names does not work yet. "
45 // FIXME - this may be more complicated...
46 //for (var i in this.def) {
47 // this.file[i] = this.get(i).el.get_text();
57 var dir = _this.project.firstPath();
59 //for (var i in this.project.paths) {
67 if (GLib.FileUtil.test(_this.file.name + ".bjs", GLib.FileTest.EXISTS)) {
68 StandardErrorDialog.show(
69 "That file already exists"
76 //var tmpl = this.project.loadFileOnly(DialogNewComponent.get('template').getValue());
78 var nf = _this.project.create(dir + "/" + _this.file.name + ".bjs");
79 //for (var i in this.file) {
80 // nf[i] = this.file[i];
82 _this.success(_this.project, nf);
85 -- fixme -- needs to be a signal..
86 if (DialogNewComponent.success != null) {
87 DialogNewComponent.success(_this.project, nf);
98 id : "DialogNewComponent",
99 title : "New Component",
102 'void:show' : (JsRender.JsRender c)
104 this.project = c.project;
119 _this.name.el.set_text(c.name);
120 _this.title.el.set_text(c.title);
121 _this.parent.el.set_text(c.parent);
122 _this.region.el.set_text(c.region);
123 _this.modOrder.el.set_text(c.modOrder);
124 _this.permname.el.set_text(c.permname);
126 if (c.path.length > 0) {
127 this.el.set_title("Edit File Details - " + c.name);
129 this.el.set_title("Create New File");
133 //console.log('show all');
136 //this.success = c.success;
143 pack : function(p,e) {
144 p.el.get_content_area().add(e.el)
151 pack : "pack_start,false,false,0",
156 label : "Component Name",
160 justify : Gtk.Justification.RIGHT
174 justify : Gtk.Justification.RIGHT,
187 tooltip_text : "center, north, south, east, west",
190 justify : Gtk.Justification.RIGHT,
201 label : "Parent Name",
205 justify : Gtk.Justification.RIGHT,
216 label : "Permission Name",
220 justify : Gtk.Justification.RIGHT,
231 label : "Order (for tabs)",
235 justify : Gtk.Justification.RIGHT,
250 pack : "add_action_widget,0",
255 pack : "add_action_widget,1",
260 DialogNewComponent.init();
261 XObject.cache['/DialogNewComponent'] = DialogNewComponent;