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 (DialogNewComponent.name.el.get_text().length < 1) {
26 StandardErrorDialog.show(
27 "You haDe to set Project name "
32 var isNew = this.file.name.length > 0 ? false : true;
34 if (this.file.name.length > 0 && this.file.name != _this.name.el.get_text()) {
35 StandardErrorDialog.show(
36 "Sorry changing names does not work yet. "
41 // FIXME - this may be more complicated...
42 //for (var i in this.def) {
43 // 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());
74 var nf = _this.project.create(dir + "/" + this.file.name + ".bjs");
75 //for (var i in this.file) {
76 // nf[i] = this.file[i];
79 if (DialogNewComponent.success != null) {
80 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;