2 valac --pkg gio-2.0 --pkg posix --pkg gtk+-3.0 --pkg libnotify --pkg gtksourceview-3.0 --pkg libwnck-3.0 \
3 /tmp/DialogNewComponent.vala -o /tmp/DialogNewComponent
8 static int main (string[] args) {
10 new Xcls_DialogNewComponent();
11 DialogNewComponent.show_all();
18 public static Xcls_DialogNewComponent DialogNewComponent;
20 public class Xcls_DialogNewComponent
23 private static Xcls_DialogNewComponent _this;
25 public Xcls_name name;
26 public Xcls_title title;
27 public Xcls_region region;
28 public Xcls_parent parent;
29 public Xcls_permname permname;
30 public Xcls_modOrder modOrder;
33 public JsRender.JsRender file;
34 public Project.Project project;
35 public signal void success(Project.Project pr, JsRender.JsRender file);
38 public Xcls_DialogNewComponent()
40 this.el = new Gtk.Dialog();
42 DialogNewComponent = this;
47 this.el.default_height = 200;
48 this.el.default_width = 500;
49 this.el.deletable = false;
51 this.el.title = "New Component";
52 var child_0 = new Xcls_VBox2();
53 this.el.add ( child_0.el );
54 var child_1 = new Xcls_Button16();
55 this.el.add_action_widget ( child_1.el , 0 );
56 var child_2 = new Xcls_Button17();
57 this.el.add_action_widget ( child_2.el , 1 );
60 this.el.delete_event.connect( (self, event) => {
67 this.el.response.connect( (self, response_id) => {
69 if (response_id < 1) { // cancel!
74 if (_this.name.el.get_text().length < 1) {
75 StandardErrorDialog.show(
76 "You have to set Project name "
83 var isNew = _this.file.name.length > 0 ? false : true;
85 if (_this.file.name.length > 0 && this.file.name != _this.name.el.get_text()) {
86 StandardErrorDialog.show(
87 "Sorry changing names does not work yet. "
93 // FIXME - this may be more complicated...
94 //for (var i in this.def) {
95 // this.file[i] = this.get(i).el.get_text();
105 var dir = _this.project.firstPath();
107 //for (var i in this.project.paths) {
115 if (GLib.FileUtil.test(_this.file.name + ".bjs", GLib.FileTest.EXISTS)) {
116 StandardErrorDialog.show(
117 "That file already exists"
124 //var tmpl = this.project.loadFileOnly(DialogNewComponent.get('template').getValue());
126 var nf = _this.project.create(dir + "/" + _this.file.name + ".bjs");
127 //for (var i in this.file) {
128 // nf[i] = this.file[i];
130 _this.success(_this.project, nf);
133 -- fixme -- needs to be a signal..
134 if (DialogNewComponent.success != null) {
135 DialogNewComponent.success(_this.project, nf);
139 this.el.show.connect( (self) => {
145 // userdefined functions
147 // skip listeners - not pipe
149 // skip .JsRender.JsRender:file - already used
151 // skip .Project.Project:project - already used
153 // skip .signal:void:success - already used
155 // skip default_height - already used
157 // skip default_width - already used
159 // skip id - not pipe
161 // skip title - already used
163 // skip xtype - not pipe
165 // skip |deletable - already used
167 // skip |modal - already used
168 public void show(JsRender.JsRender c)
170 this.project = c.project;
185 _this.name.el.set_text(c.name);
186 _this.title.el.set_text(c.title);
187 _this.parent.el.set_text(c.parent);
188 _this.region.el.set_text(c.region);
189 _this.modOrder.el.set_text(c.modOrder);
190 _this.permname.el.set_text(c.permname);
192 if (c.path.length > 0) {
193 this.el.set_title("Edit File Details - " + c.name);
195 this.el.set_title("Create New File");
199 //console.log('show all');
202 //this.success = c.success;
207 // skip |xns - no return type
209 // skip items - not pipe
211 // skip xvala_cls - not pipe
213 // skip xvala_xcls - not pipe
215 // skip xvala_id - not pipe
216 public class Xcls_VBox2
225 this.el = new Gtk.VBox( true, 0 );
229 // set gobject values
230 var child_0 = new Xcls_Table3();
231 this.el.pack_start ( child_0.el , false,false,0 );
234 // userdefined functions
236 // skip |xns - no return type
238 // skip xtype - not pipe
240 // skip |pack - already used
242 // skip items - not pipe
244 // skip xvala_cls - not pipe
246 // skip xvala_xcls - not pipe
248 // skip xvala_id - not pipe
250 public class Xcls_Table3
259 this.el = new Gtk.Table();
263 // set gobject values
264 this.el.homogeneous = false;
265 this.el.n_columns = 2;
267 var child_0 = new Xcls_Label4();
268 this.el.add ( child_0.el );
269 var child_1 = new Xcls_name();
270 this.el.add ( child_1.el );
271 var child_2 = new Xcls_Label6();
272 this.el.add ( child_2.el );
273 var child_3 = new Xcls_title();
274 this.el.add ( child_3.el );
275 var child_4 = new Xcls_Label8();
276 this.el.add ( child_4.el );
277 var child_5 = new Xcls_region();
278 this.el.add ( child_5.el );
279 var child_6 = new Xcls_Label10();
280 this.el.add ( child_6.el );
281 var child_7 = new Xcls_parent();
282 this.el.add ( child_7.el );
283 var child_8 = new Xcls_Label12();
284 this.el.add ( child_8.el );
285 var child_9 = new Xcls_permname();
286 this.el.add ( child_9.el );
287 var child_10 = new Xcls_Label14();
288 this.el.add ( child_10.el );
289 var child_11 = new Xcls_modOrder();
290 this.el.add ( child_11.el );
293 // userdefined functions
295 // skip n_columns - already used
297 // skip n_rows - already used
299 // skip pack - not pipe
301 // skip xtype - not pipe
303 // skip |homogeneous - already used
305 // skip |xns - no return type
307 // skip items - not pipe
309 // skip xvala_cls - not pipe
311 // skip xvala_xcls - not pipe
313 // skip xvala_id - not pipe
315 public class Xcls_Label4
324 this.el = new Gtk.Label();
328 // set gobject values
329 this.el.justify = Gtk.Justification.RIGHT;
330 this.el.label = "Component Name";
331 this.el.xalign = 0.9;
334 // userdefined functions
336 // skip label - already used
338 // skip pack - not pipe
340 // skip x_options - not pipe
342 // skip xalign - already used
344 // skip xtype - not pipe
346 // skip |justify - already used
348 // skip |xns - no return type
350 // skip xvala_cls - not pipe
352 // skip xvala_xcls - not pipe
354 // skip xvala_id - not pipe
356 public class Xcls_name
365 this.el = new Gtk.Entry();
370 // set gobject values
371 this.el.visible = true;
374 // userdefined functions
376 // skip id - not pipe
378 // skip pack - not pipe
380 // skip xtype - not pipe
382 // skip |visible - already used
384 // skip |xns - no return type
386 // skip xvala_cls - not pipe
388 // skip xvala_xcls - not pipe
390 // skip xvala_id - not pipe
392 public class Xcls_Label6
401 this.el = new Gtk.Label();
405 // set gobject values
406 this.el.justify = Gtk.Justification.RIGHT;
407 this.el.label = "Title";
408 this.el.visible = true;
409 this.el.xalign = 0.9;
412 // userdefined functions
414 // skip label - already used
416 // skip pack - not pipe
418 // skip x_options - not pipe
420 // skip xalign - already used
422 // skip xtype - not pipe
424 // skip |justify - already used
426 // skip |visible - already used
428 // skip |xns - no return type
430 // skip xvala_cls - not pipe
432 // skip xvala_xcls - not pipe
434 // skip xvala_id - not pipe
436 public class Xcls_title
445 this.el = new Gtk.Entry();
450 // set gobject values
451 this.el.visible = true;
454 // userdefined functions
456 // skip id - not pipe
458 // skip pack - not pipe
460 // skip xtype - not pipe
462 // skip |visible - already used
464 // skip |xns - no return type
466 // skip xvala_cls - not pipe
468 // skip xvala_xcls - not pipe
470 // skip xvala_id - not pipe
472 public class Xcls_Label8
481 this.el = new Gtk.Label();
485 // set gobject values
486 this.el.justify = Gtk.Justification.RIGHT;
487 this.el.label = "Region";
488 this.el.tooltip_text = "center, north, south, east, west";
489 this.el.visible = true;
490 this.el.xalign = 0.9;
493 // userdefined functions
495 // skip label - already used
497 // skip pack - not pipe
499 // skip tooltip_text - already used
501 // skip x_options - not pipe
503 // skip xalign - already used
505 // skip xtype - not pipe
507 // skip |justify - already used
509 // skip |visible - already used
511 // skip |xns - no return type
513 // skip xvala_cls - not pipe
515 // skip xvala_xcls - not pipe
517 // skip xvala_id - not pipe
519 public class Xcls_region
528 this.el = new Gtk.Entry();
533 // set gobject values
534 this.el.visible = true;
537 // userdefined functions
539 // skip id - not pipe
541 // skip pack - not pipe
543 // skip xtype - not pipe
545 // skip |visible - already used
547 // skip |xns - no return type
549 // skip xvala_cls - not pipe
551 // skip xvala_xcls - not pipe
553 // skip xvala_id - not pipe
555 public class Xcls_Label10
562 public Xcls_Label10()
564 this.el = new Gtk.Label();
568 // set gobject values
569 this.el.justify = Gtk.Justification.RIGHT;
570 this.el.label = "Parent Name";
571 this.el.visible = true;
572 this.el.xalign = 0.9;
575 // userdefined functions
577 // skip label - already used
579 // skip pack - not pipe
581 // skip x_options - not pipe
583 // skip xalign - already used
585 // skip xtype - not pipe
587 // skip |justify - already used
589 // skip |visible - already used
591 // skip |xns - no return type
593 // skip xvala_cls - not pipe
595 // skip xvala_xcls - not pipe
597 // skip xvala_id - not pipe
599 public class Xcls_parent
608 this.el = new Gtk.Entry();
613 // set gobject values
614 this.el.visible = true;
617 // userdefined functions
619 // skip id - not pipe
621 // skip pack - not pipe
623 // skip xtype - not pipe
625 // skip |visible - already used
627 // skip |xns - no return type
629 // skip xvala_cls - not pipe
631 // skip xvala_xcls - not pipe
633 // skip xvala_id - not pipe
635 public class Xcls_Label12
642 public Xcls_Label12()
644 this.el = new Gtk.Label();
648 // set gobject values
649 this.el.justify = Gtk.Justification.RIGHT;
650 this.el.label = "Permission Name";
651 this.el.visible = true;
652 this.el.xalign = 0.9;
655 // userdefined functions
657 // skip label - already used
659 // skip pack - not pipe
661 // skip x_options - not pipe
663 // skip xalign - already used
665 // skip xtype - not pipe
667 // skip |justify - already used
669 // skip |visible - already used
671 // skip |xns - no return type
673 // skip xvala_cls - not pipe
675 // skip xvala_xcls - not pipe
677 // skip xvala_id - not pipe
679 public class Xcls_permname
686 public Xcls_permname()
688 this.el = new Gtk.Entry();
689 _this.permname = this;
693 // set gobject values
694 this.el.visible = true;
697 // userdefined functions
699 // skip id - not pipe
701 // skip pack - not pipe
703 // skip xtype - not pipe
705 // skip |visible - already used
707 // skip |xns - no return type
709 // skip xvala_cls - not pipe
711 // skip xvala_xcls - not pipe
713 // skip xvala_id - not pipe
715 public class Xcls_Label14
722 public Xcls_Label14()
724 this.el = new Gtk.Label();
728 // set gobject values
729 this.el.justify = Gtk.Justification.RIGHT;
730 this.el.label = "Order (for tabs)";
731 this.el.visible = true;
732 this.el.xalign = 0.9;
735 // userdefined functions
737 // skip label - already used
739 // skip pack - not pipe
741 // skip x_options - not pipe
743 // skip xalign - already used
745 // skip xtype - not pipe
747 // skip |justify - already used
749 // skip |visible - already used
751 // skip |xns - no return type
753 // skip xvala_cls - not pipe
755 // skip xvala_xcls - not pipe
757 // skip xvala_id - not pipe
759 public class Xcls_modOrder
766 public Xcls_modOrder()
768 this.el = new Gtk.Entry();
769 _this.modOrder = this;
773 // set gobject values
774 this.el.visible = true;
777 // userdefined functions
779 // skip id - not pipe
781 // skip pack - not pipe
783 // skip xtype - not pipe
785 // skip |visible - already used
787 // skip |xns - no return type
789 // skip xvala_cls - not pipe
791 // skip xvala_xcls - not pipe
793 // skip xvala_id - not pipe
795 public class Xcls_Button16
797 public Gtk.Button el;
802 public Xcls_Button16()
804 this.el = new Gtk.Button();
808 // set gobject values
809 this.el.label = "Cancel";
812 // userdefined functions
814 // skip |xns - no return type
816 // skip xtype - not pipe
818 // skip pack - not pipe
820 // skip label - already used
822 // skip xvala_cls - not pipe
824 // skip xvala_xcls - not pipe
826 // skip xvala_id - not pipe
828 public class Xcls_Button17
830 public Gtk.Button el;
835 public Xcls_Button17()
837 this.el = new Gtk.Button();
841 // set gobject values
842 this.el.label = "OK";
845 // userdefined functions
847 // skip |xns - no return type
849 // skip xtype - not pipe
851 // skip pack - not pipe
853 // skip label - already used
855 // skip xvala_cls - not pipe
857 // skip xvala_xcls - not pipe
859 // skip xvala_id - not pipe