fix line numbering issues with vala generator - hopefully fixes completion in node...
[roobuilder] / src / Builder4 / DialogFiles.vala
1     static DialogFiles  _DialogFiles;
2
3     public class DialogFiles : Object
4     {
5         public Gtk.Window el;
6         private DialogFiles  _this;
7
8         public static DialogFiles singleton()
9         {
10             if (_DialogFiles == null) {
11                 _DialogFiles= new DialogFiles();
12             }
13             return _DialogFiles;
14         }
15         public Xcls_mainpane mainpane;
16         public Xcls_projectscroll projectscroll;
17         public Xcls_project_list project_list;
18         public Xcls_projectselection projectselection;
19         public Xcls_projectsort projectsort;
20         public Xcls_projectmodel projectmodel;
21         public Xcls_filepane filepane;
22         public Xcls_searchbox searchbox;
23         public Xcls_iconscroll iconscroll;
24         public Xcls_gridview gridview;
25         public Xcls_iconsel iconsel;
26         public Xcls_gridsort gridsort;
27         public Xcls_gridmodel gridmodel;
28         public Xcls_iconsearch iconsearch;
29         public Xcls_treescroll treescroll;
30         public Xcls_treeview treeview;
31         public Xcls_treeselmodel treeselmodel;
32         public Xcls_treelistsort treelistsort;
33         public Xcls_treelistmodel treelistmodel;
34         public Xcls_treemodel treemodel;
35         public Xcls_treefilter treefilter;
36         public Xcls_name name;
37         public Xcls_btn_newproj btn_newproj;
38         public Xcls_btn_projprop btn_projprop;
39         public Xcls_btn_delproj btn_delproj;
40         public Xcls_btn_addfile btn_addfile;
41         public Xcls_btn_delfile btn_delfile;
42
43             // my vars (def)
44         public Xcls_MainWindow win;
45         public string lastfilter;
46         public bool in_onprojectselected;
47         public bool is_loading;
48         public bool new_window;
49         public Project.Project selectedProject;
50         public Gdk.Pixbuf missing_thumb_pixbuf;
51         public Gee.HashMap<string,Gdk.Pixbuf> image_cache;
52
53         // ctor
54         public DialogFiles()
55         {
56             _this = this;
57             this.el = new Gtk.Window();
58
59             // my vars (dec)
60             this.in_onprojectselected = false;
61             this.is_loading = false;
62             this.new_window = false;
63
64             // set gobject values
65             this.el.title = "Select Project / File";
66             this.el.name = "DialogFiles";
67             this.el.default_height = 550;
68             this.el.default_width = 1000;
69             this.el.modal = true;
70             var child_1 = new Xcls_Box2( _this );
71             this.el.child = child_1.el;
72             var child_2 = new Xcls_HeaderBar44( _this );
73             this.el.titlebar = child_2.el;
74         }
75
76         // user defined functions
77         public void onProjectSelected (Project.Project? project) 
78         {
79                 if (this.in_onprojectselected) { 
80                         return;
81                 }
82                 this.selectedProject = project;
83                 
84                 if (project == null) {
85                         GLib.debug("Hide project files");
86                         _this.mainpane.el.set_end_child(null);
87                         _this.filepane.el.hide();
88                         return;
89                         
90                 }
91                 
92                 GLib.debug("Show project files");
93                 _this.mainpane.el.set_end_child(_this.filepane.el);
94                 
95                 _this.filepane.el.show();       
96                 this.in_onprojectselected = true;
97                 
98                 
99         
100                 project.load();
101                  
102                 
103                 _this.searchbox.el.text = "";
104                  _this.gridview.el.set_model(new Gtk.SingleSelection(null));
105                  _this.selectedProject.loadFilesIntoStore(_this.gridmodel.el);
106                  _this.iconsel.el.selected = Gtk.INVALID_LIST_POSITION;
107                         
108                  _this.gridview.el.set_model(_this.iconsel.el);
109                    
110                  
111                  GLib.Timeout.add(500, () => {
112                         _this.iconsel.el.selected = Gtk.INVALID_LIST_POSITION;
113                          _this.treeselmodel.el.selected = Gtk.INVALID_LIST_POSITION;             
114                  
115                      _this.searchbox.el.grab_focus();
116                            return false;
117              });
118                  _this.treeview.el.set_model(new Gtk.SingleSelection(null));
119             
120             this.selectedProject.loadDirsIntoStore(_this.treemodel.el);
121             
122             _this.treeview.el.set_model(_this.treeselmodel.el);
123             
124                  _this.treeselmodel.el.selected = Gtk.INVALID_LIST_POSITION;
125                 this.treescroll.el.vadjustment.value = 0;
126                 this.in_onprojectselected = false;      
127         }
128         public void selectProject (Project.Project? project) {
129             
130                 
131                  
132                 var sm = this.projectselection.el;
133                 if (project == null) {
134                         sm.selected = Gtk.INVALID_LIST_POSITION;
135                         this.onProjectSelected(null);
136                         return;
137                 }
138         
139                 
140                 for (var i =0; i < sm.n_items; i++) {
141                         var p = (Project.Project) sm.get_item(i);
142                         if (p.path == project.path) {
143                                 GLib.debug("Select Project %s => %d", project.name, i);
144                                 sm.selected = i;
145                                 break;
146                         }
147                 } 
148                 
149         }
150         public void show (Project.Project? project, bool new_window) {
151               
152                 this.new_window = new_window;
153         
154             this.projectscroll.el.vadjustment.value = 0; // scroll to top?
155             
156           
157                   //var win = this.win.el;
158               //var  w = win.get_width();
159               //var h = win.get_height();
160          
161                 
162                  this.el.show();
163          this.load();
164                 this.selectProject(project);
165                 this.onProjectSelected(project);   //?? twice?
166                  
167                     GLib.Timeout.add(500, () => {
168                         if (project == null) {
169                                 _this.projectselection.el.selected = Gtk.INVALID_LIST_POSITION;
170                                         this.onProjectSelected(null); 
171                 
172                                 } 
173                           this.el.set_size_request( 800 , 750);  // ?? based on default 
174                      return false;
175              });
176                  
177         }//
178         public void load () {
179              // clear list...
180             
181               
182              _this.is_loading = true;
183                  
184              
185              Project.Project.loadAll();
186              _this.project_list.el.set_model(new Gtk.SingleSelection(null));
187              Project.Project.loadIntoStore(this.projectmodel.el);
188         
189                 _this.project_list.el.set_model(_this.projectselection.el);
190                 
191                 _this.is_loading = false;
192             
193             _this.projectselection.el.selected = Gtk.INVALID_LIST_POSITION; 
194                 _this.btn_delfile.el.hide();
195                 
196           
197         }
198         public class Xcls_Box2 : Object
199         {
200             public Gtk.Box el;
201             private DialogFiles  _this;
202
203
204                 // my vars (def)
205             public bool expand;
206
207             // ctor
208             public Xcls_Box2(DialogFiles _owner )
209             {
210                 _this = _owner;
211                 this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
212
213                 // my vars (dec)
214                 this.expand = true;
215
216                 // set gobject values
217                 this.el.homogeneous = false;
218                 this.el.margin_end = 10;
219                 this.el.margin_start = 10;
220                 this.el.margin_bottom = 10;
221                 this.el.margin_top = 10;
222                 var child_1 = new Xcls_Box3( _this );
223                 child_1.ref();
224                 this.el.append( child_1.el );
225                 new Xcls_mainpane( _this );
226                 this.el.append( _this.mainpane.el );
227             }
228
229             // user defined functions
230         }
231         public class Xcls_Box3 : Object
232         {
233             public Gtk.Box el;
234             private DialogFiles  _this;
235
236
237                 // my vars (def)
238
239             // ctor
240             public Xcls_Box3(DialogFiles _owner )
241             {
242                 _this = _owner;
243                 this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
244
245                 // my vars (dec)
246
247                 // set gobject values
248                 this.el.hexpand = true;
249             }
250
251             // user defined functions
252         }
253
254         public class Xcls_mainpane : Object
255         {
256             public Gtk.Paned el;
257             private DialogFiles  _this;
258
259
260                 // my vars (def)
261             public bool homogeneous;
262             public int spacing;
263
264             // ctor
265             public Xcls_mainpane(DialogFiles _owner )
266             {
267                 _this = _owner;
268                 _this.mainpane = this;
269                 this.el = new Gtk.Paned( Gtk.Orientation.HORIZONTAL );
270
271                 // my vars (dec)
272                 this.homogeneous = false;
273                 this.spacing = 0;
274
275                 // set gobject values
276                 this.el.hexpand = true;
277                 this.el.vexpand = true;
278                 this.el.position = 200;
279                 new Xcls_projectscroll( _this );
280                 this.el.start_child = _this.projectscroll.el;
281                 new Xcls_filepane( _this );
282                 this.el.end_child = _this.filepane.el;
283             }
284
285             // user defined functions
286         }
287         public class Xcls_projectscroll : Object
288         {
289             public Gtk.ScrolledWindow el;
290             private DialogFiles  _this;
291
292
293                 // my vars (def)
294             public bool expand;
295
296             // ctor
297             public Xcls_projectscroll(DialogFiles _owner )
298             {
299                 _this = _owner;
300                 _this.projectscroll = this;
301                 this.el = new Gtk.ScrolledWindow();
302
303                 // my vars (dec)
304                 this.expand = true;
305
306                 // set gobject values
307                 this.el.width_request = 150;
308                 this.el.has_frame = true;
309                 this.el.hexpand = true;
310                 this.el.vexpand = true;
311                 new Xcls_project_list( _this );
312                 this.el.child = _this.project_list.el;
313
314                 // init method
315
316                 this.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);
317             }
318
319             // user defined functions
320         }
321         public class Xcls_project_list : Object
322         {
323             public Gtk.ColumnView el;
324             private DialogFiles  _this;
325
326
327                 // my vars (def)
328             public Gtk.CssProvider css;
329
330             // ctor
331             public Xcls_project_list(DialogFiles _owner )
332             {
333                 _this = _owner;
334                 _this.project_list = this;
335                 new Xcls_projectselection( _this );
336                 this.el = new Gtk.ColumnView( _this.projectselection.el );
337
338                 // my vars (dec)
339
340                 // set gobject values
341                 this.el.name = "project-list";
342                 var child_2 = new Xcls_ColumnViewColumn12( _this );
343                 child_2.ref();
344                 this.el.append_column ( child_2.el  );
345
346                 // init method
347
348                 {
349                  
350                         this.css = new Gtk.CssProvider();
351                  
352                         this.css.load_from_string("#project-list { font-size: 12px;}");
353                 
354                         Gtk.StyleContext.add_provider_for_display(
355                                 this.el.get_display(),
356                                 this.css,
357                                 Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION
358                         );
359                                 
360                    
361                 }
362             }
363
364             // user defined functions
365         }
366         public class Xcls_projectselection : Object
367         {
368             public Gtk.SingleSelection el;
369             private DialogFiles  _this;
370
371
372                 // my vars (def)
373
374             // ctor
375             public Xcls_projectselection(DialogFiles _owner )
376             {
377                 _this = _owner;
378                 _this.projectselection = this;
379                 new Xcls_projectsort( _this );
380                 this.el = new Gtk.SingleSelection( _this.projectsort.el );
381
382                 // my vars (dec)
383
384                 // set gobject values
385                 this.el.can_unselect = true;
386
387                 //listeners
388                 this.el.notify["selected"].connect( (position, n_items) => {
389                 
390                     if (_this.is_loading) {
391                         return;
392                         }
393                   
394                         if (this.el.selected == Gtk.INVALID_LIST_POSITION) {
395                                 _this.btn_delproj.el.hide();
396                                 _this.btn_projprop.el.hide();
397                                 _this.btn_addfile.el.hide();
398                                 //_this.btn_delfile.el.hide();
399                                  
400                         } else {
401                                 _this.btn_delproj.el.show();
402                                 _this.btn_projprop.el.show();
403                                 _this.btn_addfile.el.show();
404                                 //_this.btn_delfile.el.show(); // ??
405                         }
406                  
407                  
408                  
409                     
410                     
411                     if (_this.is_loading) {
412                         return;
413                     }
414                             
415                          Project.Project project  = this.el.selected == Gtk.INVALID_LIST_POSITION ? null :
416                                         (Project.Project) _this.projectsort.el.get_item(this.el.selected);
417                          
418                          GLib.debug("selection changed to %s", project == null ? "none" : project.name);
419                   
420                     _this.onProjectSelected(project);
421                 });
422             }
423
424             // user defined functions
425         }
426         public class Xcls_projectsort : Object
427         {
428             public Gtk.SortListModel el;
429             private DialogFiles  _this;
430
431
432                 // my vars (def)
433
434             // ctor
435             public Xcls_projectsort(DialogFiles _owner )
436             {
437                 _this = _owner;
438                 _this.projectsort = this;
439                 new Xcls_projectmodel( _this );
440                 var child_2 = new Xcls_StringSorter10( _this );
441                 child_2.ref();
442                 this.el = new Gtk.SortListModel( _this.projectmodel.el, child_2.el );
443
444                 // my vars (dec)
445
446                 // set gobject values
447                 this.el.incremental = true;
448             }
449
450             // user defined functions
451         }
452         public class Xcls_projectmodel : Object
453         {
454             public GLib.ListStore el;
455             private DialogFiles  _this;
456
457
458                 // my vars (def)
459
460             // ctor
461             public Xcls_projectmodel(DialogFiles _owner )
462             {
463                 _this = _owner;
464                 _this.projectmodel = this;
465                 this.el = new GLib.ListStore( typeof(Project.Project) );
466
467                 // my vars (dec)
468
469                 // set gobject values
470             }
471
472             // user defined functions
473             public void remove (Project.Project p) {
474             
475                 for (var i =0;i < this.el.n_items; i++ ) {
476                         var pr = (Project.Project) this.el.get_item(i);
477                         if (p.path == pr.path) {
478                                 this.el.remove(i);
479                                 return;
480                         }
481                 }
482             
483             
484             }
485         }
486
487         public class Xcls_StringSorter10 : Object
488         {
489             public Gtk.StringSorter el;
490             private DialogFiles  _this;
491
492
493                 // my vars (def)
494
495             // ctor
496             public Xcls_StringSorter10(DialogFiles _owner )
497             {
498                 _this = _owner;
499                 var child_1 = new Xcls_PropertyExpression11( _this );
500                 child_1.ref();
501                 this.el = new Gtk.StringSorter( child_1.el );
502
503                 // my vars (dec)
504
505                 // set gobject values
506             }
507
508             // user defined functions
509         }
510         public class Xcls_PropertyExpression11 : Object
511         {
512             public Gtk.PropertyExpression el;
513             private DialogFiles  _this;
514
515
516                 // my vars (def)
517
518             // ctor
519             public Xcls_PropertyExpression11(DialogFiles _owner )
520             {
521                 _this = _owner;
522                 this.el = new Gtk.PropertyExpression( typeof(Project.Project), null, "name" );
523
524                 // my vars (dec)
525
526                 // set gobject values
527             }
528
529             // user defined functions
530         }
531
532
533
534
535         public class Xcls_ColumnViewColumn12 : Object
536         {
537             public Gtk.ColumnViewColumn el;
538             private DialogFiles  _this;
539
540
541                 // my vars (def)
542
543             // ctor
544             public Xcls_ColumnViewColumn12(DialogFiles _owner )
545             {
546                 _this = _owner;
547                 var child_1 = new Xcls_SignalListItemFactory13( _this );
548                 child_1.ref();
549                 this.el = new Gtk.ColumnViewColumn( "Project", child_1.el );
550
551                 // my vars (dec)
552
553                 // set gobject values
554                 this.el.expand = true;
555             }
556
557             // user defined functions
558         }
559         public class Xcls_SignalListItemFactory13 : Object
560         {
561             public Gtk.SignalListItemFactory el;
562             private DialogFiles  _this;
563
564
565                 // my vars (def)
566
567             // ctor
568             public Xcls_SignalListItemFactory13(DialogFiles _owner )
569             {
570                 _this = _owner;
571                 this.el = new Gtk.SignalListItemFactory();
572
573                 // my vars (dec)
574
575                 // set gobject values
576
577                 //listeners
578                 this.el.setup.connect( (item) => {
579                         //var j = (JsRender.JsRender) item;
580                         var gi = (Gtk.ListItem)item;
581                          
582                         var lbl = new Gtk.Label("");
583                         lbl.halign = Gtk.Align.START;
584                         gi.set_child(lbl);
585                 
586                 
587                 
588                 });
589                 this.el.bind.connect( (listitem) => {
590                  
591                         var lbl = (Gtk.Label)  ((Gtk.ListItem)listitem).get_child();
592                            
593                         var item = (Project.Project)  ((Gtk.ListItem)listitem).get_item();
594                 
595                         item.bind_property("name",
596                                 lbl, "label",
597                            GLib.BindingFlags.SYNC_CREATE);
598                 
599                           
600                 });
601             }
602
603             // user defined functions
604         }
605
606
607
608
609         public class Xcls_filepane : Object
610         {
611             public Gtk.Paned el;
612             private DialogFiles  _this;
613
614
615                 // my vars (def)
616
617             // ctor
618             public Xcls_filepane(DialogFiles _owner )
619             {
620                 _this = _owner;
621                 _this.filepane = this;
622                 this.el = new Gtk.Paned( Gtk.Orientation.HORIZONTAL );
623
624                 // my vars (dec)
625
626                 // set gobject values
627                 this.el.position = 200;
628                 this.el.visible = false;
629                 var child_1 = new Xcls_Box15( _this );
630                 this.el.end_child = child_1.el;
631                 new Xcls_treescroll( _this );
632                 this.el.start_child = _this.treescroll.el;
633             }
634
635             // user defined functions
636         }
637         public class Xcls_Box15 : Object
638         {
639             public Gtk.Box el;
640             private DialogFiles  _this;
641
642
643                 // my vars (def)
644
645             // ctor
646             public Xcls_Box15(DialogFiles _owner )
647             {
648                 _this = _owner;
649                 this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
650
651                 // my vars (dec)
652
653                 // set gobject values
654                 this.el.hexpand = true;
655                 this.el.vexpand = true;
656                 var child_1 = new Xcls_Box16( _this );
657                 child_1.ref();
658                 this.el.append( child_1.el );
659                 new Xcls_iconscroll( _this );
660                 this.el.append( _this.iconscroll.el );
661             }
662
663             // user defined functions
664         }
665         public class Xcls_Box16 : Object
666         {
667             public Gtk.Box el;
668             private DialogFiles  _this;
669
670
671                 // my vars (def)
672
673             // ctor
674             public Xcls_Box16(DialogFiles _owner )
675             {
676                 _this = _owner;
677                 this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
678
679                 // my vars (dec)
680
681                 // set gobject values
682                 this.el.hexpand = true;
683                 new Xcls_searchbox( _this );
684                 this.el.append( _this.searchbox.el );
685             }
686
687             // user defined functions
688         }
689         public class Xcls_searchbox : Object
690         {
691             public Gtk.SearchEntry el;
692             private DialogFiles  _this;
693
694
695                 // my vars (def)
696             public Gtk.CssProvider css;
697
698             // ctor
699             public Xcls_searchbox(DialogFiles _owner )
700             {
701                 _this = _owner;
702                 _this.searchbox = this;
703                 this.el = new Gtk.SearchEntry();
704
705                 // my vars (dec)
706
707                 // set gobject values
708                 this.el.name = "popover-files-iconsearch";
709                 this.el.hexpand = true;
710                 this.el.placeholder_text = "type to filter results";
711                 this.el.search_delay = 1000;
712
713                 // init method
714
715                 /*
716                 this.css = new Gtk.CssProvider();
717                 try {
718                         this.css.load_from_data("#popover-files-iconsearch { font:  10px monospace;}".data);
719                 } catch (Error e) {}
720                 this.el.get_style_context().add_provider(this.css,Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION);
721                         
722                         
723                 */
724
725                 //listeners
726                 this.el.search_changed.connect( ( ) => {
727                 
728                         _this.treefilter.el.changed(Gtk.FilterChange.DIFFERENT);
729                         _this.iconsearch.el.set_search(this.el.text);
730                 });
731             }
732
733             // user defined functions
734         }
735
736
737         public class Xcls_iconscroll : Object
738         {
739             public Gtk.ScrolledWindow el;
740             private DialogFiles  _this;
741
742
743                 // my vars (def)
744
745             // ctor
746             public Xcls_iconscroll(DialogFiles _owner )
747             {
748                 _this = _owner;
749                 _this.iconscroll = this;
750                 this.el = new Gtk.ScrolledWindow();
751
752                 // my vars (dec)
753
754                 // set gobject values
755                 this.el.has_frame = true;
756                 this.el.hexpand = true;
757                 this.el.vexpand = true;
758                 new Xcls_gridview( _this );
759                 this.el.child = _this.gridview.el;
760
761                 // init method
762
763                 this.el.set_policy (Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC);
764             }
765
766             // user defined functions
767         }
768         public class Xcls_gridview : Object
769         {
770             public Gtk.GridView el;
771             private DialogFiles  _this;
772
773
774                 // my vars (def)
775
776             // ctor
777             public Xcls_gridview(DialogFiles _owner )
778             {
779                 _this = _owner;
780                 _this.gridview = this;
781                 new Xcls_iconsel( _this );
782                 var child_2 = new Xcls_SignalListItemFactory29( _this );
783                 child_2.ref();
784                 this.el = new Gtk.GridView( _this.iconsel.el, child_2.el );
785
786                 // my vars (dec)
787
788                 // set gobject values
789                 var child_3 = new Xcls_GestureClick20( _this );
790                 child_3.ref();
791                 this.el.add_controller(  child_3.el );
792             }
793
794             // user defined functions
795         }
796         public class Xcls_GestureClick20 : Object
797         {
798             public Gtk.GestureClick el;
799             private DialogFiles  _this;
800
801
802                 // my vars (def)
803
804             // ctor
805             public Xcls_GestureClick20(DialogFiles _owner )
806             {
807                 _this = _owner;
808                 this.el = new Gtk.GestureClick();
809
810                 // my vars (dec)
811
812                 // set gobject values
813
814                 //listeners
815                 this.el.pressed.connect( (n_press, x, y) => {
816                         if (n_press == 2) {
817                                 GLib.debug("double cliced");
818                         } else {
819                                 return;
820                         }
821                         var f = (JsRender.JsRender)_this.iconsel.el.selected_item;
822                           
823                         GLib.debug("Click %s", f.name);
824                         if (f.xtype == "Dir") {
825                                 return;
826                         }
827                         
828                         
829                         _this.win.windowstate.fileViewOpen(f, _this.new_window);
830                         _this.el.hide();
831                         
832                         
833                         
834                 
835                 });
836             }
837
838             // user defined functions
839         }
840
841         public class Xcls_iconsel : Object
842         {
843             public Gtk.SingleSelection el;
844             private DialogFiles  _this;
845
846
847                 // my vars (def)
848
849             // ctor
850             public Xcls_iconsel(DialogFiles _owner )
851             {
852                 _this = _owner;
853                 _this.iconsel = this;
854                 var child_1 = new Xcls_FilterListModel22( _this );
855                 child_1.ref();
856                 this.el = new Gtk.SingleSelection( child_1.el );
857
858                 // my vars (dec)
859
860                 // set gobject values
861                 this.el.can_unselect = true;
862
863                 //listeners
864                 this.el.notify["selected"].connect( () => {
865                         if (this.el.selected == Gtk.INVALID_LIST_POSITION) {
866                                 if (_this.treeselmodel.el.selected == Gtk.INVALID_LIST_POSITION) {
867                                         _this.btn_delfile.el.hide();
868                                 }
869                         
870                                 return;
871                         }
872                         _this.btn_delfile.el.show();
873                         _this.treeselmodel.el.selected = Gtk.INVALID_LIST_POSITION;
874                 
875                 
876                 });
877             }
878
879             // user defined functions
880             public JsRender.JsRender? selectedFile () {
881             
882                 if (this.el.selected == Gtk.INVALID_LIST_POSITION) {
883                         return null;
884                 }
885                 return  (JsRender.JsRender)this.el.get_item(this.el.selected); 
886                 
887              
888             }
889         }
890         public class Xcls_FilterListModel22 : Object
891         {
892             public Gtk.FilterListModel el;
893             private DialogFiles  _this;
894
895
896                 // my vars (def)
897
898             // ctor
899             public Xcls_FilterListModel22(DialogFiles _owner )
900             {
901                 _this = _owner;
902                 new Xcls_gridsort( _this );
903                 new Xcls_iconsearch( _this );
904                 this.el = new Gtk.FilterListModel( _this.gridsort.el, _this.iconsearch.el );
905
906                 // my vars (dec)
907
908                 // set gobject values
909             }
910
911             // user defined functions
912         }
913         public class Xcls_gridsort : Object
914         {
915             public Gtk.SortListModel el;
916             private DialogFiles  _this;
917
918
919                 // my vars (def)
920
921             // ctor
922             public Xcls_gridsort(DialogFiles _owner )
923             {
924                 _this = _owner;
925                 _this.gridsort = this;
926                 new Xcls_gridmodel( _this );
927                 var child_2 = new Xcls_StringSorter25( _this );
928                 child_2.ref();
929                 this.el = new Gtk.SortListModel( _this.gridmodel.el, child_2.el );
930
931                 // my vars (dec)
932
933                 // set gobject values
934             }
935
936             // user defined functions
937         }
938         public class Xcls_gridmodel : Object
939         {
940             public GLib.ListStore el;
941             private DialogFiles  _this;
942
943
944                 // my vars (def)
945
946             // ctor
947             public Xcls_gridmodel(DialogFiles _owner )
948             {
949                 _this = _owner;
950                 _this.gridmodel = this;
951                 this.el = new GLib.ListStore( typeof(JsRender.JsRender) );
952
953                 // my vars (dec)
954
955                 // set gobject values
956             }
957
958             // user defined functions
959             public void remove (JsRender.JsRender p) {
960             
961                 for (var i =0;i < this.el.n_items; i++ ) {
962                         var pr = (JsRender.JsRender) this.el.get_item(i);
963                         if (p.path == pr.path) {
964                                 this.el.remove(i);
965                                 return;
966                         }
967                 }
968              
969             }
970         }
971
972         public class Xcls_StringSorter25 : Object
973         {
974             public Gtk.StringSorter el;
975             private DialogFiles  _this;
976
977
978                 // my vars (def)
979
980             // ctor
981             public Xcls_StringSorter25(DialogFiles _owner )
982             {
983                 _this = _owner;
984                 var child_1 = new Xcls_PropertyExpression26( _this );
985                 child_1.ref();
986                 this.el = new Gtk.StringSorter( child_1.el );
987
988                 // my vars (dec)
989
990                 // set gobject values
991                 this.el.ignore_case = true;
992             }
993
994             // user defined functions
995         }
996         public class Xcls_PropertyExpression26 : Object
997         {
998             public Gtk.PropertyExpression el;
999             private DialogFiles  _this;
1000
1001
1002                 // my vars (def)
1003
1004             // ctor
1005             public Xcls_PropertyExpression26(DialogFiles _owner )
1006             {
1007                 _this = _owner;
1008                 this.el = new Gtk.PropertyExpression( typeof(JsRender.JsRender), null, "name" );
1009
1010                 // my vars (dec)
1011
1012                 // set gobject values
1013             }
1014
1015             // user defined functions
1016         }
1017
1018
1019
1020         public class Xcls_iconsearch : Object
1021         {
1022             public Gtk.StringFilter el;
1023             private DialogFiles  _this;
1024
1025
1026                 // my vars (def)
1027
1028             // ctor
1029             public Xcls_iconsearch(DialogFiles _owner )
1030             {
1031                 _this = _owner;
1032                 _this.iconsearch = this;
1033                 var child_1 = new Xcls_PropertyExpression28( _this );
1034                 child_1.ref();
1035                 this.el = new Gtk.StringFilter( child_1.el );
1036
1037                 // my vars (dec)
1038
1039                 // set gobject values
1040                 this.el.match_mode = Gtk.StringFilterMatchMode.SUBSTRING;
1041                 this.el.ignore_case = true;
1042             }
1043
1044             // user defined functions
1045         }
1046         public class Xcls_PropertyExpression28 : Object
1047         {
1048             public Gtk.PropertyExpression el;
1049             private DialogFiles  _this;
1050
1051
1052                 // my vars (def)
1053
1054             // ctor
1055             public Xcls_PropertyExpression28(DialogFiles _owner )
1056             {
1057                 _this = _owner;
1058                 this.el = new Gtk.PropertyExpression( typeof(JsRender.JsRender), null, "name" );
1059
1060                 // my vars (dec)
1061
1062                 // set gobject values
1063             }
1064
1065             // user defined functions
1066         }
1067
1068
1069
1070
1071         public class Xcls_SignalListItemFactory29 : Object
1072         {
1073             public Gtk.SignalListItemFactory el;
1074             private DialogFiles  _this;
1075
1076
1077                 // my vars (def)
1078
1079             // ctor
1080             public Xcls_SignalListItemFactory29(DialogFiles _owner )
1081             {
1082                 _this = _owner;
1083                 this.el = new Gtk.SignalListItemFactory();
1084
1085                 // my vars (dec)
1086
1087                 // set gobject values
1088
1089                 //listeners
1090                 this.el.setup.connect( (item) => {
1091                         //var j = (JsRender.JsRender) item;
1092                         var gi = (Gtk.ListItem)item;
1093                         var b  = new Gtk.Box(Gtk.Orientation.VERTICAL,4);
1094                         var i = new Gtk.Image();
1095                         i.pixel_size = 96;
1096                         var t = new Gtk.Label("");
1097                         b.append(i);
1098                         b.append(t);
1099                         
1100                         gi.set_child(b);
1101                         b.has_tooltip = true;
1102                         b.query_tooltip.connect((x, y, keyboard_tooltip, tooltip) => {
1103                                 var j = (JsRender.JsRender) gi.get_item();
1104                                 
1105                                 var ti = new Gtk.Image.from_file ( j.getIconFileName());
1106                                 ti.pixel_size = 368;
1107                                 tooltip.set_custom( ti );
1108                                 return true;
1109                         });
1110                 
1111                 
1112                 });
1113                 this.el.bind.connect( (listitem) => {
1114                  
1115                         var box = (Gtk.Box)  ((Gtk.ListItem)listitem).get_child();
1116                            
1117                         var img = (Gtk.Image) box.get_first_child();
1118                         var lbl = (Gtk.Label)img.get_next_sibling();
1119                 
1120                         var item = (JsRender.JsRender)  ((Gtk.ListItem)listitem).get_item();
1121                         //GLib.debug("set label name to %s", item.name);
1122                          
1123                         var ns = item.name.split(".");
1124                         if (ns.length < 2) {
1125                                 lbl.label = item.name;
1126                         } else {
1127                                 lbl.label =  
1128                                         item.name.substring(0, item.name.length - ns[ns.length-1].length)
1129                                          + "\n"+  ns[ns.length-1];
1130                         }
1131                 
1132                 /*
1133                         item.bind_property("name",
1134                                 lbl, "label",
1135                            GLib.BindingFlags.SYNC_CREATE);
1136                 
1137                         */
1138                     img.set_from_file(item.getIconFileName());
1139                     
1140                           
1141                 });
1142             }
1143
1144             // user defined functions
1145         }
1146
1147
1148
1149
1150         public class Xcls_treescroll : Object
1151         {
1152             public Gtk.ScrolledWindow el;
1153             private DialogFiles  _this;
1154
1155
1156                 // my vars (def)
1157
1158             // ctor
1159             public Xcls_treescroll(DialogFiles _owner )
1160             {
1161                 _this = _owner;
1162                 _this.treescroll = this;
1163                 this.el = new Gtk.ScrolledWindow();
1164
1165                 // my vars (dec)
1166
1167                 // set gobject values
1168                 this.el.width_request = 200;
1169                 this.el.has_frame = true;
1170                 this.el.hexpand = true;
1171                 this.el.vexpand = true;
1172                 this.el.visible = true;
1173                 new Xcls_treeview( _this );
1174                 this.el.child = _this.treeview.el;
1175
1176                 // init method
1177
1178                 this.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);
1179             }
1180
1181             // user defined functions
1182         }
1183         public class Xcls_treeview : Object
1184         {
1185             public Gtk.ColumnView el;
1186             private DialogFiles  _this;
1187
1188
1189                 // my vars (def)
1190             public Gtk.CssProvider css;
1191
1192             // ctor
1193             public Xcls_treeview(DialogFiles _owner )
1194             {
1195                 _this = _owner;
1196                 _this.treeview = this;
1197                 new Xcls_treeselmodel( _this );
1198                 this.el = new Gtk.ColumnView( _this.treeselmodel.el );
1199
1200                 // my vars (dec)
1201
1202                 // set gobject values
1203                 this.el.name = "file-list";
1204                 var child_2 = new Xcls_GestureClick32( _this );
1205                 child_2.ref();
1206                 this.el.add_controller(  child_2.el );
1207                 new Xcls_name( _this );
1208                 this.el.append_column ( _this.name.el  );
1209
1210                 // init method
1211
1212                 {
1213                  
1214                         this.css = new Gtk.CssProvider();
1215                  
1216                         this.css.load_from_string("#file-list { font-size: 12px;}");
1217                 
1218                         Gtk.StyleContext.add_provider_for_display(
1219                                 this.el.get_display(),
1220                                 this.css,
1221                                 Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION
1222                         );
1223                                  
1224                 }
1225             }
1226
1227             // user defined functions
1228         }
1229         public class Xcls_GestureClick32 : Object
1230         {
1231             public Gtk.GestureClick el;
1232             private DialogFiles  _this;
1233
1234
1235                 // my vars (def)
1236
1237             // ctor
1238             public Xcls_GestureClick32(DialogFiles _owner )
1239             {
1240                 _this = _owner;
1241                 this.el = new Gtk.GestureClick();
1242
1243                 // my vars (dec)
1244
1245                 // set gobject values
1246
1247                 //listeners
1248                 this.el.pressed.connect( (n_press, x, y) => {
1249                         if (n_press == 2) {
1250                                 GLib.debug("double cliced");
1251                         } else {
1252                                 return;
1253                         }
1254                         var tr = (Gtk.TreeListRow)_this.treeselmodel.el.selected_item;
1255                         GLib.debug("SELECTED = %s", tr.item.get_type().name());
1256                         var f = (JsRender.JsRender) tr.item;
1257                         GLib.debug("Click %s", f.name);
1258                         if (f.xtype == "Dir") {
1259                                 return;
1260                         }
1261                         
1262                         
1263                         _this.win.windowstate.fileViewOpen(f, _this.new_window);
1264                         
1265                         _this.el.hide();
1266                         
1267                         
1268                 
1269                 });
1270             }
1271
1272             // user defined functions
1273         }
1274
1275         public class Xcls_treeselmodel : Object
1276         {
1277             public Gtk.SingleSelection el;
1278             private DialogFiles  _this;
1279
1280
1281                 // my vars (def)
1282
1283             // ctor
1284             public Xcls_treeselmodel(DialogFiles _owner )
1285             {
1286                 _this = _owner;
1287                 _this.treeselmodel = this;
1288                 var child_1 = new Xcls_FilterListModel34( _this );
1289                 child_1.ref();
1290                 this.el = new Gtk.SingleSelection( child_1.el );
1291
1292                 // my vars (dec)
1293
1294                 // set gobject values
1295                 this.el.can_unselect = true;
1296
1297                 //listeners
1298                 this.el.notify["selected"].connect( () => {
1299                         if (this.el.selected == Gtk.INVALID_LIST_POSITION) {
1300                                 if (_this.iconsel.el.selected == Gtk.INVALID_LIST_POSITION) {
1301                                         _this.btn_delfile.el.hide();
1302                                 }
1303                                 return;
1304                         }
1305                         
1306                         var tr = (Gtk.TreeListRow)_this.treeselmodel.el.selected_item;
1307                         GLib.debug("SELECTED = %s", tr.item.get_type().name());
1308                         var f = (JsRender.JsRender) tr.item;
1309                         if (f.xtype == "Dir") {
1310                                 _this.btn_delfile.el.hide();    
1311                         } else {
1312                                 _this.btn_delfile.el.show();
1313                         }
1314                 
1315                         _this.iconsel.el.selected = Gtk.INVALID_LIST_POSITION;
1316                 
1317                 
1318                 });
1319             }
1320
1321             // user defined functions
1322             public JsRender.JsRender? selectedFile () {
1323             
1324                 if (this.el.selected == Gtk.INVALID_LIST_POSITION) {
1325                         return null;
1326                 }
1327                 var tr = (Gtk.TreeListRow) this.el.selected_item;
1328             
1329                 return  (JsRender.JsRender) tr.item;
1330             }
1331         }
1332         public class Xcls_FilterListModel34 : Object
1333         {
1334             public Gtk.FilterListModel el;
1335             private DialogFiles  _this;
1336
1337
1338                 // my vars (def)
1339
1340             // ctor
1341             public Xcls_FilterListModel34(DialogFiles _owner )
1342             {
1343                 _this = _owner;
1344                 new Xcls_treelistsort( _this );
1345                 new Xcls_treefilter( _this );
1346                 this.el = new Gtk.FilterListModel( _this.treelistsort.el, _this.treefilter.el );
1347
1348                 // my vars (dec)
1349
1350                 // set gobject values
1351             }
1352
1353             // user defined functions
1354         }
1355         public class Xcls_treelistsort : Object
1356         {
1357             public Gtk.SortListModel el;
1358             private DialogFiles  _this;
1359
1360
1361                 // my vars (def)
1362
1363             // ctor
1364             public Xcls_treelistsort(DialogFiles _owner )
1365             {
1366                 _this = _owner;
1367                 _this.treelistsort = this;
1368                 new Xcls_treelistmodel( _this );
1369                 var child_2 = new Xcls_TreeListRowSorter38( _this );
1370                 child_2.ref();
1371                 this.el = new Gtk.SortListModel( _this.treelistmodel.el, child_2.el );
1372
1373                 // my vars (dec)
1374
1375                 // set gobject values
1376                 this.el.incremental = true;
1377             }
1378
1379             // user defined functions
1380         }
1381         public class Xcls_treelistmodel : Object
1382         {
1383             public Gtk.TreeListModel el;
1384             private DialogFiles  _this;
1385
1386
1387                 // my vars (def)
1388
1389             // ctor
1390             public Xcls_treelistmodel(DialogFiles _owner )
1391             {
1392                 _this = _owner;
1393                 _this.treelistmodel = this;
1394                 new Xcls_treemodel( _this );
1395                 this.el = new Gtk.TreeListModel( _this.treemodel.el, false, true, (item) => {
1396         //GLib.debug("liststore got %s", item.get_type().name());
1397         return ((JsRender.JsRender)item).childfiles;
1398 }  );
1399
1400                 // my vars (dec)
1401
1402                 // set gobject values
1403             }
1404
1405             // user defined functions
1406         }
1407         public class Xcls_treemodel : Object
1408         {
1409             public GLib.ListStore el;
1410             private DialogFiles  _this;
1411
1412
1413                 // my vars (def)
1414
1415             // ctor
1416             public Xcls_treemodel(DialogFiles _owner )
1417             {
1418                 _this = _owner;
1419                 _this.treemodel = this;
1420                 this.el = new GLib.ListStore( typeof(JsRender.JsRender) );
1421
1422                 // my vars (dec)
1423
1424                 // set gobject values
1425             }
1426
1427             // user defined functions
1428         }
1429
1430
1431         public class Xcls_TreeListRowSorter38 : Object
1432         {
1433             public Gtk.TreeListRowSorter el;
1434             private DialogFiles  _this;
1435
1436
1437                 // my vars (def)
1438
1439             // ctor
1440             public Xcls_TreeListRowSorter38(DialogFiles _owner )
1441             {
1442                 _this = _owner;
1443                 var child_1 = new Xcls_StringSorter39( _this );
1444                 child_1.ref();
1445                 this.el = new Gtk.TreeListRowSorter( child_1.el );
1446
1447                 // my vars (dec)
1448
1449                 // set gobject values
1450             }
1451
1452             // user defined functions
1453         }
1454         public class Xcls_StringSorter39 : Object
1455         {
1456             public Gtk.StringSorter el;
1457             private DialogFiles  _this;
1458
1459
1460                 // my vars (def)
1461
1462             // ctor
1463             public Xcls_StringSorter39(DialogFiles _owner )
1464             {
1465                 _this = _owner;
1466                 var child_1 = new Xcls_PropertyExpression40( _this );
1467                 child_1.ref();
1468                 this.el = new Gtk.StringSorter( child_1.el );
1469
1470                 // my vars (dec)
1471
1472                 // set gobject values
1473                 this.el.ignore_case = true;
1474             }
1475
1476             // user defined functions
1477         }
1478         public class Xcls_PropertyExpression40 : Object
1479         {
1480             public Gtk.PropertyExpression el;
1481             private DialogFiles  _this;
1482
1483
1484                 // my vars (def)
1485
1486             // ctor
1487             public Xcls_PropertyExpression40(DialogFiles _owner )
1488             {
1489                 _this = _owner;
1490                 this.el = new Gtk.PropertyExpression( typeof(JsRender.JsRender) , null, "name" );
1491
1492                 // my vars (dec)
1493
1494                 // set gobject values
1495             }
1496
1497             // user defined functions
1498         }
1499
1500
1501
1502
1503         public class Xcls_treefilter : Object
1504         {
1505             public Gtk.CustomFilter el;
1506             private DialogFiles  _this;
1507
1508
1509                 // my vars (def)
1510
1511             // ctor
1512             public Xcls_treefilter(DialogFiles _owner )
1513             {
1514                 _this = _owner;
1515                 _this.treefilter = this;
1516                 this.el = new Gtk.CustomFilter( (item) => { 
1517         var tr = ((Gtk.TreeListRow)item).get_item();
1518         //GLib.debug("filter %s", tr.get_type().name());
1519         var j =  (JsRender.JsRender) tr;
1520         if (j.xtype == "Dir" && j.childfiles.n_items < 1) {
1521                 return false;
1522         }
1523         var str = _this.searchbox.el.text.down();       
1524         if (j.xtype == "Dir") {
1525         
1526                 if (str.length < 1) {
1527                         return true;
1528                 }
1529                 for (var i =0 ; i < j.childfiles.n_items; i++) {
1530                         var f = (JsRender.JsRender) j.childfiles.get_item(i);
1531                         if (f.xtype != "PlainFile") {
1532                                 continue;
1533                         }
1534                         if (f.name.down().contains(str)) {
1535                                 return true;
1536                         }
1537                 }
1538                 return false;
1539         }
1540         if (j.xtype != "PlainFile") {
1541                 return false;
1542         }
1543
1544         if (str.length < 1) {
1545                 return true;
1546         }
1547         if (j.name.down().contains(str)) {
1548                 return true;
1549         }
1550         return false; 
1551
1552 } );
1553
1554                 // my vars (dec)
1555
1556                 // set gobject values
1557             }
1558
1559             // user defined functions
1560         }
1561
1562
1563
1564         public class Xcls_name : Object
1565         {
1566             public Gtk.ColumnViewColumn el;
1567             private DialogFiles  _this;
1568
1569
1570                 // my vars (def)
1571
1572             // ctor
1573             public Xcls_name(DialogFiles _owner )
1574             {
1575                 _this = _owner;
1576                 _this.name = this;
1577                 var child_1 = new Xcls_SignalListItemFactory43( _this );
1578                 child_1.ref();
1579                 this.el = new Gtk.ColumnViewColumn( "General Files", child_1.el );
1580
1581                 // my vars (dec)
1582
1583                 // set gobject values
1584                 this.el.id = "name";
1585                 this.el.expand = true;
1586                 this.el.resizable = true;
1587
1588                 // init method
1589
1590                 {
1591                         // this.el.set_sorter(  new Gtk.StringSorter(
1592                         //      new Gtk.PropertyExpression(typeof(JsRender.NodeProp), null, "name")
1593                  //     ));
1594                                 
1595                 }
1596             }
1597
1598             // user defined functions
1599         }
1600         public class Xcls_SignalListItemFactory43 : Object
1601         {
1602             public Gtk.SignalListItemFactory el;
1603             private DialogFiles  _this;
1604
1605
1606                 // my vars (def)
1607
1608             // ctor
1609             public Xcls_SignalListItemFactory43(DialogFiles _owner )
1610             {
1611                 _this = _owner;
1612                 this.el = new Gtk.SignalListItemFactory();
1613
1614                 // my vars (dec)
1615
1616                 // set gobject values
1617
1618                 //listeners
1619                 this.el.setup.connect( (listitem) => {
1620                         
1621                         var expand = new Gtk.TreeExpander();
1622                          
1623                         expand.set_indent_for_depth(true);
1624                         expand.set_indent_for_icon(true);
1625                          
1626                         var lbl = new Gtk.Label("");
1627                         lbl.use_markup = true;
1628                         
1629                         
1630                         lbl.justify = Gtk.Justification.LEFT;
1631                         lbl.xalign = 0;
1632                 
1633                  
1634                         expand.set_child(lbl);
1635                         ((Gtk.ListItem)listitem).set_child(expand);
1636                         ((Gtk.ListItem)listitem).activatable = false;
1637                 });
1638                 this.el.bind.connect( (listitem) => {
1639                          //GLib.debug("listitme is is %s", ((Gtk.ListItem)listitem).get_type().name());
1640                         
1641                         
1642                         
1643                         //var expand = (Gtk.TreeExpander) ((Gtk.ListItem)listitem).get_child();
1644                         var expand = (Gtk.TreeExpander)  ((Gtk.ListItem)listitem).get_child();
1645                           
1646                  
1647                         var lbl = (Gtk.Label) expand.child;
1648                         
1649                          if (lbl.label != "") { // do not update
1650                                 return;
1651                         }
1652                         var lr = (Gtk.TreeListRow)((Gtk.ListItem)listitem).get_item();
1653                         //GLib.debug("LR = %s", lr.get_type().name());
1654                 
1655                         
1656                         var jr =(JsRender.JsRender) lr.get_item();
1657                         //GLib.debug("JR = %s", jr.get_type().name());          
1658                         
1659                          if (jr == null) {
1660                                  GLib.debug("Problem getting item"); 
1661                                  return;
1662                          }
1663                         //GLib.debug("change  %s to %s", lbl.label, np.name);
1664                         lbl.label = jr.name; // for dir's we could hsow the sub path..
1665                         lbl.tooltip_markup = jr.path;
1666                          
1667                     expand.set_hide_expander(  jr.xtype != "Dir" );
1668                          expand.set_list_row(lr);
1669                  
1670                          
1671                         // bind image...
1672                         
1673                 });
1674             }
1675
1676             // user defined functions
1677         }
1678
1679
1680
1681
1682
1683
1684
1685         public class Xcls_HeaderBar44 : Object
1686         {
1687             public Gtk.HeaderBar el;
1688             private DialogFiles  _this;
1689
1690
1691                 // my vars (def)
1692
1693             // ctor
1694             public Xcls_HeaderBar44(DialogFiles _owner )
1695             {
1696                 _this = _owner;
1697                 this.el = new Gtk.HeaderBar();
1698
1699                 // my vars (dec)
1700
1701                 // set gobject values
1702                 this.el.show_title_buttons = false;
1703                 var child_1 = new Xcls_Button45( _this );
1704                 child_1.ref();
1705                 this.el.pack_end ( child_1.el  );
1706                 new Xcls_btn_newproj( _this );
1707                 this.el.pack_start ( _this.btn_newproj.el  );
1708                 new Xcls_btn_projprop( _this );
1709                 this.el.pack_start ( _this.btn_projprop.el  );
1710                 new Xcls_btn_delproj( _this );
1711                 this.el.pack_start ( _this.btn_delproj.el  );
1712                 new Xcls_btn_addfile( _this );
1713                 this.el.pack_start ( _this.btn_addfile.el  );
1714                 new Xcls_btn_delfile( _this );
1715                 this.el.pack_start ( _this.btn_delfile.el  );
1716             }
1717
1718             // user defined functions
1719         }
1720         public class Xcls_Button45 : Object
1721         {
1722             public Gtk.Button el;
1723             private DialogFiles  _this;
1724
1725
1726                 // my vars (def)
1727
1728             // ctor
1729             public Xcls_Button45(DialogFiles _owner )
1730             {
1731                 _this = _owner;
1732                 this.el = new Gtk.Button();
1733
1734                 // my vars (dec)
1735
1736                 // set gobject values
1737                 this.el.label = "Close / Cancel";
1738
1739                 //listeners
1740                 this.el.clicked.connect( ( ) => {
1741                         if (BuilderApplication.windows.size < 2 && 
1742                                 _this.win.windowstate.file == null
1743                         ) { 
1744                                 BuilderApplication.singleton(null).quit();
1745                                 return;
1746                         }
1747                 
1748                         _this.el.hide();
1749                         
1750                          if (_this.win.windowstate.file == null) {               
1751                                 BuilderApplication.removeWindow(_this.win);
1752                                  
1753                                  
1754                                 
1755                         }
1756                 
1757                 });
1758             }
1759
1760             // user defined functions
1761         }
1762
1763         public class Xcls_btn_newproj : Object
1764         {
1765             public Gtk.Button el;
1766             private DialogFiles  _this;
1767
1768
1769                 // my vars (def)
1770
1771             // ctor
1772             public Xcls_btn_newproj(DialogFiles _owner )
1773             {
1774                 _this = _owner;
1775                 _this.btn_newproj = this;
1776                 this.el = new Gtk.Button();
1777
1778                 // my vars (dec)
1779
1780                 // set gobject values
1781                 var child_1 = new Xcls_Box47( _this );
1782                 this.el.child = child_1.el;
1783
1784                 //listeners
1785                 this.el.clicked.connect( ( ) => {
1786                   
1787                     // create a new file in project..
1788                     //Xcls_DialogNewComponent.singleton().show(
1789                    var  pe =      EditProject.singleton();
1790                    pe.windowstate = _this.win.windowstate;
1791                    
1792                    pe.el.application = _this.win.el.application;
1793                     pe.el.set_transient_for( _this.el );
1794                  
1795                     var cb = new Project.Callback();
1796                     cb.call.connect((pr) => {
1797                         _this.show(  pr , _this.new_window);
1798                         });
1799                       
1800                     pe.show( cb);
1801                    
1802                 
1803                 });
1804             }
1805
1806             // user defined functions
1807             public void onCreated () {
1808                 var pe =      EditProject.singleton();
1809             
1810                 _this.show(  pe.result , _this.new_window);
1811             }
1812         }
1813         public class Xcls_Box47 : Object
1814         {
1815             public Gtk.Box el;
1816             private DialogFiles  _this;
1817
1818
1819                 // my vars (def)
1820
1821             // ctor
1822             public Xcls_Box47(DialogFiles _owner )
1823             {
1824                 _this = _owner;
1825                 this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
1826
1827                 // my vars (dec)
1828
1829                 // set gobject values
1830                 var child_1 = new Xcls_Image48( _this );
1831                 child_1.ref();
1832                 this.el.append( child_1.el );
1833                 var child_2 = new Xcls_Label49( _this );
1834                 child_2.ref();
1835                 this.el.append( child_2.el );
1836             }
1837
1838             // user defined functions
1839         }
1840         public class Xcls_Image48 : Object
1841         {
1842             public Gtk.Image el;
1843             private DialogFiles  _this;
1844
1845
1846                 // my vars (def)
1847
1848             // ctor
1849             public Xcls_Image48(DialogFiles _owner )
1850             {
1851                 _this = _owner;
1852                 this.el = new Gtk.Image();
1853
1854                 // my vars (dec)
1855
1856                 // set gobject values
1857                 this.el.icon_name = "folder-new";
1858                 this.el.margin_end = 4;
1859                 this.el.icon_size = Gtk.IconSize.NORMAL;
1860             }
1861
1862             // user defined functions
1863         }
1864
1865         public class Xcls_Label49 : Object
1866         {
1867             public Gtk.Label el;
1868             private DialogFiles  _this;
1869
1870
1871                 // my vars (def)
1872
1873             // ctor
1874             public Xcls_Label49(DialogFiles _owner )
1875             {
1876                 _this = _owner;
1877                 this.el = new Gtk.Label( "New Project" );
1878
1879                 // my vars (dec)
1880
1881                 // set gobject values
1882                 this.el.halign = Gtk.Align.START;
1883             }
1884
1885             // user defined functions
1886         }
1887
1888
1889
1890         public class Xcls_btn_projprop : Object
1891         {
1892             public Gtk.Button el;
1893             private DialogFiles  _this;
1894
1895
1896                 // my vars (def)
1897
1898             // ctor
1899             public Xcls_btn_projprop(DialogFiles _owner )
1900             {
1901                 _this = _owner;
1902                 _this.btn_projprop = this;
1903                 this.el = new Gtk.Button();
1904
1905                 // my vars (dec)
1906
1907                 // set gobject values
1908                 var child_1 = new Xcls_Box51( _this );
1909                 this.el.child = child_1.el;
1910
1911                 //listeners
1912                 this.el.clicked.connect( ( ) => {
1913                   // should disable the button really.
1914                    if (_this.selectedProject == null) {
1915                            return;
1916                    }
1917                         _this.win.windowstate.projectPopoverShow(_this.el, _this.selectedProject, null);
1918                  });
1919             }
1920
1921             // user defined functions
1922         }
1923         public class Xcls_Box51 : Object
1924         {
1925             public Gtk.Box el;
1926             private DialogFiles  _this;
1927
1928
1929                 // my vars (def)
1930
1931             // ctor
1932             public Xcls_Box51(DialogFiles _owner )
1933             {
1934                 _this = _owner;
1935                 this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
1936
1937                 // my vars (dec)
1938
1939                 // set gobject values
1940                 var child_1 = new Xcls_Image52( _this );
1941                 child_1.ref();
1942                 this.el.append( child_1.el );
1943                 var child_2 = new Xcls_Label53( _this );
1944                 child_2.ref();
1945                 this.el.append( child_2.el );
1946             }
1947
1948             // user defined functions
1949         }
1950         public class Xcls_Image52 : Object
1951         {
1952             public Gtk.Image el;
1953             private DialogFiles  _this;
1954
1955
1956                 // my vars (def)
1957
1958             // ctor
1959             public Xcls_Image52(DialogFiles _owner )
1960             {
1961                 _this = _owner;
1962                 this.el = new Gtk.Image();
1963
1964                 // my vars (dec)
1965
1966                 // set gobject values
1967                 this.el.icon_name = "emblem-system";
1968                 this.el.margin_end = 4;
1969             }
1970
1971             // user defined functions
1972         }
1973
1974         public class Xcls_Label53 : Object
1975         {
1976             public Gtk.Label el;
1977             private DialogFiles  _this;
1978
1979
1980                 // my vars (def)
1981
1982             // ctor
1983             public Xcls_Label53(DialogFiles _owner )
1984             {
1985                 _this = _owner;
1986                 this.el = new Gtk.Label( "Project Properties" );
1987
1988                 // my vars (dec)
1989
1990                 // set gobject values
1991             }
1992
1993             // user defined functions
1994         }
1995
1996
1997
1998         public class Xcls_btn_delproj : Object
1999         {
2000             public Gtk.Button el;
2001             private DialogFiles  _this;
2002
2003
2004                 // my vars (def)
2005             public DialogConfirm confirm;
2006
2007             // ctor
2008             public Xcls_btn_delproj(DialogFiles _owner )
2009             {
2010                 _this = _owner;
2011                 _this.btn_delproj = this;
2012                 this.el = new Gtk.Button();
2013
2014                 // my vars (dec)
2015                 this.confirm = null;
2016
2017                 // set gobject values
2018                 var child_1 = new Xcls_Box55( _this );
2019                 this.el.child = child_1.el;
2020
2021                 //listeners
2022                 this.el.clicked.connect( ( ) => {
2023                   
2024                   
2025                         if (this.confirm == null) {
2026                                 this.confirm = new DialogConfirm();
2027                                 this.confirm.el.set_transient_for(_this.el);
2028                         }
2029                         
2030                         var project  = (Project.Project) _this.projectsort.el.get_item(
2031                                 _this.projectselection.el.selected
2032                                 );
2033                         
2034                         this.confirm.el.response.connect((res) => {
2035                                 this.confirm.el.hide();
2036                                 if (res == Gtk.ResponseType.CANCEL) {
2037                                         return;
2038                                 }
2039                            project  = (Project.Project) _this.projectsort.el.get_item(
2040                                         _this.projectselection.el.selected
2041                                 );
2042                                 Project.Project.remove(project);
2043                           _this.projectmodel.remove(project);
2044                                 _this.projectselection.el.selected = Gtk.INVALID_LIST_POSITION;
2045                         
2046                         });
2047                         this.confirm.showIt("Confirm Delete Project", "Are you sure you want to delete this project?");
2048                 });
2049             }
2050
2051             // user defined functions
2052         }
2053         public class Xcls_Box55 : Object
2054         {
2055             public Gtk.Box el;
2056             private DialogFiles  _this;
2057
2058
2059                 // my vars (def)
2060
2061             // ctor
2062             public Xcls_Box55(DialogFiles _owner )
2063             {
2064                 _this = _owner;
2065                 this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
2066
2067                 // my vars (dec)
2068
2069                 // set gobject values
2070                 var child_1 = new Xcls_Image56( _this );
2071                 child_1.ref();
2072                 this.el.append( child_1.el );
2073                 var child_2 = new Xcls_Label57( _this );
2074                 child_2.ref();
2075                 this.el.append( child_2.el );
2076             }
2077
2078             // user defined functions
2079         }
2080         public class Xcls_Image56 : Object
2081         {
2082             public Gtk.Image el;
2083             private DialogFiles  _this;
2084
2085
2086                 // my vars (def)
2087
2088             // ctor
2089             public Xcls_Image56(DialogFiles _owner )
2090             {
2091                 _this = _owner;
2092                 this.el = new Gtk.Image();
2093
2094                 // my vars (dec)
2095
2096                 // set gobject values
2097                 this.el.icon_name = "user-trash";
2098             }
2099
2100             // user defined functions
2101         }
2102
2103         public class Xcls_Label57 : Object
2104         {
2105             public Gtk.Label el;
2106             private DialogFiles  _this;
2107
2108
2109                 // my vars (def)
2110
2111             // ctor
2112             public Xcls_Label57(DialogFiles _owner )
2113             {
2114                 _this = _owner;
2115                 this.el = new Gtk.Label( "Delete Project" );
2116
2117                 // my vars (dec)
2118
2119                 // set gobject values
2120             }
2121
2122             // user defined functions
2123         }
2124
2125
2126
2127         public class Xcls_btn_addfile : Object
2128         {
2129             public Gtk.Button el;
2130             private DialogFiles  _this;
2131
2132
2133                 // my vars (def)
2134
2135             // ctor
2136             public Xcls_btn_addfile(DialogFiles _owner )
2137             {
2138                 _this = _owner;
2139                 _this.btn_addfile = this;
2140                 this.el = new Gtk.Button();
2141
2142                 // my vars (dec)
2143
2144                 // set gobject values
2145                 var child_1 = new Xcls_Box59( _this );
2146                 this.el.child = child_1.el;
2147
2148                 //listeners
2149                 this.el.clicked.connect( () => {
2150                     // create a new file in project..
2151                     print("add file selected\n");
2152                     
2153                     if (_this.selectedProject == null) {
2154                         return;
2155                     }
2156                     try {
2157                         var f = JsRender.JsRender.factory(_this.selectedProject.xtype,  _this.selectedProject, "");
2158                         _this.win.windowstate.file_details.show( f, _this.el, _this.new_window );
2159                      } catch (JsRender.Error e) {}
2160                 
2161                 });
2162             }
2163
2164             // user defined functions
2165         }
2166         public class Xcls_Box59 : Object
2167         {
2168             public Gtk.Box el;
2169             private DialogFiles  _this;
2170
2171
2172                 // my vars (def)
2173
2174             // ctor
2175             public Xcls_Box59(DialogFiles _owner )
2176             {
2177                 _this = _owner;
2178                 this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
2179
2180                 // my vars (dec)
2181
2182                 // set gobject values
2183                 var child_1 = new Xcls_Image60( _this );
2184                 child_1.ref();
2185                 this.el.append( child_1.el );
2186                 var child_2 = new Xcls_Label61( _this );
2187                 child_2.ref();
2188                 this.el.append( child_2.el );
2189             }
2190
2191             // user defined functions
2192         }
2193         public class Xcls_Image60 : Object
2194         {
2195             public Gtk.Image el;
2196             private DialogFiles  _this;
2197
2198
2199                 // my vars (def)
2200
2201             // ctor
2202             public Xcls_Image60(DialogFiles _owner )
2203             {
2204                 _this = _owner;
2205                 this.el = new Gtk.Image();
2206
2207                 // my vars (dec)
2208
2209                 // set gobject values
2210                 this.el.icon_name = "document-new";
2211                 this.el.margin_end = 4;
2212             }
2213
2214             // user defined functions
2215         }
2216
2217         public class Xcls_Label61 : Object
2218         {
2219             public Gtk.Label el;
2220             private DialogFiles  _this;
2221
2222
2223                 // my vars (def)
2224
2225             // ctor
2226             public Xcls_Label61(DialogFiles _owner )
2227             {
2228                 _this = _owner;
2229                 this.el = new Gtk.Label( "New File" );
2230
2231                 // my vars (dec)
2232
2233                 // set gobject values
2234             }
2235
2236             // user defined functions
2237         }
2238
2239
2240
2241         public class Xcls_btn_delfile : Object
2242         {
2243             public Gtk.Button el;
2244             private DialogFiles  _this;
2245
2246
2247                 // my vars (def)
2248             public DialogConfirm confirm;
2249
2250             // ctor
2251             public Xcls_btn_delfile(DialogFiles _owner )
2252             {
2253                 _this = _owner;
2254                 _this.btn_delfile = this;
2255                 this.el = new Gtk.Button();
2256
2257                 // my vars (dec)
2258                 this.confirm = null;
2259
2260                 // set gobject values
2261                 var child_1 = new Xcls_Box63( _this );
2262                 this.el.child = child_1.el;
2263
2264                 //listeners
2265                 this.el.clicked.connect( ( ) => {
2266                   
2267                         if (this.confirm == null) {
2268                                 this.confirm = new DialogConfirm();
2269                                 this.confirm.el.set_transient_for(_this.el);
2270                  
2271                         }
2272                         GLib.debug("DELETE");
2273                         var is_icon = true;
2274                         var isel = _this.iconsel.selectedFile();
2275                          
2276                         if (isel == null) {
2277                                 GLib.debug("DELETE - no icons selected");
2278                                 is_icon = false;
2279                                 isel = _this.treeselmodel.selectedFile();
2280                         }
2281                         if (isel == null) {
2282                                         GLib.debug("DELETE - no tree item selected");
2283                                 return; // should nto happen..
2284                         }
2285                         
2286                         GLib.debug("DELETE - calling confirm.");
2287                         this.confirm.el.response.connect((res) => {
2288                                 this.confirm.el.hide();
2289                                 if (res == Gtk.ResponseType.CANCEL) {
2290                                         return;
2291                                 }
2292                                 is_icon = true;
2293                                 isel = _this.iconsel.selectedFile();
2294                                 if (isel == null) {
2295                                         is_icon = false;
2296                                         isel = _this.treeselmodel.selectedFile();
2297                                 }
2298                                 if (isel == null) {
2299                                         return; // should nto happen..
2300                                 }
2301                                 
2302                                 if (is_icon) {
2303                                         isel.project.deleteFile(isel);
2304                                         _this.gridmodel.remove(isel);
2305                                         return;
2306                                 }
2307                                 isel.project.deleteFile(isel);                  
2308                         
2309                         });
2310                                 this.confirm.showIt("Confirm Delete File",
2311                                         "Are you sure you want to delete this file?");
2312                         
2313                  
2314                 
2315                 });
2316             }
2317
2318             // user defined functions
2319         }
2320         public class Xcls_Box63 : Object
2321         {
2322             public Gtk.Box el;
2323             private DialogFiles  _this;
2324
2325
2326                 // my vars (def)
2327
2328             // ctor
2329             public Xcls_Box63(DialogFiles _owner )
2330             {
2331                 _this = _owner;
2332                 this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
2333
2334                 // my vars (dec)
2335
2336                 // set gobject values
2337                 var child_1 = new Xcls_Image64( _this );
2338                 child_1.ref();
2339                 this.el.append( child_1.el );
2340                 var child_2 = new Xcls_Label65( _this );
2341                 child_2.ref();
2342                 this.el.append( child_2.el );
2343             }
2344
2345             // user defined functions
2346         }
2347         public class Xcls_Image64 : Object
2348         {
2349             public Gtk.Image el;
2350             private DialogFiles  _this;
2351
2352
2353                 // my vars (def)
2354
2355             // ctor
2356             public Xcls_Image64(DialogFiles _owner )
2357             {
2358                 _this = _owner;
2359                 this.el = new Gtk.Image();
2360
2361                 // my vars (dec)
2362
2363                 // set gobject values
2364                 this.el.icon_name = "user-trash";
2365             }
2366
2367             // user defined functions
2368         }
2369
2370         public class Xcls_Label65 : Object
2371         {
2372             public Gtk.Label el;
2373             private DialogFiles  _this;
2374
2375
2376                 // my vars (def)
2377
2378             // ctor
2379             public Xcls_Label65(DialogFiles _owner )
2380             {
2381                 _this = _owner;
2382                 this.el = new Gtk.Label( "Delete File" );
2383
2384                 // my vars (dec)
2385
2386                 // set gobject values
2387             }
2388
2389             // user defined functions
2390         }
2391
2392
2393
2394
2395     }