Merge branch 'master' of http://git.roojs.com/roobuilder
[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         // user defined functions
551     }
552
553
554
555     public class Xcls_Box9 : Object
556     {
557         public Gtk.Box el;
558         private Xcls_PopoverFiles  _this;
559
560
561             // my vars (def)
562
563         // ctor
564         public Xcls_Box9(Xcls_PopoverFiles _owner )
565         {
566             _this = _owner;
567             this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
568
569             // my vars (dec)
570
571             // set gobject values
572             this.el.homogeneous = false;
573             var child_0 = new Xcls_ScrolledWindow10( _this );
574             child_0.ref();
575             this.el.add (  child_0.el  );
576             var child_1 = new Xcls_iconscroll( _this );
577             child_1.ref();
578             this.el.add (  child_1.el  );
579             var child_2 = new Xcls_file_container( _this );
580             child_2.ref();
581             this.el.add (  child_2.el  );
582         }
583
584         // user defined functions
585     }
586     public class Xcls_ScrolledWindow10 : Object
587     {
588         public Gtk.ScrolledWindow el;
589         private Xcls_PopoverFiles  _this;
590
591
592             // my vars (def)
593
594         // ctor
595         public Xcls_ScrolledWindow10(Xcls_PopoverFiles _owner )
596         {
597             _this = _owner;
598             this.el = new Gtk.ScrolledWindow( null, null );
599
600             // my vars (dec)
601
602             // set gobject values
603             this.el.width_request = 150;
604             this.el.expand = true;
605             this.el.shadow_type = Gtk.ShadowType.IN;
606             var child_0 = new Xcls_view( _this );
607             child_0.ref();
608             this.el.add (  child_0.el  );
609
610             // init method
611
612             this.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);
613         }
614
615         // user defined functions
616     }
617     public class Xcls_view : Object
618     {
619         public Gtk.TreeView el;
620         private Xcls_PopoverFiles  _this;
621
622
623             // my vars (def)
624
625         // ctor
626         public Xcls_view(Xcls_PopoverFiles _owner )
627         {
628             _this = _owner;
629             _this.view = this;
630             this.el = new Gtk.TreeView();
631
632             // my vars (dec)
633
634             // set gobject values
635             this.el.enable_tree_lines = true;
636             this.el.headers_visible = true;
637             var child_0 = new Xcls_model( _this );
638             child_0.ref();
639             this.el.set_model (  child_0.el  );
640             var child_1 = new Xcls_TreeViewColumn13( _this );
641             child_1.ref();
642             this.el.append_column (  child_1.el  );
643
644             // init method
645
646             var description = new Pango.FontDescription();
647                  description.set_size(9000);
648                 this.el.override_font(description);     
649                                 
650                 var selection = this.el.get_selection();
651                 selection.set_mode( Gtk.SelectionMode.SINGLE);
652
653             //listeners
654             this.el.cursor_changed.connect( () => {
655                 if (_this.is_loading) {
656                     return;
657                 }
658                 
659                 Gtk.TreeIter iter;
660                 Gtk.TreeModel mod;
661                         
662                 var s = this.el.get_selection();
663                 if (!s.get_selected(out mod, out iter)) {
664                     return;
665                 }
666                 
667                 GLib.Value gval;
668             
669                 mod.get_value(iter, 1 , out gval);
670                 var project = (Project.Project)gval.get_object();
671                 
672                 _this.onProjectSelected(project);
673                 
674             });
675         }
676
677         // user defined functions
678     }
679     public class Xcls_model : Object
680     {
681         public Gtk.ListStore el;
682         private Xcls_PopoverFiles  _this;
683
684
685             // my vars (def)
686
687         // ctor
688         public Xcls_model(Xcls_PopoverFiles _owner )
689         {
690             _this = _owner;
691             _this.model = this;
692             this.el = new Gtk.ListStore.newv(  { typeof(string), typeof(Object) }  );
693
694             // my vars (dec)
695
696             // set gobject values
697
698             // init method
699
700             {
701                this.el.set_sort_func(0, (mod,a,b) => {
702                    GLib.Value ga, gb;
703                    mod.get_value(a,0, out ga);
704                    mod.get_value(b,0, out gb);
705                     
706                     if ((string)ga == (string)gb) {
707                         return 0;
708                     }
709                     return (string)ga > (string)gb ? 1 : -1;
710                }); 
711             
712             
713             }
714         }
715
716         // user defined functions
717     }
718
719     public class Xcls_TreeViewColumn13 : Object
720     {
721         public Gtk.TreeViewColumn el;
722         private Xcls_PopoverFiles  _this;
723
724
725             // my vars (def)
726
727         // ctor
728         public Xcls_TreeViewColumn13(Xcls_PopoverFiles _owner )
729         {
730             _this = _owner;
731             this.el = new Gtk.TreeViewColumn();
732
733             // my vars (dec)
734
735             // set gobject values
736             this.el.title = "Projects";
737             var child_0 = new Xcls_namecol( _this );
738             child_0.ref();
739             this.el.pack_start (  child_0.el , true );
740
741             // init method
742
743             this.el.add_attribute(_this.namecol.el , "markup", 0  );
744         }
745
746         // user defined functions
747     }
748     public class Xcls_namecol : Object
749     {
750         public Gtk.CellRendererText el;
751         private Xcls_PopoverFiles  _this;
752
753
754             // my vars (def)
755
756         // ctor
757         public Xcls_namecol(Xcls_PopoverFiles _owner )
758         {
759             _this = _owner;
760             _this.namecol = this;
761             this.el = new Gtk.CellRendererText();
762
763             // my vars (dec)
764
765             // set gobject values
766         }
767
768         // user defined functions
769     }
770
771
772
773
774     public class Xcls_iconscroll : Object
775     {
776         public Gtk.ScrolledWindow el;
777         private Xcls_PopoverFiles  _this;
778
779
780             // my vars (def)
781
782         // ctor
783         public Xcls_iconscroll(Xcls_PopoverFiles _owner )
784         {
785             _this = _owner;
786             _this.iconscroll = this;
787             this.el = new Gtk.ScrolledWindow( null, null );
788
789             // my vars (dec)
790
791             // set gobject values
792             this.el.width_request = 600;
793             this.el.expand = true;
794             this.el.shadow_type = Gtk.ShadowType.IN;
795             var child_0 = new Xcls_iconview( _this );
796             child_0.ref();
797             this.el.add (  child_0.el  );
798
799             // init method
800
801             this.el.set_policy (Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC);
802         }
803
804         // user defined functions
805     }
806     public class Xcls_iconview : Object
807     {
808         public Gtk.IconView el;
809         private Xcls_PopoverFiles  _this;
810
811
812             // my vars (def)
813
814         // ctor
815         public Xcls_iconview(Xcls_PopoverFiles _owner )
816         {
817             _this = _owner;
818             _this.iconview = this;
819             this.el = new Gtk.IconView();
820
821             // my vars (dec)
822
823             // set gobject values
824             this.el.markup_column = 1;
825             this.el.pixbuf_column = 3;
826             this.el.has_tooltip = true;
827             this.el.item_width = 100;
828             var child_0 = new Xcls_iconmodel( _this );
829             child_0.ref();
830             this.el.model = child_0.el;
831
832             // init method
833
834             {
835             
836             }
837
838             //listeners
839             this.el.item_activated.connect( (path) => {
840                 
841                 _this.win.windowstate.project = _this.selectedProject;
842                 _this.el.hide();
843                 
844                 
845                 Gtk.TreeIter iter;
846                
847                         
848                 this.el.model.get_iter(out iter, path);
849                 
850                 GLib.Value gval;
851             
852                 this.el.model.get_value(iter, 0 , out gval);
853                 var file = (JsRender.JsRender)gval;
854                 
855                 
856                 _this.win.windowstate.fileViewOpen(file, _this.new_window);
857             
858                 
859                 
860             });
861             this.el.query_tooltip.connect( (x, y, keyboard_tooltip, tooltip) => {
862             
863                 Gtk.TreePath path;
864                 Gtk.CellRenderer cell;
865                 var s = _this.iconview.el.get_item_at_pos(x,y + (int) _this.iconscroll.el.vadjustment.value, out path, out cell);
866                 
867                 
868                // GLib.debug("Tooltip? %d,%d scroll: %d",x,y, (int)_this.iconscroll.el.vadjustment.value);
869                  
870                 
871                 if (path == null) {
872                         // GLib.debug("Tooltip? - no path");
873                         return false;
874                 }
875                 
876                 Gtk.TreeIter iter;
877                 _this.iconmodel.el.get_iter(out iter, path);
878                 GLib.Value val;
879                 _this.iconmodel.el.get_value(iter, 4, out val);
880                 
881                 tooltip.set_icon((Gdk.Pixbuf) val.get_object());
882                  _this.iconview.el.set_tooltip_item(tooltip, path);
883                 return true;
884             });
885         }
886
887         // user defined functions
888     }
889     public class Xcls_iconmodel : Object
890     {
891         public Gtk.ListStore el;
892         private Xcls_PopoverFiles  _this;
893
894
895             // my vars (def)
896
897         // ctor
898         public Xcls_iconmodel(Xcls_PopoverFiles _owner )
899         {
900             _this = _owner;
901             _this.iconmodel = this;
902             this.el = new Gtk.ListStore.newv(  { typeof(Object), typeof(string), typeof(string), typeof(Gdk.Pixbuf), typeof(Gdk.Pixbuf)  }  );
903
904             // my vars (dec)
905
906             // set gobject values
907         }
908
909         // user defined functions
910     }
911
912
913
914     public class Xcls_file_container : Object
915     {
916         public Gtk.ScrolledWindow el;
917         private Xcls_PopoverFiles  _this;
918
919
920             // my vars (def)
921
922         // ctor
923         public Xcls_file_container(Xcls_PopoverFiles _owner )
924         {
925             _this = _owner;
926             _this.file_container = this;
927             this.el = new Gtk.ScrolledWindow( null, null );
928
929             // my vars (dec)
930
931             // set gobject values
932             this.el.width_request = 100;
933             this.el.expand = true;
934             this.el.shadow_type = Gtk.ShadowType.IN;
935             this.el.visible = false;
936             var child_0 = new Xcls_fileview( _this );
937             child_0.ref();
938             this.el.add (  child_0.el  );
939
940             // init method
941
942             this.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);
943         }
944
945         // user defined functions
946     }
947     public class Xcls_fileview : Object
948     {
949         public Gtk.TreeView el;
950         private Xcls_PopoverFiles  _this;
951
952
953             // my vars (def)
954
955         // ctor
956         public Xcls_fileview(Xcls_PopoverFiles _owner )
957         {
958             _this = _owner;
959             _this.fileview = this;
960             this.el = new Gtk.TreeView();
961
962             // my vars (dec)
963
964             // set gobject values
965             this.el.activate_on_single_click = false;
966             this.el.expand = true;
967             this.el.enable_tree_lines = true;
968             this.el.headers_visible = true;
969             var child_0 = new Xcls_filemodel( _this );
970             child_0.ref();
971             this.el.set_model (  child_0.el  );
972             var child_1 = new Xcls_TreeViewColumn21( _this );
973             child_1.ref();
974             this.el.append_column (  child_1.el  );
975
976             // init method
977
978             var description = new Pango.FontDescription();
979                  description.set_size(9000);
980                 this.el.override_font(description);     
981                                 
982                 var selection = this.el.get_selection();
983                 selection.set_mode( Gtk.SelectionMode.SINGLE);
984
985             //listeners
986             this.el.row_activated.connect( (path, col) => {
987             
988                 Gtk.TreeIter iter;
989                
990                         
991                 this.el.model.get_iter(out iter, path);
992                 
993                 GLib.Value gval;
994             
995                 this.el.model.get_value(iter, 1 , out gval);
996                var fn = (string)gval;
997                 if (fn.length < 1) {
998                         return;
999                 }
1000                 _this.win.windowstate.project = _this.selectedProject;
1001                  _this.el.hide();
1002                 
1003                 var f = JsRender.JsRender.factory("PlainFile", _this.selectedProject, fn);
1004                
1005                
1006                 _this.win.windowstate.fileViewOpen(f, _this.new_window);
1007                
1008                 
1009             });
1010             this.el.cursor_changed.connect( () => {
1011              /*
1012                 if (_this.is_loading) {
1013                     return;
1014                 }
1015                 
1016                 Gtk.TreeIter iter;
1017                 Gtk.TreeModel mod;
1018                         
1019                 var s = this.el.get_selection();
1020                 if (!s.get_selected(out mod, out iter)) {
1021                     return;
1022                 }
1023                 
1024                 GLib.Value gval;
1025             
1026                 mod.get_value(iter, 1 , out gval);
1027                 var project = (Project.Project)gval.get_object();
1028                 
1029                 _this.project_selected(project);
1030                 */
1031             });
1032         }
1033
1034         // user defined functions
1035     }
1036     public class Xcls_filemodel : Object
1037     {
1038         public Gtk.TreeStore el;
1039         private Xcls_PopoverFiles  _this;
1040
1041
1042             // my vars (def)
1043
1044         // ctor
1045         public Xcls_filemodel(Xcls_PopoverFiles _owner )
1046         {
1047             _this = _owner;
1048             _this.filemodel = this;
1049             this.el = new Gtk.TreeStore.newv(  { typeof(string), typeof(string) }  );
1050
1051             // my vars (dec)
1052
1053             // set gobject values
1054
1055             // init method
1056
1057             {
1058                this.el.set_sort_func(0, (mod,a,b) => {
1059                    GLib.Value ga, gb;
1060                    mod.get_value(a,0, out ga);
1061                    mod.get_value(b,0, out gb);
1062                     
1063                     if ((string)ga == (string)gb) {
1064                         return 0;
1065                     }
1066                     return (string)ga > (string)gb ? 1 : -1;
1067                }); 
1068              
1069             
1070             }
1071         }
1072
1073         // user defined functions
1074     }
1075
1076     public class Xcls_TreeViewColumn21 : Object
1077     {
1078         public Gtk.TreeViewColumn el;
1079         private Xcls_PopoverFiles  _this;
1080
1081
1082             // my vars (def)
1083
1084         // ctor
1085         public Xcls_TreeViewColumn21(Xcls_PopoverFiles _owner )
1086         {
1087             _this = _owner;
1088             this.el = new Gtk.TreeViewColumn();
1089
1090             // my vars (dec)
1091
1092             // set gobject values
1093             this.el.title = "File";
1094             var child_0 = new Xcls_filenamecol( _this );
1095             child_0.ref();
1096             this.el.pack_start (  child_0.el , true );
1097
1098             // init method
1099
1100             this.el.add_attribute(_this.filenamecol.el , "markup", 0  );
1101         }
1102
1103         // user defined functions
1104     }
1105     public class Xcls_filenamecol : Object
1106     {
1107         public Gtk.CellRendererText el;
1108         private Xcls_PopoverFiles  _this;
1109
1110
1111             // my vars (def)
1112
1113         // ctor
1114         public Xcls_filenamecol(Xcls_PopoverFiles _owner )
1115         {
1116             _this = _owner;
1117             _this.filenamecol = this;
1118             this.el = new Gtk.CellRendererText();
1119
1120             // my vars (dec)
1121
1122             // set gobject values
1123         }
1124
1125         // user defined functions
1126     }
1127
1128
1129
1130
1131
1132
1133 }