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 : function (self, event) {
19 response : function (self, response_id) {
20 if (response_id < 1) { // cancel!
25 if (!this.get('name').el.get_text().length ) {
26 this.get('/StandardErrorDialog').show(
27 "You have to set Project name "
32 var isNew = this.file.name.length ? false : true;
34 if (this.file.name.length && this.file.name != this.get('name').el.get_text()) {
35 this.get('/StandardErrorDialog').show(
36 "Sorry changing names does not work yet. "
41 for (var i in this.def) {
42 this.file[i] = this.get(i).el.get_text();
53 for (var i in this.project.paths) {
61 if (GLib.file_test (GLib.dir + '/' + this.file.name + '.bjs', GLib.FileTest.EXISTS)) {
62 StandardErrorDialog.show(
63 "That file already exists"
70 //var tmpl = this.project.loadFileOnly(DialogNewComponent.get('template').getValue());
73 var nf = _this.project.create(dir + '/' + this.file.name + '.bjs');
74 for (var i in this.file) {
77 if (this.get('/DialogNewComponent').success) {
78 this.get('/DialogNewComponent').success(_this.project, nf);
81 show : function (self) {
87 id : "DialogNewComponent",
88 title : "New Component",
93 this.project = c.project;
106 for (var i in this.def) {
107 c[i] = c[i] || this.def[i];
108 this.get(i).el.set_text(c[i]);
111 this.el.set_title("Edit File Details - " + c.name);
113 this.el.set_title("Create New File");
117 console.log('show all');
119 this.success = c.success;
126 pack : function(p,e) {
127 p.el.get_content_area().add(e.el)
134 pack : "pack_start,false,false,0",
139 label : "Component Name",
143 justify : Gtk.Justification.RIGHT
157 justify : Gtk.Justification.RIGHT,
170 tooltip_text : "center, north, south, east, west",
173 justify : Gtk.Justification.RIGHT,
184 label : "Parent Name",
188 justify : Gtk.Justification.RIGHT,
199 label : "Permission Name",
203 justify : Gtk.Justification.RIGHT,
214 label : "Order (for tabs)",
218 justify : Gtk.Justification.RIGHT,
233 pack : "add_action_widget,0",
238 pack : "add_action_widget,1",
243 DialogNewComponent.init();
244 XObject.cache['/DialogNewComponent'] = DialogNewComponent;