Fix #7959 - new project flow - use void func to callback after each step, tidy up...
[roobuilder] / src / Builder4 / EditProject.vala
1     static EditProject  _EditProject;
2
3     public class EditProject : Object
4     {
5         public Gtk.Window el;
6         private EditProject  _this;
7
8         public static EditProject singleton()
9         {
10             if (_EditProject == null) {
11                 _EditProject= new EditProject();
12             }
13             return _EditProject;
14         }
15         public Xcls_ok_btn ok_btn;
16         public Xcls_type_lbl type_lbl;
17         public Xcls_type_dd type_dd;
18         public Xcls_parent_lbl parent_lbl;
19         public Xcls_parent_dd parent_dd;
20         public Xcls_folder_lbl folder_lbl;
21         public Xcls_folder_dd folder_dd;
22         public Xcls_name_lbl name_lbl;
23         public Xcls_name_entry name_entry;
24         public Xcls_ptype_lbl ptype_lbl;
25         public Xcls_ptype_dd ptype_dd;
26
27             // my vars (def)
28         public Project.Callback doneObj;
29         public WindowState? windowstate;
30         public signal void canceled ();
31         public Project.Project result;
32
33         // ctor
34         public EditProject()
35         {
36             _this = this;
37             this.el = new Gtk.Window();
38
39             // my vars (dec)
40             this.doneObj = null;
41             this.windowstate = null;
42             this.result = null;
43
44             // set gobject values
45             this.el.title = "New Project";
46             this.el.name = "EditProject";
47             this.el.default_width = 600;
48             this.el.deletable = true;
49             this.el.modal = true;
50             var child_1 = new Xcls_HeaderBar2( _this );
51             this.el.titlebar = child_1.el;
52             var child_2 = new Xcls_Box5( _this );
53             this.el.child = child_2.el;
54         }
55
56         // user defined functions
57         public void show (Project.Callback doneObj) {
58              this.doneObj= doneObj;
59             _this.hideAll(); 
60              // hide stuff..
61              _this.type_dd.el.selected = Gtk.INVALID_LIST_POSITION;
62              _this.folder_dd.el.selected = Gtk.INVALID_LIST_POSITION;
63              _this.ptype_dd.el.selected = Gtk.INVALID_LIST_POSITION;
64              _this.parent_dd.extra_value = "";
65             //[ 'xtype'  ].forEach(function(k) {
66             //    _this.get(k).setValue(typeof(c[k]) == 'undefined' ? '' : c[k]);
67             //});
68                 // shouild set path..
69             
70             this.el.show();
71             
72         }
73         public void hideAll () {
74                 _this.parent_lbl.el.hide();
75              _this.parent_dd.el.hide();   
76                 
77                 _this.folder_lbl.el.hide();
78              _this.folder_dd.el.hide();     
79              _this.name_lbl.el.hide();          
80              _this.name_entry.el.hide();     
81              _this.ptype_lbl.el.hide();          
82              _this.ptype_dd.el.hide();          
83               _this.ok_btn.el.hide();   
84             
85         }
86         public class Xcls_HeaderBar2 : Object
87         {
88             public Gtk.HeaderBar el;
89             private EditProject  _this;
90
91
92                 // my vars (def)
93
94             // ctor
95             public Xcls_HeaderBar2(EditProject _owner )
96             {
97                 _this = _owner;
98                 this.el = new Gtk.HeaderBar();
99
100                 // my vars (dec)
101
102                 // set gobject values
103                 this.el.show_title_buttons = false;
104                 var child_1 = new Xcls_Button3( _this );
105                 child_1.ref();
106                 this.el.pack_start ( child_1.el  );
107                 new Xcls_ok_btn( _this );
108                 this.el.pack_end ( _this.ok_btn.el  );
109             }
110
111             // user defined functions
112         }
113         public class Xcls_Button3 : Object
114         {
115             public Gtk.Button el;
116             private EditProject  _this;
117
118
119                 // my vars (def)
120
121             // ctor
122             public Xcls_Button3(EditProject _owner )
123             {
124                 _this = _owner;
125                 this.el = new Gtk.Button();
126
127                 // my vars (dec)
128
129                 // set gobject values
130                 this.el.halign = Gtk.Align.END;
131                 this.el.hexpand = false;
132                 this.el.label = "Cancel";
133
134                 //listeners
135                 this.el.clicked.connect( ( ) => {
136                    
137                     _this.el.hide();
138                         _this.canceled();
139                     
140                 
141                 });
142             }
143
144             // user defined functions
145         }
146
147         public class Xcls_ok_btn : Object
148         {
149             public Gtk.Button el;
150             private EditProject  _this;
151
152
153                 // my vars (def)
154
155             // ctor
156             public Xcls_ok_btn(EditProject _owner )
157             {
158                 _this = _owner;
159                 _this.ok_btn = this;
160                 this.el = new Gtk.Button();
161
162                 // my vars (dec)
163
164                 // set gobject values
165                 this.el.halign = Gtk.Align.START;
166                 this.el.hexpand = false;
167                 this.el.css_classes = { "suggested-action" };
168                 this.el.label = "OK";
169
170                 //listeners
171                 this.el.clicked.connect( ( ) => {
172                    var err_dialog = Xcls_StandardErrorDialog.singleton();
173                    
174                    
175                         if (_this.ptype_dd.getValue().length < 1) {
176                         err_dialog.show(_this.el,"You have to set Project type");             
177                         return;
178                     }
179                    var fn = _this.parent_dd.getValue();
180                    var is_existing = false;
181                    var is_new_folder = false;
182                    switch (_this.type_dd.getValue()) {
183                                 case "Existing Folder":
184                                         if (_this.folder_dd.getValue().length < 1) {
185                                                 err_dialog.show(_this.el,"You have to set Folder");             
186                                                 return;
187                                         }
188                                         fn += "/" + _this.folder_dd.getValue();
189                                         is_existing = true;
190                                         break;
191                                 
192                                 case "New Folder":
193                                         if (_this.name_entry.getValue().length < 1) {
194                                                 err_dialog.show(_this.el,"You have enter a Project Name");             
195                                                 return;
196                                         }
197                                         fn += "/" + _this.name_entry.getValue();           
198                                         
199                                         if (FileUtils.test( fn ,FileTest.EXISTS)) {
200                                                 err_dialog.show(_this.el,"That folder already exists");             
201                                                 return;                 
202                                         }
203                                         var dir = File.new_for_path(fn);
204                                         try {
205                                                 dir.make_directory();   
206                                         } catch (Error e) {
207                                                 GLib.error("Failed to make directory %s", fn);
208                                         } 
209                                         is_new_folder = true;
210                                         break;
211                                         
212                                 default:
213                                         return;
214                                 
215                     }
216                    
217                    
218                   
219                     
220                     _this.el.hide();
221                     
222                     
223                 
224                   
225                     GLib.debug("add %s\n" , fn);
226                     try {
227                                 var project = Project.Project.factory(_this.ptype_dd.getValue(), fn);
228                                 if (is_new_folder) {    
229                                         project.initialize();
230                                         
231                                 } else {
232                                         project.load();
233                                 }
234                                 
235                                 project.save();
236                                  Project.Project.saveProjectList();
237                                 _this.result = project;
238                                 if (is_new_folder || is_existing) {
239                                            
240                                 
241                                  _this.windowstate.projectPopoverShow(
242                                         _this.el.transient_for, project,  _this.doneObj 
243                                 );
244                          } else {
245                                 if (_this.doneObj != null) {
246                                          _this.doneObj.call(project);
247                                  }
248                          }
249                                 
250                                 return;
251                         } catch (Error e) {
252                                 GLib.debug("got error? %s" , e.message);
253                         }
254                          
255                 
256                 });
257             }
258
259             // user defined functions
260         }
261
262
263         public class Xcls_Box5 : Object
264         {
265             public Gtk.Box el;
266             private EditProject  _this;
267
268
269                 // my vars (def)
270             public bool expand;
271
272             // ctor
273             public Xcls_Box5(EditProject _owner )
274             {
275                 _this = _owner;
276                 this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
277
278                 // my vars (dec)
279                 this.expand = true;
280
281                 // set gobject values
282                 this.el.homogeneous = false;
283                 this.el.margin_end = 10;
284                 this.el.margin_start = 10;
285                 this.el.margin_bottom = 10;
286                 this.el.margin_top = 10;
287                 var child_1 = new Xcls_Grid6( _this );
288                 child_1.ref();
289                 this.el.append( child_1.el );
290             }
291
292             // user defined functions
293         }
294         public class Xcls_Grid6 : Object
295         {
296             public Gtk.Grid el;
297             private EditProject  _this;
298
299
300                 // my vars (def)
301
302             // ctor
303             public Xcls_Grid6(EditProject _owner )
304             {
305                 _this = _owner;
306                 this.el = new Gtk.Grid();
307
308                 // my vars (dec)
309
310                 // set gobject values
311                 this.el.column_spacing = 4;
312                 this.el.row_spacing = 4;
313                 this.el.margin_bottom = 20;
314                 new Xcls_type_lbl( _this );
315                 this.el.attach( _this.type_lbl.el, 0, 0, 1, 1 );
316                 new Xcls_type_dd( _this );
317                 this.el.attach( _this.type_dd.el, 1, 0, 1, 1 );
318                 new Xcls_parent_lbl( _this );
319                 this.el.attach( _this.parent_lbl.el, 0, 1, 1, 1 );
320                 new Xcls_parent_dd( _this );
321                 this.el.attach( _this.parent_dd.el, 1, 1, 1, 1 );
322                 new Xcls_folder_lbl( _this );
323                 this.el.attach( _this.folder_lbl.el, 0, 2, 1, 1 );
324                 new Xcls_folder_dd( _this );
325                 this.el.attach( _this.folder_dd.el, 1, 2, 1, 1 );
326                 new Xcls_name_lbl( _this );
327                 this.el.attach( _this.name_lbl.el, 0, 3, 1, 1 );
328                 new Xcls_name_entry( _this );
329                 this.el.attach( _this.name_entry.el, 1, 3, 1, 1 );
330                 new Xcls_ptype_lbl( _this );
331                 this.el.attach( _this.ptype_lbl.el, 0, 4, 1, 1 );
332                 new Xcls_ptype_dd( _this );
333                 this.el.attach( _this.ptype_dd.el, 1, 4, 1, 1 );
334             }
335
336             // user defined functions
337         }
338         public class Xcls_type_lbl : Object
339         {
340             public Gtk.Label el;
341             private EditProject  _this;
342
343
344                 // my vars (def)
345
346             // ctor
347             public Xcls_type_lbl(EditProject _owner )
348             {
349                 _this = _owner;
350                 _this.type_lbl = this;
351                 this.el = new Gtk.Label( "Create a Project from:" );
352
353                 // my vars (dec)
354
355                 // set gobject values
356                 this.el.halign = Gtk.Align.START;
357             }
358
359             // user defined functions
360         }
361
362         public class Xcls_type_dd : Object
363         {
364             public Gtk.DropDown el;
365             private EditProject  _this;
366
367
368                 // my vars (def)
369
370             // ctor
371             public Xcls_type_dd(EditProject _owner )
372             {
373                 _this = _owner;
374                 _this.type_dd = this;
375                 var child_1 = new Xcls_StringList9( _this );
376                 child_1.ref();
377                 this.el = new Gtk.DropDown( child_1.el, null );
378
379                 // my vars (dec)
380
381                 // set gobject values
382                 this.el.hexpand = true;
383                 this.el.selected = Gtk.INVALID_LIST_POSITION;
384
385                 // init method
386
387                 {
388                 
389                 }
390
391                 //listeners
392                 this.el.notify["selected"].connect( ( ) => {
393                          
394                         if (this.el.selected == Gtk.INVALID_LIST_POSITION) {
395                                 return;
396                         }
397                         var m = (Gtk.StringList) this.el.model;
398                         GLib.debug("selected item: %s", m.get_string(this.el.selected));
399                         
400                         _this.hideAll();
401                         _this.parent_lbl.el.show();
402                         _this.parent_dd.el.show();
403                         _this.parent_dd.load();
404                         /*
405                                          break;
406                         
407                         switch (m.get_string(this.el.selected)) {
408                                 case "New Folder":
409                                     _this.name_lbl.el.show();          
410                                 _this.name_entry.el.show();     
411                                          break;
412                                 case "Existing Folder":
413                                         _this.folder_lbl.el.show();
414                                          _this.folder_dd.el.show();             
415                                          break;
416                                          
417                                 case "Checkout from git":
418                                     _this.name_lbl.el.show();          
419                                         _this.name_entry.el.show();  
420                                         break;   
421                                 default:
422                                         _this.hideAll();
423                                         break;
424                 
425                         }       
426                         
427                         */
428                          
429                  
430                               
431                           
432                     
433                                 
434                 });
435             }
436
437             // user defined functions
438             public string getValue () {
439                 var m = (Gtk.StringList) this.el.model;
440                 return  m.get_string(this.el.selected);
441                 
442             }
443         }
444         public class Xcls_StringList9 : Object
445         {
446             public Gtk.StringList el;
447             private EditProject  _this;
448
449
450                 // my vars (def)
451
452             // ctor
453             public Xcls_StringList9(EditProject _owner )
454             {
455                 _this = _owner;
456                 this.el = new Gtk.StringList( {  "New Folder", "Existing Folder" /*,  "Checkout from git"  */ } );
457
458                 // my vars (dec)
459
460                 // set gobject values
461             }
462
463             // user defined functions
464         }
465
466
467         public class Xcls_parent_lbl : Object
468         {
469             public Gtk.Label el;
470             private EditProject  _this;
471
472
473                 // my vars (def)
474
475             // ctor
476             public Xcls_parent_lbl(EditProject _owner )
477             {
478                 _this = _owner;
479                 _this.parent_lbl = this;
480                 this.el = new Gtk.Label( "In Folder:" );
481
482                 // my vars (dec)
483
484                 // set gobject values
485                 this.el.halign = Gtk.Align.START;
486             }
487
488             // user defined functions
489         }
490
491         public class Xcls_parent_dd : Object
492         {
493             public Gtk.DropDown el;
494             private EditProject  _this;
495
496
497                 // my vars (def)
498             public string extra_value;
499
500             // ctor
501             public Xcls_parent_dd(EditProject _owner )
502             {
503                 _this = _owner;
504                 _this.parent_dd = this;
505                 var child_1 = new Xcls_StringList12( _this );
506                 child_1.ref();
507                 this.el = new Gtk.DropDown( child_1.el, null );
508
509                 // my vars (dec)
510
511                 // set gobject values
512                 this.el.hexpand = true;
513
514                 //listeners
515                 this.el.notify["selected"].connect( ( ) => {
516                         if (this.el.selected == Gtk.INVALID_LIST_POSITION) {
517                                 _this.hideAll();
518                                 _this.parent_lbl.el.show();
519                         _this.parent_dd.el.show();   
520                         
521                                 return;
522                         }
523                         
524                         
525                         
526                         if (this.getValue() == "Select Folder") {
527                                 var fd = new Gtk.FileDialog();
528                                 fd.title = "Select Folder";
529                                 fd.modal = true;
530                                 
531                                 fd.select_folder.begin(_this.el, null, (obj, res) => {
532                                         try {
533                                         var f = fd.select_folder.end(res);
534                                                 this.extra_value = f.get_path();
535                                                 var sl = (Gtk.StringList) this.el.model;        
536                                                 
537                                                 sl.remove(sl.get_n_items()-1);
538                                                 
539                                                 sl.append(this.extra_value);
540                                                 sl.append("Select Folder");
541                                                 this.el.selected = sl.get_n_items()-2;
542                                         } catch (GLib.Error e) {
543                                                 // do nothing?
544                                         }
545                                         
546                                 });
547                                 return;
548                 
549                         }
550                         _this.hideAll();
551                         _this.parent_lbl.el.show();
552                         _this.parent_dd.el.show();   
553                         
554                         
555                    _this.ptype_lbl.el.show();          
556                    _this.ptype_dd.el.show();  
557                         // folder selected...
558                         switch(_this.type_dd.getValue()) {
559                                 case "New Folder":
560                                    _this.name_lbl.el.show();          
561                            _this.name_entry.el.show(); 
562                            _this.name_entry.el.text = "";
563                                    _this.ptype_lbl.el.show();          
564                                    _this.ptype_dd.el.show();  
565                            break;
566                            
567                                 case "Existing Folder":
568                                         _this.folder_lbl.el.show();
569                                         _this.folder_dd.el.show();
570                                         _this.folder_dd.load();
571                                    
572                                         break;
573                                         
574                                 case "Checkout from git":
575                                    _this.name_lbl.el.show();          
576                            _this.name_entry.el.show(); 
577                            _this.name_lbl.el.label= "not yet";
578                            _this.name_entry.el.text = "this is not supported yet";
579                                         break;
580                                 default:
581                                         break;
582                         }
583                     
584                         
585                 
586                 });
587             }
588
589             // user defined functions
590             public string getValue () {
591                 var m = (Gtk.StringList) this.el.model;
592                 return  m.get_string(this.el.selected);
593                 
594             }
595             public void load () {
596             
597                 var sl = (Gtk.StringList) this.el.model;        
598                 var hd = GLib.Environment.get_home_dir();
599                 while(sl.get_n_items() > 0)  {
600                         sl.remove(0);
601                 }
602                 if (FileUtils.test(hd + "/gitlive" ,FileTest.IS_DIR)) {
603                         sl.append(hd + "/gitlive");
604                 }
605                 if (FileUtils.test(hd + "/Projects" ,FileTest.IS_DIR)) {
606                         sl.append(hd + "/Projects");
607                 }
608                 if (this.extra_value != "" && FileUtils.test(this.extra_value ,FileTest.IS_DIR)) {
609                         sl.append(this.extra_value);
610                 }
611                 
612                 sl.append("Select Folder");
613                 this.el.selected = Gtk.INVALID_LIST_POSITION;
614                 
615             }
616         }
617         public class Xcls_StringList12 : Object
618         {
619             public Gtk.StringList el;
620             private EditProject  _this;
621
622
623                 // my vars (def)
624
625             // ctor
626             public Xcls_StringList12(EditProject _owner )
627             {
628                 _this = _owner;
629                 this.el = new Gtk.StringList( { "gitlive", "Projects", "Select" } );
630
631                 // my vars (dec)
632
633                 // set gobject values
634             }
635
636             // user defined functions
637         }
638
639
640         public class Xcls_folder_lbl : Object
641         {
642             public Gtk.Label el;
643             private EditProject  _this;
644
645
646                 // my vars (def)
647
648             // ctor
649             public Xcls_folder_lbl(EditProject _owner )
650             {
651                 _this = _owner;
652                 _this.folder_lbl = this;
653                 this.el = new Gtk.Label( "Add Folder" );
654
655                 // my vars (dec)
656
657                 // set gobject values
658                 this.el.halign = Gtk.Align.START;
659             }
660
661             // user defined functions
662         }
663
664         public class Xcls_folder_dd : Object
665         {
666             public Gtk.DropDown el;
667             private EditProject  _this;
668
669
670                 // my vars (def)
671
672             // ctor
673             public Xcls_folder_dd(EditProject _owner )
674             {
675                 _this = _owner;
676                 _this.folder_dd = this;
677                 var child_1 = new Xcls_StringList15( _this );
678                 child_1.ref();
679                 this.el = new Gtk.DropDown( child_1.el, null );
680
681                 // my vars (dec)
682
683                 // set gobject values
684                 this.el.hexpand = true;
685
686                 //listeners
687                 this.el.notify["selected"].connect( () => {
688                         var fn = this.getValue();
689                         if (fn == "") {
690                                 return;
691                         }
692                         var p  = _this.parent_dd.getValue();
693                         if (!FileUtils.test(p  + "/" + fn + "/.roobuilder.jcfg"  , GLib.FileTest.EXISTS)) {
694                                 return;
695                         }
696                         var ty = Project.Project.peekProjectType(p  + "/" + fn + "/.roobuilder.jcfg" );
697                         if (ty == "") {
698                                 return;
699                         }
700                         _this.ptype_dd.setValue(ty);
701                          
702                  });
703             }
704
705             // user defined functions
706             public string getValue () {
707                 var m = (Gtk.StringList) this.el.model;
708                 return this.el.selected  == Gtk.INVALID_LIST_POSITION ?
709                                  "" : m.get_string(this.el.selected);
710                 
711             }
712             public void load () {
713                 var p  = _this.parent_dd.getValue();
714                 var f = File.new_for_path(p);
715                 var sl = (Gtk.StringList) this.el.model;        
716                 while(sl.get_n_items() > 0)  {
717                         sl.remove(0);
718                 }
719                 var gstr = new Gee.ArrayList<string>();
720                 
721                 
722                 try {
723                         var file_enum = f.enumerate_children(
724                                 GLib.FileAttribute.STANDARD_DISPLAY_NAME, 
725                                 GLib.FileQueryInfoFlags.NONE, null);
726                   
727                 
728                         
729                         FileInfo next_file; 
730                          
731                         while ((next_file = file_enum.next_file(null)) != null) {
732                                 var fn = next_file.get_display_name();
733                          
734                                 if (fn[0] == '.') { // skip hidden
735                                         continue;
736                                 }
737                                  
738                                 if (!FileUtils.test(p  + "/" + fn, GLib.FileTest.IS_DIR)) {
739                                         continue;
740                                 }
741                                 if (null != Project.Project.getProjectByPath(p  + "/" + fn)) {
742                                         continue;
743                                 }
744                         
745                                 gstr.add(fn);
746                         }
747                 } catch (GLib.Error e) {
748                         // do nothing.. 
749                 }
750                 gstr.sort((a,b) => {
751                         return Posix.strcmp(a.down(), b.down());
752                 });
753             
754                 foreach(var str in gstr) {
755                         sl.append(str);
756                 }
757                  
758             }
759         }
760         public class Xcls_StringList15 : Object
761         {
762             public Gtk.StringList el;
763             private EditProject  _this;
764
765
766                 // my vars (def)
767
768             // ctor
769             public Xcls_StringList15(EditProject _owner )
770             {
771                 _this = _owner;
772                 this.el = new Gtk.StringList( { "gitlive", "Projects", "Select" } );
773
774                 // my vars (dec)
775
776                 // set gobject values
777             }
778
779             // user defined functions
780         }
781
782
783         public class Xcls_name_lbl : Object
784         {
785             public Gtk.Label el;
786             private EditProject  _this;
787
788
789                 // my vars (def)
790
791             // ctor
792             public Xcls_name_lbl(EditProject _owner )
793             {
794                 _this = _owner;
795                 _this.name_lbl = this;
796                 this.el = new Gtk.Label( "Named (New Folder Name)" );
797
798                 // my vars (dec)
799
800                 // set gobject values
801                 this.el.halign = Gtk.Align.START;
802             }
803
804             // user defined functions
805         }
806
807         public class Xcls_name_entry : Object
808         {
809             public Gtk.Entry el;
810             private EditProject  _this;
811
812
813                 // my vars (def)
814
815             // ctor
816             public Xcls_name_entry(EditProject _owner )
817             {
818                 _this = _owner;
819                 _this.name_entry = this;
820                 this.el = new Gtk.Entry();
821
822                 // my vars (dec)
823
824                 // set gobject values
825                 this.el.hexpand = true;
826             }
827
828             // user defined functions
829             public string getValue () {
830                 return this.el.text;
831             }
832         }
833
834         public class Xcls_ptype_lbl : Object
835         {
836             public Gtk.Label el;
837             private EditProject  _this;
838
839
840                 // my vars (def)
841
842             // ctor
843             public Xcls_ptype_lbl(EditProject _owner )
844             {
845                 _this = _owner;
846                 _this.ptype_lbl = this;
847                 this.el = new Gtk.Label( "Project type :" );
848
849                 // my vars (dec)
850
851                 // set gobject values
852                 this.el.halign = Gtk.Align.START;
853             }
854
855             // user defined functions
856         }
857
858         public class Xcls_ptype_dd : Object
859         {
860             public Gtk.DropDown el;
861             private EditProject  _this;
862
863
864                 // my vars (def)
865
866             // ctor
867             public Xcls_ptype_dd(EditProject _owner )
868             {
869                 _this = _owner;
870                 _this.ptype_dd = this;
871                 var child_1 = new Xcls_StringList20( _this );
872                 child_1.ref();
873                 this.el = new Gtk.DropDown( child_1.el, null );
874
875                 // my vars (dec)
876
877                 // set gobject values
878                 this.el.hexpand = true;
879
880                 //listeners
881                 this.el.notify["selected"].connect( ( ) => {
882                 
883                         _this.ok_btn.el.hide(); 
884                         if (this.getValue() != "") {
885                            _this.ok_btn.el.show();
886                         }
887                 
888                 });
889             }
890
891             // user defined functions
892             public string getValue () {
893                 var m = (Gtk.StringList) this.el.model;
894                 var str = this.el.selected == Gtk.INVALID_LIST_POSITION ?
895                                  "" : m.get_string(this.el.selected);
896                                  
897                 var ar = str.split(" ");
898                 return ar[0];
899                 
900             }
901             public void setValue (string val) {
902                 var m = (Gtk.StringList) this.el.model;
903                 for(var i = 0; i < m.get_n_items();i++) {
904                         if (m.get_string(i) == val) {
905                                 this.el.selected = i;
906                                 break;
907                         }
908                 }
909                 this.el.selected = Gtk.INVALID_LIST_POSITION;
910             
911             }
912         }
913         public class Xcls_StringList20 : Object
914         {
915             public Gtk.StringList el;
916             private EditProject  _this;
917
918
919                 // my vars (def)
920
921             // ctor
922             public Xcls_StringList20(EditProject _owner )
923             {
924                 _this = _owner;
925                 this.el = new Gtk.StringList( {  
926         "Gtk - A Gtk / Vala Desktop project", 
927         "Roo - A Web  Javascript Project using the Roo Library"
928         /*,  "Flutter" */ 
929 } );
930
931                 // my vars (dec)
932
933                 // set gobject values
934             }
935
936             // user defined functions
937         }
938
939
940
941
942     }