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