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.FileUtils.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;
110 _this.name.el.set_text(c.name);
111 _this.title.el.set_text(c.title);
112 _this.parent.el.set_text(c.parent);
113 _this.region.el.set_text(c.region);
114 _this.modOrder.el.set_text(c.modOrder);
115 _this.permname.el.set_text(c.permname);
117 if (c.path.length > 0) {
118 this.el.set_title("Edit File Details - " + c.name);
120 this.el.set_title("Create New File");
124 //console.log('show all');
127 //this.success = c.success;
134 pack : function(p,e) {
135 p.el.get_content_area().add(e.el)
142 pack : "pack_start,false,false,0",
147 label : "Component Name",
151 justify : Gtk.Justification.RIGHT
165 justify : Gtk.Justification.RIGHT,
178 tooltip_text : "center, north, south, east, west",
181 justify : Gtk.Justification.RIGHT,
192 label : "Parent Name",
196 justify : Gtk.Justification.RIGHT,
207 label : "Permission Name",
211 justify : Gtk.Justification.RIGHT,
222 label : "Order (for tabs)",
226 justify : Gtk.Justification.RIGHT,
241 pack : "add_action_widget,0",
246 pack : "add_action_widget,1",
251 DialogNewComponent.init();
252 XObject.cache['/DialogNewComponent'] = DialogNewComponent;