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