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) => {
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.FileUtils.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];
128 _this.success(_this.project, nf);
131 -- fixme -- needs to be a signal..
132 if (DialogNewComponent.success != null) {
133 DialogNewComponent.success(_this.project, nf);
137 this.el.show.connect( (self) => {
143 // userdefined functions
145 // skip listeners - not pipe
147 // skip .JsRender.JsRender:file - already used
149 // skip .Project.Project:project - already used
151 // skip .signal:void:success - already used
153 // skip default_height - already used
155 // skip default_width - already used
157 // skip id - not pipe
159 // skip title - already used
161 // skip xtype - not pipe
163 // skip |deletable - already used
165 // skip |modal - already used
166 public void show(JsRender.JsRender c)
168 this.project = c.project;
174 _this.name.el.set_text(c.name);
175 _this.title.el.set_text(c.title);
176 _this.parent.el.set_text(c.parent);
177 _this.region.el.set_text(c.region);
178 _this.modOrder.el.set_text(c.modOrder);
179 _this.permname.el.set_text(c.permname);
181 if (c.path.length > 0) {
182 this.el.set_title("Edit File Details - " + c.name);
184 this.el.set_title("Create New File");
188 //console.log('show all');
191 //this.success = c.success;
196 // skip |xns - no return type
198 // skip items - not pipe
200 // skip xvala_cls - not pipe
202 // skip xvala_xcls - not pipe
204 // skip xvala_id - not pipe
205 public class Xcls_VBox2
214 this.el = new Gtk.VBox( true, 0 );
218 // set gobject values
219 var child_0 = new Xcls_Table3();
220 this.el.pack_start ( child_0.el , false,false,0 );
223 // userdefined functions
225 // skip |xns - no return type
227 // skip xtype - not pipe
229 // skip |pack - already used
231 // skip items - not pipe
233 // skip xvala_cls - not pipe
235 // skip xvala_xcls - not pipe
237 // skip xvala_id - not pipe
239 public class Xcls_Table3
248 this.el = new Gtk.Table( 3, 2, false );
252 // set gobject values
253 var child_0 = new Xcls_Label4();
254 this.el.add ( child_0.el );
255 var child_1 = new Xcls_name();
256 this.el.add ( child_1.el );
257 var child_2 = new Xcls_Label6();
258 this.el.add ( child_2.el );
259 var child_3 = new Xcls_title();
260 this.el.add ( child_3.el );
261 var child_4 = new Xcls_Label8();
262 this.el.add ( child_4.el );
263 var child_5 = new Xcls_region();
264 this.el.add ( child_5.el );
265 var child_6 = new Xcls_Label10();
266 this.el.add ( child_6.el );
267 var child_7 = new Xcls_parent();
268 this.el.add ( child_7.el );
269 var child_8 = new Xcls_Label12();
270 this.el.add ( child_8.el );
271 var child_9 = new Xcls_permname();
272 this.el.add ( child_9.el );
273 var child_10 = new Xcls_Label14();
274 this.el.add ( child_10.el );
275 var child_11 = new Xcls_modOrder();
276 this.el.add ( child_11.el );
279 // userdefined functions
281 // skip n_columns - already used
283 // skip n_rows - already used
285 // skip pack - not pipe
287 // skip xtype - not pipe
289 // skip |homogeneous - already used
291 // skip |xns - no return type
293 // skip items - not pipe
295 // skip xvala_cls - not pipe
297 // skip xvala_xcls - not pipe
299 // skip xvala_id - not pipe
301 public class Xcls_Label4
310 this.el = new Gtk.Label( "Component Name" );
314 // set gobject values
315 this.el.justify = Gtk.Justification.RIGHT;
316 this.el.xalign = 0.9f;
319 // userdefined functions
321 // skip label - already used
323 // skip pack - not pipe
325 // skip x_options - not pipe
327 // skip xalign - already used
329 // skip xtype - not pipe
331 // skip |justify - already used
333 // skip |xns - no return type
335 // skip xvala_cls - not pipe
337 // skip xvala_xcls - not pipe
339 // skip xvala_id - not pipe
341 public class Xcls_name
350 this.el = new Gtk.Entry();
355 // set gobject values
356 this.el.visible = true;
359 // userdefined functions
361 // skip id - not pipe
363 // skip pack - not pipe
365 // skip xtype - not pipe
367 // skip |visible - already used
369 // skip |xns - no return type
371 // skip xvala_cls - not pipe
373 // skip xvala_xcls - not pipe
375 // skip xvala_id - not pipe
377 public class Xcls_Label6
386 this.el = new Gtk.Label( "Title" );
390 // set gobject values
391 this.el.justify = Gtk.Justification.RIGHT;
392 this.el.visible = true;
393 this.el.xalign = 0.9f;
396 // userdefined functions
398 // skip label - already used
400 // skip pack - not pipe
402 // skip x_options - not pipe
404 // skip xalign - already used
406 // skip xtype - not pipe
408 // skip |justify - already used
410 // skip |visible - already used
412 // skip |xns - no return type
414 // skip xvala_cls - not pipe
416 // skip xvala_xcls - not pipe
418 // skip xvala_id - not pipe
420 public class Xcls_title
429 this.el = new Gtk.Entry();
434 // set gobject values
435 this.el.visible = true;
438 // userdefined functions
440 // skip id - not pipe
442 // skip pack - not pipe
444 // skip xtype - not pipe
446 // skip |visible - already used
448 // skip |xns - no return type
450 // skip xvala_cls - not pipe
452 // skip xvala_xcls - not pipe
454 // skip xvala_id - not pipe
456 public class Xcls_Label8
465 this.el = new Gtk.Label( "Region" );
469 // set gobject values
470 this.el.justify = Gtk.Justification.RIGHT;
471 this.el.tooltip_text = "center, north, south, east, west";
472 this.el.visible = true;
473 this.el.xalign = 0.9f;
476 // userdefined functions
478 // skip label - already used
480 // skip pack - not pipe
482 // skip tooltip_text - already used
484 // skip x_options - not pipe
486 // skip xalign - already used
488 // skip xtype - not pipe
490 // skip |justify - already used
492 // skip |visible - already used
494 // skip |xns - no return type
496 // skip xvala_cls - not pipe
498 // skip xvala_xcls - not pipe
500 // skip xvala_id - not pipe
502 public class Xcls_region
511 this.el = new Gtk.Entry();
516 // set gobject values
517 this.el.visible = true;
520 // userdefined functions
522 // skip id - not pipe
524 // skip pack - not pipe
526 // skip xtype - not pipe
528 // skip |visible - already used
530 // skip |xns - no return type
532 // skip xvala_cls - not pipe
534 // skip xvala_xcls - not pipe
536 // skip xvala_id - not pipe
538 public class Xcls_Label10
545 public Xcls_Label10()
547 this.el = new Gtk.Label( "Parent Name" );
551 // set gobject values
552 this.el.justify = Gtk.Justification.RIGHT;
553 this.el.visible = true;
554 this.el.xalign = 0.9f;
557 // userdefined functions
559 // skip label - already used
561 // skip pack - not pipe
563 // skip x_options - not pipe
565 // skip xalign - already used
567 // skip xtype - not pipe
569 // skip |justify - already used
571 // skip |visible - already used
573 // skip |xns - no return type
575 // skip xvala_cls - not pipe
577 // skip xvala_xcls - not pipe
579 // skip xvala_id - not pipe
581 public class Xcls_parent
590 this.el = new Gtk.Entry();
595 // set gobject values
596 this.el.visible = true;
599 // userdefined functions
601 // skip id - not pipe
603 // skip pack - not pipe
605 // skip xtype - not pipe
607 // skip |visible - already used
609 // skip |xns - no return type
611 // skip xvala_cls - not pipe
613 // skip xvala_xcls - not pipe
615 // skip xvala_id - not pipe
617 public class Xcls_Label12
624 public Xcls_Label12()
626 this.el = new Gtk.Label( "Permission Name" );
630 // set gobject values
631 this.el.justify = Gtk.Justification.RIGHT;
632 this.el.visible = true;
633 this.el.xalign = 0.9f;
636 // userdefined functions
638 // skip label - already used
640 // skip pack - not pipe
642 // skip x_options - not pipe
644 // skip xalign - already used
646 // skip xtype - not pipe
648 // skip |justify - already used
650 // skip |visible - already used
652 // skip |xns - no return type
654 // skip xvala_cls - not pipe
656 // skip xvala_xcls - not pipe
658 // skip xvala_id - not pipe
660 public class Xcls_permname
667 public Xcls_permname()
669 this.el = new Gtk.Entry();
670 _this.permname = this;
674 // set gobject values
675 this.el.visible = true;
678 // userdefined functions
680 // skip id - not pipe
682 // skip pack - not pipe
684 // skip xtype - not pipe
686 // skip |visible - already used
688 // skip |xns - no return type
690 // skip xvala_cls - not pipe
692 // skip xvala_xcls - not pipe
694 // skip xvala_id - not pipe
696 public class Xcls_Label14
703 public Xcls_Label14()
705 this.el = new Gtk.Label( "Order (for tabs)" );
709 // set gobject values
710 this.el.justify = Gtk.Justification.RIGHT;
711 this.el.visible = true;
712 this.el.xalign = 0.9f;
715 // userdefined functions
717 // skip label - already used
719 // skip pack - not pipe
721 // skip x_options - not pipe
723 // skip xalign - already used
725 // skip xtype - not pipe
727 // skip |justify - already used
729 // skip |visible - already used
731 // skip |xns - no return type
733 // skip xvala_cls - not pipe
735 // skip xvala_xcls - not pipe
737 // skip xvala_id - not pipe
739 public class Xcls_modOrder
746 public Xcls_modOrder()
748 this.el = new Gtk.Entry();
749 _this.modOrder = this;
753 // set gobject values
754 this.el.visible = true;
757 // userdefined functions
759 // skip id - not pipe
761 // skip pack - not pipe
763 // skip xtype - not pipe
765 // skip |visible - already used
767 // skip |xns - no return type
769 // skip xvala_cls - not pipe
771 // skip xvala_xcls - not pipe
773 // skip xvala_id - not pipe
775 public class Xcls_Button16
777 public Gtk.Button el;
782 public Xcls_Button16()
784 this.el = new Gtk.Button();
788 // set gobject values
789 this.el.label = "Cancel";
792 // userdefined functions
794 // skip |xns - no return type
796 // skip xtype - not pipe
798 // skip pack - not pipe
800 // skip label - already used
802 // skip xvala_cls - not pipe
804 // skip xvala_xcls - not pipe
806 // skip xvala_id - not pipe
808 public class Xcls_Button17
810 public Gtk.Button el;
815 public Xcls_Button17()
817 this.el = new Gtk.Button();
821 // set gobject values
822 this.el.label = "OK";
825 // userdefined functions
827 // skip |xns - no return type
829 // skip xtype - not pipe
831 // skip pack - not pipe
833 // skip label - already used
835 // skip xvala_cls - not pipe
837 // skip xvala_xcls - not pipe
839 // skip xvala_id - not pipe