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;
37 public Xcls_DialogNewComponent()
39 this.el = new Gtk.Dialog();
41 DialogNewComponent = this;
46 this.el.default_height = 200;
47 this.el.default_width = 500;
48 this.el.deletable = false;
50 this.el.title = "New Component";
51 var child_0 = new Xcls_VBox2();
52 this.el.add ( child_0.el );
53 var child_1 = new Xcls_Button16();
54 this.el.add_action_widget ( child_1.el , 0 );
55 var child_2 = new Xcls_Button17();
56 this.el.add_action_widget ( child_2.el , 1 );
59 this.el.delete_event.connect( (self, event) => {
65 this.el.response.connect( (self, response_id) => {
67 if (response_id < 1) { // cancel!
72 if (_this.name.el.get_text().length < 1) {
73 StandardErrorDialog.show(
74 "You have to set Project name "
81 var isNew = _this.file.name.length > 0 ? false : true;
83 if (_this.file.name.length > 0 && this.file.name != _this.name.el.get_text()) {
84 StandardErrorDialog.show(
85 "Sorry changing names does not work yet. "
91 // FIXME - this may be more complicated...
92 //for (var i in this.def) {
93 // this.file[i] = this.get(i).el.get_text();
103 var dir = _this.project.firstPath();
105 //for (var i in this.project.paths) {
113 if (GLib.FileUtil.test(_this.file.name + ".bjs", GLib.FileTest.EXISTS)) {
114 StandardErrorDialog.show(
115 "That file already exists"
122 //var tmpl = this.project.loadFileOnly(DialogNewComponent.get('template').getValue());
124 var nf = _this.project.create(dir + "/" + _this.file.name + ".bjs");
125 //for (var i in this.file) {
126 // nf[i] = this.file[i];
129 -- fixme -- needs to be a signal..
130 if (DialogNewComponent.success != null) {
131 DialogNewComponent.success(_this.project, nf);
135 this.el.show.connect( (self) => {
140 // userdefined functions
142 // skip listeners - not pipe
144 // skip .JsRender.JsRender:file - already used
146 // skip .Project.Project:project - already used
148 // skip default_height - already used
150 // skip default_width - already used
152 // skip id - not pipe
154 // skip title - already used
156 // skip xtype - not pipe
158 // skip |deletable - already used
160 // skip |modal - already used
161 public void show(JsRender.JsRender c)
163 this.project = c.project;
180 for (var i in this.def) {
181 c[i] = c[i] || this.def[i];
182 this.get(i).el.set_text(c[i]);
185 if (c.path.length > 0) {
186 this.el.set_title("Edit File Details - " + c.name);
188 this.el.set_title("Create New File");
192 console.log('show all');
194 this.success = c.success;
199 // skip |xns - no return type
201 // skip items - not pipe
203 // skip xvala_cls - not pipe
205 // skip xvala_xcls - not pipe
207 // skip xvala_id - not pipe
208 public class Xcls_VBox2
217 this.el = new Gtk.VBox( true, 0 );
221 // set gobject values
222 var child_0 = new Xcls_Table3();
223 this.el.pack_start ( child_0.el , false,false,0 );
226 // userdefined functions
228 // skip |xns - no return type
230 // skip xtype - not pipe
232 // skip |pack - already used
234 // skip items - not pipe
236 // skip xvala_cls - not pipe
238 // skip xvala_xcls - not pipe
240 // skip xvala_id - not pipe
242 public class Xcls_Table3
251 this.el = new Gtk.Table();
255 // set gobject values
256 this.el.homogeneous = false;
257 this.el.n_columns = 2;
259 var child_0 = new Xcls_Label4();
260 this.el.add ( child_0.el );
261 var child_1 = new Xcls_name();
262 this.el.add ( child_1.el );
263 var child_2 = new Xcls_Label6();
264 this.el.add ( child_2.el );
265 var child_3 = new Xcls_title();
266 this.el.add ( child_3.el );
267 var child_4 = new Xcls_Label8();
268 this.el.add ( child_4.el );
269 var child_5 = new Xcls_region();
270 this.el.add ( child_5.el );
271 var child_6 = new Xcls_Label10();
272 this.el.add ( child_6.el );
273 var child_7 = new Xcls_parent();
274 this.el.add ( child_7.el );
275 var child_8 = new Xcls_Label12();
276 this.el.add ( child_8.el );
277 var child_9 = new Xcls_permname();
278 this.el.add ( child_9.el );
279 var child_10 = new Xcls_Label14();
280 this.el.add ( child_10.el );
281 var child_11 = new Xcls_modOrder();
282 this.el.add ( child_11.el );
285 // userdefined functions
287 // skip n_columns - already used
289 // skip n_rows - already used
291 // skip pack - not pipe
293 // skip xtype - not pipe
295 // skip |homogeneous - already used
297 // skip |xns - no return type
299 // skip items - not pipe
301 // skip xvala_cls - not pipe
303 // skip xvala_xcls - not pipe
305 // skip xvala_id - not pipe
307 public class Xcls_Label4
316 this.el = new Gtk.Label();
320 // set gobject values
321 this.el.justify = Gtk.Justification.RIGHT;
322 this.el.label = "Component Name";
323 this.el.xalign = 0.9;
326 // userdefined functions
328 // skip label - already used
330 // skip pack - not pipe
332 // skip x_options - not pipe
334 // skip xalign - already used
336 // skip xtype - not pipe
338 // skip |justify - already used
340 // skip |xns - no return type
342 // skip xvala_cls - not pipe
344 // skip xvala_xcls - not pipe
346 // skip xvala_id - not pipe
348 public class Xcls_name
357 this.el = new Gtk.Entry();
362 // set gobject values
363 this.el.visible = true;
366 // userdefined functions
368 // skip id - not pipe
370 // skip pack - not pipe
372 // skip xtype - not pipe
374 // skip |visible - already used
376 // skip |xns - no return type
378 // skip xvala_cls - not pipe
380 // skip xvala_xcls - not pipe
382 // skip xvala_id - not pipe
384 public class Xcls_Label6
393 this.el = new Gtk.Label();
397 // set gobject values
398 this.el.justify = Gtk.Justification.RIGHT;
399 this.el.label = "Title";
400 this.el.visible = true;
401 this.el.xalign = 0.9;
404 // userdefined functions
406 // skip label - already used
408 // skip pack - not pipe
410 // skip x_options - not pipe
412 // skip xalign - already used
414 // skip xtype - not pipe
416 // skip |justify - already used
418 // skip |visible - already used
420 // skip |xns - no return type
422 // skip xvala_cls - not pipe
424 // skip xvala_xcls - not pipe
426 // skip xvala_id - not pipe
428 public class Xcls_title
437 this.el = new Gtk.Entry();
442 // set gobject values
443 this.el.visible = true;
446 // userdefined functions
448 // skip id - not pipe
450 // skip pack - not pipe
452 // skip xtype - not pipe
454 // skip |visible - already used
456 // skip |xns - no return type
458 // skip xvala_cls - not pipe
460 // skip xvala_xcls - not pipe
462 // skip xvala_id - not pipe
464 public class Xcls_Label8
473 this.el = new Gtk.Label();
477 // set gobject values
478 this.el.justify = Gtk.Justification.RIGHT;
479 this.el.label = "Region";
480 this.el.tooltip_text = "center, north, south, east, west";
481 this.el.visible = true;
482 this.el.xalign = 0.9;
485 // userdefined functions
487 // skip label - already used
489 // skip pack - not pipe
491 // skip tooltip_text - already used
493 // skip x_options - not pipe
495 // skip xalign - already used
497 // skip xtype - not pipe
499 // skip |justify - already used
501 // skip |visible - already used
503 // skip |xns - no return type
505 // skip xvala_cls - not pipe
507 // skip xvala_xcls - not pipe
509 // skip xvala_id - not pipe
511 public class Xcls_region
520 this.el = new Gtk.Entry();
525 // set gobject values
526 this.el.visible = true;
529 // userdefined functions
531 // skip id - not pipe
533 // skip pack - not pipe
535 // skip xtype - not pipe
537 // skip |visible - already used
539 // skip |xns - no return type
541 // skip xvala_cls - not pipe
543 // skip xvala_xcls - not pipe
545 // skip xvala_id - not pipe
547 public class Xcls_Label10
554 public Xcls_Label10()
556 this.el = new Gtk.Label();
560 // set gobject values
561 this.el.justify = Gtk.Justification.RIGHT;
562 this.el.label = "Parent Name";
563 this.el.visible = true;
564 this.el.xalign = 0.9;
567 // userdefined functions
569 // skip label - already used
571 // skip pack - not pipe
573 // skip x_options - not pipe
575 // skip xalign - already used
577 // skip xtype - not pipe
579 // skip |justify - already used
581 // skip |visible - already used
583 // skip |xns - no return type
585 // skip xvala_cls - not pipe
587 // skip xvala_xcls - not pipe
589 // skip xvala_id - not pipe
591 public class Xcls_parent
600 this.el = new Gtk.Entry();
605 // set gobject values
606 this.el.visible = true;
609 // userdefined functions
611 // skip id - not pipe
613 // skip pack - not pipe
615 // skip xtype - not pipe
617 // skip |visible - already used
619 // skip |xns - no return type
621 // skip xvala_cls - not pipe
623 // skip xvala_xcls - not pipe
625 // skip xvala_id - not pipe
627 public class Xcls_Label12
634 public Xcls_Label12()
636 this.el = new Gtk.Label();
640 // set gobject values
641 this.el.justify = Gtk.Justification.RIGHT;
642 this.el.label = "Permission Name";
643 this.el.visible = true;
644 this.el.xalign = 0.9;
647 // userdefined functions
649 // skip label - already used
651 // skip pack - not pipe
653 // skip x_options - not pipe
655 // skip xalign - already used
657 // skip xtype - not pipe
659 // skip |justify - already used
661 // skip |visible - already used
663 // skip |xns - no return type
665 // skip xvala_cls - not pipe
667 // skip xvala_xcls - not pipe
669 // skip xvala_id - not pipe
671 public class Xcls_permname
678 public Xcls_permname()
680 this.el = new Gtk.Entry();
681 _this.permname = this;
685 // set gobject values
686 this.el.visible = true;
689 // userdefined functions
691 // skip id - not pipe
693 // skip pack - not pipe
695 // skip xtype - not pipe
697 // skip |visible - already used
699 // skip |xns - no return type
701 // skip xvala_cls - not pipe
703 // skip xvala_xcls - not pipe
705 // skip xvala_id - not pipe
707 public class Xcls_Label14
714 public Xcls_Label14()
716 this.el = new Gtk.Label();
720 // set gobject values
721 this.el.justify = Gtk.Justification.RIGHT;
722 this.el.label = "Order (for tabs)";
723 this.el.visible = true;
724 this.el.xalign = 0.9;
727 // userdefined functions
729 // skip label - already used
731 // skip pack - not pipe
733 // skip x_options - not pipe
735 // skip xalign - already used
737 // skip xtype - not pipe
739 // skip |justify - already used
741 // skip |visible - already used
743 // skip |xns - no return type
745 // skip xvala_cls - not pipe
747 // skip xvala_xcls - not pipe
749 // skip xvala_id - not pipe
751 public class Xcls_modOrder
758 public Xcls_modOrder()
760 this.el = new Gtk.Entry();
761 _this.modOrder = this;
765 // set gobject values
766 this.el.visible = true;
769 // userdefined functions
771 // skip id - not pipe
773 // skip pack - not pipe
775 // skip xtype - not pipe
777 // skip |visible - already used
779 // skip |xns - no return type
781 // skip xvala_cls - not pipe
783 // skip xvala_xcls - not pipe
785 // skip xvala_id - not pipe
787 public class Xcls_Button16
789 public Gtk.Button el;
794 public Xcls_Button16()
796 this.el = new Gtk.Button();
800 // set gobject values
801 this.el.label = "Cancel";
804 // userdefined functions
806 // skip |xns - no return type
808 // skip xtype - not pipe
810 // skip pack - not pipe
812 // skip label - already used
814 // skip xvala_cls - not pipe
816 // skip xvala_xcls - not pipe
818 // skip xvala_id - not pipe
820 public class Xcls_Button17
822 public Gtk.Button el;
827 public Xcls_Button17()
829 this.el = new Gtk.Button();
833 // set gobject values
834 this.el.label = "OK";
837 // userdefined functions
839 // skip |xns - no return type
841 // skip xtype - not pipe
843 // skip pack - not pipe
845 // skip label - already used
847 // skip xvala_cls - not pipe
849 // skip xvala_xcls - not pipe
851 // skip xvala_id - not pipe