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;
12 console = imports.console;
13 XObject = imports.XObject.XObject;
14 DialogNewComponent=new XObject({
17 delete_event : function (self, event) {
21 response : function (self, response_id) {
22 if (response_id < 1) { // cancel!
27 if (!this.get('name').el.get_text().length ) {
28 this.get('/StandardErrorDialog').show(
29 "You have to set Project name "
34 var isNew = this.file.name.length ? false : true;
36 if (this.file.name.length && this.file.name != this.get('name').el.get_text()) {
37 this.get('/StandardErrorDialog').show(
38 "Sorry changing names does not work yet. "
43 for (var i in this.def) {
44 this.file[i] = this.get(i).el.get_text();
55 for (var i in this.project.paths) {
63 if (GLib.file_test (GLib.dir + '/' + this.file.name + '.bjs', GLib.FileTest.EXISTS)) {
64 StandardErrorDialog.show(
65 "That file already exists"
72 //var tmpl = this.project.loadFileOnly(DialogNewComponent.get('template').getValue());
75 var nf = _this.project.create(dir + '/' + this.file.name + '.bjs');
76 for (var i in this.file) {
79 if (this.get('/DialogNewComponent').success) {
80 this.get('/DialogNewComponent').success(_this.project, nf);
83 show : function (self) {
89 id : "DialogNewComponent",
90 title : "New Component",
95 this.project = c.project;
108 for (var i in this.def) {
109 c[i] = c[i] || this.def[i];
110 this.get(i).el.set_text(c[i]);
113 this.el.set_title("Edit File Details - " + c.name);
115 this.el.set_title("Create New File");
119 console.log('show all');
121 this.success = c.success;
128 pack : function(p,e) {
129 p.el.get_content_area().add(e.el)
136 pack : "pack_start,false,false,0",
141 label : "Component Name",
145 justify : Gtk.Justification.RIGHT
159 justify : Gtk.Justification.RIGHT,
172 tooltip_text : "center, north, south, east, west",
175 justify : Gtk.Justification.RIGHT,
186 label : "Parent Name",
190 justify : Gtk.Justification.RIGHT,
201 label : "Permission Name",
205 justify : Gtk.Justification.RIGHT,
216 label : "Order (for tabs)",
220 justify : Gtk.Justification.RIGHT,
235 pack : "add_action_widget,0",
240 pack : "add_action_widget,1",
245 DialogNewComponent.init();
246 XObject.cache['/DialogNewComponent'] = DialogNewComponent;