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().length ) {
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",
105 for (var i in this.def) {
106 c[i] = c[i] || this.def[i];
107 this.get(i).el.set_text(c[i]);
111 console.log('show all');
113 this.success = c.success;
120 pack : function(p,e) {
121 p.el.get_content_area().add(e.el)
128 pack : "pack_start,false,false,0",
133 label : "Component Name",
137 justify : Gtk.Justification.RIGHT
151 justify : Gtk.Justification.RIGHT,
164 tooltip_text : "center, north, south, east, west",
167 justify : Gtk.Justification.RIGHT,
178 label : "Parent Name",
182 justify : Gtk.Justification.RIGHT,
193 label : "Disable method",
197 justify : Gtk.Justification.RIGHT,
208 label : "Order (for tabs)",
212 justify : Gtk.Justification.RIGHT,
227 pack : "add_action_widget,0",
232 pack : "add_action_widget,1",
237 DialogNewComponent.init();
238 XObject.cache['/DialogNewComponent'] = DialogNewComponent;