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