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_Box1( _this );
71 this.el.child = child_1.el;
72 var child_2 = new Xcls_HeaderBar43( _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_Box1 : Object
201 private DialogFiles _this;
208 public Xcls_Box1(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_Box2( _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_Box2 : Object
234 private DialogFiles _this;
240 public Xcls_Box2(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_ColumnViewColumn11( _this );
344 this.el.append_column ( child_2.el );
347 // user defined functions
349 public class Xcls_projectselection : Object
351 public Gtk.SingleSelection el;
352 private DialogFiles _this;
358 public Xcls_projectselection(DialogFiles _owner )
361 _this.projectselection = this;
362 new Xcls_projectsort( _this );
363 this.el = new Gtk.SingleSelection( _this.projectsort.el );
367 // set gobject values
368 this.el.can_unselect = true;
371 this.el.notify["selected"].connect( (position, n_items) => {
373 if (_this.is_loading) {
377 if (this.el.selected == Gtk.INVALID_LIST_POSITION) {
378 _this.btn_delproj.el.hide();
379 _this.btn_projprop.el.hide();
380 _this.btn_addfile.el.hide();
381 //_this.btn_delfile.el.hide();
384 _this.btn_delproj.el.show();
385 _this.btn_projprop.el.show();
386 _this.btn_addfile.el.show();
387 //_this.btn_delfile.el.show(); // ??
394 if (_this.is_loading) {
398 Project.Project project = this.el.selected == Gtk.INVALID_LIST_POSITION ? null :
399 (Project.Project) _this.projectsort.el.get_item(this.el.selected);
401 GLib.debug("selection changed to %s", project == null ? "none" : project.name);
403 _this.onProjectSelected(project);
407 // user defined functions
409 public class Xcls_projectsort : Object
411 public Gtk.SortListModel el;
412 private DialogFiles _this;
418 public Xcls_projectsort(DialogFiles _owner )
421 _this.projectsort = this;
422 new Xcls_projectmodel( _this );
423 var child_2 = new Xcls_StringSorter9( _this );
425 this.el = new Gtk.SortListModel( _this.projectmodel.el, child_2.el );
429 // set gobject values
430 this.el.incremental = true;
433 // user defined functions
435 public class Xcls_projectmodel : Object
437 public GLib.ListStore el;
438 private DialogFiles _this;
444 public Xcls_projectmodel(DialogFiles _owner )
447 _this.projectmodel = this;
448 this.el = new GLib.ListStore( typeof(Project.Project) );
452 // set gobject values
455 // user defined functions
456 public void remove (Project.Project p) {
458 for (var i =0;i < this.el.n_items; i++ ) {
459 var pr = (Project.Project) this.el.get_item(i);
460 if (p.path == pr.path) {
470 public class Xcls_StringSorter9 : Object
472 public Gtk.StringSorter el;
473 private DialogFiles _this;
479 public Xcls_StringSorter9(DialogFiles _owner )
482 var child_1 = new Xcls_PropertyExpression10( _this );
484 this.el = new Gtk.StringSorter( child_1.el );
488 // set gobject values
491 // user defined functions
493 public class Xcls_PropertyExpression10 : Object
495 public Gtk.PropertyExpression el;
496 private DialogFiles _this;
502 public Xcls_PropertyExpression10(DialogFiles _owner )
505 this.el = new Gtk.PropertyExpression( typeof(Project.Project), null, "name" );
509 // set gobject values
512 // user defined functions
518 public class Xcls_ColumnViewColumn11 : Object
520 public Gtk.ColumnViewColumn el;
521 private DialogFiles _this;
527 public Xcls_ColumnViewColumn11(DialogFiles _owner )
530 var child_1 = new Xcls_SignalListItemFactory12( _this );
532 this.el = new Gtk.ColumnViewColumn( "Project", child_1.el );
536 // set gobject values
537 this.el.expand = true;
540 // user defined functions
542 public class Xcls_SignalListItemFactory12 : Object
544 public Gtk.SignalListItemFactory el;
545 private DialogFiles _this;
551 public Xcls_SignalListItemFactory12(DialogFiles _owner )
554 this.el = new Gtk.SignalListItemFactory();
558 // set gobject values
561 this.el.setup.connect( (item) => {
562 //var j = (JsRender.JsRender) item;
563 var gi = (Gtk.ListItem)item;
565 var lbl = new Gtk.Label("");
566 lbl.halign = Gtk.Align.START;
572 this.el.bind.connect( (listitem) => {
574 var lbl = (Gtk.Label) ((Gtk.ListItem)listitem).get_child();
576 var item = (Project.Project) ((Gtk.ListItem)listitem).get_item();
578 item.bind_property("name",
580 GLib.BindingFlags.SYNC_CREATE);
586 // user defined functions
592 public class Xcls_filepane : Object
595 private DialogFiles _this;
601 public Xcls_filepane(DialogFiles _owner )
604 _this.filepane = this;
605 this.el = new Gtk.Paned( Gtk.Orientation.HORIZONTAL );
609 // set gobject values
610 this.el.position = 200;
611 this.el.visible = false;
612 var child_1 = new Xcls_Box14( _this );
613 this.el.end_child = child_1.el;
614 new Xcls_treescroll( _this );
615 this.el.start_child = _this.treescroll.el;
618 // user defined functions
620 public class Xcls_Box14 : Object
623 private DialogFiles _this;
629 public Xcls_Box14(DialogFiles _owner )
632 this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
636 // set gobject values
637 this.el.hexpand = true;
638 this.el.vexpand = true;
639 var child_1 = new Xcls_Box15( _this );
641 this.el.append( child_1.el );
642 new Xcls_iconscroll( _this );
643 this.el.append( _this.iconscroll.el );
646 // user defined functions
648 public class Xcls_Box15 : Object
651 private DialogFiles _this;
657 public Xcls_Box15(DialogFiles _owner )
660 this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
664 // set gobject values
665 this.el.hexpand = true;
666 new Xcls_searchbox( _this );
667 this.el.append( _this.searchbox.el );
670 // user defined functions
672 public class Xcls_searchbox : Object
674 public Gtk.SearchEntry el;
675 private DialogFiles _this;
679 public Gtk.CssProvider css;
682 public Xcls_searchbox(DialogFiles _owner )
685 _this.searchbox = this;
686 this.el = new Gtk.SearchEntry();
690 // set gobject values
691 this.el.name = "popover-files-iconsearch";
692 this.el.hexpand = true;
693 this.el.placeholder_text = "type to filter results";
694 this.el.search_delay = 1000;
699 this.css = new Gtk.CssProvider();
701 this.css.load_from_data("#popover-files-iconsearch { font: 10px monospace;}".data);
703 this.el.get_style_context().add_provider(this.css,Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION);
709 this.el.search_changed.connect( ( ) => {
711 _this.treefilter.el.changed(Gtk.FilterChange.DIFFERENT);
712 _this.iconsearch.el.set_search(this.el.text);
716 // user defined functions
720 public class Xcls_iconscroll : Object
722 public Gtk.ScrolledWindow el;
723 private DialogFiles _this;
729 public Xcls_iconscroll(DialogFiles _owner )
732 _this.iconscroll = this;
733 this.el = new Gtk.ScrolledWindow();
737 // set gobject values
738 this.el.has_frame = true;
739 this.el.hexpand = true;
740 this.el.vexpand = true;
741 new Xcls_gridview( _this );
742 this.el.child = _this.gridview.el;
746 this.el.set_policy (Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC);
749 // user defined functions
751 public class Xcls_gridview : Object
753 public Gtk.GridView el;
754 private DialogFiles _this;
760 public Xcls_gridview(DialogFiles _owner )
763 _this.gridview = this;
764 new Xcls_iconsel( _this );
765 var child_2 = new Xcls_SignalListItemFactory28( _this );
767 this.el = new Gtk.GridView( _this.iconsel.el, child_2.el );
771 // set gobject values
772 var child_3 = new Xcls_GestureClick19( _this );
774 this.el.add_controller( child_3.el );
777 // user defined functions
779 public class Xcls_GestureClick19 : Object
781 public Gtk.GestureClick el;
782 private DialogFiles _this;
788 public Xcls_GestureClick19(DialogFiles _owner )
791 this.el = new Gtk.GestureClick();
795 // set gobject values
798 this.el.pressed.connect( (n_press, x, y) => {
800 GLib.debug("double cliced");
804 var f = (JsRender.JsRender)_this.iconsel.el.selected_item;
806 GLib.debug("Click %s", f.name);
807 if (f.xtype == "Dir") {
812 _this.win.windowstate.fileViewOpen(f, _this.new_window);
821 // user defined functions
824 public class Xcls_iconsel : Object
826 public Gtk.SingleSelection el;
827 private DialogFiles _this;
833 public Xcls_iconsel(DialogFiles _owner )
836 _this.iconsel = this;
837 var child_1 = new Xcls_FilterListModel21( _this );
839 this.el = new Gtk.SingleSelection( child_1.el );
843 // set gobject values
844 this.el.can_unselect = true;
847 this.el.notify["selected"].connect( () => {
848 if (this.el.selected == Gtk.INVALID_LIST_POSITION) {
849 if (_this.treeselmodel.el.selected == Gtk.INVALID_LIST_POSITION) {
850 _this.btn_delfile.el.hide();
855 _this.btn_delfile.el.show();
856 _this.treeselmodel.el.selected = Gtk.INVALID_LIST_POSITION;
862 // user defined functions
863 public JsRender.JsRender? selectedFile () {
865 if (this.el.selected == Gtk.INVALID_LIST_POSITION) {
868 return (JsRender.JsRender)this.el.get_item(this.el.selected);
873 public class Xcls_FilterListModel21 : Object
875 public Gtk.FilterListModel el;
876 private DialogFiles _this;
882 public Xcls_FilterListModel21(DialogFiles _owner )
885 new Xcls_gridsort( _this );
886 new Xcls_iconsearch( _this );
887 this.el = new Gtk.FilterListModel( _this.gridsort.el, _this.iconsearch.el );
891 // set gobject values
894 // user defined functions
896 public class Xcls_gridsort : Object
898 public Gtk.SortListModel el;
899 private DialogFiles _this;
905 public Xcls_gridsort(DialogFiles _owner )
908 _this.gridsort = this;
909 new Xcls_gridmodel( _this );
910 var child_2 = new Xcls_StringSorter24( _this );
912 this.el = new Gtk.SortListModel( _this.gridmodel.el, child_2.el );
916 // set gobject values
919 // user defined functions
921 public class Xcls_gridmodel : Object
923 public GLib.ListStore el;
924 private DialogFiles _this;
930 public Xcls_gridmodel(DialogFiles _owner )
933 _this.gridmodel = this;
934 this.el = new GLib.ListStore( typeof(JsRender.JsRender) );
938 // set gobject values
941 // user defined functions
942 public void remove (JsRender.JsRender p) {
944 for (var i =0;i < this.el.n_items; i++ ) {
945 var pr = (JsRender.JsRender) this.el.get_item(i);
946 if (p.path == pr.path) {
955 public class Xcls_StringSorter24 : Object
957 public Gtk.StringSorter el;
958 private DialogFiles _this;
964 public Xcls_StringSorter24(DialogFiles _owner )
967 var child_1 = new Xcls_PropertyExpression25( _this );
969 this.el = new Gtk.StringSorter( child_1.el );
973 // set gobject values
974 this.el.ignore_case = true;
977 // user defined functions
979 public class Xcls_PropertyExpression25 : Object
981 public Gtk.PropertyExpression el;
982 private DialogFiles _this;
988 public Xcls_PropertyExpression25(DialogFiles _owner )
991 this.el = new Gtk.PropertyExpression( typeof(JsRender.JsRender), null, "name" );
995 // set gobject values
998 // user defined functions
1003 public class Xcls_iconsearch : Object
1005 public Gtk.StringFilter el;
1006 private DialogFiles _this;
1012 public Xcls_iconsearch(DialogFiles _owner )
1015 _this.iconsearch = this;
1016 var child_1 = new Xcls_PropertyExpression27( _this );
1018 this.el = new Gtk.StringFilter( child_1.el );
1022 // set gobject values
1023 this.el.match_mode = Gtk.StringFilterMatchMode.SUBSTRING;
1024 this.el.ignore_case = true;
1027 // user defined functions
1029 public class Xcls_PropertyExpression27 : Object
1031 public Gtk.PropertyExpression el;
1032 private DialogFiles _this;
1038 public Xcls_PropertyExpression27(DialogFiles _owner )
1041 this.el = new Gtk.PropertyExpression( typeof(JsRender.JsRender), null, "name" );
1045 // set gobject values
1048 // user defined functions
1054 public class Xcls_SignalListItemFactory28 : Object
1056 public Gtk.SignalListItemFactory el;
1057 private DialogFiles _this;
1063 public Xcls_SignalListItemFactory28(DialogFiles _owner )
1066 this.el = new Gtk.SignalListItemFactory();
1070 // set gobject values
1073 this.el.setup.connect( (item) => {
1074 //var j = (JsRender.JsRender) item;
1075 var gi = (Gtk.ListItem)item;
1076 var b = new Gtk.Box(Gtk.Orientation.VERTICAL,4);
1077 var i = new Gtk.Image();
1079 var t = new Gtk.Label("");
1084 b.has_tooltip = true;
1085 b.query_tooltip.connect((x, y, keyboard_tooltip, tooltip) => {
1086 var j = (JsRender.JsRender) gi.get_item();
1088 var ti = new Gtk.Image.from_file ( j.getIconFileName());
1089 ti.pixel_size = 368;
1090 tooltip.set_custom( ti );
1096 this.el.bind.connect( (listitem) => {
1098 var box = (Gtk.Box) ((Gtk.ListItem)listitem).get_child();
1100 var img = (Gtk.Image) box.get_first_child();
1101 var lbl = (Gtk.Label)img.get_next_sibling();
1103 var item = (JsRender.JsRender) ((Gtk.ListItem)listitem).get_item();
1104 //GLib.debug("set label name to %s", item.name);
1106 var ns = item.name.split(".");
1107 if (ns.length < 2) {
1108 lbl.label = item.name;
1111 item.name.substring(0, item.name.length - ns[ns.length-1].length)
1112 + "\n"+ ns[ns.length-1];
1116 item.bind_property("name",
1118 GLib.BindingFlags.SYNC_CREATE);
1121 img.set_from_file(item.getIconFileName());
1127 // user defined functions
1133 public class Xcls_treescroll : Object
1135 public Gtk.ScrolledWindow el;
1136 private DialogFiles _this;
1142 public Xcls_treescroll(DialogFiles _owner )
1145 _this.treescroll = this;
1146 this.el = new Gtk.ScrolledWindow();
1150 // set gobject values
1151 this.el.width_request = 200;
1152 this.el.has_frame = true;
1153 this.el.hexpand = true;
1154 this.el.vexpand = true;
1155 this.el.visible = true;
1156 new Xcls_treeview( _this );
1157 this.el.child = _this.treeview.el;
1161 this.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);
1164 // user defined functions
1166 public class Xcls_treeview : Object
1168 public Gtk.ColumnView el;
1169 private DialogFiles _this;
1173 public Gtk.CssProvider css;
1176 public Xcls_treeview(DialogFiles _owner )
1179 _this.treeview = this;
1180 new Xcls_treeselmodel( _this );
1181 this.el = new Gtk.ColumnView( _this.treeselmodel.el );
1185 // set gobject values
1186 this.el.name = "file-list";
1187 var child_2 = new Xcls_GestureClick31( _this );
1189 this.el.add_controller( child_2.el );
1190 new Xcls_name( _this );
1191 this.el.append_column ( _this.name.el );
1197 this.css = new Gtk.CssProvider();
1199 this.css.load_from_string("
1200 #file-list { font-size: 12px;}
1202 -gtk-icon-size : 2px;
1204 #file-list indent:nth-last-child(2) {
1209 Gtk.StyleContext.add_provider_for_display(
1210 this.el.get_display(),
1212 Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION
1218 // user defined functions
1220 public class Xcls_GestureClick31 : Object
1222 public Gtk.GestureClick el;
1223 private DialogFiles _this;
1229 public Xcls_GestureClick31(DialogFiles _owner )
1232 this.el = new Gtk.GestureClick();
1236 // set gobject values
1239 this.el.pressed.connect( (n_press, x, y) => {
1241 GLib.debug("double cliced");
1245 var tr = (Gtk.TreeListRow)_this.treeselmodel.el.selected_item;
1246 GLib.debug("SELECTED = %s", tr.item.get_type().name());
1247 var f = (JsRender.JsRender) tr.item;
1248 GLib.debug("Click %s", f.name);
1249 if (f.xtype == "Dir") {
1254 _this.win.windowstate.fileViewOpen(f, _this.new_window);
1263 // user defined functions
1266 public class Xcls_treeselmodel : Object
1268 public Gtk.SingleSelection el;
1269 private DialogFiles _this;
1275 public Xcls_treeselmodel(DialogFiles _owner )
1278 _this.treeselmodel = this;
1279 var child_1 = new Xcls_FilterListModel33( _this );
1281 this.el = new Gtk.SingleSelection( child_1.el );
1285 // set gobject values
1286 this.el.can_unselect = true;
1289 this.el.notify["selected"].connect( () => {
1290 if (this.el.selected == Gtk.INVALID_LIST_POSITION) {
1291 if (_this.iconsel.el.selected == Gtk.INVALID_LIST_POSITION) {
1292 _this.btn_delfile.el.hide();
1297 var tr = (Gtk.TreeListRow)_this.treeselmodel.el.selected_item;
1298 GLib.debug("SELECTED = %s", tr.item.get_type().name());
1299 var f = (JsRender.JsRender) tr.item;
1300 if (f.xtype == "Dir") {
1301 _this.btn_delfile.el.hide();
1303 _this.btn_delfile.el.show();
1306 _this.iconsel.el.selected = Gtk.INVALID_LIST_POSITION;
1312 // user defined functions
1313 public JsRender.JsRender? selectedFile () {
1315 if (this.el.selected == Gtk.INVALID_LIST_POSITION) {
1318 var tr = (Gtk.TreeListRow) this.el.selected_item;
1320 return (JsRender.JsRender) tr.item;
1323 public class Xcls_FilterListModel33 : Object
1325 public Gtk.FilterListModel el;
1326 private DialogFiles _this;
1332 public Xcls_FilterListModel33(DialogFiles _owner )
1335 new Xcls_treelistsort( _this );
1336 new Xcls_treefilter( _this );
1337 this.el = new Gtk.FilterListModel( _this.treelistsort.el, _this.treefilter.el );
1341 // set gobject values
1344 // user defined functions
1346 public class Xcls_treelistsort : Object
1348 public Gtk.SortListModel el;
1349 private DialogFiles _this;
1355 public Xcls_treelistsort(DialogFiles _owner )
1358 _this.treelistsort = this;
1359 new Xcls_treelistmodel( _this );
1360 var child_2 = new Xcls_TreeListRowSorter37( _this );
1362 this.el = new Gtk.SortListModel( _this.treelistmodel.el, child_2.el );
1366 // set gobject values
1367 this.el.incremental = true;
1370 // user defined functions
1372 public class Xcls_treelistmodel : Object
1374 public Gtk.TreeListModel el;
1375 private DialogFiles _this;
1381 public Xcls_treelistmodel(DialogFiles _owner )
1384 _this.treelistmodel = this;
1385 new Xcls_treemodel( _this );
1386 this.el = new Gtk.TreeListModel( _this.treemodel.el, false, true, (item) => {
1387 //GLib.debug("liststore got %s", item.get_type().name());
1388 return ((JsRender.JsRender)item).childfiles;
1393 // set gobject values
1396 // user defined functions
1398 public class Xcls_treemodel : Object
1400 public GLib.ListStore el;
1401 private DialogFiles _this;
1407 public Xcls_treemodel(DialogFiles _owner )
1410 _this.treemodel = this;
1411 this.el = new GLib.ListStore( typeof(JsRender.JsRender) );
1415 // set gobject values
1418 // user defined functions
1422 public class Xcls_TreeListRowSorter37 : Object
1424 public Gtk.TreeListRowSorter el;
1425 private DialogFiles _this;
1431 public Xcls_TreeListRowSorter37(DialogFiles _owner )
1434 var child_1 = new Xcls_StringSorter38( _this );
1436 this.el = new Gtk.TreeListRowSorter( child_1.el );
1440 // set gobject values
1443 // user defined functions
1445 public class Xcls_StringSorter38 : Object
1447 public Gtk.StringSorter el;
1448 private DialogFiles _this;
1454 public Xcls_StringSorter38(DialogFiles _owner )
1457 var child_1 = new Xcls_PropertyExpression39( _this );
1459 this.el = new Gtk.StringSorter( child_1.el );
1463 // set gobject values
1464 this.el.ignore_case = true;
1467 // user defined functions
1469 public class Xcls_PropertyExpression39 : Object
1471 public Gtk.PropertyExpression el;
1472 private DialogFiles _this;
1478 public Xcls_PropertyExpression39(DialogFiles _owner )
1481 this.el = new Gtk.PropertyExpression( typeof(JsRender.JsRender) , null, "name" );
1485 // set gobject values
1488 // user defined functions
1494 public class Xcls_treefilter : Object
1496 public Gtk.CustomFilter el;
1497 private DialogFiles _this;
1503 public Xcls_treefilter(DialogFiles _owner )
1506 _this.treefilter = this;
1507 this.el = new Gtk.CustomFilter( (item) => {
1508 var tr = ((Gtk.TreeListRow)item).get_item();
1509 //GLib.debug("filter %s", tr.get_type().name());
1510 var j = (JsRender.JsRender) tr;
1511 if (j.xtype == "Dir" && j.childfiles.n_items < 1) {
1514 var str = _this.searchbox.el.text.down();
1515 if (j.xtype == "Dir") {
1518 for (var i =0 ; i < j.childfiles.n_items; i++) {
1519 var f = (JsRender.JsRender) j.childfiles.get_item(i);
1520 if (f.xtype != "PlainFile") {
1523 if (f.content_type.contains("image")) {
1526 if (str.length < 1) {
1529 if (f.name.down().contains(str)) {
1537 if (j.xtype != "PlainFile") {
1540 if (j.content_type.contains("image")) {
1544 if (str.length < 1) { // no search.
1547 if (j.name.down().contains(str)) {
1556 // set gobject values
1559 // user defined functions
1564 public class Xcls_name : Object
1566 public Gtk.ColumnViewColumn el;
1567 private DialogFiles _this;
1573 public Xcls_name(DialogFiles _owner )
1577 var child_1 = new Xcls_SignalListItemFactory42( _this );
1579 this.el = new Gtk.ColumnViewColumn( "General Files", child_1.el );
1583 // set gobject values
1584 this.el.id = "name";
1585 this.el.expand = true;
1586 this.el.resizable = true;
1591 // this.el.set_sorter( new Gtk.StringSorter(
1592 // new Gtk.PropertyExpression(typeof(JsRender.NodeProp), null, "name")
1598 // user defined functions
1600 public class Xcls_SignalListItemFactory42 : Object
1602 public Gtk.SignalListItemFactory el;
1603 private DialogFiles _this;
1609 public Xcls_SignalListItemFactory42(DialogFiles _owner )
1612 this.el = new Gtk.SignalListItemFactory();
1616 // set gobject values
1619 this.el.setup.connect( (listitem) => {
1621 var expand = new Gtk.TreeExpander();
1623 expand.set_indent_for_depth(true);
1624 expand.set_indent_for_icon(true);
1625 var hbox = new Gtk.Box(Gtk.Orientation.HORIZONTAL,0);
1626 var icon = new Gtk.Image();
1627 icon.margin_end = 4;
1628 var lbl = new Gtk.Label("");
1629 lbl.use_markup = true;
1632 lbl.justify = Gtk.Justification.LEFT;
1637 expand.set_child(hbox);
1638 ((Gtk.ListItem)listitem).set_child(expand);
1639 ((Gtk.ListItem)listitem).activatable = false;
1641 this.el.bind.connect( (listitem) => {
1643 //GLib.debug("listitme is is %s", ((Gtk.ListItem)listitem).get_type().name());
1647 //var expand = (Gtk.TreeExpander) ((Gtk.ListItem)listitem).get_child();
1648 var expand = (Gtk.TreeExpander) ((Gtk.ListItem)listitem).get_child();
1650 var hbox = (Gtk.Box) expand.child;
1653 var img = (Gtk.Image) hbox.get_first_child();
1654 var lbl = (Gtk.Label) img.get_next_sibling();
1658 if (lbl.label != "") { // do not update
1661 var lr = (Gtk.TreeListRow)((Gtk.ListItem)listitem).get_item();
1662 //GLib.debug("LR = %s", lr.get_type().name());
1665 var jr =(JsRender.JsRender) lr.get_item();
1666 //GLib.debug("JR = %s", jr.get_type().name());
1669 GLib.debug("Problem getting item");
1673 jr.bind_property("icon",
1675 GLib.BindingFlags.SYNC_CREATE);
1677 //GLib.debug("change %s to %s", lbl.label, np.name);
1678 lbl.label = jr.name; // for dir's we could hsow the sub path..
1679 lbl.tooltip_markup = jr.path;
1681 expand.set_hide_expander( jr.xtype != "Dir" );
1682 expand.set_list_row(lr);
1689 // user defined functions
1698 public class Xcls_HeaderBar43 : Object
1700 public Gtk.HeaderBar el;
1701 private DialogFiles _this;
1707 public Xcls_HeaderBar43(DialogFiles _owner )
1710 this.el = new Gtk.HeaderBar();
1714 // set gobject values
1715 this.el.show_title_buttons = false;
1716 var child_1 = new Xcls_Button44( _this );
1718 this.el.pack_end ( child_1.el );
1719 new Xcls_btn_newproj( _this );
1720 this.el.pack_start ( _this.btn_newproj.el );
1721 new Xcls_btn_projprop( _this );
1722 this.el.pack_start ( _this.btn_projprop.el );
1723 new Xcls_btn_delproj( _this );
1724 this.el.pack_start ( _this.btn_delproj.el );
1725 new Xcls_btn_addfile( _this );
1726 this.el.pack_start ( _this.btn_addfile.el );
1727 new Xcls_btn_delfile( _this );
1728 this.el.pack_start ( _this.btn_delfile.el );
1731 // user defined functions
1733 public class Xcls_Button44 : Object
1735 public Gtk.Button el;
1736 private DialogFiles _this;
1742 public Xcls_Button44(DialogFiles _owner )
1745 this.el = new Gtk.Button();
1749 // set gobject values
1750 this.el.label = "Close / Cancel";
1753 this.el.clicked.connect( ( ) => {
1754 if (BuilderApplication.windows.size < 2 &&
1755 _this.win.windowstate.file == null
1757 BuilderApplication.singleton(null).quit();
1763 if (_this.win.windowstate.file == null) {
1764 BuilderApplication.removeWindow(_this.win);
1773 // user defined functions
1776 public class Xcls_btn_newproj : Object
1778 public Gtk.Button el;
1779 private DialogFiles _this;
1785 public Xcls_btn_newproj(DialogFiles _owner )
1788 _this.btn_newproj = this;
1789 this.el = new Gtk.Button();
1793 // set gobject values
1794 var child_1 = new Xcls_Box46( _this );
1795 this.el.child = child_1.el;
1798 this.el.clicked.connect( ( ) => {
1800 // create a new file in project..
1801 //Xcls_DialogNewComponent.singleton().show(
1802 var pe = EditProject.singleton();
1803 pe.windowstate = _this.win.windowstate;
1805 pe.el.application = _this.win.el.application;
1806 pe.el.set_transient_for( _this.el );
1808 var cb = new Project.Callback();
1809 cb.call.connect((pr) => {
1810 _this.show( pr , _this.new_window);
1819 // user defined functions
1820 public void onCreated () {
1821 var pe = EditProject.singleton();
1823 _this.show( pe.result , _this.new_window);
1826 public class Xcls_Box46 : Object
1829 private DialogFiles _this;
1835 public Xcls_Box46(DialogFiles _owner )
1838 this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
1842 // set gobject values
1843 var child_1 = new Xcls_Image47( _this );
1845 this.el.append( child_1.el );
1846 var child_2 = new Xcls_Label48( _this );
1848 this.el.append( child_2.el );
1851 // user defined functions
1853 public class Xcls_Image47 : Object
1855 public Gtk.Image el;
1856 private DialogFiles _this;
1862 public Xcls_Image47(DialogFiles _owner )
1865 this.el = new Gtk.Image();
1869 // set gobject values
1870 this.el.icon_name = "folder-new";
1871 this.el.margin_end = 4;
1872 this.el.icon_size = Gtk.IconSize.NORMAL;
1875 // user defined functions
1878 public class Xcls_Label48 : Object
1880 public Gtk.Label el;
1881 private DialogFiles _this;
1887 public Xcls_Label48(DialogFiles _owner )
1890 this.el = new Gtk.Label( "New Project" );
1894 // set gobject values
1895 this.el.halign = Gtk.Align.START;
1898 // user defined functions
1903 public class Xcls_btn_projprop : Object
1905 public Gtk.Button el;
1906 private DialogFiles _this;
1912 public Xcls_btn_projprop(DialogFiles _owner )
1915 _this.btn_projprop = this;
1916 this.el = new Gtk.Button();
1920 // set gobject values
1921 var child_1 = new Xcls_Box50( _this );
1922 this.el.child = child_1.el;
1925 this.el.clicked.connect( ( ) => {
1926 // should disable the button really.
1927 if (_this.selectedProject == null) {
1930 _this.win.windowstate.projectPopoverShow(_this.el, _this.selectedProject, null);
1934 // user defined functions
1936 public class Xcls_Box50 : Object
1939 private DialogFiles _this;
1945 public Xcls_Box50(DialogFiles _owner )
1948 this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
1952 // set gobject values
1953 var child_1 = new Xcls_Image51( _this );
1955 this.el.append( child_1.el );
1956 var child_2 = new Xcls_Label52( _this );
1958 this.el.append( child_2.el );
1961 // user defined functions
1963 public class Xcls_Image51 : Object
1965 public Gtk.Image el;
1966 private DialogFiles _this;
1972 public Xcls_Image51(DialogFiles _owner )
1975 this.el = new Gtk.Image();
1979 // set gobject values
1980 this.el.icon_name = "emblem-system";
1981 this.el.margin_end = 4;
1984 // user defined functions
1987 public class Xcls_Label52 : Object
1989 public Gtk.Label el;
1990 private DialogFiles _this;
1996 public Xcls_Label52(DialogFiles _owner )
1999 this.el = new Gtk.Label( "Project Properties" );
2003 // set gobject values
2006 // user defined functions
2011 public class Xcls_btn_delproj : Object
2013 public Gtk.Button el;
2014 private DialogFiles _this;
2018 public DialogConfirm confirm;
2021 public Xcls_btn_delproj(DialogFiles _owner )
2024 _this.btn_delproj = this;
2025 this.el = new Gtk.Button();
2028 this.confirm = null;
2030 // set gobject values
2031 var child_1 = new Xcls_Box54( _this );
2032 this.el.child = child_1.el;
2035 this.el.clicked.connect( ( ) => {
2038 if (this.confirm == null) {
2039 this.confirm = new DialogConfirm();
2040 this.confirm.el.set_transient_for(_this.el);
2043 var project = (Project.Project) _this.projectsort.el.get_item(
2044 _this.projectselection.el.selected
2047 this.confirm.el.response.connect((res) => {
2048 this.confirm.el.hide();
2049 if (res == Gtk.ResponseType.CANCEL) {
2052 project = (Project.Project) _this.projectsort.el.get_item(
2053 _this.projectselection.el.selected
2055 Project.Project.remove(project);
2056 _this.projectmodel.remove(project);
2057 _this.projectselection.el.selected = Gtk.INVALID_LIST_POSITION;
2060 this.confirm.showIt("Confirm Delete Project", "Are you sure you want to delete this project?");
2064 // user defined functions
2066 public class Xcls_Box54 : Object
2069 private DialogFiles _this;
2075 public Xcls_Box54(DialogFiles _owner )
2078 this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
2082 // set gobject values
2083 var child_1 = new Xcls_Image55( _this );
2085 this.el.append( child_1.el );
2086 var child_2 = new Xcls_Label56( _this );
2088 this.el.append( child_2.el );
2091 // user defined functions
2093 public class Xcls_Image55 : Object
2095 public Gtk.Image el;
2096 private DialogFiles _this;
2102 public Xcls_Image55(DialogFiles _owner )
2105 this.el = new Gtk.Image();
2109 // set gobject values
2110 this.el.icon_name = "user-trash";
2113 // user defined functions
2116 public class Xcls_Label56 : Object
2118 public Gtk.Label el;
2119 private DialogFiles _this;
2125 public Xcls_Label56(DialogFiles _owner )
2128 this.el = new Gtk.Label( "Delete Project" );
2132 // set gobject values
2135 // user defined functions
2140 public class Xcls_btn_addfile : Object
2142 public Gtk.Button el;
2143 private DialogFiles _this;
2149 public Xcls_btn_addfile(DialogFiles _owner )
2152 _this.btn_addfile = this;
2153 this.el = new Gtk.Button();
2157 // set gobject values
2158 var child_1 = new Xcls_Box58( _this );
2159 this.el.child = child_1.el;
2162 this.el.clicked.connect( () => {
2163 // create a new file in project..
2164 print("add file selected\n");
2166 if (_this.selectedProject == null) {
2170 var f = JsRender.JsRender.factory(_this.selectedProject.xtype, _this.selectedProject, "");
2171 _this.win.windowstate.file_details.show( f, _this.el, _this.new_window );
2172 } catch (JsRender.Error e) {}
2177 // user defined functions
2179 public class Xcls_Box58 : Object
2182 private DialogFiles _this;
2188 public Xcls_Box58(DialogFiles _owner )
2191 this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
2195 // set gobject values
2196 var child_1 = new Xcls_Image59( _this );
2198 this.el.append( child_1.el );
2199 var child_2 = new Xcls_Label60( _this );
2201 this.el.append( child_2.el );
2204 // user defined functions
2206 public class Xcls_Image59 : Object
2208 public Gtk.Image el;
2209 private DialogFiles _this;
2215 public Xcls_Image59(DialogFiles _owner )
2218 this.el = new Gtk.Image();
2222 // set gobject values
2223 this.el.icon_name = "document-new";
2224 this.el.margin_end = 4;
2227 // user defined functions
2230 public class Xcls_Label60 : Object
2232 public Gtk.Label el;
2233 private DialogFiles _this;
2239 public Xcls_Label60(DialogFiles _owner )
2242 this.el = new Gtk.Label( "New File" );
2246 // set gobject values
2249 // user defined functions
2254 public class Xcls_btn_delfile : Object
2256 public Gtk.Button el;
2257 private DialogFiles _this;
2261 public DialogConfirm confirm;
2264 public Xcls_btn_delfile(DialogFiles _owner )
2267 _this.btn_delfile = this;
2268 this.el = new Gtk.Button();
2271 this.confirm = null;
2273 // set gobject values
2274 var child_1 = new Xcls_Box62( _this );
2275 this.el.child = child_1.el;
2278 this.el.clicked.connect( ( ) => {
2280 if (this.confirm == null) {
2281 this.confirm = new DialogConfirm();
2282 this.confirm.el.set_transient_for(_this.el);
2285 GLib.debug("DELETE");
2287 var isel = _this.iconsel.selectedFile();
2290 GLib.debug("DELETE - no icons selected");
2292 isel = _this.treeselmodel.selectedFile();
2295 GLib.debug("DELETE - no tree item selected");
2296 return; // should nto happen..
2299 GLib.debug("DELETE - calling confirm.");
2300 this.confirm.el.response.connect((res) => {
2301 this.confirm.el.hide();
2302 if (res == Gtk.ResponseType.CANCEL) {
2306 isel = _this.iconsel.selectedFile();
2309 isel = _this.treeselmodel.selectedFile();
2312 return; // should nto happen..
2316 isel.project.deleteFile(isel);
2317 _this.gridmodel.remove(isel);
2320 isel.project.deleteFile(isel);
2323 this.confirm.showIt("Confirm Delete File",
2324 "Are you sure you want to delete this file?");
2331 // user defined functions
2333 public class Xcls_Box62 : Object
2336 private DialogFiles _this;
2342 public Xcls_Box62(DialogFiles _owner )
2345 this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
2349 // set gobject values
2350 var child_1 = new Xcls_Image63( _this );
2352 this.el.append( child_1.el );
2353 var child_2 = new Xcls_Label64( _this );
2355 this.el.append( child_2.el );
2358 // user defined functions
2360 public class Xcls_Image63 : Object
2362 public Gtk.Image el;
2363 private DialogFiles _this;
2369 public Xcls_Image63(DialogFiles _owner )
2372 this.el = new Gtk.Image();
2376 // set gobject values
2377 this.el.icon_name = "user-trash";
2380 // user defined functions
2383 public class Xcls_Label64 : Object
2385 public Gtk.Label el;
2386 private DialogFiles _this;
2392 public Xcls_Label64(DialogFiles _owner )
2395 this.el = new Gtk.Label( "Delete File" );
2399 // set gobject values
2402 // user defined functions