1 static DialogFiles _DialogFiles;
3 public class DialogFiles : Object
6 private DialogFiles _this;
8 public static DialogFiles singleton()
10 if (_DialogFiles == null) {
11 _DialogFiles= new DialogFiles();
15 public Xcls_mainpane mainpane;
16 public Xcls_projectscroll projectscroll;
17 public Xcls_project_list project_list;
18 public Xcls_projectselection projectselection;
19 public Xcls_projectsort projectsort;
20 public Xcls_projectmodel projectmodel;
21 public Xcls_filepane filepane;
22 public Xcls_searchbox searchbox;
23 public Xcls_iconscroll iconscroll;
24 public Xcls_gridview gridview;
25 public Xcls_iconsel iconsel;
26 public Xcls_gridsort gridsort;
27 public Xcls_gridmodel gridmodel;
28 public Xcls_iconsearch iconsearch;
29 public Xcls_treescroll treescroll;
30 public Xcls_treeview treeview;
31 public Xcls_treeselmodel treeselmodel;
32 public Xcls_treelistsort treelistsort;
33 public Xcls_treelistmodel treelistmodel;
34 public Xcls_treemodel treemodel;
35 public Xcls_treefilter treefilter;
36 public Xcls_name name;
37 public Xcls_btn_newproj btn_newproj;
38 public Xcls_btn_projprop btn_projprop;
39 public Xcls_btn_delproj btn_delproj;
40 public Xcls_btn_addfile btn_addfile;
41 public Xcls_btn_delfile btn_delfile;
44 public Xcls_MainWindow win;
45 public string lastfilter;
46 public bool in_onprojectselected;
47 public bool is_loading;
48 public bool new_window;
49 public Project.Project selectedProject;
50 public Gdk.Pixbuf missing_thumb_pixbuf;
51 public Gee.HashMap<string,Gdk.Pixbuf> image_cache;
57 this.el = new Gtk.Window();
60 this.in_onprojectselected = false;
61 this.is_loading = false;
62 this.new_window = false;
65 this.el.title = "Select Project / File";
66 this.el.name = "DialogFiles";
67 this.el.default_height = 550;
68 this.el.default_width = 1000;
70 var child_1 = new Xcls_Box2( _this );
71 this.el.child = child_1.el;
72 var child_2 = new Xcls_HeaderBar44( _this );
73 this.el.titlebar = child_2.el;
76 // user defined functions
77 public void onProjectSelected (Project.Project? project)
79 if (this.in_onprojectselected) {
82 this.selectedProject = project;
84 if (project == null) {
85 GLib.debug("Hide project files");
86 _this.mainpane.el.set_end_child(null);
87 _this.filepane.el.hide();
92 GLib.debug("Show project files");
93 _this.mainpane.el.set_end_child(_this.filepane.el);
95 _this.filepane.el.show();
96 this.in_onprojectselected = true;
103 _this.searchbox.el.text = "";
104 _this.gridview.el.set_model(new Gtk.SingleSelection(null));
105 _this.selectedProject.loadFilesIntoStore(_this.gridmodel.el);
106 _this.iconsel.el.selected = Gtk.INVALID_LIST_POSITION;
108 _this.gridview.el.set_model(_this.iconsel.el);
111 GLib.Timeout.add(500, () => {
112 _this.iconsel.el.selected = Gtk.INVALID_LIST_POSITION;
113 _this.treeselmodel.el.selected = Gtk.INVALID_LIST_POSITION;
115 _this.searchbox.el.grab_focus();
118 _this.treeview.el.set_model(new Gtk.SingleSelection(null));
120 this.selectedProject.loadDirsIntoStore(_this.treemodel.el);
122 _this.treeview.el.set_model(_this.treeselmodel.el);
124 _this.treeselmodel.el.selected = Gtk.INVALID_LIST_POSITION;
125 this.treescroll.el.vadjustment.value = 0;
126 this.in_onprojectselected = false;
128 public void selectProject (Project.Project? project) {
132 var sm = this.projectselection.el;
133 if (project == null) {
134 sm.selected = Gtk.INVALID_LIST_POSITION;
135 this.onProjectSelected(null);
140 for (var i =0; i < sm.n_items; i++) {
141 var p = (Project.Project) sm.get_item(i);
142 if (p.path == project.path) {
143 GLib.debug("Select Project %s => %d", project.name, i);
150 public void show (Project.Project? project, bool new_window) {
152 this.new_window = new_window;
154 this.projectscroll.el.vadjustment.value = 0; // scroll to top?
157 //var win = this.win.el;
158 //var w = win.get_width();
159 //var h = win.get_height();
164 this.selectProject(project);
165 this.onProjectSelected(project); //?? twice?
167 GLib.Timeout.add(500, () => {
168 if (project == null) {
169 _this.projectselection.el.selected = Gtk.INVALID_LIST_POSITION;
170 this.onProjectSelected(null);
173 this.el.set_size_request( 800 , 750); // ?? based on default
178 public void load () {
181 _this.is_loading = true;
183 Project.Project.loadAll();
184 _this.project_list.el.set_model(new Gtk.SingleSelection(null));
185 Project.Project.loadIntoStore(this.projectmodel.el);
187 _this.project_list.el.set_model(_this.projectselection.el);
189 _this.is_loading = false;
191 _this.projectselection.el.selected = Gtk.INVALID_LIST_POSITION;
192 _this.btn_delfile.el.hide();
194 public class Xcls_Box2 : Object
197 private DialogFiles _this;
204 public Xcls_Box2(DialogFiles _owner )
207 this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
212 // set gobject values
213 this.el.homogeneous = false;
214 this.el.margin_end = 10;
215 this.el.margin_start = 10;
216 this.el.margin_bottom = 10;
217 this.el.margin_top = 10;
218 var child_1 = new Xcls_Box3( _this );
220 this.el.append( child_1.el );
221 new Xcls_mainpane( _this );
222 this.el.append( _this.mainpane.el );
225 // user defined functions
227 public class Xcls_Box3 : Object
230 private DialogFiles _this;
236 public Xcls_Box3(DialogFiles _owner )
239 this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
243 // set gobject values
244 this.el.hexpand = true;
247 // user defined functions
250 public class Xcls_mainpane : Object
253 private DialogFiles _this;
257 public bool homogeneous;
261 public Xcls_mainpane(DialogFiles _owner )
264 _this.mainpane = this;
265 this.el = new Gtk.Paned( Gtk.Orientation.HORIZONTAL );
268 this.homogeneous = false;
271 // set gobject values
272 this.el.hexpand = true;
273 this.el.vexpand = true;
274 this.el.position = 200;
275 new Xcls_projectscroll( _this );
276 this.el.start_child = _this.projectscroll.el;
277 new Xcls_filepane( _this );
278 this.el.end_child = _this.filepane.el;
281 // user defined functions
283 public class Xcls_projectscroll : Object
285 public Gtk.ScrolledWindow el;
286 private DialogFiles _this;
293 public Xcls_projectscroll(DialogFiles _owner )
296 _this.projectscroll = this;
297 this.el = new Gtk.ScrolledWindow();
302 // set gobject values
303 this.el.width_request = 150;
304 this.el.has_frame = true;
305 this.el.hexpand = true;
306 this.el.vexpand = true;
307 new Xcls_project_list( _this );
308 this.el.child = _this.project_list.el;
312 this.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);
315 // user defined functions
317 public class Xcls_project_list : Object
319 public Gtk.ColumnView el;
320 private DialogFiles _this;
324 public Gtk.CssProvider css;
327 public Xcls_project_list(DialogFiles _owner )
330 _this.project_list = this;
331 new Xcls_projectselection( _this );
332 this.el = new Gtk.ColumnView( _this.projectselection.el );
336 // set gobject values
337 this.el.name = "project-list";
338 var child_2 = new Xcls_ColumnViewColumn12( _this );
340 this.el.append_column ( child_2.el );
346 this.css = new Gtk.CssProvider();
348 this.css.load_from_string("
349 #project-list { font-size: 12px;}
352 Gtk.StyleContext.add_provider_for_display(
353 this.el.get_display(),
355 Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION
362 // user defined functions
364 public class Xcls_projectselection : Object
366 public Gtk.SingleSelection el;
367 private DialogFiles _this;
373 public Xcls_projectselection(DialogFiles _owner )
376 _this.projectselection = this;
377 new Xcls_projectsort( _this );
378 this.el = new Gtk.SingleSelection( _this.projectsort.el );
382 // set gobject values
383 this.el.can_unselect = true;
386 this.el.notify["selected"].connect( (position, n_items) => {
388 if (_this.is_loading) {
392 if (this.el.selected == Gtk.INVALID_LIST_POSITION) {
393 _this.btn_delproj.el.hide();
394 _this.btn_projprop.el.hide();
395 _this.btn_addfile.el.hide();
396 //_this.btn_delfile.el.hide();
399 _this.btn_delproj.el.show();
400 _this.btn_projprop.el.show();
401 _this.btn_addfile.el.show();
402 //_this.btn_delfile.el.show(); // ??
409 if (_this.is_loading) {
413 Project.Project project = this.el.selected == Gtk.INVALID_LIST_POSITION ? null :
414 (Project.Project) _this.projectsort.el.get_item(this.el.selected);
416 GLib.debug("selection changed to %s", project == null ? "none" : project.name);
418 _this.onProjectSelected(project);
422 // user defined functions
424 public class Xcls_projectsort : Object
426 public Gtk.SortListModel el;
427 private DialogFiles _this;
433 public Xcls_projectsort(DialogFiles _owner )
436 _this.projectsort = this;
437 new Xcls_projectmodel( _this );
438 var child_2 = new Xcls_StringSorter10( _this );
440 this.el = new Gtk.SortListModel( _this.projectmodel.el, child_2.el );
444 // set gobject values
445 this.el.incremental = true;
448 // user defined functions
450 public class Xcls_projectmodel : Object
452 public GLib.ListStore el;
453 private DialogFiles _this;
459 public Xcls_projectmodel(DialogFiles _owner )
462 _this.projectmodel = this;
463 this.el = new GLib.ListStore( typeof(Project.Project) );
467 // set gobject values
470 // user defined functions
471 public void remove (Project.Project p) {
473 for (var i =0;i < this.el.n_items; i++ ) {
474 var pr = (Project.Project) this.el.get_item(i);
475 if (p.path == pr.path) {
485 public class Xcls_StringSorter10 : Object
487 public Gtk.StringSorter el;
488 private DialogFiles _this;
494 public Xcls_StringSorter10(DialogFiles _owner )
497 var child_1 = new Xcls_PropertyExpression11( _this );
499 this.el = new Gtk.StringSorter( child_1.el );
503 // set gobject values
506 // user defined functions
508 public class Xcls_PropertyExpression11 : Object
510 public Gtk.PropertyExpression el;
511 private DialogFiles _this;
517 public Xcls_PropertyExpression11(DialogFiles _owner )
520 this.el = new Gtk.PropertyExpression( typeof(Project.Project), null, "name" );
524 // set gobject values
527 // user defined functions
533 public class Xcls_ColumnViewColumn12 : Object
535 public Gtk.ColumnViewColumn el;
536 private DialogFiles _this;
542 public Xcls_ColumnViewColumn12(DialogFiles _owner )
545 var child_1 = new Xcls_SignalListItemFactory13( _this );
547 this.el = new Gtk.ColumnViewColumn( "Project", child_1.el );
551 // set gobject values
552 this.el.expand = true;
555 // user defined functions
557 public class Xcls_SignalListItemFactory13 : Object
559 public Gtk.SignalListItemFactory el;
560 private DialogFiles _this;
566 public Xcls_SignalListItemFactory13(DialogFiles _owner )
569 this.el = new Gtk.SignalListItemFactory();
573 // set gobject values
576 this.el.setup.connect( (item) => {
577 //var j = (JsRender.JsRender) item;
578 var gi = (Gtk.ListItem)item;
580 var lbl = new Gtk.Label("");
581 lbl.halign = Gtk.Align.START;
587 this.el.bind.connect( (listitem) => {
589 var lbl = (Gtk.Label) ((Gtk.ListItem)listitem).get_child();
591 var item = (Project.Project) ((Gtk.ListItem)listitem).get_item();
593 item.bind_property("name",
595 GLib.BindingFlags.SYNC_CREATE);
601 // user defined functions
607 public class Xcls_filepane : Object
610 private DialogFiles _this;
616 public Xcls_filepane(DialogFiles _owner )
619 _this.filepane = this;
620 this.el = new Gtk.Paned( Gtk.Orientation.HORIZONTAL );
624 // set gobject values
625 this.el.position = 200;
626 this.el.visible = false;
627 var child_1 = new Xcls_Box15( _this );
628 this.el.end_child = child_1.el;
629 new Xcls_treescroll( _this );
630 this.el.start_child = _this.treescroll.el;
633 // user defined functions
635 public class Xcls_Box15 : Object
638 private DialogFiles _this;
644 public Xcls_Box15(DialogFiles _owner )
647 this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
651 // set gobject values
652 this.el.hexpand = true;
653 this.el.vexpand = true;
654 var child_1 = new Xcls_Box16( _this );
656 this.el.append( child_1.el );
657 new Xcls_iconscroll( _this );
658 this.el.append( _this.iconscroll.el );
661 // user defined functions
663 public class Xcls_Box16 : Object
666 private DialogFiles _this;
672 public Xcls_Box16(DialogFiles _owner )
675 this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
679 // set gobject values
680 this.el.hexpand = true;
681 new Xcls_searchbox( _this );
682 this.el.append( _this.searchbox.el );
685 // user defined functions
687 public class Xcls_searchbox : Object
689 public Gtk.SearchEntry el;
690 private DialogFiles _this;
694 public Gtk.CssProvider css;
697 public Xcls_searchbox(DialogFiles _owner )
700 _this.searchbox = this;
701 this.el = new Gtk.SearchEntry();
705 // set gobject values
706 this.el.name = "popover-files-iconsearch";
707 this.el.hexpand = true;
708 this.el.placeholder_text = "type to filter results";
709 this.el.search_delay = 1000;
714 this.css = new Gtk.CssProvider();
716 this.css.load_from_data("#popover-files-iconsearch { font: 10px monospace;}".data);
718 this.el.get_style_context().add_provider(this.css,Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION);
724 this.el.search_changed.connect( ( ) => {
726 _this.treefilter.el.changed(Gtk.FilterChange.DIFFERENT);
727 _this.iconsearch.el.set_search(this.el.text);
731 // user defined functions
735 public class Xcls_iconscroll : Object
737 public Gtk.ScrolledWindow el;
738 private DialogFiles _this;
744 public Xcls_iconscroll(DialogFiles _owner )
747 _this.iconscroll = this;
748 this.el = new Gtk.ScrolledWindow();
752 // set gobject values
753 this.el.has_frame = true;
754 this.el.hexpand = true;
755 this.el.vexpand = true;
756 new Xcls_gridview( _this );
757 this.el.child = _this.gridview.el;
761 this.el.set_policy (Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC);
764 // user defined functions
766 public class Xcls_gridview : Object
768 public Gtk.GridView el;
769 private DialogFiles _this;
775 public Xcls_gridview(DialogFiles _owner )
778 _this.gridview = this;
779 new Xcls_iconsel( _this );
780 var child_2 = new Xcls_SignalListItemFactory29( _this );
782 this.el = new Gtk.GridView( _this.iconsel.el, child_2.el );
786 // set gobject values
787 var child_3 = new Xcls_GestureClick20( _this );
789 this.el.add_controller( child_3.el );
792 // user defined functions
794 public class Xcls_GestureClick20 : Object
796 public Gtk.GestureClick el;
797 private DialogFiles _this;
803 public Xcls_GestureClick20(DialogFiles _owner )
806 this.el = new Gtk.GestureClick();
810 // set gobject values
813 this.el.pressed.connect( (n_press, x, y) => {
815 GLib.debug("double cliced");
819 var f = (JsRender.JsRender)_this.iconsel.el.selected_item;
821 GLib.debug("Click %s", f.name);
822 if (f.xtype == "Dir") {
827 _this.win.windowstate.fileViewOpen(f, _this.new_window);
836 // user defined functions
839 public class Xcls_iconsel : Object
841 public Gtk.SingleSelection el;
842 private DialogFiles _this;
848 public Xcls_iconsel(DialogFiles _owner )
851 _this.iconsel = this;
852 var child_1 = new Xcls_FilterListModel22( _this );
854 this.el = new Gtk.SingleSelection( child_1.el );
858 // set gobject values
859 this.el.can_unselect = true;
862 this.el.notify["selected"].connect( () => {
863 if (this.el.selected == Gtk.INVALID_LIST_POSITION) {
864 if (_this.treeselmodel.el.selected == Gtk.INVALID_LIST_POSITION) {
865 _this.btn_delfile.el.hide();
870 _this.btn_delfile.el.show();
871 _this.treeselmodel.el.selected = Gtk.INVALID_LIST_POSITION;
877 // user defined functions
878 public JsRender.JsRender? selectedFile () {
880 if (this.el.selected == Gtk.INVALID_LIST_POSITION) {
883 return (JsRender.JsRender)this.el.get_item(this.el.selected);
888 public class Xcls_FilterListModel22 : Object
890 public Gtk.FilterListModel el;
891 private DialogFiles _this;
897 public Xcls_FilterListModel22(DialogFiles _owner )
900 new Xcls_gridsort( _this );
901 new Xcls_iconsearch( _this );
902 this.el = new Gtk.FilterListModel( _this.gridsort.el, _this.iconsearch.el );
906 // set gobject values
909 // user defined functions
911 public class Xcls_gridsort : Object
913 public Gtk.SortListModel el;
914 private DialogFiles _this;
920 public Xcls_gridsort(DialogFiles _owner )
923 _this.gridsort = this;
924 new Xcls_gridmodel( _this );
925 var child_2 = new Xcls_StringSorter25( _this );
927 this.el = new Gtk.SortListModel( _this.gridmodel.el, child_2.el );
931 // set gobject values
934 // user defined functions
936 public class Xcls_gridmodel : Object
938 public GLib.ListStore el;
939 private DialogFiles _this;
945 public Xcls_gridmodel(DialogFiles _owner )
948 _this.gridmodel = this;
949 this.el = new GLib.ListStore( typeof(JsRender.JsRender) );
953 // set gobject values
956 // user defined functions
957 public void remove (JsRender.JsRender p) {
959 for (var i =0;i < this.el.n_items; i++ ) {
960 var pr = (JsRender.JsRender) this.el.get_item(i);
961 if (p.path == pr.path) {
970 public class Xcls_StringSorter25 : Object
972 public Gtk.StringSorter el;
973 private DialogFiles _this;
979 public Xcls_StringSorter25(DialogFiles _owner )
982 var child_1 = new Xcls_PropertyExpression26( _this );
984 this.el = new Gtk.StringSorter( child_1.el );
988 // set gobject values
989 this.el.ignore_case = true;
992 // user defined functions
994 public class Xcls_PropertyExpression26 : Object
996 public Gtk.PropertyExpression el;
997 private DialogFiles _this;
1003 public Xcls_PropertyExpression26(DialogFiles _owner )
1006 this.el = new Gtk.PropertyExpression( typeof(JsRender.JsRender), null, "name" );
1010 // set gobject values
1013 // user defined functions
1018 public class Xcls_iconsearch : Object
1020 public Gtk.StringFilter el;
1021 private DialogFiles _this;
1027 public Xcls_iconsearch(DialogFiles _owner )
1030 _this.iconsearch = this;
1031 var child_1 = new Xcls_PropertyExpression28( _this );
1033 this.el = new Gtk.StringFilter( child_1.el );
1037 // set gobject values
1038 this.el.match_mode = Gtk.StringFilterMatchMode.SUBSTRING;
1039 this.el.ignore_case = true;
1042 // user defined functions
1044 public class Xcls_PropertyExpression28 : Object
1046 public Gtk.PropertyExpression el;
1047 private DialogFiles _this;
1053 public Xcls_PropertyExpression28(DialogFiles _owner )
1056 this.el = new Gtk.PropertyExpression( typeof(JsRender.JsRender), null, "name" );
1060 // set gobject values
1063 // user defined functions
1069 public class Xcls_SignalListItemFactory29 : Object
1071 public Gtk.SignalListItemFactory el;
1072 private DialogFiles _this;
1078 public Xcls_SignalListItemFactory29(DialogFiles _owner )
1081 this.el = new Gtk.SignalListItemFactory();
1085 // set gobject values
1088 this.el.setup.connect( (item) => {
1089 //var j = (JsRender.JsRender) item;
1090 var gi = (Gtk.ListItem)item;
1091 var b = new Gtk.Box(Gtk.Orientation.VERTICAL,4);
1092 var i = new Gtk.Image();
1094 var t = new Gtk.Label("");
1099 b.has_tooltip = true;
1100 b.query_tooltip.connect((x, y, keyboard_tooltip, tooltip) => {
1101 var j = (JsRender.JsRender) gi.get_item();
1103 var ti = new Gtk.Image.from_file ( j.getIconFileName());
1104 ti.pixel_size = 368;
1105 tooltip.set_custom( ti );
1111 this.el.bind.connect( (listitem) => {
1113 var box = (Gtk.Box) ((Gtk.ListItem)listitem).get_child();
1115 var img = (Gtk.Image) box.get_first_child();
1116 var lbl = (Gtk.Label)img.get_next_sibling();
1118 var item = (JsRender.JsRender) ((Gtk.ListItem)listitem).get_item();
1119 //GLib.debug("set label name to %s", item.name);
1121 var ns = item.name.split(".");
1122 if (ns.length < 2) {
1123 lbl.label = item.name;
1126 item.name.substring(0, item.name.length - ns[ns.length-1].length)
1127 + "\n"+ ns[ns.length-1];
1131 item.bind_property("name",
1133 GLib.BindingFlags.SYNC_CREATE);
1136 img.set_from_file(item.getIconFileName());
1142 // user defined functions
1148 public class Xcls_treescroll : Object
1150 public Gtk.ScrolledWindow el;
1151 private DialogFiles _this;
1157 public Xcls_treescroll(DialogFiles _owner )
1160 _this.treescroll = this;
1161 this.el = new Gtk.ScrolledWindow();
1165 // set gobject values
1166 this.el.width_request = 200;
1167 this.el.has_frame = true;
1168 this.el.hexpand = true;
1169 this.el.vexpand = true;
1170 this.el.visible = true;
1171 new Xcls_treeview( _this );
1172 this.el.child = _this.treeview.el;
1176 this.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);
1179 // user defined functions
1181 public class Xcls_treeview : Object
1183 public Gtk.ColumnView el;
1184 private DialogFiles _this;
1188 public Gtk.CssProvider css;
1191 public Xcls_treeview(DialogFiles _owner )
1194 _this.treeview = this;
1195 new Xcls_treeselmodel( _this );
1196 this.el = new Gtk.ColumnView( _this.treeselmodel.el );
1200 // set gobject values
1201 this.el.name = "file-list";
1202 var child_2 = new Xcls_GestureClick32( _this );
1204 this.el.add_controller( child_2.el );
1205 new Xcls_name( _this );
1206 this.el.append_column ( _this.name.el );
1212 this.css = new Gtk.CssProvider();
1214 this.css.load_from_string("
1215 #file-list { font-size: 12px;}
1217 -gtk-icon-size : 2px;
1219 #file-list indent:nth-last-child(2) {
1224 Gtk.StyleContext.add_provider_for_display(
1225 this.el.get_display(),
1227 Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION
1233 // user defined functions
1235 public class Xcls_GestureClick32 : Object
1237 public Gtk.GestureClick el;
1238 private DialogFiles _this;
1244 public Xcls_GestureClick32(DialogFiles _owner )
1247 this.el = new Gtk.GestureClick();
1251 // set gobject values
1254 this.el.pressed.connect( (n_press, x, y) => {
1256 GLib.debug("double cliced");
1260 var tr = (Gtk.TreeListRow)_this.treeselmodel.el.selected_item;
1261 GLib.debug("SELECTED = %s", tr.item.get_type().name());
1262 var f = (JsRender.JsRender) tr.item;
1263 GLib.debug("Click %s", f.name);
1264 if (f.xtype == "Dir") {
1269 _this.win.windowstate.fileViewOpen(f, _this.new_window);
1278 // user defined functions
1281 public class Xcls_treeselmodel : Object
1283 public Gtk.SingleSelection el;
1284 private DialogFiles _this;
1290 public Xcls_treeselmodel(DialogFiles _owner )
1293 _this.treeselmodel = this;
1294 var child_1 = new Xcls_FilterListModel34( _this );
1296 this.el = new Gtk.SingleSelection( child_1.el );
1300 // set gobject values
1301 this.el.can_unselect = true;
1304 this.el.notify["selected"].connect( () => {
1305 if (this.el.selected == Gtk.INVALID_LIST_POSITION) {
1306 if (_this.iconsel.el.selected == Gtk.INVALID_LIST_POSITION) {
1307 _this.btn_delfile.el.hide();
1312 var tr = (Gtk.TreeListRow)_this.treeselmodel.el.selected_item;
1313 GLib.debug("SELECTED = %s", tr.item.get_type().name());
1314 var f = (JsRender.JsRender) tr.item;
1315 if (f.xtype == "Dir") {
1316 _this.btn_delfile.el.hide();
1318 _this.btn_delfile.el.show();
1321 _this.iconsel.el.selected = Gtk.INVALID_LIST_POSITION;
1327 // user defined functions
1328 public JsRender.JsRender? selectedFile () {
1330 if (this.el.selected == Gtk.INVALID_LIST_POSITION) {
1333 var tr = (Gtk.TreeListRow) this.el.selected_item;
1335 return (JsRender.JsRender) tr.item;
1338 public class Xcls_FilterListModel34 : Object
1340 public Gtk.FilterListModel el;
1341 private DialogFiles _this;
1347 public Xcls_FilterListModel34(DialogFiles _owner )
1350 new Xcls_treelistsort( _this );
1351 new Xcls_treefilter( _this );
1352 this.el = new Gtk.FilterListModel( _this.treelistsort.el, _this.treefilter.el );
1356 // set gobject values
1359 // user defined functions
1361 public class Xcls_treelistsort : Object
1363 public Gtk.SortListModel el;
1364 private DialogFiles _this;
1370 public Xcls_treelistsort(DialogFiles _owner )
1373 _this.treelistsort = this;
1374 new Xcls_treelistmodel( _this );
1375 var child_2 = new Xcls_TreeListRowSorter38( _this );
1377 this.el = new Gtk.SortListModel( _this.treelistmodel.el, child_2.el );
1381 // set gobject values
1382 this.el.incremental = true;
1385 // user defined functions
1387 public class Xcls_treelistmodel : Object
1389 public Gtk.TreeListModel el;
1390 private DialogFiles _this;
1396 public Xcls_treelistmodel(DialogFiles _owner )
1399 _this.treelistmodel = this;
1400 new Xcls_treemodel( _this );
1401 this.el = new Gtk.TreeListModel( _this.treemodel.el, false, true, (item) => {
1402 //GLib.debug("liststore got %s", item.get_type().name());
1403 return ((JsRender.JsRender)item).childfiles;
1408 // set gobject values
1411 // user defined functions
1413 public class Xcls_treemodel : Object
1415 public GLib.ListStore el;
1416 private DialogFiles _this;
1422 public Xcls_treemodel(DialogFiles _owner )
1425 _this.treemodel = this;
1426 this.el = new GLib.ListStore( typeof(JsRender.JsRender) );
1430 // set gobject values
1433 // user defined functions
1437 public class Xcls_TreeListRowSorter38 : Object
1439 public Gtk.TreeListRowSorter el;
1440 private DialogFiles _this;
1446 public Xcls_TreeListRowSorter38(DialogFiles _owner )
1449 var child_1 = new Xcls_StringSorter39( _this );
1451 this.el = new Gtk.TreeListRowSorter( child_1.el );
1455 // set gobject values
1458 // user defined functions
1460 public class Xcls_StringSorter39 : Object
1462 public Gtk.StringSorter el;
1463 private DialogFiles _this;
1469 public Xcls_StringSorter39(DialogFiles _owner )
1472 var child_1 = new Xcls_PropertyExpression40( _this );
1474 this.el = new Gtk.StringSorter( child_1.el );
1478 // set gobject values
1479 this.el.ignore_case = true;
1482 // user defined functions
1484 public class Xcls_PropertyExpression40 : Object
1486 public Gtk.PropertyExpression el;
1487 private DialogFiles _this;
1493 public Xcls_PropertyExpression40(DialogFiles _owner )
1496 this.el = new Gtk.PropertyExpression( typeof(JsRender.JsRender) , null, "name" );
1500 // set gobject values
1503 // user defined functions
1509 public class Xcls_treefilter : Object
1511 public Gtk.CustomFilter el;
1512 private DialogFiles _this;
1518 public Xcls_treefilter(DialogFiles _owner )
1521 _this.treefilter = this;
1522 this.el = new Gtk.CustomFilter( (item) => {
1523 var tr = ((Gtk.TreeListRow)item).get_item();
1524 //GLib.debug("filter %s", tr.get_type().name());
1525 var j = (JsRender.JsRender) tr;
1526 if (j.xtype == "Dir" && j.childfiles.n_items < 1) {
1529 var str = _this.searchbox.el.text.down();
1530 if (j.xtype == "Dir") {
1532 if (str.length < 1) {
1535 for (var i =0 ; i < j.childfiles.n_items; i++) {
1536 var f = (JsRender.JsRender) j.childfiles.get_item(i);
1537 if (f.xtype != "PlainFile") {
1540 if (f.name.down().contains(str)) {
1546 if (j.xtype != "PlainFile") {
1550 if (str.length < 1) {
1553 if (j.name.down().contains(str)) {
1562 // set gobject values
1565 // user defined functions
1570 public class Xcls_name : Object
1572 public Gtk.ColumnViewColumn el;
1573 private DialogFiles _this;
1579 public Xcls_name(DialogFiles _owner )
1583 var child_1 = new Xcls_SignalListItemFactory43( _this );
1585 this.el = new Gtk.ColumnViewColumn( "General Files", child_1.el );
1589 // set gobject values
1590 this.el.id = "name";
1591 this.el.expand = true;
1592 this.el.resizable = true;
1597 // this.el.set_sorter( new Gtk.StringSorter(
1598 // new Gtk.PropertyExpression(typeof(JsRender.NodeProp), null, "name")
1604 // user defined functions
1606 public class Xcls_SignalListItemFactory43 : Object
1608 public Gtk.SignalListItemFactory el;
1609 private DialogFiles _this;
1615 public Xcls_SignalListItemFactory43(DialogFiles _owner )
1618 this.el = new Gtk.SignalListItemFactory();
1622 // set gobject values
1625 this.el.setup.connect( (listitem) => {
1627 var expand = new Gtk.TreeExpander();
1629 expand.set_indent_for_depth(true);
1630 expand.set_indent_for_icon(true);
1631 var hbox = new Gtk.Box(Gtk.Orientation.HORIZONTAL,0);
1632 var icon = new Gtk.Image();
1633 icon.margin_end = 4;
1634 var lbl = new Gtk.Label("");
1635 lbl.use_markup = true;
1638 lbl.justify = Gtk.Justification.LEFT;
1643 expand.set_child(hbox);
1644 ((Gtk.ListItem)listitem).set_child(expand);
1645 ((Gtk.ListItem)listitem).activatable = false;
1647 this.el.bind.connect( (listitem) => {
1649 //GLib.debug("listitme is is %s", ((Gtk.ListItem)listitem).get_type().name());
1653 //var expand = (Gtk.TreeExpander) ((Gtk.ListItem)listitem).get_child();
1654 var expand = (Gtk.TreeExpander) ((Gtk.ListItem)listitem).get_child();
1656 var hbox = (Gtk.Box) expand.child;
1659 var img = (Gtk.Image) hbox.get_first_child();
1660 var lbl = (Gtk.Label) img.get_next_sibling();
1664 if (lbl.label != "") { // do not update
1667 var lr = (Gtk.TreeListRow)((Gtk.ListItem)listitem).get_item();
1668 //GLib.debug("LR = %s", lr.get_type().name());
1671 var jr =(JsRender.JsRender) lr.get_item();
1672 //GLib.debug("JR = %s", jr.get_type().name());
1675 GLib.debug("Problem getting item");
1679 jr.bind_property("icon",
1681 GLib.BindingFlags.SYNC_CREATE);
1683 //GLib.debug("change %s to %s", lbl.label, np.name);
1684 lbl.label = jr.name; // for dir's we could hsow the sub path..
1685 lbl.tooltip_markup = jr.path;
1687 expand.set_hide_expander( jr.xtype != "Dir" );
1688 expand.set_list_row(lr);
1695 // user defined functions
1704 public class Xcls_HeaderBar44 : Object
1706 public Gtk.HeaderBar el;
1707 private DialogFiles _this;
1713 public Xcls_HeaderBar44(DialogFiles _owner )
1716 this.el = new Gtk.HeaderBar();
1720 // set gobject values
1721 this.el.show_title_buttons = false;
1722 var child_1 = new Xcls_Button45( _this );
1724 this.el.pack_end ( child_1.el );
1725 new Xcls_btn_newproj( _this );
1726 this.el.pack_start ( _this.btn_newproj.el );
1727 new Xcls_btn_projprop( _this );
1728 this.el.pack_start ( _this.btn_projprop.el );
1729 new Xcls_btn_delproj( _this );
1730 this.el.pack_start ( _this.btn_delproj.el );
1731 new Xcls_btn_addfile( _this );
1732 this.el.pack_start ( _this.btn_addfile.el );
1733 new Xcls_btn_delfile( _this );
1734 this.el.pack_start ( _this.btn_delfile.el );
1737 // user defined functions
1739 public class Xcls_Button45 : Object
1741 public Gtk.Button el;
1742 private DialogFiles _this;
1748 public Xcls_Button45(DialogFiles _owner )
1751 this.el = new Gtk.Button();
1755 // set gobject values
1756 this.el.label = "Close / Cancel";
1759 this.el.clicked.connect( ( ) => {
1760 if (BuilderApplication.windows.size < 2 &&
1761 _this.win.windowstate.file == null
1763 BuilderApplication.singleton(null).quit();
1769 if (_this.win.windowstate.file == null) {
1770 BuilderApplication.removeWindow(_this.win);
1779 // user defined functions
1782 public class Xcls_btn_newproj : Object
1784 public Gtk.Button el;
1785 private DialogFiles _this;
1791 public Xcls_btn_newproj(DialogFiles _owner )
1794 _this.btn_newproj = this;
1795 this.el = new Gtk.Button();
1799 // set gobject values
1800 var child_1 = new Xcls_Box47( _this );
1801 this.el.child = child_1.el;
1804 this.el.clicked.connect( ( ) => {
1806 // create a new file in project..
1807 //Xcls_DialogNewComponent.singleton().show(
1808 var pe = EditProject.singleton();
1809 pe.windowstate = _this.win.windowstate;
1811 pe.el.application = _this.win.el.application;
1812 pe.el.set_transient_for( _this.el );
1814 var cb = new Project.Callback();
1815 cb.call.connect((pr) => {
1816 _this.show( pr , _this.new_window);
1825 // user defined functions
1826 public void onCreated () {
1827 var pe = EditProject.singleton();
1829 _this.show( pe.result , _this.new_window);
1832 public class Xcls_Box47 : Object
1835 private DialogFiles _this;
1841 public Xcls_Box47(DialogFiles _owner )
1844 this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
1848 // set gobject values
1849 var child_1 = new Xcls_Image48( _this );
1851 this.el.append( child_1.el );
1852 var child_2 = new Xcls_Label49( _this );
1854 this.el.append( child_2.el );
1857 // user defined functions
1859 public class Xcls_Image48 : Object
1861 public Gtk.Image el;
1862 private DialogFiles _this;
1868 public Xcls_Image48(DialogFiles _owner )
1871 this.el = new Gtk.Image();
1875 // set gobject values
1876 this.el.icon_name = "folder-new";
1877 this.el.margin_end = 4;
1878 this.el.icon_size = Gtk.IconSize.NORMAL;
1881 // user defined functions
1884 public class Xcls_Label49 : Object
1886 public Gtk.Label el;
1887 private DialogFiles _this;
1893 public Xcls_Label49(DialogFiles _owner )
1896 this.el = new Gtk.Label( "New Project" );
1900 // set gobject values
1901 this.el.halign = Gtk.Align.START;
1904 // user defined functions
1909 public class Xcls_btn_projprop : Object
1911 public Gtk.Button el;
1912 private DialogFiles _this;
1918 public Xcls_btn_projprop(DialogFiles _owner )
1921 _this.btn_projprop = this;
1922 this.el = new Gtk.Button();
1926 // set gobject values
1927 var child_1 = new Xcls_Box51( _this );
1928 this.el.child = child_1.el;
1931 this.el.clicked.connect( ( ) => {
1932 // should disable the button really.
1933 if (_this.selectedProject == null) {
1936 _this.win.windowstate.projectPopoverShow(_this.el, _this.selectedProject, null);
1940 // user defined functions
1942 public class Xcls_Box51 : Object
1945 private DialogFiles _this;
1951 public Xcls_Box51(DialogFiles _owner )
1954 this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
1958 // set gobject values
1959 var child_1 = new Xcls_Image52( _this );
1961 this.el.append( child_1.el );
1962 var child_2 = new Xcls_Label53( _this );
1964 this.el.append( child_2.el );
1967 // user defined functions
1969 public class Xcls_Image52 : Object
1971 public Gtk.Image el;
1972 private DialogFiles _this;
1978 public Xcls_Image52(DialogFiles _owner )
1981 this.el = new Gtk.Image();
1985 // set gobject values
1986 this.el.icon_name = "emblem-system";
1987 this.el.margin_end = 4;
1990 // user defined functions
1993 public class Xcls_Label53 : Object
1995 public Gtk.Label el;
1996 private DialogFiles _this;
2002 public Xcls_Label53(DialogFiles _owner )
2005 this.el = new Gtk.Label( "Project Properties" );
2009 // set gobject values
2012 // user defined functions
2017 public class Xcls_btn_delproj : Object
2019 public Gtk.Button el;
2020 private DialogFiles _this;
2024 public DialogConfirm confirm;
2027 public Xcls_btn_delproj(DialogFiles _owner )
2030 _this.btn_delproj = this;
2031 this.el = new Gtk.Button();
2034 this.confirm = null;
2036 // set gobject values
2037 var child_1 = new Xcls_Box55( _this );
2038 this.el.child = child_1.el;
2041 this.el.clicked.connect( ( ) => {
2044 if (this.confirm == null) {
2045 this.confirm = new DialogConfirm();
2046 this.confirm.el.set_transient_for(_this.el);
2049 var project = (Project.Project) _this.projectsort.el.get_item(
2050 _this.projectselection.el.selected
2053 this.confirm.el.response.connect((res) => {
2054 this.confirm.el.hide();
2055 if (res == Gtk.ResponseType.CANCEL) {
2058 project = (Project.Project) _this.projectsort.el.get_item(
2059 _this.projectselection.el.selected
2061 Project.Project.remove(project);
2062 _this.projectmodel.remove(project);
2063 _this.projectselection.el.selected = Gtk.INVALID_LIST_POSITION;
2066 this.confirm.showIt("Confirm Delete Project", "Are you sure you want to delete this project?");
2070 // user defined functions
2072 public class Xcls_Box55 : Object
2075 private DialogFiles _this;
2081 public Xcls_Box55(DialogFiles _owner )
2084 this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
2088 // set gobject values
2089 var child_1 = new Xcls_Image56( _this );
2091 this.el.append( child_1.el );
2092 var child_2 = new Xcls_Label57( _this );
2094 this.el.append( child_2.el );
2097 // user defined functions
2099 public class Xcls_Image56 : Object
2101 public Gtk.Image el;
2102 private DialogFiles _this;
2108 public Xcls_Image56(DialogFiles _owner )
2111 this.el = new Gtk.Image();
2115 // set gobject values
2116 this.el.icon_name = "user-trash";
2119 // user defined functions
2122 public class Xcls_Label57 : Object
2124 public Gtk.Label el;
2125 private DialogFiles _this;
2131 public Xcls_Label57(DialogFiles _owner )
2134 this.el = new Gtk.Label( "Delete Project" );
2138 // set gobject values
2141 // user defined functions
2146 public class Xcls_btn_addfile : Object
2148 public Gtk.Button el;
2149 private DialogFiles _this;
2155 public Xcls_btn_addfile(DialogFiles _owner )
2158 _this.btn_addfile = this;
2159 this.el = new Gtk.Button();
2163 // set gobject values
2164 var child_1 = new Xcls_Box59( _this );
2165 this.el.child = child_1.el;
2168 this.el.clicked.connect( () => {
2169 // create a new file in project..
2170 print("add file selected\n");
2172 if (_this.selectedProject == null) {
2176 var f = JsRender.JsRender.factory(_this.selectedProject.xtype, _this.selectedProject, "");
2177 _this.win.windowstate.file_details.show( f, _this.el, _this.new_window );
2178 } catch (JsRender.Error e) {}
2183 // user defined functions
2185 public class Xcls_Box59 : Object
2188 private DialogFiles _this;
2194 public Xcls_Box59(DialogFiles _owner )
2197 this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
2201 // set gobject values
2202 var child_1 = new Xcls_Image60( _this );
2204 this.el.append( child_1.el );
2205 var child_2 = new Xcls_Label61( _this );
2207 this.el.append( child_2.el );
2210 // user defined functions
2212 public class Xcls_Image60 : Object
2214 public Gtk.Image el;
2215 private DialogFiles _this;
2221 public Xcls_Image60(DialogFiles _owner )
2224 this.el = new Gtk.Image();
2228 // set gobject values
2229 this.el.icon_name = "document-new";
2230 this.el.margin_end = 4;
2233 // user defined functions
2236 public class Xcls_Label61 : Object
2238 public Gtk.Label el;
2239 private DialogFiles _this;
2245 public Xcls_Label61(DialogFiles _owner )
2248 this.el = new Gtk.Label( "New File" );
2252 // set gobject values
2255 // user defined functions
2260 public class Xcls_btn_delfile : Object
2262 public Gtk.Button el;
2263 private DialogFiles _this;
2267 public DialogConfirm confirm;
2270 public Xcls_btn_delfile(DialogFiles _owner )
2273 _this.btn_delfile = this;
2274 this.el = new Gtk.Button();
2277 this.confirm = null;
2279 // set gobject values
2280 var child_1 = new Xcls_Box63( _this );
2281 this.el.child = child_1.el;
2284 this.el.clicked.connect( ( ) => {
2286 if (this.confirm == null) {
2287 this.confirm = new DialogConfirm();
2288 this.confirm.el.set_transient_for(_this.el);
2291 GLib.debug("DELETE");
2293 var isel = _this.iconsel.selectedFile();
2296 GLib.debug("DELETE - no icons selected");
2298 isel = _this.treeselmodel.selectedFile();
2301 GLib.debug("DELETE - no tree item selected");
2302 return; // should nto happen..
2305 GLib.debug("DELETE - calling confirm.");
2306 this.confirm.el.response.connect((res) => {
2307 this.confirm.el.hide();
2308 if (res == Gtk.ResponseType.CANCEL) {
2312 isel = _this.iconsel.selectedFile();
2315 isel = _this.treeselmodel.selectedFile();
2318 return; // should nto happen..
2322 isel.project.deleteFile(isel);
2323 _this.gridmodel.remove(isel);
2326 isel.project.deleteFile(isel);
2329 this.confirm.showIt("Confirm Delete File",
2330 "Are you sure you want to delete this file?");
2337 // user defined functions
2339 public class Xcls_Box63 : Object
2342 private DialogFiles _this;
2348 public Xcls_Box63(DialogFiles _owner )
2351 this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
2355 // set gobject values
2356 var child_1 = new Xcls_Image64( _this );
2358 this.el.append( child_1.el );
2359 var child_2 = new Xcls_Label65( _this );
2361 this.el.append( child_2.el );
2364 // user defined functions
2366 public class Xcls_Image64 : Object
2368 public Gtk.Image el;
2369 private DialogFiles _this;
2375 public Xcls_Image64(DialogFiles _owner )
2378 this.el = new Gtk.Image();
2382 // set gobject values
2383 this.el.icon_name = "user-trash";
2386 // user defined functions
2389 public class Xcls_Label65 : Object
2391 public Gtk.Label el;
2392 private DialogFiles _this;
2398 public Xcls_Label65(DialogFiles _owner )
2401 this.el = new Gtk.Label( "Delete File" );
2405 // set gobject values
2408 // user defined functions