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;
34 public JsRender.JsRender file;
35 public Project.Project project;
38 public Xcls_DialogNewComponent()
40 this.el = new Gtk.Dialog();
42 DialogNewComponent = this;
48 this.el.default_height = 200;
49 this.el.default_width = 500;
50 this.el.deletable = false;
52 this.el.title = "New Component";
53 var child_0 = new Xcls_VBox2();
54 this.el.add ( child_0.el );
55 var child_1 = new Xcls_Button16();
56 this.el.add_action_widget ( child_1.el , 0 );
57 var child_2 = new Xcls_Button17();
58 this.el.add_action_widget ( child_2.el , 1 );
61 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) => {
144 // userdefined functions
146 // skip listeners - not pipe
148 // skip .signal:void:success - already used
150 // skip .JsRender.JsRender:file - already used
152 // skip .Project.Project:project - already used
154 // skip default_height - already used
156 // skip default_width - already used
158 // skip id - not pipe
160 // skip title - already used
162 // skip xtype - not pipe
164 // skip |deletable - already used
166 // skip |modal - already used
167 public void show(JsRender.JsRender c)
169 this.project = c.project;
184 _this.name.el.set_text(c.name);
185 _this.title.el.set_text(c.title);
186 _this.parent.el.set_text(c.parent);
187 _this.region.el.set_text(c.region);
188 _this.modOrder.el.set_text(c.modOrder);
189 _this.permname.el.set_text(c.permname);
191 if (c.path.length > 0) {
192 this.el.set_title("Edit File Details - " + c.name);
194 this.el.set_title("Create New File");
198 //console.log('show all');
201 //this.success = c.success;
206 // skip |xns - no return type
208 // skip items - not pipe
210 // skip xvala_cls - not pipe
212 // skip xvala_xcls - not pipe
214 // skip xvala_id - not pipe
215 public class Xcls_VBox2
224 this.el = new Gtk.VBox( true, 0 );
228 // set gobject values
229 var child_0 = new Xcls_Table3();
230 this.el.pack_start ( child_0.el , false,false,0 );
233 // userdefined functions
235 // skip |xns - no return type
237 // skip xtype - not pipe
239 // skip |pack - already used
241 // skip items - not pipe
243 // skip xvala_cls - not pipe
245 // skip xvala_xcls - not pipe
247 // skip xvala_id - not pipe
249 public class Xcls_Table3
258 this.el = new Gtk.Table();
262 // set gobject values
263 this.el.homogeneous = false;
264 this.el.n_columns = 2;
266 var child_0 = new Xcls_Label4();
267 this.el.add ( child_0.el );
268 var child_1 = new Xcls_name();
269 this.el.add ( child_1.el );
270 var child_2 = new Xcls_Label6();
271 this.el.add ( child_2.el );
272 var child_3 = new Xcls_title();
273 this.el.add ( child_3.el );
274 var child_4 = new Xcls_Label8();
275 this.el.add ( child_4.el );
276 var child_5 = new Xcls_region();
277 this.el.add ( child_5.el );
278 var child_6 = new Xcls_Label10();
279 this.el.add ( child_6.el );
280 var child_7 = new Xcls_parent();
281 this.el.add ( child_7.el );
282 var child_8 = new Xcls_Label12();
283 this.el.add ( child_8.el );
284 var child_9 = new Xcls_permname();
285 this.el.add ( child_9.el );
286 var child_10 = new Xcls_Label14();
287 this.el.add ( child_10.el );
288 var child_11 = new Xcls_modOrder();
289 this.el.add ( child_11.el );
292 // userdefined functions
294 // skip n_columns - already used
296 // skip n_rows - already used
298 // skip pack - not pipe
300 // skip xtype - not pipe
302 // skip |homogeneous - already used
304 // skip |xns - no return type
306 // skip items - not pipe
308 // skip xvala_cls - not pipe
310 // skip xvala_xcls - not pipe
312 // skip xvala_id - not pipe
314 public class Xcls_Label4
323 this.el = new Gtk.Label();
327 // set gobject values
328 this.el.justify = Gtk.Justification.RIGHT;
329 this.el.label = "Component Name";
330 this.el.xalign = 0.9;
333 // userdefined functions
335 // skip label - already used
337 // skip pack - not pipe
339 // skip x_options - not pipe
341 // skip xalign - already used
343 // skip xtype - not pipe
345 // skip |justify - already used
347 // skip |xns - no return type
349 // skip xvala_cls - not pipe
351 // skip xvala_xcls - not pipe
353 // skip xvala_id - not pipe
355 public class Xcls_name
364 this.el = new Gtk.Entry();
369 // set gobject values
370 this.el.visible = true;
373 // userdefined functions
375 // skip id - not pipe
377 // skip pack - not pipe
379 // skip xtype - not pipe
381 // skip |visible - already used
383 // skip |xns - no return type
385 // skip xvala_cls - not pipe
387 // skip xvala_xcls - not pipe
389 // skip xvala_id - not pipe
391 public class Xcls_Label6
400 this.el = new Gtk.Label();
404 // set gobject values
405 this.el.justify = Gtk.Justification.RIGHT;
406 this.el.label = "Title";
407 this.el.visible = true;
408 this.el.xalign = 0.9;
411 // userdefined functions
413 // skip label - already used
415 // skip pack - not pipe
417 // skip x_options - not pipe
419 // skip xalign - already used
421 // skip xtype - not pipe
423 // skip |justify - already used
425 // skip |visible - already used
427 // skip |xns - no return type
429 // skip xvala_cls - not pipe
431 // skip xvala_xcls - not pipe
433 // skip xvala_id - not pipe
435 public class Xcls_title
444 this.el = new Gtk.Entry();
449 // set gobject values
450 this.el.visible = true;
453 // userdefined functions
455 // skip id - not pipe
457 // skip pack - not pipe
459 // skip xtype - not pipe
461 // skip |visible - already used
463 // skip |xns - no return type
465 // skip xvala_cls - not pipe
467 // skip xvala_xcls - not pipe
469 // skip xvala_id - not pipe
471 public class Xcls_Label8
480 this.el = new Gtk.Label();
484 // set gobject values
485 this.el.justify = Gtk.Justification.RIGHT;
486 this.el.label = "Region";
487 this.el.tooltip_text = "center, north, south, east, west";
488 this.el.visible = true;
489 this.el.xalign = 0.9;
492 // userdefined functions
494 // skip label - already used
496 // skip pack - not pipe
498 // skip tooltip_text - already used
500 // skip x_options - not pipe
502 // skip xalign - already used
504 // skip xtype - not pipe
506 // skip |justify - already used
508 // skip |visible - already used
510 // skip |xns - no return type
512 // skip xvala_cls - not pipe
514 // skip xvala_xcls - not pipe
516 // skip xvala_id - not pipe
518 public class Xcls_region
527 this.el = new Gtk.Entry();
532 // set gobject values
533 this.el.visible = true;
536 // userdefined functions
538 // skip id - not pipe
540 // skip pack - not pipe
542 // skip xtype - not pipe
544 // skip |visible - already used
546 // skip |xns - no return type
548 // skip xvala_cls - not pipe
550 // skip xvala_xcls - not pipe
552 // skip xvala_id - not pipe
554 public class Xcls_Label10
561 public Xcls_Label10()
563 this.el = new Gtk.Label();
567 // set gobject values
568 this.el.justify = Gtk.Justification.RIGHT;
569 this.el.label = "Parent Name";
570 this.el.visible = true;
571 this.el.xalign = 0.9;
574 // userdefined functions
576 // skip label - already used
578 // skip pack - not pipe
580 // skip x_options - not pipe
582 // skip xalign - already used
584 // skip xtype - not pipe
586 // skip |justify - already used
588 // skip |visible - already used
590 // skip |xns - no return type
592 // skip xvala_cls - not pipe
594 // skip xvala_xcls - not pipe
596 // skip xvala_id - not pipe
598 public class Xcls_parent
607 this.el = new Gtk.Entry();
612 // set gobject values
613 this.el.visible = true;
616 // userdefined functions
618 // skip id - not pipe
620 // skip pack - not pipe
622 // skip xtype - not pipe
624 // skip |visible - already used
626 // skip |xns - no return type
628 // skip xvala_cls - not pipe
630 // skip xvala_xcls - not pipe
632 // skip xvala_id - not pipe
634 public class Xcls_Label12
641 public Xcls_Label12()
643 this.el = new Gtk.Label();
647 // set gobject values
648 this.el.justify = Gtk.Justification.RIGHT;
649 this.el.label = "Permission Name";
650 this.el.visible = true;
651 this.el.xalign = 0.9;
654 // userdefined functions
656 // skip label - already used
658 // skip pack - not pipe
660 // skip x_options - not pipe
662 // skip xalign - already used
664 // skip xtype - not pipe
666 // skip |justify - already used
668 // skip |visible - already used
670 // skip |xns - no return type
672 // skip xvala_cls - not pipe
674 // skip xvala_xcls - not pipe
676 // skip xvala_id - not pipe
678 public class Xcls_permname
685 public Xcls_permname()
687 this.el = new Gtk.Entry();
688 _this.permname = this;
692 // set gobject values
693 this.el.visible = true;
696 // userdefined functions
698 // skip id - not pipe
700 // skip pack - not pipe
702 // skip xtype - not pipe
704 // skip |visible - already used
706 // skip |xns - no return type
708 // skip xvala_cls - not pipe
710 // skip xvala_xcls - not pipe
712 // skip xvala_id - not pipe
714 public class Xcls_Label14
721 public Xcls_Label14()
723 this.el = new Gtk.Label();
727 // set gobject values
728 this.el.justify = Gtk.Justification.RIGHT;
729 this.el.label = "Order (for tabs)";
730 this.el.visible = true;
731 this.el.xalign = 0.9;
734 // userdefined functions
736 // skip label - already used
738 // skip pack - not pipe
740 // skip x_options - not pipe
742 // skip xalign - already used
744 // skip xtype - not pipe
746 // skip |justify - already used
748 // skip |visible - already used
750 // skip |xns - no return type
752 // skip xvala_cls - not pipe
754 // skip xvala_xcls - not pipe
756 // skip xvala_id - not pipe
758 public class Xcls_modOrder
765 public Xcls_modOrder()
767 this.el = new Gtk.Entry();
768 _this.modOrder = this;
772 // set gobject values
773 this.el.visible = true;
776 // userdefined functions
778 // skip id - not pipe
780 // skip pack - not pipe
782 // skip xtype - not pipe
784 // skip |visible - already used
786 // skip |xns - no return type
788 // skip xvala_cls - not pipe
790 // skip xvala_xcls - not pipe
792 // skip xvala_id - not pipe
794 public class Xcls_Button16
796 public Gtk.Button el;
801 public Xcls_Button16()
803 this.el = new Gtk.Button();
807 // set gobject values
808 this.el.label = "Cancel";
811 // userdefined functions
813 // skip |xns - no return type
815 // skip xtype - not pipe
817 // skip pack - not pipe
819 // skip label - already used
821 // skip xvala_cls - not pipe
823 // skip xvala_xcls - not pipe
825 // skip xvala_id - not pipe
827 public class Xcls_Button17
829 public Gtk.Button el;
834 public Xcls_Button17()
836 this.el = new Gtk.Button();
840 // set gobject values
841 this.el.label = "OK";
844 // userdefined functions
846 // skip |xns - no return type
848 // skip xtype - not pipe
850 // skip pack - not pipe
852 // skip label - already used
854 // skip xvala_cls - not pipe
856 // skip xvala_xcls - not pipe
858 // skip xvala_id - not pipe