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