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