5b5d5b0f46b698b2514a98acac2c53a132f54558
[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                 var child_2 = new Xcls_mainpane( _this );
226                 this.el.append( child_2.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                 var child_1 = new Xcls_projectscroll( _this );
280                 this.el.start_child = child_1.el;
281                 var child_2 = new Xcls_filepane( _this );
282                 this.el.end_child = child_2.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                 var child_1 = new Xcls_project_list( _this );
312                 this.el.child = child_1.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                 var child_1 = new Xcls_projectselection( _this );
336                 this.el = new Gtk.ColumnView( child_1.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                 var child_1 = new Xcls_projectsort( _this );
380                 this.el = new Gtk.SingleSelection( child_1.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                 var child_1 = new Xcls_projectmodel( _this );
440                 var child_2 = new Xcls_StringSorter10( _this );
441                 child_2.ref();
442                 this.el = new Gtk.SortListModel( child_1.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 = (JsRender.JsRender)  ((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                 var child_2 = new Xcls_treescroll( _this );
632                 this.el.start_child = child_2.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                 var child_2 = new Xcls_iconscroll( _this );
660                 this.el.append( child_2.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                 var child_1 = new Xcls_searchbox( _this );
684                 this.el.append( child_1.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                 var child_1 = new Xcls_gridview( _this );
759                 this.el.child = child_1.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                 var child_1 = new Xcls_iconsel( _this );
782                 var child_2 = new Xcls_SignalListItemFactory29( _this );
783                 child_2.ref();
784                 this.el = new Gtk.GridView( child_1.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                 var child_1 = new Xcls_gridsort( _this );
903                 var child_2 = new Xcls_iconsearch( _this );
904                 this.el = new Gtk.FilterListModel( child_1.el, child_2.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                 var child_1 = new Xcls_gridmodel( _this );
927                 var child_2 = new Xcls_StringSorter25( _this );
928                 child_2.ref();
929                 this.el = new Gtk.SortListModel( child_1.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                 var child_1 = new Xcls_treeview( _this );
1174                 this.el.child = child_1.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                 var child_1 = new Xcls_treeselmodel( _this );
1198                 this.el = new Gtk.ColumnView( child_1.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                 var child_3 = new Xcls_name( _this );
1208                 this.el.append_column ( child_3.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                 var child_1 = new Xcls_treelistsort( _this );
1345                 var child_2 = new Xcls_treefilter( _this );
1346                 this.el = new Gtk.FilterListModel( child_1.el, child_2.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                 var child_1 = new Xcls_treelistmodel( _this );
1369                 var child_2 = new Xcls_TreeListRowSorter38( _this );
1370                 child_2.ref();
1371                 this.el = new Gtk.SortListModel( child_1.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                 var child_1 = new Xcls_treemodel( _this );
1395                 this.el = new Gtk.TreeListModel( child_1.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                 var child_2 = new Xcls_btn_newproj( _this );
1707                 this.el.pack_start ( child_2.el  );
1708                 var child_3 = new Xcls_btn_projprop( _this );
1709                 this.el.pack_start ( child_3.el  );
1710                 var child_4 = new Xcls_btn_delproj( _this );
1711                 this.el.pack_start ( child_4.el  );
1712                 var child_5 = new Xcls_btn_addfile( _this );
1713                 this.el.pack_start ( child_5.el  );
1714                 var child_6 = new Xcls_btn_delfile( _this );
1715                 this.el.pack_start ( child_6.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                   
1796                     pe.selected.connect((pr) => {
1797                          
1798                              _this.show(  pr, _this.new_window);
1799                 
1800                     });
1801                     
1802                       
1803                     pe.show();
1804                    
1805                 
1806                 });
1807             }
1808
1809             // user defined functions
1810         }
1811         public class Xcls_Box47 : Object
1812         {
1813             public Gtk.Box el;
1814             private DialogFiles  _this;
1815
1816
1817                 // my vars (def)
1818
1819             // ctor
1820             public Xcls_Box47(DialogFiles _owner )
1821             {
1822                 _this = _owner;
1823                 this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
1824
1825                 // my vars (dec)
1826
1827                 // set gobject values
1828                 var child_1 = new Xcls_Image48( _this );
1829                 child_1.ref();
1830                 this.el.append( child_1.el );
1831                 var child_2 = new Xcls_Label49( _this );
1832                 child_2.ref();
1833                 this.el.append( child_2.el );
1834             }
1835
1836             // user defined functions
1837         }
1838         public class Xcls_Image48 : Object
1839         {
1840             public Gtk.Image el;
1841             private DialogFiles  _this;
1842
1843
1844                 // my vars (def)
1845
1846             // ctor
1847             public Xcls_Image48(DialogFiles _owner )
1848             {
1849                 _this = _owner;
1850                 this.el = new Gtk.Image();
1851
1852                 // my vars (dec)
1853
1854                 // set gobject values
1855                 this.el.icon_name = "folder-new";
1856                 this.el.margin_end = 4;
1857                 this.el.icon_size = Gtk.IconSize.NORMAL;
1858             }
1859
1860             // user defined functions
1861         }
1862
1863         public class Xcls_Label49 : Object
1864         {
1865             public Gtk.Label el;
1866             private DialogFiles  _this;
1867
1868
1869                 // my vars (def)
1870
1871             // ctor
1872             public Xcls_Label49(DialogFiles _owner )
1873             {
1874                 _this = _owner;
1875                 this.el = new Gtk.Label( "New Project" );
1876
1877                 // my vars (dec)
1878
1879                 // set gobject values
1880                 this.el.halign = Gtk.Align.START;
1881             }
1882
1883             // user defined functions
1884         }
1885
1886
1887
1888         public class Xcls_btn_projprop : Object
1889         {
1890             public Gtk.Button el;
1891             private DialogFiles  _this;
1892
1893
1894                 // my vars (def)
1895
1896             // ctor
1897             public Xcls_btn_projprop(DialogFiles _owner )
1898             {
1899                 _this = _owner;
1900                 _this.btn_projprop = this;
1901                 this.el = new Gtk.Button();
1902
1903                 // my vars (dec)
1904
1905                 // set gobject values
1906                 var child_1 = new Xcls_Box51( _this );
1907                 this.el.child = child_1.el;
1908
1909                 //listeners
1910                 this.el.clicked.connect( ( ) => {
1911                   // should disable the button really.
1912                    if (_this.selectedProject == null) {
1913                            return;
1914                    }
1915                         _this.win.windowstate.projectPopoverShow(_this.el, _this.selectedProject);
1916                  });
1917             }
1918
1919             // user defined functions
1920         }
1921         public class Xcls_Box51 : Object
1922         {
1923             public Gtk.Box el;
1924             private DialogFiles  _this;
1925
1926
1927                 // my vars (def)
1928
1929             // ctor
1930             public Xcls_Box51(DialogFiles _owner )
1931             {
1932                 _this = _owner;
1933                 this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
1934
1935                 // my vars (dec)
1936
1937                 // set gobject values
1938                 var child_1 = new Xcls_Image52( _this );
1939                 child_1.ref();
1940                 this.el.append( child_1.el );
1941                 var child_2 = new Xcls_Label53( _this );
1942                 child_2.ref();
1943                 this.el.append( child_2.el );
1944             }
1945
1946             // user defined functions
1947         }
1948         public class Xcls_Image52 : Object
1949         {
1950             public Gtk.Image el;
1951             private DialogFiles  _this;
1952
1953
1954                 // my vars (def)
1955
1956             // ctor
1957             public Xcls_Image52(DialogFiles _owner )
1958             {
1959                 _this = _owner;
1960                 this.el = new Gtk.Image();
1961
1962                 // my vars (dec)
1963
1964                 // set gobject values
1965                 this.el.icon_name = "emblem-system";
1966                 this.el.margin_end = 4;
1967             }
1968
1969             // user defined functions
1970         }
1971
1972         public class Xcls_Label53 : Object
1973         {
1974             public Gtk.Label el;
1975             private DialogFiles  _this;
1976
1977
1978                 // my vars (def)
1979
1980             // ctor
1981             public Xcls_Label53(DialogFiles _owner )
1982             {
1983                 _this = _owner;
1984                 this.el = new Gtk.Label( "Project Properties" );
1985
1986                 // my vars (dec)
1987
1988                 // set gobject values
1989             }
1990
1991             // user defined functions
1992         }
1993
1994
1995
1996         public class Xcls_btn_delproj : Object
1997         {
1998             public Gtk.Button el;
1999             private DialogFiles  _this;
2000
2001
2002                 // my vars (def)
2003             public DialogConfirm confirm;
2004
2005             // ctor
2006             public Xcls_btn_delproj(DialogFiles _owner )
2007             {
2008                 _this = _owner;
2009                 _this.btn_delproj = this;
2010                 this.el = new Gtk.Button();
2011
2012                 // my vars (dec)
2013                 this.confirm = null;
2014
2015                 // set gobject values
2016                 var child_1 = new Xcls_Box55( _this );
2017                 this.el.child = child_1.el;
2018
2019                 //listeners
2020                 this.el.clicked.connect( ( ) => {
2021                   
2022                   
2023                         if (this.confirm == null) {
2024                                 this.confirm = new DialogConfirm();
2025                                 this.confirm.el.set_transient_for(_this.el);
2026                         }
2027                         
2028                         var project  = (Project.Project) _this.projectsort.el.get_item(
2029                                 _this.projectselection.el.selected
2030                                 );
2031                         
2032                         this.confirm.el.response.connect((res) => {
2033                                 this.confirm.el.hide();
2034                                 if (res == Gtk.ResponseType.CANCEL) {
2035                                         return;
2036                                 }
2037                            project  = (Project.Project) _this.projectsort.el.get_item(
2038                                         _this.projectselection.el.selected
2039                                 );
2040                                 Project.Project.remove(project);
2041                           _this.projectmodel.remove(project);
2042                                 _this.projectselection.el.selected = Gtk.INVALID_LIST_POSITION;
2043                         
2044                         });
2045                         this.confirm.showIt("Confirm Delete Project", "Are you sure you want to delete this project?");
2046                 });
2047             }
2048
2049             // user defined functions
2050         }
2051         public class Xcls_Box55 : Object
2052         {
2053             public Gtk.Box el;
2054             private DialogFiles  _this;
2055
2056
2057                 // my vars (def)
2058
2059             // ctor
2060             public Xcls_Box55(DialogFiles _owner )
2061             {
2062                 _this = _owner;
2063                 this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
2064
2065                 // my vars (dec)
2066
2067                 // set gobject values
2068                 var child_1 = new Xcls_Image56( _this );
2069                 child_1.ref();
2070                 this.el.append( child_1.el );
2071                 var child_2 = new Xcls_Label57( _this );
2072                 child_2.ref();
2073                 this.el.append( child_2.el );
2074             }
2075
2076             // user defined functions
2077         }
2078         public class Xcls_Image56 : Object
2079         {
2080             public Gtk.Image el;
2081             private DialogFiles  _this;
2082
2083
2084                 // my vars (def)
2085
2086             // ctor
2087             public Xcls_Image56(DialogFiles _owner )
2088             {
2089                 _this = _owner;
2090                 this.el = new Gtk.Image();
2091
2092                 // my vars (dec)
2093
2094                 // set gobject values
2095                 this.el.icon_name = "user-trash";
2096             }
2097
2098             // user defined functions
2099         }
2100
2101         public class Xcls_Label57 : Object
2102         {
2103             public Gtk.Label el;
2104             private DialogFiles  _this;
2105
2106
2107                 // my vars (def)
2108
2109             // ctor
2110             public Xcls_Label57(DialogFiles _owner )
2111             {
2112                 _this = _owner;
2113                 this.el = new Gtk.Label( "Delete Project" );
2114
2115                 // my vars (dec)
2116
2117                 // set gobject values
2118             }
2119
2120             // user defined functions
2121         }
2122
2123
2124
2125         public class Xcls_btn_addfile : Object
2126         {
2127             public Gtk.Button el;
2128             private DialogFiles  _this;
2129
2130
2131                 // my vars (def)
2132
2133             // ctor
2134             public Xcls_btn_addfile(DialogFiles _owner )
2135             {
2136                 _this = _owner;
2137                 _this.btn_addfile = this;
2138                 this.el = new Gtk.Button();
2139
2140                 // my vars (dec)
2141
2142                 // set gobject values
2143                 var child_1 = new Xcls_Box59( _this );
2144                 this.el.child = child_1.el;
2145
2146                 //listeners
2147                 this.el.clicked.connect( () => {
2148                     // create a new file in project..
2149                     print("add file selected\n");
2150                     
2151                     if (_this.selectedProject == null) {
2152                         return;
2153                     }
2154                     try {
2155                         var f = JsRender.JsRender.factory(_this.selectedProject.xtype,  _this.selectedProject, "");
2156                         _this.win.windowstate.file_details.show( f, _this.el, _this.new_window );
2157                      } catch (JsRender.Error e) {}
2158                 
2159                 });
2160             }
2161
2162             // user defined functions
2163         }
2164         public class Xcls_Box59 : Object
2165         {
2166             public Gtk.Box el;
2167             private DialogFiles  _this;
2168
2169
2170                 // my vars (def)
2171
2172             // ctor
2173             public Xcls_Box59(DialogFiles _owner )
2174             {
2175                 _this = _owner;
2176                 this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
2177
2178                 // my vars (dec)
2179
2180                 // set gobject values
2181                 var child_1 = new Xcls_Image60( _this );
2182                 child_1.ref();
2183                 this.el.append( child_1.el );
2184                 var child_2 = new Xcls_Label61( _this );
2185                 child_2.ref();
2186                 this.el.append( child_2.el );
2187             }
2188
2189             // user defined functions
2190         }
2191         public class Xcls_Image60 : Object
2192         {
2193             public Gtk.Image el;
2194             private DialogFiles  _this;
2195
2196
2197                 // my vars (def)
2198
2199             // ctor
2200             public Xcls_Image60(DialogFiles _owner )
2201             {
2202                 _this = _owner;
2203                 this.el = new Gtk.Image();
2204
2205                 // my vars (dec)
2206
2207                 // set gobject values
2208                 this.el.icon_name = "document-new";
2209                 this.el.margin_end = 4;
2210             }
2211
2212             // user defined functions
2213         }
2214
2215         public class Xcls_Label61 : Object
2216         {
2217             public Gtk.Label el;
2218             private DialogFiles  _this;
2219
2220
2221                 // my vars (def)
2222
2223             // ctor
2224             public Xcls_Label61(DialogFiles _owner )
2225             {
2226                 _this = _owner;
2227                 this.el = new Gtk.Label( "New File" );
2228
2229                 // my vars (dec)
2230
2231                 // set gobject values
2232             }
2233
2234             // user defined functions
2235         }
2236
2237
2238
2239         public class Xcls_btn_delfile : Object
2240         {
2241             public Gtk.Button el;
2242             private DialogFiles  _this;
2243
2244
2245                 // my vars (def)
2246             public DialogConfirm confirm;
2247
2248             // ctor
2249             public Xcls_btn_delfile(DialogFiles _owner )
2250             {
2251                 _this = _owner;
2252                 _this.btn_delfile = this;
2253                 this.el = new Gtk.Button();
2254
2255                 // my vars (dec)
2256                 this.confirm = null;
2257
2258                 // set gobject values
2259                 var child_1 = new Xcls_Box63( _this );
2260                 this.el.child = child_1.el;
2261
2262                 //listeners
2263                 this.el.clicked.connect( ( ) => {
2264                   
2265                         if (this.confirm == null) {
2266                                 this.confirm = new DialogConfirm();
2267                                 this.confirm.el.set_transient_for(_this.el);
2268                  
2269                         }
2270                         GLib.debug("DELETE");
2271                         var is_icon = true;
2272                         var isel = _this.iconsel.selectedFile();
2273                          
2274                         if (isel == null) {
2275                                 GLib.debug("DELETE - no icons selected");
2276                                 is_icon = false;
2277                                 isel = _this.treeselmodel.selectedFile();
2278                         }
2279                         if (isel == null) {
2280                                         GLib.debug("DELETE - no tree item selected");
2281                                 return; // should nto happen..
2282                         }
2283                         
2284                         GLib.debug("DELETE - calling confirm.");
2285                         this.confirm.el.response.connect((res) => {
2286                                 this.confirm.el.hide();
2287                                 if (res == Gtk.ResponseType.CANCEL) {
2288                                         return;
2289                                 }
2290                                 is_icon = true;
2291                                 isel = _this.iconsel.selectedFile();
2292                                 if (isel == null) {
2293                                         is_icon = false;
2294                                         isel = _this.treeselmodel.selectedFile();
2295                                 }
2296                                 if (isel == null) {
2297                                         return; // should nto happen..
2298                                 }
2299                                 
2300                                 if (is_icon) {
2301                                         isel.project.deleteFile(isel);
2302                                         _this.gridmodel.remove(isel);
2303                                         return;
2304                                 }
2305                                 isel.project.deleteFile(isel);                  
2306                         
2307                         });
2308                                 this.confirm.showIt("Confirm Delete File",
2309                                         "Are you sure you want to delete this file?");
2310                         
2311                  
2312                 
2313                 });
2314             }
2315
2316             // user defined functions
2317         }
2318         public class Xcls_Box63 : Object
2319         {
2320             public Gtk.Box el;
2321             private DialogFiles  _this;
2322
2323
2324                 // my vars (def)
2325
2326             // ctor
2327             public Xcls_Box63(DialogFiles _owner )
2328             {
2329                 _this = _owner;
2330                 this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
2331
2332                 // my vars (dec)
2333
2334                 // set gobject values
2335                 var child_1 = new Xcls_Image64( _this );
2336                 child_1.ref();
2337                 this.el.append( child_1.el );
2338                 var child_2 = new Xcls_Label65( _this );
2339                 child_2.ref();
2340                 this.el.append( child_2.el );
2341             }
2342
2343             // user defined functions
2344         }
2345         public class Xcls_Image64 : Object
2346         {
2347             public Gtk.Image el;
2348             private DialogFiles  _this;
2349
2350
2351                 // my vars (def)
2352
2353             // ctor
2354             public Xcls_Image64(DialogFiles _owner )
2355             {
2356                 _this = _owner;
2357                 this.el = new Gtk.Image();
2358
2359                 // my vars (dec)
2360
2361                 // set gobject values
2362                 this.el.icon_name = "user-trash";
2363             }
2364
2365             // user defined functions
2366         }
2367
2368         public class Xcls_Label65 : Object
2369         {
2370             public Gtk.Label el;
2371             private DialogFiles  _this;
2372
2373
2374                 // my vars (def)
2375
2376             // ctor
2377             public Xcls_Label65(DialogFiles _owner )
2378             {
2379                 _this = _owner;
2380                 this.el = new Gtk.Label( "Delete File" );
2381
2382                 // my vars (dec)
2383
2384                 // set gobject values
2385             }
2386
2387             // user defined functions
2388         }
2389
2390
2391
2392
2393     }