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 () {
182 _this.is_loading = true;
185 Project.Project.loadAll();
186 _this.project_list.el.set_model(new Gtk.SingleSelection(null));
187 Project.Project.loadIntoStore(this.projectmodel.el);
189 _this.project_list.el.set_model(_this.projectselection.el);
191 _this.is_loading = false;
193 _this.projectselection.el.selected = Gtk.INVALID_LIST_POSITION;
194 _this.btn_delfile.el.hide();
198 public class Xcls_Box2 : Object
201 private DialogFiles _this;
208 public Xcls_Box2(DialogFiles _owner )
211 this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
216 // set gobject values
217 this.el.homogeneous = false;
218 this.el.margin_end = 10;
219 this.el.margin_start = 10;
220 this.el.margin_bottom = 10;
221 this.el.margin_top = 10;
222 var child_1 = new Xcls_Box3( _this );
224 this.el.append( child_1.el );
225 new Xcls_mainpane( _this );
226 this.el.append( _this.mainpane.el );
229 // user defined functions
231 public class Xcls_Box3 : Object
234 private DialogFiles _this;
240 public Xcls_Box3(DialogFiles _owner )
243 this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
247 // set gobject values
248 this.el.hexpand = true;
251 // user defined functions
254 public class Xcls_mainpane : Object
257 private DialogFiles _this;
261 public bool homogeneous;
265 public Xcls_mainpane(DialogFiles _owner )
268 _this.mainpane = this;
269 this.el = new Gtk.Paned( Gtk.Orientation.HORIZONTAL );
272 this.homogeneous = false;
275 // set gobject values
276 this.el.hexpand = true;
277 this.el.vexpand = true;
278 this.el.position = 200;
279 new Xcls_projectscroll( _this );
280 this.el.start_child = _this.projectscroll.el;
281 new Xcls_filepane( _this );
282 this.el.end_child = _this.filepane.el;
285 // user defined functions
287 public class Xcls_projectscroll : Object
289 public Gtk.ScrolledWindow el;
290 private DialogFiles _this;
297 public Xcls_projectscroll(DialogFiles _owner )
300 _this.projectscroll = this;
301 this.el = new Gtk.ScrolledWindow();
306 // set gobject values
307 this.el.width_request = 150;
308 this.el.has_frame = true;
309 this.el.hexpand = true;
310 this.el.vexpand = true;
311 new Xcls_project_list( _this );
312 this.el.child = _this.project_list.el;
316 this.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);
319 // user defined functions
321 public class Xcls_project_list : Object
323 public Gtk.ColumnView el;
324 private DialogFiles _this;
328 public Gtk.CssProvider css;
331 public Xcls_project_list(DialogFiles _owner )
334 _this.project_list = this;
335 new Xcls_projectselection( _this );
336 this.el = new Gtk.ColumnView( _this.projectselection.el );
340 // set gobject values
341 this.el.name = "project-list";
342 var child_2 = new Xcls_ColumnViewColumn12( _this );
344 this.el.append_column ( child_2.el );
350 this.css = new Gtk.CssProvider();
352 this.css.load_from_string("
353 #project-list { font-size: 12px;}
356 Gtk.StyleContext.add_provider_for_display(
357 this.el.get_display(),
359 Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION
366 // user defined functions
368 public class Xcls_projectselection : Object
370 public Gtk.SingleSelection el;
371 private DialogFiles _this;
377 public Xcls_projectselection(DialogFiles _owner )
380 _this.projectselection = this;
381 new Xcls_projectsort( _this );
382 this.el = new Gtk.SingleSelection( _this.projectsort.el );
386 // set gobject values
387 this.el.can_unselect = true;
390 this.el.notify["selected"].connect( (position, n_items) => {
392 if (_this.is_loading) {
396 if (this.el.selected == Gtk.INVALID_LIST_POSITION) {
397 _this.btn_delproj.el.hide();
398 _this.btn_projprop.el.hide();
399 _this.btn_addfile.el.hide();
400 //_this.btn_delfile.el.hide();
403 _this.btn_delproj.el.show();
404 _this.btn_projprop.el.show();
405 _this.btn_addfile.el.show();
406 //_this.btn_delfile.el.show(); // ??
413 if (_this.is_loading) {
417 Project.Project project = this.el.selected == Gtk.INVALID_LIST_POSITION ? null :
418 (Project.Project) _this.projectsort.el.get_item(this.el.selected);
420 GLib.debug("selection changed to %s", project == null ? "none" : project.name);
422 _this.onProjectSelected(project);
426 // user defined functions
428 public class Xcls_projectsort : Object
430 public Gtk.SortListModel el;
431 private DialogFiles _this;
437 public Xcls_projectsort(DialogFiles _owner )
440 _this.projectsort = this;
441 new Xcls_projectmodel( _this );
442 var child_2 = new Xcls_StringSorter10( _this );
444 this.el = new Gtk.SortListModel( _this.projectmodel.el, child_2.el );
448 // set gobject values
449 this.el.incremental = true;
452 // user defined functions
454 public class Xcls_projectmodel : Object
456 public GLib.ListStore el;
457 private DialogFiles _this;
463 public Xcls_projectmodel(DialogFiles _owner )
466 _this.projectmodel = this;
467 this.el = new GLib.ListStore( typeof(Project.Project) );
471 // set gobject values
474 // user defined functions
475 public void remove (Project.Project p) {
477 for (var i =0;i < this.el.n_items; i++ ) {
478 var pr = (Project.Project) this.el.get_item(i);
479 if (p.path == pr.path) {
489 public class Xcls_StringSorter10 : Object
491 public Gtk.StringSorter el;
492 private DialogFiles _this;
498 public Xcls_StringSorter10(DialogFiles _owner )
501 var child_1 = new Xcls_PropertyExpression11( _this );
503 this.el = new Gtk.StringSorter( child_1.el );
507 // set gobject values
510 // user defined functions
512 public class Xcls_PropertyExpression11 : Object
514 public Gtk.PropertyExpression el;
515 private DialogFiles _this;
521 public Xcls_PropertyExpression11(DialogFiles _owner )
524 this.el = new Gtk.PropertyExpression( typeof(Project.Project), null, "name" );
528 // set gobject values
531 // user defined functions
537 public class Xcls_ColumnViewColumn12 : Object
539 public Gtk.ColumnViewColumn el;
540 private DialogFiles _this;
546 public Xcls_ColumnViewColumn12(DialogFiles _owner )
549 var child_1 = new Xcls_SignalListItemFactory13( _this );
551 this.el = new Gtk.ColumnViewColumn( "Project", child_1.el );
555 // set gobject values
556 this.el.expand = true;
559 // user defined functions
561 public class Xcls_SignalListItemFactory13 : Object
563 public Gtk.SignalListItemFactory el;
564 private DialogFiles _this;
570 public Xcls_SignalListItemFactory13(DialogFiles _owner )
573 this.el = new Gtk.SignalListItemFactory();
577 // set gobject values
580 this.el.setup.connect( (item) => {
581 //var j = (JsRender.JsRender) item;
582 var gi = (Gtk.ListItem)item;
584 var lbl = new Gtk.Label("");
585 lbl.halign = Gtk.Align.START;
591 this.el.bind.connect( (listitem) => {
593 var lbl = (Gtk.Label) ((Gtk.ListItem)listitem).get_child();
595 var item = (Project.Project) ((Gtk.ListItem)listitem).get_item();
597 item.bind_property("name",
599 GLib.BindingFlags.SYNC_CREATE);
605 // user defined functions
611 public class Xcls_filepane : Object
614 private DialogFiles _this;
620 public Xcls_filepane(DialogFiles _owner )
623 _this.filepane = this;
624 this.el = new Gtk.Paned( Gtk.Orientation.HORIZONTAL );
628 // set gobject values
629 this.el.position = 200;
630 this.el.visible = false;
631 var child_1 = new Xcls_Box15( _this );
632 this.el.end_child = child_1.el;
633 new Xcls_treescroll( _this );
634 this.el.start_child = _this.treescroll.el;
637 // user defined functions
639 public class Xcls_Box15 : Object
642 private DialogFiles _this;
648 public Xcls_Box15(DialogFiles _owner )
651 this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
655 // set gobject values
656 this.el.hexpand = true;
657 this.el.vexpand = true;
658 var child_1 = new Xcls_Box16( _this );
660 this.el.append( child_1.el );
661 new Xcls_iconscroll( _this );
662 this.el.append( _this.iconscroll.el );
665 // user defined functions
667 public class Xcls_Box16 : Object
670 private DialogFiles _this;
676 public Xcls_Box16(DialogFiles _owner )
679 this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
683 // set gobject values
684 this.el.hexpand = true;
685 new Xcls_searchbox( _this );
686 this.el.append( _this.searchbox.el );
689 // user defined functions
691 public class Xcls_searchbox : Object
693 public Gtk.SearchEntry el;
694 private DialogFiles _this;
698 public Gtk.CssProvider css;
701 public Xcls_searchbox(DialogFiles _owner )
704 _this.searchbox = this;
705 this.el = new Gtk.SearchEntry();
709 // set gobject values
710 this.el.name = "popover-files-iconsearch";
711 this.el.hexpand = true;
712 this.el.placeholder_text = "type to filter results";
713 this.el.search_delay = 1000;
718 this.css = new Gtk.CssProvider();
720 this.css.load_from_data("#popover-files-iconsearch { font: 10px monospace;}".data);
722 this.el.get_style_context().add_provider(this.css,Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION);
728 this.el.search_changed.connect( ( ) => {
730 _this.treefilter.el.changed(Gtk.FilterChange.DIFFERENT);
731 _this.iconsearch.el.set_search(this.el.text);
735 // user defined functions
739 public class Xcls_iconscroll : Object
741 public Gtk.ScrolledWindow el;
742 private DialogFiles _this;
748 public Xcls_iconscroll(DialogFiles _owner )
751 _this.iconscroll = this;
752 this.el = new Gtk.ScrolledWindow();
756 // set gobject values
757 this.el.has_frame = true;
758 this.el.hexpand = true;
759 this.el.vexpand = true;
760 new Xcls_gridview( _this );
761 this.el.child = _this.gridview.el;
765 this.el.set_policy (Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC);
768 // user defined functions
770 public class Xcls_gridview : Object
772 public Gtk.GridView el;
773 private DialogFiles _this;
779 public Xcls_gridview(DialogFiles _owner )
782 _this.gridview = this;
783 new Xcls_iconsel( _this );
784 var child_2 = new Xcls_SignalListItemFactory29( _this );
786 this.el = new Gtk.GridView( _this.iconsel.el, child_2.el );
790 // set gobject values
791 var child_3 = new Xcls_GestureClick20( _this );
793 this.el.add_controller( child_3.el );
796 // user defined functions
798 public class Xcls_GestureClick20 : Object
800 public Gtk.GestureClick el;
801 private DialogFiles _this;
807 public Xcls_GestureClick20(DialogFiles _owner )
810 this.el = new Gtk.GestureClick();
814 // set gobject values
817 this.el.pressed.connect( (n_press, x, y) => {
819 GLib.debug("double cliced");
823 var f = (JsRender.JsRender)_this.iconsel.el.selected_item;
825 GLib.debug("Click %s", f.name);
826 if (f.xtype == "Dir") {
831 _this.win.windowstate.fileViewOpen(f, _this.new_window);
840 // user defined functions
843 public class Xcls_iconsel : Object
845 public Gtk.SingleSelection el;
846 private DialogFiles _this;
852 public Xcls_iconsel(DialogFiles _owner )
855 _this.iconsel = this;
856 var child_1 = new Xcls_FilterListModel22( _this );
858 this.el = new Gtk.SingleSelection( child_1.el );
862 // set gobject values
863 this.el.can_unselect = true;
866 this.el.notify["selected"].connect( () => {
867 if (this.el.selected == Gtk.INVALID_LIST_POSITION) {
868 if (_this.treeselmodel.el.selected == Gtk.INVALID_LIST_POSITION) {
869 _this.btn_delfile.el.hide();
874 _this.btn_delfile.el.show();
875 _this.treeselmodel.el.selected = Gtk.INVALID_LIST_POSITION;
881 // user defined functions
882 public JsRender.JsRender? selectedFile () {
884 if (this.el.selected == Gtk.INVALID_LIST_POSITION) {
887 return (JsRender.JsRender)this.el.get_item(this.el.selected);
892 public class Xcls_FilterListModel22 : Object
894 public Gtk.FilterListModel el;
895 private DialogFiles _this;
901 public Xcls_FilterListModel22(DialogFiles _owner )
904 new Xcls_gridsort( _this );
905 new Xcls_iconsearch( _this );
906 this.el = new Gtk.FilterListModel( _this.gridsort.el, _this.iconsearch.el );
910 // set gobject values
913 // user defined functions
915 public class Xcls_gridsort : Object
917 public Gtk.SortListModel el;
918 private DialogFiles _this;
924 public Xcls_gridsort(DialogFiles _owner )
927 _this.gridsort = this;
928 new Xcls_gridmodel( _this );
929 var child_2 = new Xcls_StringSorter25( _this );
931 this.el = new Gtk.SortListModel( _this.gridmodel.el, child_2.el );
935 // set gobject values
938 // user defined functions
940 public class Xcls_gridmodel : Object
942 public GLib.ListStore el;
943 private DialogFiles _this;
949 public Xcls_gridmodel(DialogFiles _owner )
952 _this.gridmodel = this;
953 this.el = new GLib.ListStore( typeof(JsRender.JsRender) );
957 // set gobject values
960 // user defined functions
961 public void remove (JsRender.JsRender p) {
963 for (var i =0;i < this.el.n_items; i++ ) {
964 var pr = (JsRender.JsRender) this.el.get_item(i);
965 if (p.path == pr.path) {
974 public class Xcls_StringSorter25 : Object
976 public Gtk.StringSorter el;
977 private DialogFiles _this;
983 public Xcls_StringSorter25(DialogFiles _owner )
986 var child_1 = new Xcls_PropertyExpression26( _this );
988 this.el = new Gtk.StringSorter( child_1.el );
992 // set gobject values
993 this.el.ignore_case = true;
996 // user defined functions
998 public class Xcls_PropertyExpression26 : Object
1000 public Gtk.PropertyExpression el;
1001 private DialogFiles _this;
1007 public Xcls_PropertyExpression26(DialogFiles _owner )
1010 this.el = new Gtk.PropertyExpression( typeof(JsRender.JsRender), null, "name" );
1014 // set gobject values
1017 // user defined functions
1022 public class Xcls_iconsearch : Object
1024 public Gtk.StringFilter el;
1025 private DialogFiles _this;
1031 public Xcls_iconsearch(DialogFiles _owner )
1034 _this.iconsearch = this;
1035 var child_1 = new Xcls_PropertyExpression28( _this );
1037 this.el = new Gtk.StringFilter( child_1.el );
1041 // set gobject values
1042 this.el.match_mode = Gtk.StringFilterMatchMode.SUBSTRING;
1043 this.el.ignore_case = true;
1046 // user defined functions
1048 public class Xcls_PropertyExpression28 : Object
1050 public Gtk.PropertyExpression el;
1051 private DialogFiles _this;
1057 public Xcls_PropertyExpression28(DialogFiles _owner )
1060 this.el = new Gtk.PropertyExpression( typeof(JsRender.JsRender), null, "name" );
1064 // set gobject values
1067 // user defined functions
1073 public class Xcls_SignalListItemFactory29 : Object
1075 public Gtk.SignalListItemFactory el;
1076 private DialogFiles _this;
1082 public Xcls_SignalListItemFactory29(DialogFiles _owner )
1085 this.el = new Gtk.SignalListItemFactory();
1089 // set gobject values
1092 this.el.setup.connect( (item) => {
1093 //var j = (JsRender.JsRender) item;
1094 var gi = (Gtk.ListItem)item;
1095 var b = new Gtk.Box(Gtk.Orientation.VERTICAL,4);
1096 var i = new Gtk.Image();
1098 var t = new Gtk.Label("");
1103 b.has_tooltip = true;
1104 b.query_tooltip.connect((x, y, keyboard_tooltip, tooltip) => {
1105 var j = (JsRender.JsRender) gi.get_item();
1107 var ti = new Gtk.Image.from_file ( j.getIconFileName());
1108 ti.pixel_size = 368;
1109 tooltip.set_custom( ti );
1115 this.el.bind.connect( (listitem) => {
1117 var box = (Gtk.Box) ((Gtk.ListItem)listitem).get_child();
1119 var img = (Gtk.Image) box.get_first_child();
1120 var lbl = (Gtk.Label)img.get_next_sibling();
1122 var item = (JsRender.JsRender) ((Gtk.ListItem)listitem).get_item();
1123 //GLib.debug("set label name to %s", item.name);
1125 var ns = item.name.split(".");
1126 if (ns.length < 2) {
1127 lbl.label = item.name;
1130 item.name.substring(0, item.name.length - ns[ns.length-1].length)
1131 + "\n"+ ns[ns.length-1];
1135 item.bind_property("name",
1137 GLib.BindingFlags.SYNC_CREATE);
1140 img.set_from_file(item.getIconFileName());
1146 // user defined functions
1152 public class Xcls_treescroll : Object
1154 public Gtk.ScrolledWindow el;
1155 private DialogFiles _this;
1161 public Xcls_treescroll(DialogFiles _owner )
1164 _this.treescroll = this;
1165 this.el = new Gtk.ScrolledWindow();
1169 // set gobject values
1170 this.el.width_request = 200;
1171 this.el.has_frame = true;
1172 this.el.hexpand = true;
1173 this.el.vexpand = true;
1174 this.el.visible = true;
1175 new Xcls_treeview( _this );
1176 this.el.child = _this.treeview.el;
1180 this.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);
1183 // user defined functions
1185 public class Xcls_treeview : Object
1187 public Gtk.ColumnView el;
1188 private DialogFiles _this;
1192 public Gtk.CssProvider css;
1195 public Xcls_treeview(DialogFiles _owner )
1198 _this.treeview = this;
1199 new Xcls_treeselmodel( _this );
1200 this.el = new Gtk.ColumnView( _this.treeselmodel.el );
1204 // set gobject values
1205 this.el.name = "file-list";
1206 var child_2 = new Xcls_GestureClick32( _this );
1208 this.el.add_controller( child_2.el );
1209 new Xcls_name( _this );
1210 this.el.append_column ( _this.name.el );
1216 this.css = new Gtk.CssProvider();
1218 this.css.load_from_string("
1219 #file-list { font-size: 12px;}
1221 -gtk-icon-size : 2px;
1223 #file-list indent:nth-last-child(2) {
1228 Gtk.StyleContext.add_provider_for_display(
1229 this.el.get_display(),
1231 Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION
1237 // user defined functions
1239 public class Xcls_GestureClick32 : Object
1241 public Gtk.GestureClick el;
1242 private DialogFiles _this;
1248 public Xcls_GestureClick32(DialogFiles _owner )
1251 this.el = new Gtk.GestureClick();
1255 // set gobject values
1258 this.el.pressed.connect( (n_press, x, y) => {
1260 GLib.debug("double cliced");
1264 var tr = (Gtk.TreeListRow)_this.treeselmodel.el.selected_item;
1265 GLib.debug("SELECTED = %s", tr.item.get_type().name());
1266 var f = (JsRender.JsRender) tr.item;
1267 GLib.debug("Click %s", f.name);
1268 if (f.xtype == "Dir") {
1273 _this.win.windowstate.fileViewOpen(f, _this.new_window);
1282 // user defined functions
1285 public class Xcls_treeselmodel : Object
1287 public Gtk.SingleSelection el;
1288 private DialogFiles _this;
1294 public Xcls_treeselmodel(DialogFiles _owner )
1297 _this.treeselmodel = this;
1298 var child_1 = new Xcls_FilterListModel34( _this );
1300 this.el = new Gtk.SingleSelection( child_1.el );
1304 // set gobject values
1305 this.el.can_unselect = true;
1308 this.el.notify["selected"].connect( () => {
1309 if (this.el.selected == Gtk.INVALID_LIST_POSITION) {
1310 if (_this.iconsel.el.selected == Gtk.INVALID_LIST_POSITION) {
1311 _this.btn_delfile.el.hide();
1316 var tr = (Gtk.TreeListRow)_this.treeselmodel.el.selected_item;
1317 GLib.debug("SELECTED = %s", tr.item.get_type().name());
1318 var f = (JsRender.JsRender) tr.item;
1319 if (f.xtype == "Dir") {
1320 _this.btn_delfile.el.hide();
1322 _this.btn_delfile.el.show();
1325 _this.iconsel.el.selected = Gtk.INVALID_LIST_POSITION;
1331 // user defined functions
1332 public JsRender.JsRender? selectedFile () {
1334 if (this.el.selected == Gtk.INVALID_LIST_POSITION) {
1337 var tr = (Gtk.TreeListRow) this.el.selected_item;
1339 return (JsRender.JsRender) tr.item;
1342 public class Xcls_FilterListModel34 : Object
1344 public Gtk.FilterListModel el;
1345 private DialogFiles _this;
1351 public Xcls_FilterListModel34(DialogFiles _owner )
1354 new Xcls_treelistsort( _this );
1355 new Xcls_treefilter( _this );
1356 this.el = new Gtk.FilterListModel( _this.treelistsort.el, _this.treefilter.el );
1360 // set gobject values
1363 // user defined functions
1365 public class Xcls_treelistsort : Object
1367 public Gtk.SortListModel el;
1368 private DialogFiles _this;
1374 public Xcls_treelistsort(DialogFiles _owner )
1377 _this.treelistsort = this;
1378 new Xcls_treelistmodel( _this );
1379 var child_2 = new Xcls_TreeListRowSorter38( _this );
1381 this.el = new Gtk.SortListModel( _this.treelistmodel.el, child_2.el );
1385 // set gobject values
1386 this.el.incremental = true;
1389 // user defined functions
1391 public class Xcls_treelistmodel : Object
1393 public Gtk.TreeListModel el;
1394 private DialogFiles _this;
1400 public Xcls_treelistmodel(DialogFiles _owner )
1403 _this.treelistmodel = this;
1404 new Xcls_treemodel( _this );
1405 this.el = new Gtk.TreeListModel( _this.treemodel.el, false, true, (item) => {
1406 //GLib.debug("liststore got %s", item.get_type().name());
1407 return ((JsRender.JsRender)item).childfiles;
1412 // set gobject values
1415 // user defined functions
1417 public class Xcls_treemodel : Object
1419 public GLib.ListStore el;
1420 private DialogFiles _this;
1426 public Xcls_treemodel(DialogFiles _owner )
1429 _this.treemodel = this;
1430 this.el = new GLib.ListStore( typeof(JsRender.JsRender) );
1434 // set gobject values
1437 // user defined functions
1441 public class Xcls_TreeListRowSorter38 : Object
1443 public Gtk.TreeListRowSorter el;
1444 private DialogFiles _this;
1450 public Xcls_TreeListRowSorter38(DialogFiles _owner )
1453 var child_1 = new Xcls_StringSorter39( _this );
1455 this.el = new Gtk.TreeListRowSorter( child_1.el );
1459 // set gobject values
1462 // user defined functions
1464 public class Xcls_StringSorter39 : Object
1466 public Gtk.StringSorter el;
1467 private DialogFiles _this;
1473 public Xcls_StringSorter39(DialogFiles _owner )
1476 var child_1 = new Xcls_PropertyExpression40( _this );
1478 this.el = new Gtk.StringSorter( child_1.el );
1482 // set gobject values
1483 this.el.ignore_case = true;
1486 // user defined functions
1488 public class Xcls_PropertyExpression40 : Object
1490 public Gtk.PropertyExpression el;
1491 private DialogFiles _this;
1497 public Xcls_PropertyExpression40(DialogFiles _owner )
1500 this.el = new Gtk.PropertyExpression( typeof(JsRender.JsRender) , null, "name" );
1504 // set gobject values
1507 // user defined functions
1513 public class Xcls_treefilter : Object
1515 public Gtk.CustomFilter el;
1516 private DialogFiles _this;
1522 public Xcls_treefilter(DialogFiles _owner )
1525 _this.treefilter = this;
1526 this.el = new Gtk.CustomFilter( (item) => {
1527 var tr = ((Gtk.TreeListRow)item).get_item();
1528 //GLib.debug("filter %s", tr.get_type().name());
1529 var j = (JsRender.JsRender) tr;
1530 if (j.xtype == "Dir" && j.childfiles.n_items < 1) {
1533 var str = _this.searchbox.el.text.down();
1534 if (j.xtype == "Dir") {
1537 for (var i =0 ; i < j.childfiles.n_items; i++) {
1538 var f = (JsRender.JsRender) j.childfiles.get_item(i);
1539 if (f.xtype != "PlainFile") {
1542 if (f.content_type.contains("image")) {
1545 if (str.length < 1) {
1548 if (f.name.down().contains(str)) {
1556 if (j.xtype != "PlainFile") {
1559 if (j.content_type.contains("image")) {
1563 if (str.length < 1) { // no search.
1566 if (j.name.down().contains(str)) {
1575 // set gobject values
1578 // user defined functions
1583 public class Xcls_name : Object
1585 public Gtk.ColumnViewColumn el;
1586 private DialogFiles _this;
1592 public Xcls_name(DialogFiles _owner )
1596 var child_1 = new Xcls_SignalListItemFactory43( _this );
1598 this.el = new Gtk.ColumnViewColumn( "General Files", child_1.el );
1602 // set gobject values
1603 this.el.id = "name";
1604 this.el.expand = true;
1605 this.el.resizable = true;
1610 // this.el.set_sorter( new Gtk.StringSorter(
1611 // new Gtk.PropertyExpression(typeof(JsRender.NodeProp), null, "name")
1617 // user defined functions
1619 public class Xcls_SignalListItemFactory43 : Object
1621 public Gtk.SignalListItemFactory el;
1622 private DialogFiles _this;
1628 public Xcls_SignalListItemFactory43(DialogFiles _owner )
1631 this.el = new Gtk.SignalListItemFactory();
1635 // set gobject values
1638 this.el.setup.connect( (listitem) => {
1640 var expand = new Gtk.TreeExpander();
1642 expand.set_indent_for_depth(true);
1643 expand.set_indent_for_icon(true);
1644 var hbox = new Gtk.Box(Gtk.Orientation.HORIZONTAL,0);
1645 var icon = new Gtk.Image();
1646 icon.margin_end = 4;
1647 var lbl = new Gtk.Label("");
1648 lbl.use_markup = true;
1651 lbl.justify = Gtk.Justification.LEFT;
1656 expand.set_child(hbox);
1657 ((Gtk.ListItem)listitem).set_child(expand);
1658 ((Gtk.ListItem)listitem).activatable = false;
1660 this.el.bind.connect( (listitem) => {
1662 //GLib.debug("listitme is is %s", ((Gtk.ListItem)listitem).get_type().name());
1666 //var expand = (Gtk.TreeExpander) ((Gtk.ListItem)listitem).get_child();
1667 var expand = (Gtk.TreeExpander) ((Gtk.ListItem)listitem).get_child();
1669 var hbox = (Gtk.Box) expand.child;
1672 var img = (Gtk.Image) hbox.get_first_child();
1673 var lbl = (Gtk.Label) img.get_next_sibling();
1677 if (lbl.label != "") { // do not update
1680 var lr = (Gtk.TreeListRow)((Gtk.ListItem)listitem).get_item();
1681 //GLib.debug("LR = %s", lr.get_type().name());
1684 var jr =(JsRender.JsRender) lr.get_item();
1685 //GLib.debug("JR = %s", jr.get_type().name());
1688 GLib.debug("Problem getting item");
1692 jr.bind_property("icon",
1694 GLib.BindingFlags.SYNC_CREATE);
1696 //GLib.debug("change %s to %s", lbl.label, np.name);
1697 lbl.label = jr.name; // for dir's we could hsow the sub path..
1698 lbl.tooltip_markup = jr.path;
1700 expand.set_hide_expander( jr.xtype != "Dir" );
1701 expand.set_list_row(lr);
1708 // user defined functions
1717 public class Xcls_HeaderBar44 : Object
1719 public Gtk.HeaderBar el;
1720 private DialogFiles _this;
1726 public Xcls_HeaderBar44(DialogFiles _owner )
1729 this.el = new Gtk.HeaderBar();
1733 // set gobject values
1734 this.el.show_title_buttons = false;
1735 var child_1 = new Xcls_Button45( _this );
1737 this.el.pack_end ( child_1.el );
1738 new Xcls_btn_newproj( _this );
1739 this.el.pack_start ( _this.btn_newproj.el );
1740 new Xcls_btn_projprop( _this );
1741 this.el.pack_start ( _this.btn_projprop.el );
1742 new Xcls_btn_delproj( _this );
1743 this.el.pack_start ( _this.btn_delproj.el );
1744 new Xcls_btn_addfile( _this );
1745 this.el.pack_start ( _this.btn_addfile.el );
1746 new Xcls_btn_delfile( _this );
1747 this.el.pack_start ( _this.btn_delfile.el );
1750 // user defined functions
1752 public class Xcls_Button45 : Object
1754 public Gtk.Button el;
1755 private DialogFiles _this;
1761 public Xcls_Button45(DialogFiles _owner )
1764 this.el = new Gtk.Button();
1768 // set gobject values
1769 this.el.label = "Close / Cancel";
1772 this.el.clicked.connect( ( ) => {
1773 if (BuilderApplication.windows.size < 2 &&
1774 _this.win.windowstate.file == null
1776 BuilderApplication.singleton(null).quit();
1782 if (_this.win.windowstate.file == null) {
1783 BuilderApplication.removeWindow(_this.win);
1792 // user defined functions
1795 public class Xcls_btn_newproj : Object
1797 public Gtk.Button el;
1798 private DialogFiles _this;
1804 public Xcls_btn_newproj(DialogFiles _owner )
1807 _this.btn_newproj = this;
1808 this.el = new Gtk.Button();
1812 // set gobject values
1813 var child_1 = new Xcls_Box47( _this );
1814 this.el.child = child_1.el;
1817 this.el.clicked.connect( ( ) => {
1819 // create a new file in project..
1820 //Xcls_DialogNewComponent.singleton().show(
1821 var pe = EditProject.singleton();
1822 pe.windowstate = _this.win.windowstate;
1824 pe.el.application = _this.win.el.application;
1825 pe.el.set_transient_for( _this.el );
1827 var cb = new Project.Callback();
1828 cb.call.connect((pr) => {
1829 _this.show( pr , _this.new_window);
1838 // user defined functions
1839 public void onCreated () {
1840 var pe = EditProject.singleton();
1842 _this.show( pe.result , _this.new_window);
1845 public class Xcls_Box47 : Object
1848 private DialogFiles _this;
1854 public Xcls_Box47(DialogFiles _owner )
1857 this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
1861 // set gobject values
1862 var child_1 = new Xcls_Image48( _this );
1864 this.el.append( child_1.el );
1865 var child_2 = new Xcls_Label49( _this );
1867 this.el.append( child_2.el );
1870 // user defined functions
1872 public class Xcls_Image48 : Object
1874 public Gtk.Image el;
1875 private DialogFiles _this;
1881 public Xcls_Image48(DialogFiles _owner )
1884 this.el = new Gtk.Image();
1888 // set gobject values
1889 this.el.icon_name = "folder-new";
1890 this.el.margin_end = 4;
1891 this.el.icon_size = Gtk.IconSize.NORMAL;
1894 // user defined functions
1897 public class Xcls_Label49 : Object
1899 public Gtk.Label el;
1900 private DialogFiles _this;
1906 public Xcls_Label49(DialogFiles _owner )
1909 this.el = new Gtk.Label( "New Project" );
1913 // set gobject values
1914 this.el.halign = Gtk.Align.START;
1917 // user defined functions
1922 public class Xcls_btn_projprop : Object
1924 public Gtk.Button el;
1925 private DialogFiles _this;
1931 public Xcls_btn_projprop(DialogFiles _owner )
1934 _this.btn_projprop = this;
1935 this.el = new Gtk.Button();
1939 // set gobject values
1940 var child_1 = new Xcls_Box51( _this );
1941 this.el.child = child_1.el;
1944 this.el.clicked.connect( ( ) => {
1945 // should disable the button really.
1946 if (_this.selectedProject == null) {
1949 _this.win.windowstate.projectPopoverShow(_this.el, _this.selectedProject, null);
1953 // user defined functions
1955 public class Xcls_Box51 : Object
1958 private DialogFiles _this;
1964 public Xcls_Box51(DialogFiles _owner )
1967 this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
1971 // set gobject values
1972 var child_1 = new Xcls_Image52( _this );
1974 this.el.append( child_1.el );
1975 var child_2 = new Xcls_Label53( _this );
1977 this.el.append( child_2.el );
1980 // user defined functions
1982 public class Xcls_Image52 : Object
1984 public Gtk.Image el;
1985 private DialogFiles _this;
1991 public Xcls_Image52(DialogFiles _owner )
1994 this.el = new Gtk.Image();
1998 // set gobject values
1999 this.el.icon_name = "emblem-system";
2000 this.el.margin_end = 4;
2003 // user defined functions
2006 public class Xcls_Label53 : Object
2008 public Gtk.Label el;
2009 private DialogFiles _this;
2015 public Xcls_Label53(DialogFiles _owner )
2018 this.el = new Gtk.Label( "Project Properties" );
2022 // set gobject values
2025 // user defined functions
2030 public class Xcls_btn_delproj : Object
2032 public Gtk.Button el;
2033 private DialogFiles _this;
2037 public DialogConfirm confirm;
2040 public Xcls_btn_delproj(DialogFiles _owner )
2043 _this.btn_delproj = this;
2044 this.el = new Gtk.Button();
2047 this.confirm = null;
2049 // set gobject values
2050 var child_1 = new Xcls_Box55( _this );
2051 this.el.child = child_1.el;
2054 this.el.clicked.connect( ( ) => {
2057 if (this.confirm == null) {
2058 this.confirm = new DialogConfirm();
2059 this.confirm.el.set_transient_for(_this.el);
2062 var project = (Project.Project) _this.projectsort.el.get_item(
2063 _this.projectselection.el.selected
2066 this.confirm.el.response.connect((res) => {
2067 this.confirm.el.hide();
2068 if (res == Gtk.ResponseType.CANCEL) {
2071 project = (Project.Project) _this.projectsort.el.get_item(
2072 _this.projectselection.el.selected
2074 Project.Project.remove(project);
2075 _this.projectmodel.remove(project);
2076 _this.projectselection.el.selected = Gtk.INVALID_LIST_POSITION;
2079 this.confirm.showIt("Confirm Delete Project", "Are you sure you want to delete this project?");
2083 // user defined functions
2085 public class Xcls_Box55 : Object
2088 private DialogFiles _this;
2094 public Xcls_Box55(DialogFiles _owner )
2097 this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
2101 // set gobject values
2102 var child_1 = new Xcls_Image56( _this );
2104 this.el.append( child_1.el );
2105 var child_2 = new Xcls_Label57( _this );
2107 this.el.append( child_2.el );
2110 // user defined functions
2112 public class Xcls_Image56 : Object
2114 public Gtk.Image el;
2115 private DialogFiles _this;
2121 public Xcls_Image56(DialogFiles _owner )
2124 this.el = new Gtk.Image();
2128 // set gobject values
2129 this.el.icon_name = "user-trash";
2132 // user defined functions
2135 public class Xcls_Label57 : Object
2137 public Gtk.Label el;
2138 private DialogFiles _this;
2144 public Xcls_Label57(DialogFiles _owner )
2147 this.el = new Gtk.Label( "Delete Project" );
2151 // set gobject values
2154 // user defined functions
2159 public class Xcls_btn_addfile : Object
2161 public Gtk.Button el;
2162 private DialogFiles _this;
2168 public Xcls_btn_addfile(DialogFiles _owner )
2171 _this.btn_addfile = this;
2172 this.el = new Gtk.Button();
2176 // set gobject values
2177 var child_1 = new Xcls_Box59( _this );
2178 this.el.child = child_1.el;
2181 this.el.clicked.connect( () => {
2182 // create a new file in project..
2183 print("add file selected\n");
2185 if (_this.selectedProject == null) {
2189 var f = JsRender.JsRender.factory(_this.selectedProject.xtype, _this.selectedProject, "");
2190 _this.win.windowstate.file_details.show( f, _this.el, _this.new_window );
2191 } catch (JsRender.Error e) {}
2196 // user defined functions
2198 public class Xcls_Box59 : Object
2201 private DialogFiles _this;
2207 public Xcls_Box59(DialogFiles _owner )
2210 this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
2214 // set gobject values
2215 var child_1 = new Xcls_Image60( _this );
2217 this.el.append( child_1.el );
2218 var child_2 = new Xcls_Label61( _this );
2220 this.el.append( child_2.el );
2223 // user defined functions
2225 public class Xcls_Image60 : Object
2227 public Gtk.Image el;
2228 private DialogFiles _this;
2234 public Xcls_Image60(DialogFiles _owner )
2237 this.el = new Gtk.Image();
2241 // set gobject values
2242 this.el.icon_name = "document-new";
2243 this.el.margin_end = 4;
2246 // user defined functions
2249 public class Xcls_Label61 : Object
2251 public Gtk.Label el;
2252 private DialogFiles _this;
2258 public Xcls_Label61(DialogFiles _owner )
2261 this.el = new Gtk.Label( "New File" );
2265 // set gobject values
2268 // user defined functions
2273 public class Xcls_btn_delfile : Object
2275 public Gtk.Button el;
2276 private DialogFiles _this;
2280 public DialogConfirm confirm;
2283 public Xcls_btn_delfile(DialogFiles _owner )
2286 _this.btn_delfile = this;
2287 this.el = new Gtk.Button();
2290 this.confirm = null;
2292 // set gobject values
2293 var child_1 = new Xcls_Box63( _this );
2294 this.el.child = child_1.el;
2297 this.el.clicked.connect( ( ) => {
2299 if (this.confirm == null) {
2300 this.confirm = new DialogConfirm();
2301 this.confirm.el.set_transient_for(_this.el);
2304 GLib.debug("DELETE");
2306 var isel = _this.iconsel.selectedFile();
2309 GLib.debug("DELETE - no icons selected");
2311 isel = _this.treeselmodel.selectedFile();
2314 GLib.debug("DELETE - no tree item selected");
2315 return; // should nto happen..
2318 GLib.debug("DELETE - calling confirm.");
2319 this.confirm.el.response.connect((res) => {
2320 this.confirm.el.hide();
2321 if (res == Gtk.ResponseType.CANCEL) {
2325 isel = _this.iconsel.selectedFile();
2328 isel = _this.treeselmodel.selectedFile();
2331 return; // should nto happen..
2335 isel.project.deleteFile(isel);
2336 _this.gridmodel.remove(isel);
2339 isel.project.deleteFile(isel);
2342 this.confirm.showIt("Confirm Delete File",
2343 "Are you sure you want to delete this file?");
2350 // user defined functions
2352 public class Xcls_Box63 : Object
2355 private DialogFiles _this;
2361 public Xcls_Box63(DialogFiles _owner )
2364 this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
2368 // set gobject values
2369 var child_1 = new Xcls_Image64( _this );
2371 this.el.append( child_1.el );
2372 var child_2 = new Xcls_Label65( _this );
2374 this.el.append( child_2.el );
2377 // user defined functions
2379 public class Xcls_Image64 : Object
2381 public Gtk.Image el;
2382 private DialogFiles _this;
2388 public Xcls_Image64(DialogFiles _owner )
2391 this.el = new Gtk.Image();
2395 // set gobject values
2396 this.el.icon_name = "user-trash";
2399 // user defined functions
2402 public class Xcls_Label65 : Object
2404 public Gtk.Label el;
2405 private DialogFiles _this;
2411 public Xcls_Label65(DialogFiles _owner )
2414 this.el = new Gtk.Label( "Delete File" );
2418 // set gobject values
2421 // user defined functions