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 GtkClutter = imports.gi.GtkClutter;
11 console = imports.console;
12 XObject = imports.XObject.XObject;
13 DialogNewComponent=new XObject({
16 delete_event : function (self, event) {
20 response : function (self, response_id) {
21 if (response_id < 1) { // cancel!
26 if (!this.get('name').el.get_text().length ) {
27 this.get('/StandardErrorDialog').show(
28 "You have to set Project name "
33 var isNew = this.file.name.length ? false : true;
35 if (this.file.name.length && this.file.name != this.get('name').el.get_text()) {
36 this.get('/StandardErrorDialog').show(
37 "Sorry changing names does not work yet. "
42 for (var i in this.def) {
43 this.file[i] = this.get(i).el.get_text();
54 for (var i in this.project.paths) {
62 if (GLib.file_test (GLib.dir + '/' + this.file.name + '.bjs', GLib.FileTest.EXISTS)) {
63 StandardErrorDialog.show(
64 "That file already exists"
71 //var tmpl = this.project.loadFileOnly(DialogNewComponent.get('template').getValue());
74 var nf = _this.project.create(dir + '/' + this.file.name + '.bjs');
75 for (var i in this.file) {
78 if (this.get('/DialogNewComponent').success) {
79 this.get('/DialogNewComponent').success(_this.project, nf);
82 show : function (self) {
88 id : "DialogNewComponent",
89 title : "New Component",
94 this.project = c.project;
107 for (var i in this.def) {
108 c[i] = c[i] || this.def[i];
109 this.get(i).el.set_text(c[i]);
112 this.el.set_title("Edit File Details - " + c.name);
114 this.el.set_title("Create New File");
118 console.log('show all');
120 this.success = c.success;
127 pack : function(p,e) {
128 p.el.get_content_area().add(e.el)
135 pack : "pack_start,false,false,0",
140 label : "Component Name",
144 justify : Gtk.Justification.RIGHT
158 justify : Gtk.Justification.RIGHT,
171 tooltip_text : "center, north, south, east, west",
174 justify : Gtk.Justification.RIGHT,
185 label : "Parent Name",
189 justify : Gtk.Justification.RIGHT,
200 label : "Permission Name",
204 justify : Gtk.Justification.RIGHT,
215 label : "Order (for tabs)",
219 justify : Gtk.Justification.RIGHT,
234 pack : "add_action_widget,0",
239 pack : "add_action_widget,1",
244 DialogNewComponent.init();
245 XObject.cache['/DialogNewComponent'] = DialogNewComponent;