1 static Xcls_PopoverFiles _PopoverFiles;
3 public class Xcls_PopoverFiles : Object
6 private Xcls_PopoverFiles _this;
8 public static Xcls_PopoverFiles singleton()
10 if (_PopoverFiles == null) {
11 _PopoverFiles= new Xcls_PopoverFiles();
15 public Xcls_view view;
16 public Xcls_model model;
17 public Xcls_namecol namecol;
18 public Xcls_iconsearch iconsearch;
19 public Xcls_iconscroll iconscroll;
20 public Xcls_iconview iconview;
21 public Xcls_iconmodel iconmodel;
22 public Xcls_file_container file_container;
23 public Xcls_fileview fileview;
24 public Xcls_filemodel filemodel;
25 public Xcls_filenamecol filenamecol;
28 public Xcls_MainWindow win;
29 public string lastfilter;
30 public bool in_onprojectselected;
31 public bool is_loading;
32 public bool new_window;
33 public Project.Project selectedProject;
34 public Gtk.PositionType position;
35 public Gdk.Pixbuf missing_thumb_pixbuf;
36 public Gee.HashMap<string,Gdk.Pixbuf> image_cache;
38 public bool is_loaded;
41 public Xcls_PopoverFiles()
44 this.el = new Gtk.Window();
48 this.in_onprojectselected = false;
49 this.is_loading = false;
50 this.new_window = false;
51 this.position = Gtk.PositionType.TOP;
52 this.image_cache = null;
54 this.is_loaded = false;
57 this.el.width_request = 900;
58 this.el.title = "Select Project /File";
59 this.el.height_request = 800;
60 this.el.hexpand = false;
62 var child_1 = new Xcls_Box2( _this );
64 this.el.set_child ( child_1.el );
67 this.el.hide.connect( ( ) => {
70 //if (project != null) {
71 // this.selectProject(project);
73 //if (_this.win.windowstate.project == null) {
79 // user defined functions
80 public void onProjectSelected (Project.Project project)
82 if (this.in_onprojectselected) {
85 this.in_onprojectselected = true;
88 this.selectedProject = project;
90 //this.clutterfiles.loadProject(proj);
94 _this.iconsearch.el.text = "";
100 //this.project_title_name.el.text = pr.name;
101 //this.project_title_path.el.text = pr.firstPath();
103 // file items contains a reference until we reload ...
107 GLib.Timeout.add(500, () => {
108 _this.iconsearch.el.grab_focus();
115 this.in_onprojectselected = false;
117 public void selectProject (Project.Project project) {
119 var sel = _this.view.el.get_selection();
124 _this.model.el.foreach((mod, path, iter) => {
127 mod.get_value(iter, 1, out val);
128 if ( ( (Project.Project)val.get_object()).fn != project.fn) {
129 print("SKIP %s != %s\n", ((Project.Project)val.get_object()).name , project.name);
130 return false;//continue
132 sel.select_iter(iter);
133 this.selectedProject = project;
134 this.onProjectSelected(project);
141 print("tried to select %s, could not find it", project.name);
144 public void show (Gtk.Widget? on_el, Project.Project? project, bool new_window) {
145 //this.editor.show( file, node, ptype, key);
147 this.new_window = new_window;
151 this.el.set_parent(on_el);
153 // show first - so we can hide stuff later.
154 if (project != null) {
156 this.selectProject(project);
160 // var win = this.win.el;
161 // var w = win.get_width();
162 // var h = win.get_height();
164 // left tree = 250, editor area = 500?
169 //var ww = on_el.get_allocated_width();
171 // width = should be max = w-ww , or 600 at best..?
173 //this.el.set_size_request( w - 100, h - 100); // same as parent...
176 //this.el.set_autohide(true); // can hide
177 //Gtk.Allocation rect;
178 //on_el.get_allocation(out rect);
179 // this.el.set_pointing_to(rect);
180 //this.el.set_offset(200,0);
181 //this.el.set_position(Gtk.PositionType.BOTTOM);
185 public void load () {
188 if (_this.is_loaded) {
191 _this.is_loading = true;
193 _this.is_loaded = true;
195 Project.Project.loadAll();
196 var projects = Project.Project.allProjectsByName();
199 var m = this.model.el;
202 for (var i = 0; i < projects.size; i++) {
204 m.set(iter, 0,projects.get(i).name );
206 var o = GLib.Value(typeof(Object));
207 o.set_object((Object)projects.get(i));
209 m.set_value(iter, 1, o);
212 m.set_sort_column_id(0, Gtk.SortType.ASCENDING);
213 _this.is_loading = false;
215 public void loadTreeView () {
216 var project = this.selectedProject;
218 this.filemodel.el.clear();
222 if (!(project is Project.Gtk)) {
223 //print ("not gtk... skipping files");
224 this.file_container.el.hide();
230 var filter = _this.iconsearch.el.text.down();
232 this.file_container.el.show();
233 var gpr = (Project.Gtk)project;
234 var def = gpr.compilegroups.get("_default_");
235 // not sure why the above is returng null!??
237 def = new Project.GtkValaSettings("_default_");
238 gpr.compilegroups.set("_default_", def);
240 var items = def.sources;
242 Gtk.TreeIter citer; // folder iter
243 Gtk.TreeIter fxiter; // file iter
244 for(var i =0 ; i < items.size; i++) {
245 // print ("cheking folder %s\n", items.get(i));
246 var files = gpr.filesForOpen(items.get(i));
252 if (files.size < 1) {
256 for(var j =0 ; j < files.size; j++) {
259 var ff = GLib.Path.get_basename(files.get(j)).down();
260 var dp = ff.last_index_of(".");
261 if (!ff.substring(0,dp < 0 ? ff.length :dp ).contains(filter)) {
272 this.filemodel.el.append(out citer,null);
273 this.filemodel.el.set(citer, 0, GLib.Path.get_basename(items.get(i)));
274 this.filemodel.el.set(citer, 1, null); // parent (empty as it's a folder)
277 // add the directory... items.get(i);
278 //var x = new Xcls_folderitem(this,items.get(i));
279 //this.fileitems.add(x);
280 //this.filelayout.el.add_child(x.el);
283 for(var j =0 ; j < files.size; j++) {
286 var ff = GLib.Path.get_basename(files.get(j)).down();
287 var dp = ff.last_index_of(".");
288 if (!ff.substring(0,dp < 0 ? ff.length :dp ).contains(filter)) {
294 this.filemodel.el.insert(out fxiter,citer, -1);
295 this.filemodel.el.set(fxiter, 0, GLib.Path.get_basename(files.get(j))); // filename
296 this.filemodel.el.set(fxiter, 1, files.get(j)); // Folder?
302 //this.el.set_value(citer, 1, items.get(i) );
304 _this.fileview.el.expand_all();
306 public void loadIconView () {
308 if (_this.image_cache == null) {
309 _this.image_cache = new Gee.HashMap<string,Gdk.Pixbuf>();
312 var project = this.selectedProject;
314 Gdk.Pixbuf pixbuf = null;
315 Gdk.Pixbuf bigpixbuf = null;
317 var m = this.iconmodel.el;
321 var filter = _this.iconsearch.el.text.down();
322 this.lastfilter = filter;
324 var fiter = project.sortedFiles().list_iterator();
328 if (_this.missing_thumb_pixbuf == null) {
330 var icon_theme = Gtk.IconTheme.get_for_display(this.el.get_display());
331 var icon = icon_theme.lookup_icon ("package-x-generic", null, 92,1,
332 Gtk.TextDirection.NONE, 0);
333 _this.missing_thumb_pixbuf = (new Gdk.Pixbuf.from_file (icon.file.get_path())).scale_simple(
334 92, 92 , Gdk.InterpType.NEAREST) ;
335 _this.missing_thumb_pixbuf.ref();
345 while (fiter.next()) {
347 var file = fiter.get();
349 if (!file.name.down().contains(filter)) {
359 m.set(iter, 0,file ); // zero contains the file reference
360 m.set(iter, 1,file.nickType() + "\n" + file.nickName()); // marked up title?
361 m.set(iter, 2,file.nickType() ); // file type?
366 pixbuf = file.getIcon(92);
367 bigpixbuf = file.getIcon(368);
371 if (pixbuf == null) {
372 GLib.debug("PIXBUF is null? %s", file.name);
373 pixbuf = _this.missing_thumb_pixbuf;
374 bigpixbuf = _this.missing_thumb_pixbuf;
379 m.set(iter, 3,pixbuf);
380 m.set(iter, 4,bigpixbuf);
382 // this needs to add to the iconview?
384 //var a = new Xcls_fileitem(this,fiter.get());
385 //this.fileitems.add(a);
387 //this.filelayout.el.add_child(a.el);
390 public void setMainWindow (Xcls_MainWindow win) {
392 this.el.set_transient_for(win.el);
393 this.el.application = BuilderApplication.singleton({});
395 public class Xcls_Box2 : Object
398 private Xcls_PopoverFiles _this;
404 public Xcls_Box2(Xcls_PopoverFiles _owner )
407 this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
411 // set gobject values
412 this.el.hexpand = true;
413 this.el.vexpand = true;
414 var child_1 = new Xcls_Box3( _this );
416 this.el.append( child_1.el );
417 var child_2 = new Xcls_Box12( _this );
419 this.el.append( child_2.el );
422 // user defined functions
424 public class Xcls_Box3 : Object
427 private Xcls_PopoverFiles _this;
433 public Xcls_Box3(Xcls_PopoverFiles _owner )
436 this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
440 // set gobject values
441 this.el.hexpand = true;
442 var child_1 = new Xcls_Box4( _this );
444 this.el.append( child_1.el );
447 // user defined functions
449 public class Xcls_Box4 : Object
452 private Xcls_PopoverFiles _this;
458 public Xcls_Box4(Xcls_PopoverFiles _owner )
461 this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
465 // set gobject values
466 var child_1 = new Xcls_Button5( _this );
468 this.el.append( child_1.el );
469 var child_2 = new Xcls_Button9( _this );
471 this.el.append( child_2.el );
472 var child_3 = new Xcls_Button10( _this );
474 this.el.append( child_3.el );
475 var child_4 = new Xcls_Button11( _this );
477 this.el.append( child_4.el );
480 // user defined functions
482 public class Xcls_Button5 : Object
484 public Gtk.Button el;
485 private Xcls_PopoverFiles _this;
491 public Xcls_Button5(Xcls_PopoverFiles _owner )
494 this.el = new Gtk.Button();
498 // set gobject values
499 this.el.label = "New Project";
500 var child_1 = new Xcls_Box6( _this );
501 this.el.child = child_1.el;
504 this.el.clicked.connect( ( ) => {
506 // create a new file in project..
507 //Xcls_DialogNewComponent.singleton().show(
508 var pe = EditProject.singleton();
509 pe.el.application = _this.win.el.application;
510 pe.el.set_transient_for( _this.win.el );
514 pe.selected.connect((pr) => {
516 _this.is_loaded = false;
517 _this.show(null, pr, _this.new_window);
521 pe.canceled.connect((pr) => {
524 _this.show(null, null, _this.new_window);
534 // user defined functions
536 public class Xcls_Box6 : Object
539 private Xcls_PopoverFiles _this;
545 public Xcls_Box6(Xcls_PopoverFiles _owner )
548 this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
552 // set gobject values
553 var child_1 = new Xcls_Image7( _this );
555 this.el.append( child_1.el );
556 var child_2 = new Xcls_Label8( _this );
558 this.el.append( child_2.el );
561 // user defined functions
563 public class Xcls_Image7 : Object
566 private Xcls_PopoverFiles _this;
572 public Xcls_Image7(Xcls_PopoverFiles _owner )
575 this.el = new Gtk.Image();
579 // set gobject values
580 this.el.icon_name = "folder-new";
581 this.el.margin_end = 4;
582 this.el.icon_size = Gtk.IconSize.NORMAL;
585 // user defined functions
588 public class Xcls_Label8 : Object
591 private Xcls_PopoverFiles _this;
597 public Xcls_Label8(Xcls_PopoverFiles _owner )
600 this.el = new Gtk.Label( "New Project" );
604 // set gobject values
607 // user defined functions
612 public class Xcls_Button9 : Object
614 public Gtk.Button el;
615 private Xcls_PopoverFiles _this;
621 public Xcls_Button9(Xcls_PopoverFiles _owner )
624 this.el = new Gtk.Button();
628 // set gobject values
629 this.el.icon_name = "emblem-system";
630 this.el.label = "Project Properties";
633 this.el.clicked.connect( ( ) => {
634 // should disable the button really.
635 if (_this.selectedProject == null) {
638 _this.win.windowstate.projectPopoverShow(this.el, _this.selectedProject);
642 // user defined functions
645 public class Xcls_Button10 : Object
647 public Gtk.Button el;
648 private Xcls_PopoverFiles _this;
654 public Xcls_Button10(Xcls_PopoverFiles _owner )
657 this.el = new Gtk.Button();
661 // set gobject values
662 this.el.icon_name = "user-trash";
663 this.el.label = "Delete Project";
666 this.el.clicked.connect( ( ) => {
668 var cd = DialogConfirm.singleton();
669 cd.el.set_transient_for(_this.el);
670 cd.el.set_modal(true);
672 var project = _this.windowstate.left_projects.getSelectedProject();
673 if (project == null) {
674 print("SKIP - no project\n");
679 if (Gtk.ResponseType.YES != cd.show("Confirm",
680 "Are you sure you want to delete project %s".printf(project.name))) {
686 Project.Project.remove(project);
687 _this.project = null;
689 _this.windowstate.left_projects.is_loaded = false;
690 _this.windowstate.left_projects.load();
691 _this.windowstate.clutterfiles.clearFiles();
697 // user defined functions
700 public class Xcls_Button11 : Object
702 public Gtk.Button el;
703 private Xcls_PopoverFiles _this;
709 public Xcls_Button11(Xcls_PopoverFiles _owner )
712 this.el = new Gtk.Button();
716 // set gobject values
717 this.el.icon_name = "document-new";
718 this.el.label = "New File";
721 this.el.clicked.connect( () => {
722 // create a new file in project..
723 print("add file selected\n");
725 if (_this.selectedProject == null) {
729 var f = JsRender.JsRender.factory(_this.selectedProject.xtype, _this.selectedProject, "");
730 _this.win.windowstate.file_details.show( f, this.el, _this.new_window );
731 } catch (JsRender.Error e) {}
736 // user defined functions
741 public class Xcls_Box12 : Object
744 private Xcls_PopoverFiles _this;
750 public Xcls_Box12(Xcls_PopoverFiles _owner )
753 this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
757 // set gobject values
758 this.el.homogeneous = false;
759 this.el.hexpand = true;
760 this.el.vexpand = true;
761 var child_1 = new Xcls_ScrolledWindow13( _this );
763 this.el.append( child_1.el );
764 var child_2 = new Xcls_Box18( _this );
766 this.el.append( child_2.el );
767 var child_3 = new Xcls_file_container( _this );
768 this.el.append( child_3.el );
771 // user defined functions
773 public class Xcls_ScrolledWindow13 : Object
775 public Gtk.ScrolledWindow el;
776 private Xcls_PopoverFiles _this;
783 public Xcls_ScrolledWindow13(Xcls_PopoverFiles _owner )
786 this.el = new Gtk.ScrolledWindow();
791 // set gobject values
792 this.el.width_request = 150;
793 this.el.has_frame = true;
794 this.el.hexpand = true;
795 this.el.vexpand = true;
796 var child_1 = new Xcls_view( _this );
797 this.el.set_child ( child_1.el );
801 this.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);
804 // user defined functions
806 public class Xcls_view : Object
808 public Gtk.TreeView el;
809 private Xcls_PopoverFiles _this;
813 public Gtk.CssProvider css;
816 public Xcls_view(Xcls_PopoverFiles _owner )
820 this.el = new Gtk.TreeView();
824 // set gobject values
825 this.el.name = "popover-files-view";
826 this.el.hexpand = true;
827 this.el.vexpand = true;
828 this.el.enable_tree_lines = true;
829 this.el.headers_visible = true;
830 var child_1 = new Xcls_model( _this );
831 this.el.set_model ( child_1.el );
832 var child_2 = new Xcls_TreeViewColumn16( _this );
834 this.el.append_column ( child_2.el );
838 this.css = new Gtk.CssProvider();
840 this.css.load_from_data("#popover-files-view { font-size: 10px;}".data);
842 this.el.get_style_context().add_provider(this.css,Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION);
847 var selection = this.el.get_selection();
848 selection.set_mode( Gtk.SelectionMode.SINGLE);
851 this.el.cursor_changed.connect( () => {
852 if (_this.is_loading) {
859 var s = this.el.get_selection();
860 if (!s.get_selected(out mod, out iter)) {
866 mod.get_value(iter, 1 , out gval);
867 var project = (Project.Project)gval.get_object();
869 _this.onProjectSelected(project);
874 // user defined functions
876 public class Xcls_model : Object
878 public Gtk.ListStore el;
879 private Xcls_PopoverFiles _this;
885 public Xcls_model(Xcls_PopoverFiles _owner )
889 this.el = new Gtk.ListStore.newv( { typeof(string), typeof(Object) } );
893 // set gobject values
898 this.el.set_sort_func(0, (mod,a,b) => {
900 mod.get_value(a,0, out ga);
901 mod.get_value(b,0, out gb);
903 if ((string)ga == (string)gb) {
906 return (string)ga > (string)gb ? 1 : -1;
913 // user defined functions
916 public class Xcls_TreeViewColumn16 : Object
918 public Gtk.TreeViewColumn el;
919 private Xcls_PopoverFiles _this;
925 public Xcls_TreeViewColumn16(Xcls_PopoverFiles _owner )
928 this.el = new Gtk.TreeViewColumn();
932 // set gobject values
933 this.el.title = "Projects";
934 var child_1 = new Xcls_namecol( _this );
935 this.el.pack_start ( child_1.el , true );
939 this.el.add_attribute(_this.namecol.el , "markup", 0 );
942 // user defined functions
944 public class Xcls_namecol : Object
946 public Gtk.CellRendererText el;
947 private Xcls_PopoverFiles _this;
953 public Xcls_namecol(Xcls_PopoverFiles _owner )
956 _this.namecol = this;
957 this.el = new Gtk.CellRendererText();
961 // set gobject values
964 // user defined functions
970 public class Xcls_Box18 : Object
973 private Xcls_PopoverFiles _this;
979 public Xcls_Box18(Xcls_PopoverFiles _owner )
982 this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
986 // set gobject values
987 this.el.width_request = 600;
988 this.el.hexpand = true;
989 this.el.vexpand = true;
990 var child_1 = new Xcls_Box19( _this );
992 this.el.append( child_1.el );
993 var child_2 = new Xcls_iconscroll( _this );
994 this.el.append( child_2.el );
997 // user defined functions
999 public class Xcls_Box19 : Object
1002 private Xcls_PopoverFiles _this;
1008 public Xcls_Box19(Xcls_PopoverFiles _owner )
1011 this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
1015 // set gobject values
1016 this.el.hexpand = true;
1017 var child_1 = new Xcls_iconsearch( _this );
1018 this.el.append( child_1.el );
1021 // user defined functions
1023 public class Xcls_iconsearch : Object
1025 public Gtk.SearchEntry el;
1026 private Xcls_PopoverFiles _this;
1030 public Gtk.CssProvider css;
1033 public Xcls_iconsearch(Xcls_PopoverFiles _owner )
1036 _this.iconsearch = this;
1037 this.el = new Gtk.SearchEntry();
1041 // set gobject values
1042 this.el.name = "popover-files-iconsearch";
1043 this.el.hexpand = true;
1044 this.el.placeholder_text = "type to filter results";
1048 this.css = new Gtk.CssProvider();
1050 this.css.load_from_data("#popover-files-iconsearch { font: 10px monospace;}".data);
1051 } catch (Error e) {}
1052 this.el.get_style_context().add_provider(this.css,Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION);
1055 this.el.changed.connect( ( ) => {
1056 GLib.debug("Got '%s'", this.el.text);
1058 if (this.el.text.down() != _this.lastfilter) {
1059 _this.loadIconView();
1060 _this.loadTreeView();
1065 // user defined functions
1069 public class Xcls_iconscroll : Object
1071 public Gtk.ScrolledWindow el;
1072 private Xcls_PopoverFiles _this;
1078 public Xcls_iconscroll(Xcls_PopoverFiles _owner )
1081 _this.iconscroll = this;
1082 this.el = new Gtk.ScrolledWindow();
1086 // set gobject values
1087 this.el.width_request = 600;
1088 this.el.has_frame = true;
1089 this.el.hexpand = true;
1090 this.el.vexpand = true;
1091 var child_1 = new Xcls_iconview( _this );
1092 this.el.set_child ( child_1.el );
1096 this.el.set_policy (Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC);
1099 // user defined functions
1101 public class Xcls_iconview : Object
1103 public Gtk.IconView el;
1104 private Xcls_PopoverFiles _this;
1110 public Xcls_iconview(Xcls_PopoverFiles _owner )
1113 _this.iconview = this;
1114 this.el = new Gtk.IconView();
1118 // set gobject values
1119 this.el.markup_column = 1;
1120 this.el.hexpand = true;
1121 this.el.vexpand = true;
1122 this.el.pixbuf_column = 3;
1123 this.el.has_tooltip = true;
1124 this.el.item_width = 100;
1125 var child_1 = new Xcls_iconmodel( _this );
1126 this.el.model = child_1.el;
1135 this.el.item_activated.connect( (path) => {
1137 _this.win.windowstate.project = _this.selectedProject;
1144 this.el.model.get_iter(out iter, path);
1148 this.el.model.get_value(iter, 0 , out gval);
1149 var file = (JsRender.JsRender)gval;
1152 _this.win.windowstate.fileViewOpen(file, _this.new_window);
1157 this.el.query_tooltip.connect( (x, y, keyboard_tooltip, tooltip) => {
1160 Gtk.CellRenderer cell;
1161 _this.iconview.el.get_item_at_pos(x,y + (int) _this.iconscroll.el.vadjustment.value, out path, out cell);
1164 // GLib.debug("Tooltip? %d,%d scroll: %d",x,y, (int)_this.iconscroll.el.vadjustment.value);
1168 // GLib.debug("Tooltip? - no path");
1173 _this.iconmodel.el.get_iter(out iter, path);
1175 _this.iconmodel.el.get_value(iter, 4, out val);
1177 tooltip.set_icon( Gdk.Texture.for_pixbuf(
1178 (Gdk.Pixbuf) val.get_object()
1180 _this.iconview.el.set_tooltip_item(tooltip, path);
1185 // user defined functions
1187 public class Xcls_iconmodel : Object
1189 public Gtk.ListStore el;
1190 private Xcls_PopoverFiles _this;
1196 public Xcls_iconmodel(Xcls_PopoverFiles _owner )
1199 _this.iconmodel = this;
1200 this.el = new Gtk.ListStore.newv( { typeof(Object), typeof(string), typeof(string), typeof(Gdk.Pixbuf), typeof(Gdk.Pixbuf) } );
1204 // set gobject values
1207 // user defined functions
1213 public class Xcls_file_container : Object
1215 public Gtk.ScrolledWindow el;
1216 private Xcls_PopoverFiles _this;
1222 public Xcls_file_container(Xcls_PopoverFiles _owner )
1225 _this.file_container = this;
1226 this.el = new Gtk.ScrolledWindow();
1230 // set gobject values
1231 this.el.width_request = 200;
1232 this.el.has_frame = true;
1233 this.el.hexpand = true;
1234 this.el.vexpand = true;
1235 this.el.visible = false;
1236 var child_1 = new Xcls_fileview( _this );
1237 this.el.set_child ( child_1.el );
1241 this.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);
1244 // user defined functions
1246 public class Xcls_fileview : Object
1248 public Gtk.TreeView el;
1249 private Xcls_PopoverFiles _this;
1253 public Gtk.CssProvider css;
1256 public Xcls_fileview(Xcls_PopoverFiles _owner )
1259 _this.fileview = this;
1260 this.el = new Gtk.TreeView();
1264 // set gobject values
1265 this.el.name = "popover-files-fileview";
1266 this.el.activate_on_single_click = false;
1267 this.el.hexpand = true;
1268 this.el.vexpand = true;
1269 this.el.enable_tree_lines = true;
1270 this.el.headers_visible = true;
1271 var child_1 = new Xcls_filemodel( _this );
1272 this.el.set_model ( child_1.el );
1273 var child_2 = new Xcls_TreeViewColumn27( _this );
1275 this.el.append_column ( child_2.el );
1279 this.css = new Gtk.CssProvider();
1281 this.css.load_from_data("#popover-files-fileview { font-size: 12px;}".data);
1282 } catch (Error e) {}
1283 this.el.get_style_context().add_provider(this.css,Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION);
1289 var selection = this.el.get_selection();
1290 selection.set_mode( Gtk.SelectionMode.SINGLE);
1293 this.el.row_activated.connect( (path, col) => {
1298 this.el.model.get_iter(out iter, path);
1302 this.el.model.get_value(iter, 1 , out gval);
1303 var fn = (string)gval;
1304 if (fn.length < 1) {
1307 _this.win.windowstate.project = _this.selectedProject;
1310 var f = JsRender.JsRender.factory("PlainFile", _this.selectedProject, fn);
1311 _this.win.windowstate.fileViewOpen(f, _this.new_window);
1312 } catch (JsRender.Error e) {}
1315 this.el.cursor_changed.connect( () => {
1317 if (_this.is_loading) {
1324 var s = this.el.get_selection();
1325 if (!s.get_selected(out mod, out iter)) {
1331 mod.get_value(iter, 1 , out gval);
1332 var project = (Project.Project)gval.get_object();
1334 _this.project_selected(project);
1339 // user defined functions
1341 public class Xcls_filemodel : Object
1343 public Gtk.TreeStore el;
1344 private Xcls_PopoverFiles _this;
1350 public Xcls_filemodel(Xcls_PopoverFiles _owner )
1353 _this.filemodel = this;
1354 this.el = new Gtk.TreeStore.newv( { typeof(string), typeof(string) } );
1358 // set gobject values
1363 this.el.set_sort_func(0, (mod,a,b) => {
1365 mod.get_value(a,0, out ga);
1366 mod.get_value(b,0, out gb);
1368 if ((string)ga == (string)gb) {
1371 return (string)ga > (string)gb ? 1 : -1;
1378 // user defined functions
1381 public class Xcls_TreeViewColumn27 : Object
1383 public Gtk.TreeViewColumn el;
1384 private Xcls_PopoverFiles _this;
1390 public Xcls_TreeViewColumn27(Xcls_PopoverFiles _owner )
1393 this.el = new Gtk.TreeViewColumn();
1397 // set gobject values
1398 this.el.title = "File";
1399 var child_1 = new Xcls_filenamecol( _this );
1400 this.el.pack_start ( child_1.el , true );
1404 this.el.add_attribute(_this.filenamecol.el , "markup", 0 );
1407 // user defined functions
1409 public class Xcls_filenamecol : Object
1411 public Gtk.CellRendererText el;
1412 private Xcls_PopoverFiles _this;
1418 public Xcls_filenamecol(Xcls_PopoverFiles _owner )
1421 _this.filenamecol = this;
1422 this.el = new Gtk.CellRendererText();
1426 // set gobject values
1429 // user defined functions