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