DialogNewComponent=new XObject({
xtype: Gtk.Dialog,
listeners : {
- delete_event : function (self, event) {
+ delete_event : (self, event) => {
this.el.hide();
- return true;
+ return true;
},
- response : function (self, response_id) {
+ response : (self, response_id) => {
+
if (response_id < 1) { // cancel!
this.el.hide();
return;
}
- if (DialogNewComponent.name.el.get_text().length < 1) {
+ if (_this.name.el.get_text().length < 1) {
StandardErrorDialog.show(
- "You haDe to set Project name "
+ "You have to set Project name "
);
return;
}
- var isNew = this.file.name.length > 0 ? false : true;
+ // what does this do?
- if (this.file.name.length > 0 && this.file.name != _this.name.el.get_text()) {
+ var isNew = _this.file.name.length > 0 ? false : true;
+
+ if (_this.file.name.length > 0 && this.file.name != _this.name.el.get_text()) {
StandardErrorDialog.show(
"Sorry changing names does not work yet. "
);
return;
}
+
// FIXME - this may be more complicated...
//for (var i in this.def) {
// this.file[i] = this.get(i).el.get_text();
//}
-
+
if (!isNew) {
- this.file.save();
+ _this.file.save();
this.el.hide();
return;
}
-
+
- var dir ='';
+ var dir = _this.project.firstPath();
//FIXME...
//for (var i in this.project.paths) {
// dir = i;
// what about .js ?
- if (GLib.file_test (GLib.dir + "/" + this.file.name + ".bjs", GLib.FileTest.EXISTS)) {
+ if (GLib.FileUtils.test(_this.file.name + ".bjs", GLib.FileTest.EXISTS)) {
StandardErrorDialog.show(
"That file already exists"
);
//var tmpl = this.project.loadFileOnly(DialogNewComponent.get('template').getValue());
- var nf = _this.project.create(dir + "/" + this.file.name + ".bjs");
+ var nf = _this.project.create(dir + "/" + _this.file.name + ".bjs");
//for (var i in this.file) {
// nf[i] = this.file[i];
//}
-
+ _this.success(_this.project, nf);
+ /*
+
+ -- fixme -- needs to be a signal..
if (DialogNewComponent.success != null) {
DialogNewComponent.success(_this.project, nf);
}
+ */
},
- show : function (self) {
+ show : (self) => {
this.el.show_all();
+
}
},
default_height : 200,
title : "New Component",
deletable : false,
modal : true,
- show : function (c)
+ 'void:show' : (JsRender.JsRender c)
{
this.project = c.project;
- if (!this.el) {
- this.init();
- }
- this.def = {
- name : '' ,
- title : '' ,
- region : '' ,
- parent: '',
- // disable: '',
- modOrder : '0',
- permname : ''
- };
- for (var i in this.def) {
- c[i] = c[i] || this.def[i];
- this.get(i).el.set_text(c[i]);
- }
- if (c.name) {
+
+ //if (!this.el) {
+ //this.init();
+ //}
+
+ _this.name.el.set_text(c.name);
+ _this.title.el.set_text(c.title);
+ _this.parent.el.set_text(c.parent);
+ _this.region.el.set_text(c.region);
+ _this.modOrder.el.set_text(c.modOrder);
+ _this.permname.el.set_text(c.permname);
+
+ if (c.path.length > 0) {
this.el.set_title("Edit File Details - " + c.name);
} else {
this.el.set_title("Create New File");
}
- this.file = c;
- console.log('show all');
+ _this.file = c;
+ //console.log('show all');
this.el.show_all();
- this.success = c.success;
+
+ //this.success = c.success;
},