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 (DialogNewComponent.name.el.get_text().length < 1) {
27 StandardErrorDialog.show(
28 "You haDe to set Project name "
34 var isNew = this.file.name.length > 0 ? false : true;
36 if (this.file.name.length > 0 && this.file.name != _this.name.el.get_text()) {
37 StandardErrorDialog.show(
38 "Sorry changing names does not work yet. "
43 // FIXME - this may be more complicated...
44 //for (var i in this.def) {
45 // this.file[i] = this.get(i).el.get_text();
57 //for (var i in this.project.paths) {
65 if (GLib.file_test (GLib.dir + "/" + this.file.name + ".bjs", GLib.FileTest.EXISTS)) {
66 StandardErrorDialog.show(
67 "That file already exists"
74 //var tmpl = this.project.loadFileOnly(DialogNewComponent.get('template').getValue());
76 var nf = _this.project.create(dir + "/" + this.file.name + ".bjs");
77 //for (var i in this.file) {
78 // nf[i] = this.file[i];
81 if (DialogNewComponent.success != null) {
82 DialogNewComponent.success(_this.project, nf);
85 show : function (self) {
91 id : "DialogNewComponent",
92 title : "New Component",
97 this.project = c.project;
110 for (var i in this.def) {
111 c[i] = c[i] || this.def[i];
112 this.get(i).el.set_text(c[i]);
115 this.el.set_title("Edit File Details - " + c.name);
117 this.el.set_title("Create New File");
121 console.log('show all');
123 this.success = c.success;
130 pack : function(p,e) {
131 p.el.get_content_area().add(e.el)
138 pack : "pack_start,false,false,0",
143 label : "Component Name",
147 justify : Gtk.Justification.RIGHT
161 justify : Gtk.Justification.RIGHT,
174 tooltip_text : "center, north, south, east, west",
177 justify : Gtk.Justification.RIGHT,
188 label : "Parent Name",
192 justify : Gtk.Justification.RIGHT,
203 label : "Permission Name",
207 justify : Gtk.Justification.RIGHT,
218 label : "Order (for tabs)",
222 justify : Gtk.Justification.RIGHT,
237 pack : "add_action_widget,0",
242 pack : "add_action_widget,1",
247 DialogNewComponent.init();
248 XObject.cache['/DialogNewComponent'] = DialogNewComponent;