hide the file navigation window when opening a new file
[roobuilder] / src / Builder4 / PopoverFiles.vala
1 static Xcls_PopoverFiles  _PopoverFiles;
2
3 public class Xcls_PopoverFiles : Object
4 {
5     public Gtk.Popover el;
6     private Xcls_PopoverFiles  _this;
7
8     public static Xcls_PopoverFiles singleton()
9     {
10         if (_PopoverFiles == null) {
11             _PopoverFiles= new Xcls_PopoverFiles();
12         }
13         return _PopoverFiles;
14     }
15     public Xcls_view view;
16     public Xcls_model model;
17     public Xcls_namecol namecol;
18     public Xcls_iconscroll iconscroll;
19     public Xcls_iconview iconview;
20     public Xcls_iconmodel iconmodel;
21     public Xcls_file_container file_container;
22     public Xcls_fileview fileview;
23     public Xcls_filemodel filemodel;
24     public Xcls_filenamecol filenamecol;
25
26         // my vars (def)
27     public Xcls_MainWindow win;
28     public Project.Project selectedProject;
29     public bool is_loading;
30     public bool new_window;
31     public Gdk.Pixbuf missing_thumb_pixbuf;
32     public bool active;
33     public bool is_loaded;
34
35     // ctor
36     public Xcls_PopoverFiles()
37     {
38         _this = this;
39         this.el = new Gtk.Popover( null );
40
41         // my vars (dec)
42         this.is_loading = false;
43         this.new_window = false;
44         this.active = false;
45         this.is_loaded = false;
46
47         // set gobject values
48         this.el.width_request = 900;
49         this.el.height_request = 800;
50         this.el.hexpand = false;
51         this.el.modal = true;
52         this.el.position = Gtk.PositionType.TOP;
53         var child_0 = new Xcls_Box2( _this );
54         child_0.ref();
55         this.el.add (  child_0.el  );
56
57         //listeners
58         this.el.hide.connect( ( ) => {
59                 // save...
60                 //this.load();
61                 //if (project != null) {
62         //              this.selectProject(project);
63         //      }
64                 if (_this.win.windowstate.project == null) {
65                         this.el.show();
66                 }
67         });
68     }
69
70     // user defined functions
71     public void onProjectSelected (Project.Project project) {
72         this.selectedProject = project;
73         project.scanDirs();
74         //this.clutterfiles.loadProject(proj);
75         
76         
77          
78     
79         
80         
81         //this.project_title_name.el.text = pr.name;
82         //this.project_title_path.el.text = pr.firstPath();
83         
84         // file items contains a reference until we reload ...
85          Gdk.Pixbuf pixbuf = null;
86         Gdk.Pixbuf bigpixbuf = null;
87          Gtk.TreeIter iter;
88          var m = this.iconmodel.el;
89          m.clear();
90      
91         var fiter = project.sortedFiles().list_iterator();
92         while (fiter.next()) {
93             m.append(out iter);
94             var file = fiter.get();
95             m.set(iter,   0,file ); // zero contains the file reference
96             m.set(iter,   1,file.nickType() + "\n" + file.nickName()); // marked up title?
97             m.set(iter,   2,file.nickType() ); // file type?
98             
99             
100             var fname = file.getIconFileName(false);
101             try {
102                     if (FileUtils.test(fname, FileTest.EXISTS)) {
103                         var npixbuf = new Gdk.Pixbuf.from_file(fname);
104                         pixbuf = npixbuf.scale_simple(92, (int) (npixbuf.height * 92.0 /npixbuf.width * 1.0 )
105                                     , Gdk.InterpType.NEAREST) ;
106                                 bigpixbuf = npixbuf.scale_simple(368, (int) (npixbuf.height * 368.0 /npixbuf.width * 1.0 )
107                                     , Gdk.InterpType.NEAREST) ;
108                                 
109                     } 
110                 } catch (Error e) {
111                     // noop
112                 
113                 }
114             if (pixbuf == null) {
115             
116                     try {
117                         if (_this.missing_thumb_pixbuf == null) {
118                             var icon_theme = Gtk.IconTheme.get_default ();
119                             _this.missing_thumb_pixbuf = icon_theme.load_icon ("package-x-generic", 92, 0);
120                             _this.missing_thumb_pixbuf.ref();
121                         }
122                         pixbuf = _this.missing_thumb_pixbuf;
123                         bigpixbuf = _this.missing_thumb_pixbuf;
124     
125                     } catch (Error e) {
126                         // noop?
127                     }
128                 }
129                 
130                 
131                 
132             m.set(iter,   3,pixbuf);
133             m.set(iter,   4,bigpixbuf);
134           
135             // this needs to add to the iconview?
136             
137             //var a = new Xcls_fileitem(this,fiter.get());
138             //this.fileitems.add(a);
139     
140             //this.filelayout.el.add_child(a.el);
141         }
142         
143         
144          this.filemodel.el.clear();
145         
146         // folders...
147         
148         if (!(project is Project.Gtk)) {
149             print ("not gtk... skipping files");
150             this.file_container.el.hide();
151             return;
152         }
153         this.file_container.el.show();
154         var gpr = (Project.Gtk)project;
155          var def = gpr.compilegroups.get("_default_");
156          // not sure why the above is returng null!??
157          if (def == null) {
158                 def = new Project.GtkValaSettings("_default_"); 
159                 gpr.compilegroups.set("_default_", def);
160          }
161          var items  = def.sources;
162                  
163          Gtk.TreeIter citer;  // folder iter
164           Gtk.TreeIter fxiter;  // file iter
165         for(var i =0 ; i < items.size; i++) {
166              print ("cheking folder %s\n", items.get(i));
167              var files = gpr.filesForOpen(items.get(i));
168              if (files.size < 1) {
169                 continue;
170              }
171                  this.filemodel.el.append(out citer,null);
172                  this.filemodel.el.set(citer, 0, GLib.Path.get_basename(items.get(i)));
173                  this.filemodel.el.set(citer, 1, null); // parent (empty as it's a folder)
174                 
175                 
176             // add the directory... items.get(i);
177             //var x = new Xcls_folderitem(this,items.get(i));
178             //this.fileitems.add(x);
179             //this.filelayout.el.add_child(x.el);
180             
181             
182             for(var j =0 ; j < files.size; j++) {
183             
184                     this.filemodel.el.insert(out fxiter,citer, -1);
185                 this.filemodel.el.set(fxiter, 0,  GLib.Path.get_basename(files.get(j))); // filename
186                         this.filemodel.el.set(fxiter, 1, files.get(j)); // Folder?
187                  
188                 
189             }
190             
191             
192             //this.el.set_value(citer, 1,   items.get(i) );
193         }
194         _this.fileview.el.expand_all();
195         
196         
197     }
198     public void selectProject (Project.Project project) {
199         
200         var sel = _this.view.el.get_selection();
201         
202         sel.unselect_all();
203         
204         var found = false;
205         _this.model.el.foreach((mod, path, iter) => {
206             GLib.Value val;
207         
208             mod.get_value(iter, 1, out val);
209             if ( ( (Project.Project)val.get_object()).fn != project.fn) {
210                 print("SKIP %s != %s\n", ((Project.Project)val.get_object()).name , project.name);
211                 return false;//continue
212             }
213             sel.select_iter(iter);
214                 this.selectedProject = project;
215             this.onProjectSelected(project);
216             found = true;
217             return true;
218             
219         
220         });
221          if (!found) {
222             print("tried to select %s, could not find it", project.name);
223         }
224     }
225     public void show (Gtk.Widget on_el, Project.Project? project, bool new_window) {
226         //this.editor.show( file, node, ptype, key);
227         
228         this.new_window = new_window;
229                 // save...
230         this.load();
231         if (project != null) {
232                 this.selectProject(project);
233         }
234         
235         
236         int w,h;
237         this.win.el.get_size(out w, out h);
238         
239         // left tree = 250, editor area = 500?
240         
241         // min 450?
242         // max hieght ...
243         
244         var  ww =  on_el.get_allocated_width();
245         
246         // width = should be max = w-ww , or 600 at best..?
247          
248         this.el.set_size_request( w, h); // same as parent...
249     
250     
251         this.el.set_modal(true);
252         this.el.set_relative_to(on_el);
253     
254         //this.el.set_position(Gtk.PositionType.BOTTOM);
255     
256         // window + header?
257      
258         this.el.show_all();
259         //while(Gtk.events_pending()) { 
260         //        Gtk.main_iteration();   // why?
261         //}  
262     
263     }
264     public void load () {
265          // clear list...
266         
267          if (_this.is_loaded) {
268              return;
269          }
270          _this.is_loading = true;
271             
272          _this.is_loaded = true;
273          
274          Project.Project.loadAll();
275          var projects = Project.Project.allProjectsByName();
276          
277          Gtk.TreeIter iter;
278          var m = this.model.el;
279          m.clear();
280               
281          for (var i = 0; i < projects.size; i++) {
282             m.append(out iter);
283             m.set(iter,   0,projects.get(i).name );
284             
285             var o =  GLib.Value(typeof(Object));
286             o.set_object((Object)projects.get(i));
287                        
288             m.set_value(iter, 1, o);
289          
290          }
291          m.set_sort_column_id(0, Gtk.SortType.ASCENDING);
292          _this.is_loading = false;      
293     }
294     public void setMainWindow (Xcls_MainWindow win) {
295         this.win = win;
296          
297     }
298     public class Xcls_Box2 : Object
299     {
300         public Gtk.Box el;
301         private Xcls_PopoverFiles  _this;
302
303
304             // my vars (def)
305
306         // ctor
307         public Xcls_Box2(Xcls_PopoverFiles _owner )
308         {
309             _this = _owner;
310             this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
311
312             // my vars (dec)
313
314             // set gobject values
315             var child_0 = new Xcls_Box3( _this );
316             child_0.ref();
317             this.el.add (  child_0.el  );
318             var child_1 = new Xcls_Box9( _this );
319             child_1.ref();
320             this.el.add (  child_1.el  );
321         }
322
323         // user defined functions
324     }
325     public class Xcls_Box3 : Object
326     {
327         public Gtk.Box el;
328         private Xcls_PopoverFiles  _this;
329
330
331             // my vars (def)
332
333         // ctor
334         public Xcls_Box3(Xcls_PopoverFiles _owner )
335         {
336             _this = _owner;
337             this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
338
339             // my vars (dec)
340
341             // set gobject values
342             var child_0 = new Xcls_Toolbar4( _this );
343             child_0.ref();
344             this.el.add (  child_0.el  );
345         }
346
347         // user defined functions
348     }
349     public class Xcls_Toolbar4 : Object
350     {
351         public Gtk.Toolbar el;
352         private Xcls_PopoverFiles  _this;
353
354
355             // my vars (def)
356
357         // ctor
358         public Xcls_Toolbar4(Xcls_PopoverFiles _owner )
359         {
360             _this = _owner;
361             this.el = new Gtk.Toolbar();
362
363             // my vars (dec)
364
365             // set gobject values
366             this.el.toolbar_style = Gtk.ToolbarStyle.BOTH;
367             var child_0 = new Xcls_ToolButton5( _this );
368             child_0.ref();
369             this.el.add (  child_0.el  );
370             var child_1 = new Xcls_ToolButton6( _this );
371             child_1.ref();
372             this.el.add (  child_1.el  );
373             var child_2 = new Xcls_ToolButton7( _this );
374             child_2.ref();
375             this.el.add (  child_2.el  );
376             var child_3 = new Xcls_ToolButton8( _this );
377             child_3.ref();
378             this.el.add (  child_3.el  );
379         }
380
381         // user defined functions
382     }
383     public class Xcls_ToolButton5 : Object
384     {
385         public Gtk.ToolButton el;
386         private Xcls_PopoverFiles  _this;
387
388
389             // my vars (def)
390
391         // ctor
392         public Xcls_ToolButton5(Xcls_PopoverFiles _owner )
393         {
394             _this = _owner;
395             this.el = new Gtk.ToolButton( null, "New Project" );
396
397             // my vars (dec)
398
399             // set gobject values
400             this.el.icon_name = "folder-new";
401
402             //listeners
403             this.el.clicked.connect( ( ) => {
404               
405                 // create a new file in project..
406                 //Xcls_DialogNewComponent.singleton().show(
407                var  pe =      EditProject.singleton();
408                 //pe.el.set_transient_for(_this.el);
409                 pe.el.set_modal(true);   
410                
411                 var p  = pe.show();
412             
413                 if (p == null) {
414                     return;
415                 }
416                 
417                 /*
418                 _this.win.windowstate.left_projects.is_loaded = false;    
419                 _this.win.windowstate.left_projects.load();
420                 _this.win.windowstate.left_projects.selectProject(p);
421                 */
422                 return  ;    
423             
424             });
425         }
426
427         // user defined functions
428     }
429
430     public class Xcls_ToolButton6 : Object
431     {
432         public Gtk.ToolButton el;
433         private Xcls_PopoverFiles  _this;
434
435
436             // my vars (def)
437
438         // ctor
439         public Xcls_ToolButton6(Xcls_PopoverFiles _owner )
440         {
441             _this = _owner;
442             this.el = new Gtk.ToolButton( null, "Project Properties" );
443
444             // my vars (dec)
445
446             // set gobject values
447             this.el.icon_name = "emblem-system";
448
449             //listeners
450             this.el.clicked.connect( ( ) => {
451               // should disable the button really.
452                if (_this.selectedProject == null) {
453                    return;
454                }
455                 _this.win.windowstate.projectPopoverShow(this.el, _this.selectedProject);
456              });
457         }
458
459         // user defined functions
460     }
461
462     public class Xcls_ToolButton7 : Object
463     {
464         public Gtk.ToolButton el;
465         private Xcls_PopoverFiles  _this;
466
467
468             // my vars (def)
469
470         // ctor
471         public Xcls_ToolButton7(Xcls_PopoverFiles _owner )
472         {
473             _this = _owner;
474             this.el = new Gtk.ToolButton( null, "Delete Project" );
475
476             // my vars (dec)
477
478             // set gobject values
479             this.el.icon_name = "user-trash";
480
481             //listeners
482             this.el.clicked.connect( ( ) => {
483               /*
484                var cd = DialogConfirm.singleton();
485                  cd.el.set_transient_for(_this.el);
486                 cd.el.set_modal(true);
487             
488                  var project =   _this.windowstate.left_projects.getSelectedProject();
489                 if (project == null) {
490                     print("SKIP - no project\n");
491                     return;
492                 }
493                 
494                     
495                  if (Gtk.ResponseType.YES != cd.show("Confirm", 
496                     "Are you sure you want to delete project %s".printf(project.name))) {
497                     return;
498                 }
499                  
500             
501                 // confirm?
502                 Project.Project.remove(project);
503                 _this.project = null;
504                 
505                 _this.windowstate.left_projects.is_loaded =  false;
506                 _this.windowstate.left_projects.load();
507                 _this.windowstate.clutterfiles.clearFiles();
508             */
509             
510             });
511         }
512
513         // user defined functions
514     }
515
516     public class Xcls_ToolButton8 : Object
517     {
518         public Gtk.ToolButton el;
519         private Xcls_PopoverFiles  _this;
520
521
522             // my vars (def)
523
524         // ctor
525         public Xcls_ToolButton8(Xcls_PopoverFiles _owner )
526         {
527             _this = _owner;
528             this.el = new Gtk.ToolButton( null, "New File" );
529
530             // my vars (dec)
531
532             // set gobject values
533             this.el.icon_name = "document-new";
534
535             //listeners
536             this.el.clicked.connect( () => {
537                 // create a new file in project..
538                 print("add file selected\n");
539                 
540                 if (_this.selectedProject == null) {
541                         return;
542                 }
543                 
544                 var f = JsRender.JsRender.factory(_this.selectedProject.xtype,  _this.selectedProject, "");
545                  _this.win.windowstate.file_details.show( f, this.el, _this.new_window );
546                  
547             
548             });
549         }
550
551         // user defined functions
552     }
553
554
555
556     public class Xcls_Box9 : Object
557     {
558         public Gtk.Box el;
559         private Xcls_PopoverFiles  _this;
560
561
562             // my vars (def)
563
564         // ctor
565         public Xcls_Box9(Xcls_PopoverFiles _owner )
566         {
567             _this = _owner;
568             this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
569
570             // my vars (dec)
571
572             // set gobject values
573             this.el.homogeneous = false;
574             var child_0 = new Xcls_ScrolledWindow10( _this );
575             child_0.ref();
576             this.el.add (  child_0.el  );
577             var child_1 = new Xcls_iconscroll( _this );
578             child_1.ref();
579             this.el.add (  child_1.el  );
580             var child_2 = new Xcls_file_container( _this );
581             child_2.ref();
582             this.el.add (  child_2.el  );
583         }
584
585         // user defined functions
586     }
587     public class Xcls_ScrolledWindow10 : Object
588     {
589         public Gtk.ScrolledWindow el;
590         private Xcls_PopoverFiles  _this;
591
592
593             // my vars (def)
594
595         // ctor
596         public Xcls_ScrolledWindow10(Xcls_PopoverFiles _owner )
597         {
598             _this = _owner;
599             this.el = new Gtk.ScrolledWindow( null, null );
600
601             // my vars (dec)
602
603             // set gobject values
604             this.el.width_request = 150;
605             this.el.expand = true;
606             this.el.shadow_type = Gtk.ShadowType.IN;
607             var child_0 = new Xcls_view( _this );
608             child_0.ref();
609             this.el.add (  child_0.el  );
610
611             // init method
612
613             this.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);
614         }
615
616         // user defined functions
617     }
618     public class Xcls_view : Object
619     {
620         public Gtk.TreeView el;
621         private Xcls_PopoverFiles  _this;
622
623
624             // my vars (def)
625
626         // ctor
627         public Xcls_view(Xcls_PopoverFiles _owner )
628         {
629             _this = _owner;
630             _this.view = this;
631             this.el = new Gtk.TreeView();
632
633             // my vars (dec)
634
635             // set gobject values
636             this.el.enable_tree_lines = true;
637             this.el.headers_visible = true;
638             var child_0 = new Xcls_model( _this );
639             child_0.ref();
640             this.el.set_model (  child_0.el  );
641             var child_1 = new Xcls_TreeViewColumn13( _this );
642             child_1.ref();
643             this.el.append_column (  child_1.el  );
644
645             // init method
646
647             var description = new Pango.FontDescription();
648                  description.set_size(9000);
649                 this.el.override_font(description);     
650                                 
651                 var selection = this.el.get_selection();
652                 selection.set_mode( Gtk.SelectionMode.SINGLE);
653
654             //listeners
655             this.el.cursor_changed.connect( () => {
656                 if (_this.is_loading) {
657                     return;
658                 }
659                 
660                 Gtk.TreeIter iter;
661                 Gtk.TreeModel mod;
662                         
663                 var s = this.el.get_selection();
664                 if (!s.get_selected(out mod, out iter)) {
665                     return;
666                 }
667                 
668                 GLib.Value gval;
669             
670                 mod.get_value(iter, 1 , out gval);
671                 var project = (Project.Project)gval.get_object();
672                 
673                 _this.onProjectSelected(project);
674                 
675             });
676         }
677
678         // user defined functions
679     }
680     public class Xcls_model : Object
681     {
682         public Gtk.ListStore el;
683         private Xcls_PopoverFiles  _this;
684
685
686             // my vars (def)
687
688         // ctor
689         public Xcls_model(Xcls_PopoverFiles _owner )
690         {
691             _this = _owner;
692             _this.model = this;
693             this.el = new Gtk.ListStore.newv(  { typeof(string), typeof(Object) }  );
694
695             // my vars (dec)
696
697             // set gobject values
698
699             // init method
700
701             {
702                this.el.set_sort_func(0, (mod,a,b) => {
703                    GLib.Value ga, gb;
704                    mod.get_value(a,0, out ga);
705                    mod.get_value(b,0, out gb);
706                     
707                     if ((string)ga == (string)gb) {
708                         return 0;
709                     }
710                     return (string)ga > (string)gb ? 1 : -1;
711                }); 
712             
713             
714             }
715         }
716
717         // user defined functions
718     }
719
720     public class Xcls_TreeViewColumn13 : Object
721     {
722         public Gtk.TreeViewColumn el;
723         private Xcls_PopoverFiles  _this;
724
725
726             // my vars (def)
727
728         // ctor
729         public Xcls_TreeViewColumn13(Xcls_PopoverFiles _owner )
730         {
731             _this = _owner;
732             this.el = new Gtk.TreeViewColumn();
733
734             // my vars (dec)
735
736             // set gobject values
737             this.el.title = "Projects";
738             var child_0 = new Xcls_namecol( _this );
739             child_0.ref();
740             this.el.pack_start (  child_0.el , true );
741
742             // init method
743
744             this.el.add_attribute(_this.namecol.el , "markup", 0  );
745         }
746
747         // user defined functions
748     }
749     public class Xcls_namecol : Object
750     {
751         public Gtk.CellRendererText el;
752         private Xcls_PopoverFiles  _this;
753
754
755             // my vars (def)
756
757         // ctor
758         public Xcls_namecol(Xcls_PopoverFiles _owner )
759         {
760             _this = _owner;
761             _this.namecol = this;
762             this.el = new Gtk.CellRendererText();
763
764             // my vars (dec)
765
766             // set gobject values
767         }
768
769         // user defined functions
770     }
771
772
773
774
775     public class Xcls_iconscroll : Object
776     {
777         public Gtk.ScrolledWindow el;
778         private Xcls_PopoverFiles  _this;
779
780
781             // my vars (def)
782
783         // ctor
784         public Xcls_iconscroll(Xcls_PopoverFiles _owner )
785         {
786             _this = _owner;
787             _this.iconscroll = this;
788             this.el = new Gtk.ScrolledWindow( null, null );
789
790             // my vars (dec)
791
792             // set gobject values
793             this.el.width_request = 600;
794             this.el.expand = true;
795             this.el.shadow_type = Gtk.ShadowType.IN;
796             var child_0 = new Xcls_iconview( _this );
797             child_0.ref();
798             this.el.add (  child_0.el  );
799
800             // init method
801
802             this.el.set_policy (Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC);
803         }
804
805         // user defined functions
806     }
807     public class Xcls_iconview : Object
808     {
809         public Gtk.IconView el;
810         private Xcls_PopoverFiles  _this;
811
812
813             // my vars (def)
814
815         // ctor
816         public Xcls_iconview(Xcls_PopoverFiles _owner )
817         {
818             _this = _owner;
819             _this.iconview = this;
820             this.el = new Gtk.IconView();
821
822             // my vars (dec)
823
824             // set gobject values
825             this.el.markup_column = 1;
826             this.el.pixbuf_column = 3;
827             this.el.has_tooltip = true;
828             this.el.item_width = 100;
829             var child_0 = new Xcls_iconmodel( _this );
830             child_0.ref();
831             this.el.model = child_0.el;
832
833             // init method
834
835             {
836             
837             }
838
839             //listeners
840             this.el.item_activated.connect( (path) => {
841                 
842                 _this.win.windowstate.project = _this.selectedProject;
843                 _this.el.hide();
844                 
845                 
846                 Gtk.TreeIter iter;
847                
848                         
849                 this.el.model.get_iter(out iter, path);
850                 
851                 GLib.Value gval;
852             
853                 this.el.model.get_value(iter, 0 , out gval);
854                 var file = (JsRender.JsRender)gval;
855                 
856                 
857                 _this.win.windowstate.fileViewOpen(file, _this.new_window);
858             
859                 
860                 
861             });
862             this.el.query_tooltip.connect( (x, y, keyboard_tooltip, tooltip) => {
863             
864                 Gtk.TreePath path;
865                 Gtk.CellRenderer cell;
866                 var s = _this.iconview.el.get_item_at_pos(x,y + (int) _this.iconscroll.el.vadjustment.value, out path, out cell);
867                 
868                 
869                // GLib.debug("Tooltip? %d,%d scroll: %d",x,y, (int)_this.iconscroll.el.vadjustment.value);
870                  
871                 
872                 if (path == null) {
873                         // GLib.debug("Tooltip? - no path");
874                         return false;
875                 }
876                 
877                 Gtk.TreeIter iter;
878                 _this.iconmodel.el.get_iter(out iter, path);
879                 GLib.Value val;
880                 _this.iconmodel.el.get_value(iter, 4, out val);
881                 
882                 tooltip.set_icon((Gdk.Pixbuf) val.get_object());
883                  _this.iconview.el.set_tooltip_item(tooltip, path);
884                 return true;
885             });
886         }
887
888         // user defined functions
889     }
890     public class Xcls_iconmodel : Object
891     {
892         public Gtk.ListStore el;
893         private Xcls_PopoverFiles  _this;
894
895
896             // my vars (def)
897
898         // ctor
899         public Xcls_iconmodel(Xcls_PopoverFiles _owner )
900         {
901             _this = _owner;
902             _this.iconmodel = this;
903             this.el = new Gtk.ListStore.newv(  { typeof(Object), typeof(string), typeof(string), typeof(Gdk.Pixbuf), typeof(Gdk.Pixbuf)  }  );
904
905             // my vars (dec)
906
907             // set gobject values
908         }
909
910         // user defined functions
911     }
912
913
914
915     public class Xcls_file_container : Object
916     {
917         public Gtk.ScrolledWindow el;
918         private Xcls_PopoverFiles  _this;
919
920
921             // my vars (def)
922
923         // ctor
924         public Xcls_file_container(Xcls_PopoverFiles _owner )
925         {
926             _this = _owner;
927             _this.file_container = this;
928             this.el = new Gtk.ScrolledWindow( null, null );
929
930             // my vars (dec)
931
932             // set gobject values
933             this.el.width_request = 100;
934             this.el.expand = true;
935             this.el.shadow_type = Gtk.ShadowType.IN;
936             this.el.visible = false;
937             var child_0 = new Xcls_fileview( _this );
938             child_0.ref();
939             this.el.add (  child_0.el  );
940
941             // init method
942
943             this.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);
944         }
945
946         // user defined functions
947     }
948     public class Xcls_fileview : Object
949     {
950         public Gtk.TreeView el;
951         private Xcls_PopoverFiles  _this;
952
953
954             // my vars (def)
955
956         // ctor
957         public Xcls_fileview(Xcls_PopoverFiles _owner )
958         {
959             _this = _owner;
960             _this.fileview = this;
961             this.el = new Gtk.TreeView();
962
963             // my vars (dec)
964
965             // set gobject values
966             this.el.activate_on_single_click = false;
967             this.el.expand = true;
968             this.el.enable_tree_lines = true;
969             this.el.headers_visible = true;
970             var child_0 = new Xcls_filemodel( _this );
971             child_0.ref();
972             this.el.set_model (  child_0.el  );
973             var child_1 = new Xcls_TreeViewColumn21( _this );
974             child_1.ref();
975             this.el.append_column (  child_1.el  );
976
977             // init method
978
979             var description = new Pango.FontDescription();
980                  description.set_size(9000);
981                 this.el.override_font(description);     
982                                 
983                 var selection = this.el.get_selection();
984                 selection.set_mode( Gtk.SelectionMode.SINGLE);
985
986             //listeners
987             this.el.row_activated.connect( (path, col) => {
988             
989                 Gtk.TreeIter iter;
990                
991                         
992                 this.el.model.get_iter(out iter, path);
993                 
994                 GLib.Value gval;
995             
996                 this.el.model.get_value(iter, 1 , out gval);
997                var fn = (string)gval;
998                 if (fn.length < 1) {
999                         return;
1000                 }
1001                 _this.win.windowstate.project = _this.selectedProject;
1002                  _this.el.hide();
1003                 
1004                 var f = JsRender.JsRender.factory("PlainFile", _this.selectedProject, fn);
1005                
1006                
1007                 _this.win.windowstate.fileViewOpen(f, _this.new_window);
1008                
1009                 
1010             });
1011             this.el.cursor_changed.connect( () => {
1012              /*
1013                 if (_this.is_loading) {
1014                     return;
1015                 }
1016                 
1017                 Gtk.TreeIter iter;
1018                 Gtk.TreeModel mod;
1019                         
1020                 var s = this.el.get_selection();
1021                 if (!s.get_selected(out mod, out iter)) {
1022                     return;
1023                 }
1024                 
1025                 GLib.Value gval;
1026             
1027                 mod.get_value(iter, 1 , out gval);
1028                 var project = (Project.Project)gval.get_object();
1029                 
1030                 _this.project_selected(project);
1031                 */
1032             });
1033         }
1034
1035         // user defined functions
1036     }
1037     public class Xcls_filemodel : Object
1038     {
1039         public Gtk.TreeStore el;
1040         private Xcls_PopoverFiles  _this;
1041
1042
1043             // my vars (def)
1044
1045         // ctor
1046         public Xcls_filemodel(Xcls_PopoverFiles _owner )
1047         {
1048             _this = _owner;
1049             _this.filemodel = this;
1050             this.el = new Gtk.TreeStore.newv(  { typeof(string), typeof(string) }  );
1051
1052             // my vars (dec)
1053
1054             // set gobject values
1055
1056             // init method
1057
1058             {
1059                this.el.set_sort_func(0, (mod,a,b) => {
1060                    GLib.Value ga, gb;
1061                    mod.get_value(a,0, out ga);
1062                    mod.get_value(b,0, out gb);
1063                     
1064                     if ((string)ga == (string)gb) {
1065                         return 0;
1066                     }
1067                     return (string)ga > (string)gb ? 1 : -1;
1068                }); 
1069              
1070             
1071             }
1072         }
1073
1074         // user defined functions
1075     }
1076
1077     public class Xcls_TreeViewColumn21 : Object
1078     {
1079         public Gtk.TreeViewColumn el;
1080         private Xcls_PopoverFiles  _this;
1081
1082
1083             // my vars (def)
1084
1085         // ctor
1086         public Xcls_TreeViewColumn21(Xcls_PopoverFiles _owner )
1087         {
1088             _this = _owner;
1089             this.el = new Gtk.TreeViewColumn();
1090
1091             // my vars (dec)
1092
1093             // set gobject values
1094             this.el.title = "File";
1095             var child_0 = new Xcls_filenamecol( _this );
1096             child_0.ref();
1097             this.el.pack_start (  child_0.el , true );
1098
1099             // init method
1100
1101             this.el.add_attribute(_this.filenamecol.el , "markup", 0  );
1102         }
1103
1104         // user defined functions
1105     }
1106     public class Xcls_filenamecol : Object
1107     {
1108         public Gtk.CellRendererText el;
1109         private Xcls_PopoverFiles  _this;
1110
1111
1112             // my vars (def)
1113
1114         // ctor
1115         public Xcls_filenamecol(Xcls_PopoverFiles _owner )
1116         {
1117             _this = _owner;
1118             _this.filenamecol = this;
1119             this.el = new Gtk.CellRendererText();
1120
1121             // my vars (dec)
1122
1123             // set gobject values
1124         }
1125
1126         // user defined functions
1127     }
1128
1129
1130
1131
1132
1133
1134 }