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 );
72 this.el.child = child_1.el;
73 var child_2 = new Xcls_HeaderBar44( _this );
75 this.el.titlebar = child_2.el;
80 var ev = new Gtk.EventControllerKey();
81 ev.propagation_phase = Gtk.PropagationPhase.CAPTURE;
87 ev.key_released.connect( (keyval, keycode, state) => {
89 // GLib.debug("key pressed %d", (int)keycode);
93 if (BuilderApplication.windows.size < 2 &&
94 _this.win.windowstate.file == null
96 BuilderApplication.singleton(null).quit();
102 if (_this.win.windowstate.file == null) {
103 BuilderApplication.removeWindow(_this.win);
109 ev.ref(); //?? needed?
110 ((Gtk.Widget)this.el).add_controller(ev);
114 // user defined functions
115 public void onProjectSelected (Project.Project? project)
117 if (this.in_onprojectselected) {
120 this.selectedProject = project;
122 if (project == null) {
123 GLib.debug("Hide project files");
124 _this.mainpane.el.set_end_child(null);
125 _this.filepane.el.hide();
130 GLib.debug("Show project files");
131 _this.mainpane.el.set_end_child(_this.filepane.el);
133 _this.filepane.el.show();
134 this.in_onprojectselected = true;
141 _this.searchbox.el.text = "";
142 _this.gridview.el.set_model(new Gtk.SingleSelection(null));
143 _this.selectedProject.loadFilesIntoStore(_this.gridmodel.el);
144 _this.iconsel.el.selected = Gtk.INVALID_LIST_POSITION;
146 _this.gridview.el.set_model(_this.iconsel.el);
149 GLib.Timeout.add(500, () => {
150 _this.iconsel.el.selected = Gtk.INVALID_LIST_POSITION;
151 _this.treeselmodel.el.selected = Gtk.INVALID_LIST_POSITION;
153 _this.searchbox.el.grab_focus();
156 _this.treeview.el.set_model(new Gtk.SingleSelection(null));
158 this.selectedProject.loadDirsIntoStore(_this.treemodel.el);
160 _this.treeview.el.set_model(_this.treeselmodel.el);
162 _this.treeselmodel.el.selected = Gtk.INVALID_LIST_POSITION;
163 this.treescroll.el.vadjustment.value = 0;
164 this.in_onprojectselected = false;
166 public void selectProject (Project.Project? project) {
170 var sm = this.projectselection.el;
171 if (project == null) {
172 sm.selected = Gtk.INVALID_LIST_POSITION;
173 this.onProjectSelected(null);
178 for (var i =0; i < sm.n_items; i++) {
179 var p = (Project.Project) sm.get_item(i);
180 if (p.path == project.path) {
181 GLib.debug("Select Project %s => %d", project.name, i);
188 public void show (Project.Project? project, bool new_window) {
190 this.new_window = new_window;
192 this.projectscroll.el.vadjustment.value = 0; // scroll to top?
195 //var win = this.win.el;
196 //var w = win.get_width();
197 //var h = win.get_height();
202 this.selectProject(project);
203 this.onProjectSelected(project); //?? twice?
205 GLib.Timeout.add(500, () => {
206 if (project == null) {
207 _this.projectselection.el.selected = Gtk.INVALID_LIST_POSITION;
208 this.onProjectSelected(null);
211 this.el.set_size_request( 800 , 750); // ?? based on default
216 public void load () {
220 _this.is_loading = true;
223 Project.Project.loadAll();
224 _this.project_list.el.set_model(new Gtk.SingleSelection(null));
225 Project.Project.loadIntoStore(this.projectmodel.el);
227 _this.project_list.el.set_model(_this.projectselection.el);
229 _this.is_loading = false;
231 _this.projectselection.el.selected = Gtk.INVALID_LIST_POSITION;
232 _this.btn_delfile.el.hide();
236 public class Xcls_Box1 : Object
239 private DialogFiles _this;
246 public Xcls_Box1(DialogFiles _owner )
249 this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
254 // set gobject values
255 this.el.homogeneous = false;
256 this.el.margin_end = 10;
257 this.el.margin_start = 10;
258 this.el.margin_bottom = 10;
259 this.el.margin_top = 10;
260 var child_1 = new Xcls_Box2( _this );
262 this.el.append( child_1.el );
263 new Xcls_mainpane( _this );
264 this.el.append( _this.mainpane.el );
267 // user defined functions
269 public class Xcls_Box2 : Object
272 private DialogFiles _this;
278 public Xcls_Box2(DialogFiles _owner )
281 this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
285 // set gobject values
286 this.el.hexpand = true;
289 // user defined functions
292 public class Xcls_mainpane : Object
295 private DialogFiles _this;
299 public bool homogeneous;
303 public Xcls_mainpane(DialogFiles _owner )
306 _this.mainpane = this;
307 this.el = new Gtk.Paned( Gtk.Orientation.HORIZONTAL );
310 this.homogeneous = false;
313 // set gobject values
314 this.el.hexpand = true;
315 this.el.vexpand = true;
316 this.el.position = 200;
317 new Xcls_projectscroll( _this );
318 this.el.start_child = _this.projectscroll.el;
319 new Xcls_filepane( _this );
320 this.el.end_child = _this.filepane.el;
321 var child_3 = new Xcls_EventControllerKey43( _this );
323 this.el.add_controller( child_3.el );
326 // user defined functions
328 public class Xcls_projectscroll : Object
330 public Gtk.ScrolledWindow el;
331 private DialogFiles _this;
338 public Xcls_projectscroll(DialogFiles _owner )
341 _this.projectscroll = this;
342 this.el = new Gtk.ScrolledWindow();
347 // set gobject values
348 this.el.width_request = 150;
349 this.el.has_frame = true;
350 this.el.hexpand = true;
351 this.el.vexpand = true;
352 new Xcls_project_list( _this );
353 this.el.child = _this.project_list.el;
357 this.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);
360 // user defined functions
362 public class Xcls_project_list : Object
364 public Gtk.ColumnView el;
365 private DialogFiles _this;
369 public Gtk.CssProvider css;
372 public Xcls_project_list(DialogFiles _owner )
375 _this.project_list = this;
376 new Xcls_projectselection( _this );
377 this.el = new Gtk.ColumnView( _this.projectselection.el );
381 // set gobject values
382 this.el.name = "project-list";
383 var child_2 = new Xcls_ColumnViewColumn11( _this );
385 this.el.append_column ( child_2.el );
388 // user defined functions
390 public class Xcls_projectselection : Object
392 public Gtk.SingleSelection el;
393 private DialogFiles _this;
399 public Xcls_projectselection(DialogFiles _owner )
402 _this.projectselection = this;
403 new Xcls_projectsort( _this );
404 this.el = new Gtk.SingleSelection( _this.projectsort.el );
408 // set gobject values
409 this.el.can_unselect = true;
412 this.el.notify["selected"].connect( (position, n_items) => {
414 if (_this.is_loading) {
418 if (this.el.selected == Gtk.INVALID_LIST_POSITION) {
419 _this.btn_delproj.el.hide();
420 _this.btn_projprop.el.hide();
421 _this.btn_addfile.el.hide();
422 //_this.btn_delfile.el.hide();
425 _this.btn_delproj.el.show();
426 _this.btn_projprop.el.show();
427 _this.btn_addfile.el.show();
428 //_this.btn_delfile.el.show(); // ??
435 if (_this.is_loading) {
439 Project.Project project = this.el.selected == Gtk.INVALID_LIST_POSITION ? null :
440 (Project.Project) _this.projectsort.el.get_item(this.el.selected);
442 GLib.debug("selection changed to %s", project == null ? "none" : project.name);
444 _this.onProjectSelected(project);
448 // user defined functions
450 public class Xcls_projectsort : Object
452 public Gtk.SortListModel el;
453 private DialogFiles _this;
459 public Xcls_projectsort(DialogFiles _owner )
462 _this.projectsort = this;
463 new Xcls_projectmodel( _this );
464 var child_2 = new Xcls_StringSorter9( _this );
466 this.el = new Gtk.SortListModel( _this.projectmodel.el, child_2.el );
470 // set gobject values
471 this.el.incremental = true;
474 // user defined functions
476 public class Xcls_projectmodel : Object
478 public GLib.ListStore el;
479 private DialogFiles _this;
485 public Xcls_projectmodel(DialogFiles _owner )
488 _this.projectmodel = this;
489 this.el = new GLib.ListStore( typeof(Project.Project) );
493 // set gobject values
496 // user defined functions
497 public void remove (Project.Project p) {
499 for (var i =0;i < this.el.n_items; i++ ) {
500 var pr = (Project.Project) this.el.get_item(i);
501 if (p.path == pr.path) {
511 public class Xcls_StringSorter9 : Object
513 public Gtk.StringSorter el;
514 private DialogFiles _this;
520 public Xcls_StringSorter9(DialogFiles _owner )
523 var child_1 = new Xcls_PropertyExpression10( _this );
525 this.el = new Gtk.StringSorter( child_1.el );
529 // set gobject values
532 // user defined functions
534 public class Xcls_PropertyExpression10 : Object
536 public Gtk.PropertyExpression el;
537 private DialogFiles _this;
543 public Xcls_PropertyExpression10(DialogFiles _owner )
546 this.el = new Gtk.PropertyExpression( typeof(Project.Project), null, "name" );
550 // set gobject values
553 // user defined functions
559 public class Xcls_ColumnViewColumn11 : Object
561 public Gtk.ColumnViewColumn el;
562 private DialogFiles _this;
568 public Xcls_ColumnViewColumn11(DialogFiles _owner )
571 var child_1 = new Xcls_SignalListItemFactory12( _this );
573 this.el = new Gtk.ColumnViewColumn( "Project", child_1.el );
577 // set gobject values
578 this.el.expand = true;
581 // user defined functions
583 public class Xcls_SignalListItemFactory12 : Object
585 public Gtk.SignalListItemFactory el;
586 private DialogFiles _this;
592 public Xcls_SignalListItemFactory12(DialogFiles _owner )
595 this.el = new Gtk.SignalListItemFactory();
599 // set gobject values
602 this.el.setup.connect( (item) => {
603 //var j = (JsRender.JsRender) item;
604 var gi = (Gtk.ListItem)item;
606 var lbl = new Gtk.Label("");
607 lbl.halign = Gtk.Align.START;
613 this.el.bind.connect( (listitem) => {
615 var lbl = (Gtk.Label) ((Gtk.ListItem)listitem).get_child();
617 var item = (Project.Project) ((Gtk.ListItem)listitem).get_item();
619 item.bind_property("name",
621 GLib.BindingFlags.SYNC_CREATE);
627 // user defined functions
633 public class Xcls_filepane : Object
636 private DialogFiles _this;
642 public Xcls_filepane(DialogFiles _owner )
645 _this.filepane = this;
646 this.el = new Gtk.Paned( Gtk.Orientation.HORIZONTAL );
650 // set gobject values
651 this.el.position = 200;
652 this.el.visible = false;
653 var child_1 = new Xcls_Box14( _this );
655 this.el.end_child = child_1.el;
656 new Xcls_treescroll( _this );
657 this.el.start_child = _this.treescroll.el;
660 // user defined functions
662 public class Xcls_Box14 : Object
665 private DialogFiles _this;
671 public Xcls_Box14(DialogFiles _owner )
674 this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
678 // set gobject values
679 this.el.hexpand = true;
680 this.el.vexpand = true;
681 var child_1 = new Xcls_Box15( _this );
683 this.el.append( child_1.el );
684 new Xcls_iconscroll( _this );
685 this.el.append( _this.iconscroll.el );
688 // user defined functions
690 public class Xcls_Box15 : Object
693 private DialogFiles _this;
699 public Xcls_Box15(DialogFiles _owner )
702 this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
706 // set gobject values
707 this.el.hexpand = true;
708 new Xcls_searchbox( _this );
709 this.el.append( _this.searchbox.el );
712 // user defined functions
714 public class Xcls_searchbox : Object
716 public Gtk.SearchEntry el;
717 private DialogFiles _this;
721 public Gtk.CssProvider css;
724 public Xcls_searchbox(DialogFiles _owner )
727 _this.searchbox = this;
728 this.el = new Gtk.SearchEntry();
732 // set gobject values
733 this.el.name = "popover-files-iconsearch";
734 this.el.hexpand = true;
735 this.el.placeholder_text = "type to filter results";
736 this.el.search_delay = 1000;
741 this.css = new Gtk.CssProvider();
743 this.css.load_from_data("#popover-files-iconsearch { font: 10px monospace;}".data);
745 this.el.get_style_context().add_provider(this.css,Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION);
751 this.el.search_changed.connect( ( ) => {
753 _this.treefilter.el.changed(Gtk.FilterChange.DIFFERENT);
754 _this.iconsearch.el.set_search(this.el.text);
758 // user defined functions
762 public class Xcls_iconscroll : Object
764 public Gtk.ScrolledWindow el;
765 private DialogFiles _this;
771 public Xcls_iconscroll(DialogFiles _owner )
774 _this.iconscroll = this;
775 this.el = new Gtk.ScrolledWindow();
779 // set gobject values
780 this.el.has_frame = true;
781 this.el.hexpand = true;
782 this.el.vexpand = true;
783 new Xcls_gridview( _this );
784 this.el.child = _this.gridview.el;
788 this.el.set_policy (Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC);
791 // user defined functions
793 public class Xcls_gridview : Object
795 public Gtk.GridView el;
796 private DialogFiles _this;
802 public Xcls_gridview(DialogFiles _owner )
805 _this.gridview = this;
806 new Xcls_iconsel( _this );
807 var child_2 = new Xcls_SignalListItemFactory28( _this );
809 this.el = new Gtk.GridView( _this.iconsel.el, child_2.el );
813 // set gobject values
814 var child_3 = new Xcls_GestureClick19( _this );
816 this.el.add_controller( child_3.el );
819 // user defined functions
821 public class Xcls_GestureClick19 : Object
823 public Gtk.GestureClick el;
824 private DialogFiles _this;
830 public Xcls_GestureClick19(DialogFiles _owner )
833 this.el = new Gtk.GestureClick();
837 // set gobject values
840 this.el.pressed.connect( (n_press, x, y) => {
842 GLib.debug("double cliced");
846 var f = (JsRender.JsRender)_this.iconsel.el.selected_item;
848 GLib.debug("Click %s", f.name);
849 if (f.xtype == "Dir") {
854 _this.win.windowstate.fileViewOpen(f, _this.new_window);
863 // user defined functions
866 public class Xcls_iconsel : Object
868 public Gtk.SingleSelection el;
869 private DialogFiles _this;
875 public Xcls_iconsel(DialogFiles _owner )
878 _this.iconsel = this;
879 var child_1 = new Xcls_FilterListModel21( _this );
881 this.el = new Gtk.SingleSelection( child_1.el );
885 // set gobject values
886 this.el.can_unselect = true;
889 this.el.notify["selected"].connect( () => {
890 if (this.el.selected == Gtk.INVALID_LIST_POSITION) {
891 if (_this.treeselmodel.el.selected == Gtk.INVALID_LIST_POSITION) {
892 _this.btn_delfile.el.hide();
897 _this.btn_delfile.el.show();
898 _this.treeselmodel.el.selected = Gtk.INVALID_LIST_POSITION;
904 // user defined functions
905 public JsRender.JsRender? selectedFile () {
907 if (this.el.selected == Gtk.INVALID_LIST_POSITION) {
910 return (JsRender.JsRender)this.el.get_item(this.el.selected);
915 public class Xcls_FilterListModel21 : Object
917 public Gtk.FilterListModel el;
918 private DialogFiles _this;
924 public Xcls_FilterListModel21(DialogFiles _owner )
927 new Xcls_gridsort( _this );
928 new Xcls_iconsearch( _this );
929 this.el = new Gtk.FilterListModel( _this.gridsort.el, _this.iconsearch.el );
933 // set gobject values
936 // user defined functions
938 public class Xcls_gridsort : Object
940 public Gtk.SortListModel el;
941 private DialogFiles _this;
947 public Xcls_gridsort(DialogFiles _owner )
950 _this.gridsort = this;
951 new Xcls_gridmodel( _this );
952 var child_2 = new Xcls_StringSorter24( _this );
954 this.el = new Gtk.SortListModel( _this.gridmodel.el, child_2.el );
958 // set gobject values
961 // user defined functions
963 public class Xcls_gridmodel : Object
965 public GLib.ListStore el;
966 private DialogFiles _this;
972 public Xcls_gridmodel(DialogFiles _owner )
975 _this.gridmodel = this;
976 this.el = new GLib.ListStore( typeof(JsRender.JsRender) );
980 // set gobject values
983 // user defined functions
984 public void remove (JsRender.JsRender p) {
986 for (var i =0;i < this.el.n_items; i++ ) {
987 var pr = (JsRender.JsRender) this.el.get_item(i);
988 if (p.path == pr.path) {
997 public class Xcls_StringSorter24 : Object
999 public Gtk.StringSorter el;
1000 private DialogFiles _this;
1006 public Xcls_StringSorter24(DialogFiles _owner )
1009 var child_1 = new Xcls_PropertyExpression25( _this );
1011 this.el = new Gtk.StringSorter( child_1.el );
1015 // set gobject values
1016 this.el.ignore_case = true;
1019 // user defined functions
1021 public class Xcls_PropertyExpression25 : Object
1023 public Gtk.PropertyExpression el;
1024 private DialogFiles _this;
1030 public Xcls_PropertyExpression25(DialogFiles _owner )
1033 this.el = new Gtk.PropertyExpression( typeof(JsRender.JsRender), null, "name" );
1037 // set gobject values
1040 // user defined functions
1045 public class Xcls_iconsearch : Object
1047 public Gtk.StringFilter el;
1048 private DialogFiles _this;
1054 public Xcls_iconsearch(DialogFiles _owner )
1057 _this.iconsearch = this;
1058 var child_1 = new Xcls_PropertyExpression27( _this );
1060 this.el = new Gtk.StringFilter( child_1.el );
1064 // set gobject values
1065 this.el.match_mode = Gtk.StringFilterMatchMode.SUBSTRING;
1066 this.el.ignore_case = true;
1069 // user defined functions
1071 public class Xcls_PropertyExpression27 : Object
1073 public Gtk.PropertyExpression el;
1074 private DialogFiles _this;
1080 public Xcls_PropertyExpression27(DialogFiles _owner )
1083 this.el = new Gtk.PropertyExpression( typeof(JsRender.JsRender), null, "name" );
1087 // set gobject values
1090 // user defined functions
1096 public class Xcls_SignalListItemFactory28 : Object
1098 public Gtk.SignalListItemFactory el;
1099 private DialogFiles _this;
1105 public Xcls_SignalListItemFactory28(DialogFiles _owner )
1108 this.el = new Gtk.SignalListItemFactory();
1112 // set gobject values
1115 this.el.setup.connect( (item) => {
1116 //var j = (JsRender.JsRender) item;
1117 var gi = (Gtk.ListItem)item;
1118 var b = new Gtk.Box(Gtk.Orientation.VERTICAL,4);
1119 var i = new Gtk.Image();
1121 var t = new Gtk.Label("");
1126 b.has_tooltip = true;
1127 b.query_tooltip.connect((x, y, keyboard_tooltip, tooltip) => {
1128 var j = (JsRender.JsRender) gi.get_item();
1130 var ti = new Gtk.Image.from_file ( j.getIconFileName());
1131 ti.pixel_size = 368;
1132 tooltip.set_custom( ti );
1138 this.el.bind.connect( (listitem) => {
1140 var box = (Gtk.Box) ((Gtk.ListItem)listitem).get_child();
1142 var img = (Gtk.Image) box.get_first_child();
1143 var lbl = (Gtk.Label)img.get_next_sibling();
1145 var item = (JsRender.JsRender) ((Gtk.ListItem)listitem).get_item();
1146 //GLib.debug("set label name to %s", item.name);
1148 var ns = item.name.split(".");
1149 if (ns.length < 2) {
1150 lbl.label = item.name;
1153 item.name.substring(0, item.name.length - ns[ns.length-1].length)
1154 + "\n"+ ns[ns.length-1];
1158 item.bind_property("name",
1160 GLib.BindingFlags.SYNC_CREATE);
1163 img.set_from_file(item.getIconFileName());
1169 // user defined functions
1175 public class Xcls_treescroll : Object
1177 public Gtk.ScrolledWindow el;
1178 private DialogFiles _this;
1184 public Xcls_treescroll(DialogFiles _owner )
1187 _this.treescroll = this;
1188 this.el = new Gtk.ScrolledWindow();
1192 // set gobject values
1193 this.el.width_request = 200;
1194 this.el.has_frame = true;
1195 this.el.hexpand = true;
1196 this.el.vexpand = true;
1197 this.el.visible = true;
1198 new Xcls_treeview( _this );
1199 this.el.child = _this.treeview.el;
1203 this.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);
1206 // user defined functions
1208 public class Xcls_treeview : Object
1210 public Gtk.ColumnView el;
1211 private DialogFiles _this;
1215 public Gtk.CssProvider css;
1218 public Xcls_treeview(DialogFiles _owner )
1221 _this.treeview = this;
1222 new Xcls_treeselmodel( _this );
1223 this.el = new Gtk.ColumnView( _this.treeselmodel.el );
1227 // set gobject values
1228 this.el.name = "file-list";
1229 var child_2 = new Xcls_GestureClick31( _this );
1231 this.el.add_controller( child_2.el );
1232 new Xcls_name( _this );
1233 this.el.append_column ( _this.name.el );
1239 this.css = new Gtk.CssProvider();
1241 this.css.load_from_string("
1242 #file-list { font-size: 12px;}
1244 -gtk-icon-size : 2px;
1246 #file-list indent:nth-last-child(2) {
1251 Gtk.StyleContext.add_provider_for_display(
1252 this.el.get_display(),
1254 Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION
1260 // user defined functions
1262 public class Xcls_GestureClick31 : Object
1264 public Gtk.GestureClick el;
1265 private DialogFiles _this;
1271 public Xcls_GestureClick31(DialogFiles _owner )
1274 this.el = new Gtk.GestureClick();
1278 // set gobject values
1281 this.el.pressed.connect( (n_press, x, y) => {
1283 GLib.debug("double cliced");
1287 var tr = (Gtk.TreeListRow)_this.treeselmodel.el.selected_item;
1288 GLib.debug("SELECTED = %s", tr.item.get_type().name());
1289 var f = (JsRender.JsRender) tr.item;
1290 GLib.debug("Click %s", f.name);
1291 if (f.xtype == "Dir") {
1296 _this.win.windowstate.fileViewOpen(f, _this.new_window);
1305 // user defined functions
1308 public class Xcls_treeselmodel : Object
1310 public Gtk.SingleSelection el;
1311 private DialogFiles _this;
1317 public Xcls_treeselmodel(DialogFiles _owner )
1320 _this.treeselmodel = this;
1321 var child_1 = new Xcls_FilterListModel33( _this );
1323 this.el = new Gtk.SingleSelection( child_1.el );
1327 // set gobject values
1328 this.el.can_unselect = true;
1331 this.el.notify["selected"].connect( () => {
1332 if (this.el.selected == Gtk.INVALID_LIST_POSITION) {
1333 if (_this.iconsel.el.selected == Gtk.INVALID_LIST_POSITION) {
1334 _this.btn_delfile.el.hide();
1339 var tr = (Gtk.TreeListRow)_this.treeselmodel.el.selected_item;
1340 GLib.debug("SELECTED = %s", tr.item.get_type().name());
1341 var f = (JsRender.JsRender) tr.item;
1342 if (f.xtype == "Dir") {
1343 _this.btn_delfile.el.hide();
1345 _this.btn_delfile.el.show();
1348 _this.iconsel.el.selected = Gtk.INVALID_LIST_POSITION;
1354 // user defined functions
1355 public JsRender.JsRender? selectedFile () {
1357 if (this.el.selected == Gtk.INVALID_LIST_POSITION) {
1360 var tr = (Gtk.TreeListRow) this.el.selected_item;
1362 return (JsRender.JsRender) tr.item;
1365 public class Xcls_FilterListModel33 : Object
1367 public Gtk.FilterListModel el;
1368 private DialogFiles _this;
1374 public Xcls_FilterListModel33(DialogFiles _owner )
1377 new Xcls_treelistsort( _this );
1378 new Xcls_treefilter( _this );
1379 this.el = new Gtk.FilterListModel( _this.treelistsort.el, _this.treefilter.el );
1383 // set gobject values
1386 // user defined functions
1388 public class Xcls_treelistsort : Object
1390 public Gtk.SortListModel el;
1391 private DialogFiles _this;
1397 public Xcls_treelistsort(DialogFiles _owner )
1400 _this.treelistsort = this;
1401 new Xcls_treelistmodel( _this );
1402 var child_2 = new Xcls_TreeListRowSorter37( _this );
1404 this.el = new Gtk.SortListModel( _this.treelistmodel.el, child_2.el );
1408 // set gobject values
1409 this.el.incremental = true;
1412 // user defined functions
1414 public class Xcls_treelistmodel : Object
1416 public Gtk.TreeListModel el;
1417 private DialogFiles _this;
1423 public Xcls_treelistmodel(DialogFiles _owner )
1426 _this.treelistmodel = this;
1427 new Xcls_treemodel( _this );
1428 this.el = new Gtk.TreeListModel( _this.treemodel.el, false, true, (item) => {
1429 //GLib.debug("liststore got %s", item.get_type().name());
1430 return ((JsRender.JsRender)item).childfiles;
1435 // set gobject values
1438 // user defined functions
1440 public class Xcls_treemodel : Object
1442 public GLib.ListStore el;
1443 private DialogFiles _this;
1449 public Xcls_treemodel(DialogFiles _owner )
1452 _this.treemodel = this;
1453 this.el = new GLib.ListStore( typeof(JsRender.JsRender) );
1457 // set gobject values
1460 // user defined functions
1464 public class Xcls_TreeListRowSorter37 : Object
1466 public Gtk.TreeListRowSorter el;
1467 private DialogFiles _this;
1473 public Xcls_TreeListRowSorter37(DialogFiles _owner )
1476 var child_1 = new Xcls_StringSorter38( _this );
1478 this.el = new Gtk.TreeListRowSorter( child_1.el );
1482 // set gobject values
1485 // user defined functions
1487 public class Xcls_StringSorter38 : Object
1489 public Gtk.StringSorter el;
1490 private DialogFiles _this;
1496 public Xcls_StringSorter38(DialogFiles _owner )
1499 var child_1 = new Xcls_PropertyExpression39( _this );
1501 this.el = new Gtk.StringSorter( child_1.el );
1505 // set gobject values
1506 this.el.ignore_case = true;
1509 // user defined functions
1511 public class Xcls_PropertyExpression39 : Object
1513 public Gtk.PropertyExpression el;
1514 private DialogFiles _this;
1520 public Xcls_PropertyExpression39(DialogFiles _owner )
1523 this.el = new Gtk.PropertyExpression( typeof(JsRender.JsRender) , null, "name" );
1527 // set gobject values
1530 // user defined functions
1536 public class Xcls_treefilter : Object
1538 public Gtk.CustomFilter el;
1539 private DialogFiles _this;
1545 public Xcls_treefilter(DialogFiles _owner )
1548 _this.treefilter = this;
1549 this.el = new Gtk.CustomFilter( (item) => {
1550 var tr = ((Gtk.TreeListRow)item).get_item();
1551 //GLib.debug("filter %s", tr.get_type().name());
1552 var j = (JsRender.JsRender) tr;
1553 if (j.xtype == "Dir" && j.childfiles.n_items < 1) {
1556 var str = _this.searchbox.el.text.down();
1557 if (j.xtype == "Dir") {
1560 for (var i =0 ; i < j.childfiles.n_items; i++) {
1561 var f = (JsRender.JsRender) j.childfiles.get_item(i);
1562 if (f.xtype != "PlainFile") {
1565 if (f.content_type.contains("image")) {
1568 if (str.length < 1) {
1571 if (f.name.down().contains(str)) {
1579 if (j.xtype != "PlainFile") {
1582 if (j.content_type.contains("image")) {
1586 if (str.length < 1) { // no search.
1589 if (j.name.down().contains(str)) {
1598 // set gobject values
1601 // user defined functions
1606 public class Xcls_name : Object
1608 public Gtk.ColumnViewColumn el;
1609 private DialogFiles _this;
1615 public Xcls_name(DialogFiles _owner )
1619 var child_1 = new Xcls_SignalListItemFactory42( _this );
1621 this.el = new Gtk.ColumnViewColumn( "General Files", child_1.el );
1625 // set gobject values
1626 this.el.id = "name";
1627 this.el.expand = true;
1628 this.el.resizable = true;
1633 // this.el.set_sorter( new Gtk.StringSorter(
1634 // new Gtk.PropertyExpression(typeof(JsRender.NodeProp), null, "name")
1640 // user defined functions
1642 public class Xcls_SignalListItemFactory42 : Object
1644 public Gtk.SignalListItemFactory el;
1645 private DialogFiles _this;
1651 public Xcls_SignalListItemFactory42(DialogFiles _owner )
1654 this.el = new Gtk.SignalListItemFactory();
1658 // set gobject values
1661 this.el.setup.connect( (listitem) => {
1663 var expand = new Gtk.TreeExpander();
1665 expand.set_indent_for_depth(true);
1666 expand.set_indent_for_icon(true);
1667 var hbox = new Gtk.Box(Gtk.Orientation.HORIZONTAL,0);
1668 var icon = new Gtk.Image();
1669 icon.margin_end = 4;
1670 var lbl = new Gtk.Label("");
1671 lbl.use_markup = true;
1674 lbl.justify = Gtk.Justification.LEFT;
1679 expand.set_child(hbox);
1680 ((Gtk.ListItem)listitem).set_child(expand);
1681 ((Gtk.ListItem)listitem).activatable = false;
1683 this.el.bind.connect( (listitem) => {
1685 //GLib.debug("listitme is is %s", ((Gtk.ListItem)listitem).get_type().name());
1689 //var expand = (Gtk.TreeExpander) ((Gtk.ListItem)listitem).get_child();
1690 var expand = (Gtk.TreeExpander) ((Gtk.ListItem)listitem).get_child();
1692 var hbox = (Gtk.Box) expand.child;
1695 var img = (Gtk.Image) hbox.get_first_child();
1696 var lbl = (Gtk.Label) img.get_next_sibling();
1700 if (lbl.label != "") { // do not update
1703 var lr = (Gtk.TreeListRow)((Gtk.ListItem)listitem).get_item();
1704 //GLib.debug("LR = %s", lr.get_type().name());
1707 var jr =(JsRender.JsRender) lr.get_item();
1708 //GLib.debug("JR = %s", jr.get_type().name());
1711 GLib.debug("Problem getting item");
1715 jr.bind_property("icon",
1717 GLib.BindingFlags.SYNC_CREATE);
1719 //GLib.debug("change %s to %s", lbl.label, np.name);
1720 lbl.label = jr.name; // for dir's we could hsow the sub path..
1721 lbl.tooltip_markup = jr.path;
1723 expand.set_hide_expander( jr.xtype != "Dir" );
1724 expand.set_list_row(lr);
1731 // user defined functions
1738 public class Xcls_EventControllerKey43 : Object
1740 public Gtk.EventControllerKey el;
1741 private DialogFiles _this;
1747 public Xcls_EventControllerKey43(DialogFiles _owner )
1750 this.el = new Gtk.EventControllerKey();
1754 // set gobject values
1757 this.el.key_pressed.connect( (keyval, keycode, state) => {
1759 if (keycode != Gdk.Key.Escape) {
1762 if (BuilderApplication.windows.size < 2 &&
1763 _this.win.windowstate.file == null
1765 BuilderApplication.singleton(null).quit();
1771 if (_this.win.windowstate.file == null) {
1772 BuilderApplication.removeWindow(_this.win);
1780 // user defined functions
1785 public class Xcls_HeaderBar44 : Object
1787 public Gtk.HeaderBar el;
1788 private DialogFiles _this;
1794 public Xcls_HeaderBar44(DialogFiles _owner )
1797 this.el = new Gtk.HeaderBar();
1801 // set gobject values
1802 this.el.show_title_buttons = false;
1803 var child_1 = new Xcls_Button45( _this );
1805 this.el.pack_end ( child_1.el );
1806 new Xcls_btn_newproj( _this );
1807 this.el.pack_start ( _this.btn_newproj.el );
1808 new Xcls_btn_projprop( _this );
1809 this.el.pack_start ( _this.btn_projprop.el );
1810 new Xcls_btn_delproj( _this );
1811 this.el.pack_start ( _this.btn_delproj.el );
1812 new Xcls_btn_addfile( _this );
1813 this.el.pack_start ( _this.btn_addfile.el );
1814 new Xcls_btn_delfile( _this );
1815 this.el.pack_start ( _this.btn_delfile.el );
1818 // user defined functions
1820 public class Xcls_Button45 : Object
1822 public Gtk.Button el;
1823 private DialogFiles _this;
1829 public Xcls_Button45(DialogFiles _owner )
1832 this.el = new Gtk.Button();
1836 // set gobject values
1837 this.el.label = "Close / Cancel";
1840 this.el.clicked.connect( ( ) => {
1841 if (BuilderApplication.windows.size < 2 &&
1842 _this.win.windowstate.file == null
1844 BuilderApplication.singleton(null).quit();
1850 if (_this.win.windowstate.file == null) {
1851 BuilderApplication.removeWindow(_this.win);
1860 // user defined functions
1863 public class Xcls_btn_newproj : Object
1865 public Gtk.Button el;
1866 private DialogFiles _this;
1872 public Xcls_btn_newproj(DialogFiles _owner )
1875 _this.btn_newproj = this;
1876 this.el = new Gtk.Button();
1880 // set gobject values
1881 var child_1 = new Xcls_Box47( _this );
1883 this.el.child = child_1.el;
1886 this.el.clicked.connect( ( ) => {
1888 // create a new file in project..
1889 //Xcls_DialogNewComponent.singleton().show(
1890 var pe = EditProject.singleton();
1891 pe.windowstate = _this.win.windowstate;
1893 pe.el.application = _this.win.el.application;
1894 pe.el.set_transient_for( _this.el );
1896 var cb = new Project.Callback();
1897 cb.call.connect((pr) => {
1898 _this.show( pr , _this.new_window);
1907 // user defined functions
1908 public void onCreated () {
1909 var pe = EditProject.singleton();
1911 _this.show( pe.result , _this.new_window);
1914 public class Xcls_Box47 : Object
1917 private DialogFiles _this;
1923 public Xcls_Box47(DialogFiles _owner )
1926 this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
1930 // set gobject values
1931 var child_1 = new Xcls_Image48( _this );
1933 this.el.append( child_1.el );
1934 var child_2 = new Xcls_Label49( _this );
1936 this.el.append( child_2.el );
1939 // user defined functions
1941 public class Xcls_Image48 : Object
1943 public Gtk.Image el;
1944 private DialogFiles _this;
1950 public Xcls_Image48(DialogFiles _owner )
1953 this.el = new Gtk.Image();
1957 // set gobject values
1958 this.el.icon_name = "folder-new";
1959 this.el.margin_end = 4;
1960 this.el.icon_size = Gtk.IconSize.NORMAL;
1963 // user defined functions
1966 public class Xcls_Label49 : Object
1968 public Gtk.Label el;
1969 private DialogFiles _this;
1975 public Xcls_Label49(DialogFiles _owner )
1978 this.el = new Gtk.Label( "New Project" );
1982 // set gobject values
1983 this.el.halign = Gtk.Align.START;
1986 // user defined functions
1991 public class Xcls_btn_projprop : Object
1993 public Gtk.Button el;
1994 private DialogFiles _this;
2000 public Xcls_btn_projprop(DialogFiles _owner )
2003 _this.btn_projprop = this;
2004 this.el = new Gtk.Button();
2008 // set gobject values
2009 var child_1 = new Xcls_Box51( _this );
2011 this.el.child = child_1.el;
2014 this.el.clicked.connect( ( ) => {
2015 // should disable the button really.
2016 if (_this.selectedProject == null) {
2019 _this.win.windowstate.projectPopoverShow(_this.el, _this.selectedProject, null);
2023 // user defined functions
2025 public class Xcls_Box51 : Object
2028 private DialogFiles _this;
2034 public Xcls_Box51(DialogFiles _owner )
2037 this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
2041 // set gobject values
2042 var child_1 = new Xcls_Image52( _this );
2044 this.el.append( child_1.el );
2045 var child_2 = new Xcls_Label53( _this );
2047 this.el.append( child_2.el );
2050 // user defined functions
2052 public class Xcls_Image52 : Object
2054 public Gtk.Image el;
2055 private DialogFiles _this;
2061 public Xcls_Image52(DialogFiles _owner )
2064 this.el = new Gtk.Image();
2068 // set gobject values
2069 this.el.icon_name = "emblem-system";
2070 this.el.margin_end = 4;
2073 // user defined functions
2076 public class Xcls_Label53 : Object
2078 public Gtk.Label el;
2079 private DialogFiles _this;
2085 public Xcls_Label53(DialogFiles _owner )
2088 this.el = new Gtk.Label( "Project Properties" );
2092 // set gobject values
2095 // user defined functions
2100 public class Xcls_btn_delproj : Object
2102 public Gtk.Button el;
2103 private DialogFiles _this;
2107 public DialogConfirm confirm;
2110 public Xcls_btn_delproj(DialogFiles _owner )
2113 _this.btn_delproj = this;
2114 this.el = new Gtk.Button();
2117 this.confirm = null;
2119 // set gobject values
2120 var child_1 = new Xcls_Box55( _this );
2122 this.el.child = child_1.el;
2125 this.el.clicked.connect( ( ) => {
2128 if (this.confirm == null) {
2129 this.confirm = new DialogConfirm();
2130 this.confirm.el.set_transient_for(_this.el);
2133 var project = (Project.Project) _this.projectsort.el.get_item(
2134 _this.projectselection.el.selected
2137 this.confirm.el.response.connect((res) => {
2138 this.confirm.el.hide();
2139 if (res == Gtk.ResponseType.CANCEL) {
2142 project = (Project.Project) _this.projectsort.el.get_item(
2143 _this.projectselection.el.selected
2145 Project.Project.remove(project);
2146 _this.projectmodel.remove(project);
2147 _this.projectselection.el.selected = Gtk.INVALID_LIST_POSITION;
2150 this.confirm.showIt("Confirm Delete Project", "Are you sure you want to delete this project?");
2154 // user defined functions
2156 public class Xcls_Box55 : Object
2159 private DialogFiles _this;
2165 public Xcls_Box55(DialogFiles _owner )
2168 this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
2172 // set gobject values
2173 var child_1 = new Xcls_Image56( _this );
2175 this.el.append( child_1.el );
2176 var child_2 = new Xcls_Label57( _this );
2178 this.el.append( child_2.el );
2181 // user defined functions
2183 public class Xcls_Image56 : Object
2185 public Gtk.Image el;
2186 private DialogFiles _this;
2192 public Xcls_Image56(DialogFiles _owner )
2195 this.el = new Gtk.Image();
2199 // set gobject values
2200 this.el.icon_name = "user-trash";
2203 // user defined functions
2206 public class Xcls_Label57 : Object
2208 public Gtk.Label el;
2209 private DialogFiles _this;
2215 public Xcls_Label57(DialogFiles _owner )
2218 this.el = new Gtk.Label( "Delete Project" );
2222 // set gobject values
2225 // user defined functions
2230 public class Xcls_btn_addfile : Object
2232 public Gtk.Button el;
2233 private DialogFiles _this;
2239 public Xcls_btn_addfile(DialogFiles _owner )
2242 _this.btn_addfile = this;
2243 this.el = new Gtk.Button();
2247 // set gobject values
2248 var child_1 = new Xcls_Box59( _this );
2250 this.el.child = child_1.el;
2253 this.el.clicked.connect( () => {
2254 // create a new file in project..
2255 print("add file selected\n");
2257 if (_this.selectedProject == null) {
2261 var f = JsRender.JsRender.factory(_this.selectedProject.xtype, _this.selectedProject, "");
2262 _this.win.windowstate.file_details.show( f, _this.el, _this.new_window );
2263 } catch (JsRender.Error e) {}
2268 // user defined functions
2270 public class Xcls_Box59 : Object
2273 private DialogFiles _this;
2279 public Xcls_Box59(DialogFiles _owner )
2282 this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
2286 // set gobject values
2287 var child_1 = new Xcls_Image60( _this );
2289 this.el.append( child_1.el );
2290 var child_2 = new Xcls_Label61( _this );
2292 this.el.append( child_2.el );
2295 // user defined functions
2297 public class Xcls_Image60 : Object
2299 public Gtk.Image el;
2300 private DialogFiles _this;
2306 public Xcls_Image60(DialogFiles _owner )
2309 this.el = new Gtk.Image();
2313 // set gobject values
2314 this.el.icon_name = "document-new";
2315 this.el.margin_end = 4;
2318 // user defined functions
2321 public class Xcls_Label61 : Object
2323 public Gtk.Label el;
2324 private DialogFiles _this;
2330 public Xcls_Label61(DialogFiles _owner )
2333 this.el = new Gtk.Label( "New File" );
2337 // set gobject values
2340 // user defined functions
2345 public class Xcls_btn_delfile : Object
2347 public Gtk.Button el;
2348 private DialogFiles _this;
2352 public DialogConfirm confirm;
2355 public Xcls_btn_delfile(DialogFiles _owner )
2358 _this.btn_delfile = this;
2359 this.el = new Gtk.Button();
2362 this.confirm = null;
2364 // set gobject values
2365 var child_1 = new Xcls_Box63( _this );
2367 this.el.child = child_1.el;
2370 this.el.clicked.connect( ( ) => {
2372 if (this.confirm == null) {
2373 this.confirm = new DialogConfirm();
2374 this.confirm.el.set_transient_for(_this.el);
2377 GLib.debug("DELETE");
2379 var isel = _this.iconsel.selectedFile();
2382 GLib.debug("DELETE - no icons selected");
2384 isel = _this.treeselmodel.selectedFile();
2387 GLib.debug("DELETE - no tree item selected");
2388 return; // should nto happen..
2391 GLib.debug("DELETE - calling confirm.");
2392 this.confirm.el.response.connect((res) => {
2393 this.confirm.el.hide();
2394 if (res == Gtk.ResponseType.CANCEL) {
2398 isel = _this.iconsel.selectedFile();
2401 isel = _this.treeselmodel.selectedFile();
2404 return; // should nto happen..
2408 isel.project.deleteFile(isel);
2409 _this.gridmodel.remove(isel);
2412 isel.project.deleteFile(isel);
2415 this.confirm.showIt("Confirm Delete File",
2416 "Are you sure you want to delete this file?");
2423 // user defined functions
2425 public class Xcls_Box63 : Object
2428 private DialogFiles _this;
2434 public Xcls_Box63(DialogFiles _owner )
2437 this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
2441 // set gobject values
2442 var child_1 = new Xcls_Image64( _this );
2444 this.el.append( child_1.el );
2445 var child_2 = new Xcls_Label65( _this );
2447 this.el.append( child_2.el );
2450 // user defined functions
2452 public class Xcls_Image64 : Object
2454 public Gtk.Image el;
2455 private DialogFiles _this;
2461 public Xcls_Image64(DialogFiles _owner )
2464 this.el = new Gtk.Image();
2468 // set gobject values
2469 this.el.icon_name = "user-trash";
2472 // user defined functions
2475 public class Xcls_Label65 : Object
2477 public Gtk.Label el;
2478 private DialogFiles _this;
2484 public Xcls_Label65(DialogFiles _owner )
2487 this.el = new Gtk.Label( "Delete File" );
2491 // set gobject values
2494 // user defined functions