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("#project-list { font-size: 12px;}");
354 Gtk.StyleContext.add_provider_for_display(
355 this.el.get_display(),
357 Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION
364 // user defined functions
366 public class Xcls_projectselection : Object
368 public Gtk.SingleSelection el;
369 private DialogFiles _this;
375 public Xcls_projectselection(DialogFiles _owner )
378 _this.projectselection = this;
379 new Xcls_projectsort( _this );
380 this.el = new Gtk.SingleSelection( _this.projectsort.el );
384 // set gobject values
385 this.el.can_unselect = true;
388 this.el.notify["selected"].connect( (position, n_items) => {
390 if (_this.is_loading) {
394 if (this.el.selected == Gtk.INVALID_LIST_POSITION) {
395 _this.btn_delproj.el.hide();
396 _this.btn_projprop.el.hide();
397 _this.btn_addfile.el.hide();
398 //_this.btn_delfile.el.hide();
401 _this.btn_delproj.el.show();
402 _this.btn_projprop.el.show();
403 _this.btn_addfile.el.show();
404 //_this.btn_delfile.el.show(); // ??
411 if (_this.is_loading) {
415 Project.Project project = this.el.selected == Gtk.INVALID_LIST_POSITION ? null :
416 (Project.Project) _this.projectsort.el.get_item(this.el.selected);
418 GLib.debug("selection changed to %s", project == null ? "none" : project.name);
420 _this.onProjectSelected(project);
424 // user defined functions
426 public class Xcls_projectsort : Object
428 public Gtk.SortListModel el;
429 private DialogFiles _this;
435 public Xcls_projectsort(DialogFiles _owner )
438 _this.projectsort = this;
439 new Xcls_projectmodel( _this );
440 var child_2 = new Xcls_StringSorter10( _this );
442 this.el = new Gtk.SortListModel( _this.projectmodel.el, child_2.el );
446 // set gobject values
447 this.el.incremental = true;
450 // user defined functions
452 public class Xcls_projectmodel : Object
454 public GLib.ListStore el;
455 private DialogFiles _this;
461 public Xcls_projectmodel(DialogFiles _owner )
464 _this.projectmodel = this;
465 this.el = new GLib.ListStore( typeof(Project.Project) );
469 // set gobject values
472 // user defined functions
473 public void remove (Project.Project p) {
475 for (var i =0;i < this.el.n_items; i++ ) {
476 var pr = (Project.Project) this.el.get_item(i);
477 if (p.path == pr.path) {
487 public class Xcls_StringSorter10 : Object
489 public Gtk.StringSorter el;
490 private DialogFiles _this;
496 public Xcls_StringSorter10(DialogFiles _owner )
499 var child_1 = new Xcls_PropertyExpression11( _this );
501 this.el = new Gtk.StringSorter( child_1.el );
505 // set gobject values
508 // user defined functions
510 public class Xcls_PropertyExpression11 : Object
512 public Gtk.PropertyExpression el;
513 private DialogFiles _this;
519 public Xcls_PropertyExpression11(DialogFiles _owner )
522 this.el = new Gtk.PropertyExpression( typeof(Project.Project), null, "name" );
526 // set gobject values
529 // user defined functions
535 public class Xcls_ColumnViewColumn12 : Object
537 public Gtk.ColumnViewColumn el;
538 private DialogFiles _this;
544 public Xcls_ColumnViewColumn12(DialogFiles _owner )
547 var child_1 = new Xcls_SignalListItemFactory13( _this );
549 this.el = new Gtk.ColumnViewColumn( "Project", child_1.el );
553 // set gobject values
554 this.el.expand = true;
557 // user defined functions
559 public class Xcls_SignalListItemFactory13 : Object
561 public Gtk.SignalListItemFactory el;
562 private DialogFiles _this;
568 public Xcls_SignalListItemFactory13(DialogFiles _owner )
571 this.el = new Gtk.SignalListItemFactory();
575 // set gobject values
578 this.el.setup.connect( (item) => {
579 //var j = (JsRender.JsRender) item;
580 var gi = (Gtk.ListItem)item;
582 var lbl = new Gtk.Label("");
583 lbl.halign = Gtk.Align.START;
589 this.el.bind.connect( (listitem) => {
591 var lbl = (Gtk.Label) ((Gtk.ListItem)listitem).get_child();
593 var item = (Project.Project) ((Gtk.ListItem)listitem).get_item();
595 item.bind_property("name",
597 GLib.BindingFlags.SYNC_CREATE);
603 // user defined functions
609 public class Xcls_filepane : Object
612 private DialogFiles _this;
618 public Xcls_filepane(DialogFiles _owner )
621 _this.filepane = this;
622 this.el = new Gtk.Paned( Gtk.Orientation.HORIZONTAL );
626 // set gobject values
627 this.el.position = 200;
628 this.el.visible = false;
629 var child_1 = new Xcls_Box15( _this );
630 this.el.end_child = child_1.el;
631 new Xcls_treescroll( _this );
632 this.el.start_child = _this.treescroll.el;
635 // user defined functions
637 public class Xcls_Box15 : Object
640 private DialogFiles _this;
646 public Xcls_Box15(DialogFiles _owner )
649 this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
653 // set gobject values
654 this.el.hexpand = true;
655 this.el.vexpand = true;
656 var child_1 = new Xcls_Box16( _this );
658 this.el.append( child_1.el );
659 new Xcls_iconscroll( _this );
660 this.el.append( _this.iconscroll.el );
663 // user defined functions
665 public class Xcls_Box16 : Object
668 private DialogFiles _this;
674 public Xcls_Box16(DialogFiles _owner )
677 this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
681 // set gobject values
682 this.el.hexpand = true;
683 new Xcls_searchbox( _this );
684 this.el.append( _this.searchbox.el );
687 // user defined functions
689 public class Xcls_searchbox : Object
691 public Gtk.SearchEntry el;
692 private DialogFiles _this;
696 public Gtk.CssProvider css;
699 public Xcls_searchbox(DialogFiles _owner )
702 _this.searchbox = this;
703 this.el = new Gtk.SearchEntry();
707 // set gobject values
708 this.el.name = "popover-files-iconsearch";
709 this.el.hexpand = true;
710 this.el.placeholder_text = "type to filter results";
711 this.el.search_delay = 1000;
716 this.css = new Gtk.CssProvider();
718 this.css.load_from_data("#popover-files-iconsearch { font: 10px monospace;}".data);
720 this.el.get_style_context().add_provider(this.css,Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION);
726 this.el.search_changed.connect( ( ) => {
728 _this.treefilter.el.changed(Gtk.FilterChange.DIFFERENT);
729 _this.iconsearch.el.set_search(this.el.text);
733 // user defined functions
737 public class Xcls_iconscroll : Object
739 public Gtk.ScrolledWindow el;
740 private DialogFiles _this;
746 public Xcls_iconscroll(DialogFiles _owner )
749 _this.iconscroll = this;
750 this.el = new Gtk.ScrolledWindow();
754 // set gobject values
755 this.el.has_frame = true;
756 this.el.hexpand = true;
757 this.el.vexpand = true;
758 new Xcls_gridview( _this );
759 this.el.child = _this.gridview.el;
763 this.el.set_policy (Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC);
766 // user defined functions
768 public class Xcls_gridview : Object
770 public Gtk.GridView el;
771 private DialogFiles _this;
777 public Xcls_gridview(DialogFiles _owner )
780 _this.gridview = this;
781 new Xcls_iconsel( _this );
782 var child_2 = new Xcls_SignalListItemFactory29( _this );
784 this.el = new Gtk.GridView( _this.iconsel.el, child_2.el );
788 // set gobject values
789 var child_3 = new Xcls_GestureClick20( _this );
791 this.el.add_controller( child_3.el );
794 // user defined functions
796 public class Xcls_GestureClick20 : Object
798 public Gtk.GestureClick el;
799 private DialogFiles _this;
805 public Xcls_GestureClick20(DialogFiles _owner )
808 this.el = new Gtk.GestureClick();
812 // set gobject values
815 this.el.pressed.connect( (n_press, x, y) => {
817 GLib.debug("double cliced");
821 var f = (JsRender.JsRender)_this.iconsel.el.selected_item;
823 GLib.debug("Click %s", f.name);
824 if (f.xtype == "Dir") {
829 _this.win.windowstate.fileViewOpen(f, _this.new_window);
838 // user defined functions
841 public class Xcls_iconsel : Object
843 public Gtk.SingleSelection el;
844 private DialogFiles _this;
850 public Xcls_iconsel(DialogFiles _owner )
853 _this.iconsel = this;
854 var child_1 = new Xcls_FilterListModel22( _this );
856 this.el = new Gtk.SingleSelection( child_1.el );
860 // set gobject values
861 this.el.can_unselect = true;
864 this.el.notify["selected"].connect( () => {
865 if (this.el.selected == Gtk.INVALID_LIST_POSITION) {
866 if (_this.treeselmodel.el.selected == Gtk.INVALID_LIST_POSITION) {
867 _this.btn_delfile.el.hide();
872 _this.btn_delfile.el.show();
873 _this.treeselmodel.el.selected = Gtk.INVALID_LIST_POSITION;
879 // user defined functions
880 public JsRender.JsRender? selectedFile () {
882 if (this.el.selected == Gtk.INVALID_LIST_POSITION) {
885 return (JsRender.JsRender)this.el.get_item(this.el.selected);
890 public class Xcls_FilterListModel22 : Object
892 public Gtk.FilterListModel el;
893 private DialogFiles _this;
899 public Xcls_FilterListModel22(DialogFiles _owner )
902 new Xcls_gridsort( _this );
903 new Xcls_iconsearch( _this );
904 this.el = new Gtk.FilterListModel( _this.gridsort.el, _this.iconsearch.el );
908 // set gobject values
911 // user defined functions
913 public class Xcls_gridsort : Object
915 public Gtk.SortListModel el;
916 private DialogFiles _this;
922 public Xcls_gridsort(DialogFiles _owner )
925 _this.gridsort = this;
926 new Xcls_gridmodel( _this );
927 var child_2 = new Xcls_StringSorter25( _this );
929 this.el = new Gtk.SortListModel( _this.gridmodel.el, child_2.el );
933 // set gobject values
936 // user defined functions
938 public class Xcls_gridmodel : Object
940 public GLib.ListStore el;
941 private DialogFiles _this;
947 public Xcls_gridmodel(DialogFiles _owner )
950 _this.gridmodel = this;
951 this.el = new GLib.ListStore( typeof(JsRender.JsRender) );
955 // set gobject values
958 // user defined functions
959 public void remove (JsRender.JsRender p) {
961 for (var i =0;i < this.el.n_items; i++ ) {
962 var pr = (JsRender.JsRender) this.el.get_item(i);
963 if (p.path == pr.path) {
972 public class Xcls_StringSorter25 : Object
974 public Gtk.StringSorter el;
975 private DialogFiles _this;
981 public Xcls_StringSorter25(DialogFiles _owner )
984 var child_1 = new Xcls_PropertyExpression26( _this );
986 this.el = new Gtk.StringSorter( child_1.el );
990 // set gobject values
991 this.el.ignore_case = true;
994 // user defined functions
996 public class Xcls_PropertyExpression26 : Object
998 public Gtk.PropertyExpression el;
999 private DialogFiles _this;
1005 public Xcls_PropertyExpression26(DialogFiles _owner )
1008 this.el = new Gtk.PropertyExpression( typeof(JsRender.JsRender), null, "name" );
1012 // set gobject values
1015 // user defined functions
1020 public class Xcls_iconsearch : Object
1022 public Gtk.StringFilter el;
1023 private DialogFiles _this;
1029 public Xcls_iconsearch(DialogFiles _owner )
1032 _this.iconsearch = this;
1033 var child_1 = new Xcls_PropertyExpression28( _this );
1035 this.el = new Gtk.StringFilter( child_1.el );
1039 // set gobject values
1040 this.el.match_mode = Gtk.StringFilterMatchMode.SUBSTRING;
1041 this.el.ignore_case = true;
1044 // user defined functions
1046 public class Xcls_PropertyExpression28 : Object
1048 public Gtk.PropertyExpression el;
1049 private DialogFiles _this;
1055 public Xcls_PropertyExpression28(DialogFiles _owner )
1058 this.el = new Gtk.PropertyExpression( typeof(JsRender.JsRender), null, "name" );
1062 // set gobject values
1065 // user defined functions
1071 public class Xcls_SignalListItemFactory29 : Object
1073 public Gtk.SignalListItemFactory el;
1074 private DialogFiles _this;
1080 public Xcls_SignalListItemFactory29(DialogFiles _owner )
1083 this.el = new Gtk.SignalListItemFactory();
1087 // set gobject values
1090 this.el.setup.connect( (item) => {
1091 //var j = (JsRender.JsRender) item;
1092 var gi = (Gtk.ListItem)item;
1093 var b = new Gtk.Box(Gtk.Orientation.VERTICAL,4);
1094 var i = new Gtk.Image();
1096 var t = new Gtk.Label("");
1101 b.has_tooltip = true;
1102 b.query_tooltip.connect((x, y, keyboard_tooltip, tooltip) => {
1103 var j = (JsRender.JsRender) gi.get_item();
1105 var ti = new Gtk.Image.from_file ( j.getIconFileName());
1106 ti.pixel_size = 368;
1107 tooltip.set_custom( ti );
1113 this.el.bind.connect( (listitem) => {
1115 var box = (Gtk.Box) ((Gtk.ListItem)listitem).get_child();
1117 var img = (Gtk.Image) box.get_first_child();
1118 var lbl = (Gtk.Label)img.get_next_sibling();
1120 var item = (JsRender.JsRender) ((Gtk.ListItem)listitem).get_item();
1121 //GLib.debug("set label name to %s", item.name);
1123 var ns = item.name.split(".");
1124 if (ns.length < 2) {
1125 lbl.label = item.name;
1128 item.name.substring(0, item.name.length - ns[ns.length-1].length)
1129 + "\n"+ ns[ns.length-1];
1133 item.bind_property("name",
1135 GLib.BindingFlags.SYNC_CREATE);
1138 img.set_from_file(item.getIconFileName());
1144 // user defined functions
1150 public class Xcls_treescroll : Object
1152 public Gtk.ScrolledWindow el;
1153 private DialogFiles _this;
1159 public Xcls_treescroll(DialogFiles _owner )
1162 _this.treescroll = this;
1163 this.el = new Gtk.ScrolledWindow();
1167 // set gobject values
1168 this.el.width_request = 200;
1169 this.el.has_frame = true;
1170 this.el.hexpand = true;
1171 this.el.vexpand = true;
1172 this.el.visible = true;
1173 new Xcls_treeview( _this );
1174 this.el.child = _this.treeview.el;
1178 this.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);
1181 // user defined functions
1183 public class Xcls_treeview : Object
1185 public Gtk.ColumnView el;
1186 private DialogFiles _this;
1190 public Gtk.CssProvider css;
1193 public Xcls_treeview(DialogFiles _owner )
1196 _this.treeview = this;
1197 new Xcls_treeselmodel( _this );
1198 this.el = new Gtk.ColumnView( _this.treeselmodel.el );
1202 // set gobject values
1203 this.el.name = "file-list";
1204 var child_2 = new Xcls_GestureClick32( _this );
1206 this.el.add_controller( child_2.el );
1207 new Xcls_name( _this );
1208 this.el.append_column ( _this.name.el );
1214 this.css = new Gtk.CssProvider();
1216 this.css.load_from_string("#file-list { font-size: 12px;}");
1218 Gtk.StyleContext.add_provider_for_display(
1219 this.el.get_display(),
1221 Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION
1227 // user defined functions
1229 public class Xcls_GestureClick32 : Object
1231 public Gtk.GestureClick el;
1232 private DialogFiles _this;
1238 public Xcls_GestureClick32(DialogFiles _owner )
1241 this.el = new Gtk.GestureClick();
1245 // set gobject values
1248 this.el.pressed.connect( (n_press, x, y) => {
1250 GLib.debug("double cliced");
1254 var tr = (Gtk.TreeListRow)_this.treeselmodel.el.selected_item;
1255 GLib.debug("SELECTED = %s", tr.item.get_type().name());
1256 var f = (JsRender.JsRender) tr.item;
1257 GLib.debug("Click %s", f.name);
1258 if (f.xtype == "Dir") {
1263 _this.win.windowstate.fileViewOpen(f, _this.new_window);
1272 // user defined functions
1275 public class Xcls_treeselmodel : Object
1277 public Gtk.SingleSelection el;
1278 private DialogFiles _this;
1284 public Xcls_treeselmodel(DialogFiles _owner )
1287 _this.treeselmodel = this;
1288 var child_1 = new Xcls_FilterListModel34( _this );
1290 this.el = new Gtk.SingleSelection( child_1.el );
1294 // set gobject values
1295 this.el.can_unselect = true;
1298 this.el.notify["selected"].connect( () => {
1299 if (this.el.selected == Gtk.INVALID_LIST_POSITION) {
1300 if (_this.iconsel.el.selected == Gtk.INVALID_LIST_POSITION) {
1301 _this.btn_delfile.el.hide();
1306 var tr = (Gtk.TreeListRow)_this.treeselmodel.el.selected_item;
1307 GLib.debug("SELECTED = %s", tr.item.get_type().name());
1308 var f = (JsRender.JsRender) tr.item;
1309 if (f.xtype == "Dir") {
1310 _this.btn_delfile.el.hide();
1312 _this.btn_delfile.el.show();
1315 _this.iconsel.el.selected = Gtk.INVALID_LIST_POSITION;
1321 // user defined functions
1322 public JsRender.JsRender? selectedFile () {
1324 if (this.el.selected == Gtk.INVALID_LIST_POSITION) {
1327 var tr = (Gtk.TreeListRow) this.el.selected_item;
1329 return (JsRender.JsRender) tr.item;
1332 public class Xcls_FilterListModel34 : Object
1334 public Gtk.FilterListModel el;
1335 private DialogFiles _this;
1341 public Xcls_FilterListModel34(DialogFiles _owner )
1344 new Xcls_treelistsort( _this );
1345 new Xcls_treefilter( _this );
1346 this.el = new Gtk.FilterListModel( _this.treelistsort.el, _this.treefilter.el );
1350 // set gobject values
1353 // user defined functions
1355 public class Xcls_treelistsort : Object
1357 public Gtk.SortListModel el;
1358 private DialogFiles _this;
1364 public Xcls_treelistsort(DialogFiles _owner )
1367 _this.treelistsort = this;
1368 new Xcls_treelistmodel( _this );
1369 var child_2 = new Xcls_TreeListRowSorter38( _this );
1371 this.el = new Gtk.SortListModel( _this.treelistmodel.el, child_2.el );
1375 // set gobject values
1376 this.el.incremental = true;
1379 // user defined functions
1381 public class Xcls_treelistmodel : Object
1383 public Gtk.TreeListModel el;
1384 private DialogFiles _this;
1390 public Xcls_treelistmodel(DialogFiles _owner )
1393 _this.treelistmodel = this;
1394 new Xcls_treemodel( _this );
1395 this.el = new Gtk.TreeListModel( _this.treemodel.el, false, true, (item) => {
1396 //GLib.debug("liststore got %s", item.get_type().name());
1397 return ((JsRender.JsRender)item).childfiles;
1402 // set gobject values
1405 // user defined functions
1407 public class Xcls_treemodel : Object
1409 public GLib.ListStore el;
1410 private DialogFiles _this;
1416 public Xcls_treemodel(DialogFiles _owner )
1419 _this.treemodel = this;
1420 this.el = new GLib.ListStore( typeof(JsRender.JsRender) );
1424 // set gobject values
1427 // user defined functions
1431 public class Xcls_TreeListRowSorter38 : Object
1433 public Gtk.TreeListRowSorter el;
1434 private DialogFiles _this;
1440 public Xcls_TreeListRowSorter38(DialogFiles _owner )
1443 var child_1 = new Xcls_StringSorter39( _this );
1445 this.el = new Gtk.TreeListRowSorter( child_1.el );
1449 // set gobject values
1452 // user defined functions
1454 public class Xcls_StringSorter39 : Object
1456 public Gtk.StringSorter el;
1457 private DialogFiles _this;
1463 public Xcls_StringSorter39(DialogFiles _owner )
1466 var child_1 = new Xcls_PropertyExpression40( _this );
1468 this.el = new Gtk.StringSorter( child_1.el );
1472 // set gobject values
1473 this.el.ignore_case = true;
1476 // user defined functions
1478 public class Xcls_PropertyExpression40 : Object
1480 public Gtk.PropertyExpression el;
1481 private DialogFiles _this;
1487 public Xcls_PropertyExpression40(DialogFiles _owner )
1490 this.el = new Gtk.PropertyExpression( typeof(JsRender.JsRender) , null, "name" );
1494 // set gobject values
1497 // user defined functions
1503 public class Xcls_treefilter : Object
1505 public Gtk.CustomFilter el;
1506 private DialogFiles _this;
1512 public Xcls_treefilter(DialogFiles _owner )
1515 _this.treefilter = this;
1516 this.el = new Gtk.CustomFilter( (item) => {
1517 var tr = ((Gtk.TreeListRow)item).get_item();
1518 //GLib.debug("filter %s", tr.get_type().name());
1519 var j = (JsRender.JsRender) tr;
1520 if (j.xtype == "Dir" && j.childfiles.n_items < 1) {
1523 var str = _this.searchbox.el.text.down();
1524 if (j.xtype == "Dir") {
1526 if (str.length < 1) {
1529 for (var i =0 ; i < j.childfiles.n_items; i++) {
1530 var f = (JsRender.JsRender) j.childfiles.get_item(i);
1531 if (f.xtype != "PlainFile") {
1534 if (f.name.down().contains(str)) {
1540 if (j.xtype != "PlainFile") {
1544 if (str.length < 1) {
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_SignalListItemFactory43( _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_SignalListItemFactory43 : Object
1602 public Gtk.SignalListItemFactory el;
1603 private DialogFiles _this;
1609 public Xcls_SignalListItemFactory43(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);
1626 var lbl = new Gtk.Label("");
1627 lbl.use_markup = true;
1630 lbl.justify = Gtk.Justification.LEFT;
1634 expand.set_child(lbl);
1635 ((Gtk.ListItem)listitem).set_child(expand);
1636 ((Gtk.ListItem)listitem).activatable = false;
1638 this.el.bind.connect( (listitem) => {
1639 //GLib.debug("listitme is is %s", ((Gtk.ListItem)listitem).get_type().name());
1643 //var expand = (Gtk.TreeExpander) ((Gtk.ListItem)listitem).get_child();
1644 var expand = (Gtk.TreeExpander) ((Gtk.ListItem)listitem).get_child();
1647 var lbl = (Gtk.Label) expand.child;
1649 if (lbl.label != "") { // do not update
1652 var lr = (Gtk.TreeListRow)((Gtk.ListItem)listitem).get_item();
1653 //GLib.debug("LR = %s", lr.get_type().name());
1656 var jr =(JsRender.JsRender) lr.get_item();
1657 //GLib.debug("JR = %s", jr.get_type().name());
1660 GLib.debug("Problem getting item");
1663 //GLib.debug("change %s to %s", lbl.label, np.name);
1664 lbl.label = jr.name; // for dir's we could hsow the sub path..
1665 lbl.tooltip_markup = jr.path;
1667 expand.set_hide_expander( jr.xtype != "Dir" );
1668 expand.set_list_row(lr);
1676 // user defined functions
1685 public class Xcls_HeaderBar44 : Object
1687 public Gtk.HeaderBar el;
1688 private DialogFiles _this;
1694 public Xcls_HeaderBar44(DialogFiles _owner )
1697 this.el = new Gtk.HeaderBar();
1701 // set gobject values
1702 this.el.show_title_buttons = false;
1703 var child_1 = new Xcls_Button45( _this );
1705 this.el.pack_end ( child_1.el );
1706 new Xcls_btn_newproj( _this );
1707 this.el.pack_start ( _this.btn_newproj.el );
1708 new Xcls_btn_projprop( _this );
1709 this.el.pack_start ( _this.btn_projprop.el );
1710 new Xcls_btn_delproj( _this );
1711 this.el.pack_start ( _this.btn_delproj.el );
1712 new Xcls_btn_addfile( _this );
1713 this.el.pack_start ( _this.btn_addfile.el );
1714 new Xcls_btn_delfile( _this );
1715 this.el.pack_start ( _this.btn_delfile.el );
1718 // user defined functions
1720 public class Xcls_Button45 : Object
1722 public Gtk.Button el;
1723 private DialogFiles _this;
1729 public Xcls_Button45(DialogFiles _owner )
1732 this.el = new Gtk.Button();
1736 // set gobject values
1737 this.el.label = "Close / Cancel";
1740 this.el.clicked.connect( ( ) => {
1741 if (BuilderApplication.windows.size < 2 &&
1742 _this.win.windowstate.file == null
1744 BuilderApplication.singleton(null).quit();
1750 if (_this.win.windowstate.file == null) {
1751 BuilderApplication.removeWindow(_this.win);
1760 // user defined functions
1763 public class Xcls_btn_newproj : Object
1765 public Gtk.Button el;
1766 private DialogFiles _this;
1772 public Xcls_btn_newproj(DialogFiles _owner )
1775 _this.btn_newproj = this;
1776 this.el = new Gtk.Button();
1780 // set gobject values
1781 var child_1 = new Xcls_Box47( _this );
1782 this.el.child = child_1.el;
1785 this.el.clicked.connect( ( ) => {
1787 // create a new file in project..
1788 //Xcls_DialogNewComponent.singleton().show(
1789 var pe = EditProject.singleton();
1790 pe.windowstate = _this.win.windowstate;
1792 pe.el.application = _this.win.el.application;
1793 pe.el.set_transient_for( _this.el );
1795 var cb = new Project.Callback();
1796 cb.call.connect((pr) => {
1797 _this.show( pr , _this.new_window);
1806 // user defined functions
1807 public void onCreated () {
1808 var pe = EditProject.singleton();
1810 _this.show( pe.result , _this.new_window);
1813 public class Xcls_Box47 : Object
1816 private DialogFiles _this;
1822 public Xcls_Box47(DialogFiles _owner )
1825 this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
1829 // set gobject values
1830 var child_1 = new Xcls_Image48( _this );
1832 this.el.append( child_1.el );
1833 var child_2 = new Xcls_Label49( _this );
1835 this.el.append( child_2.el );
1838 // user defined functions
1840 public class Xcls_Image48 : Object
1842 public Gtk.Image el;
1843 private DialogFiles _this;
1849 public Xcls_Image48(DialogFiles _owner )
1852 this.el = new Gtk.Image();
1856 // set gobject values
1857 this.el.icon_name = "folder-new";
1858 this.el.margin_end = 4;
1859 this.el.icon_size = Gtk.IconSize.NORMAL;
1862 // user defined functions
1865 public class Xcls_Label49 : Object
1867 public Gtk.Label el;
1868 private DialogFiles _this;
1874 public Xcls_Label49(DialogFiles _owner )
1877 this.el = new Gtk.Label( "New Project" );
1881 // set gobject values
1882 this.el.halign = Gtk.Align.START;
1885 // user defined functions
1890 public class Xcls_btn_projprop : Object
1892 public Gtk.Button el;
1893 private DialogFiles _this;
1899 public Xcls_btn_projprop(DialogFiles _owner )
1902 _this.btn_projprop = this;
1903 this.el = new Gtk.Button();
1907 // set gobject values
1908 var child_1 = new Xcls_Box51( _this );
1909 this.el.child = child_1.el;
1912 this.el.clicked.connect( ( ) => {
1913 // should disable the button really.
1914 if (_this.selectedProject == null) {
1917 _this.win.windowstate.projectPopoverShow(_this.el, _this.selectedProject, null);
1921 // user defined functions
1923 public class Xcls_Box51 : Object
1926 private DialogFiles _this;
1932 public Xcls_Box51(DialogFiles _owner )
1935 this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
1939 // set gobject values
1940 var child_1 = new Xcls_Image52( _this );
1942 this.el.append( child_1.el );
1943 var child_2 = new Xcls_Label53( _this );
1945 this.el.append( child_2.el );
1948 // user defined functions
1950 public class Xcls_Image52 : Object
1952 public Gtk.Image el;
1953 private DialogFiles _this;
1959 public Xcls_Image52(DialogFiles _owner )
1962 this.el = new Gtk.Image();
1966 // set gobject values
1967 this.el.icon_name = "emblem-system";
1968 this.el.margin_end = 4;
1971 // user defined functions
1974 public class Xcls_Label53 : Object
1976 public Gtk.Label el;
1977 private DialogFiles _this;
1983 public Xcls_Label53(DialogFiles _owner )
1986 this.el = new Gtk.Label( "Project Properties" );
1990 // set gobject values
1993 // user defined functions
1998 public class Xcls_btn_delproj : Object
2000 public Gtk.Button el;
2001 private DialogFiles _this;
2005 public DialogConfirm confirm;
2008 public Xcls_btn_delproj(DialogFiles _owner )
2011 _this.btn_delproj = this;
2012 this.el = new Gtk.Button();
2015 this.confirm = null;
2017 // set gobject values
2018 var child_1 = new Xcls_Box55( _this );
2019 this.el.child = child_1.el;
2022 this.el.clicked.connect( ( ) => {
2025 if (this.confirm == null) {
2026 this.confirm = new DialogConfirm();
2027 this.confirm.el.set_transient_for(_this.el);
2030 var project = (Project.Project) _this.projectsort.el.get_item(
2031 _this.projectselection.el.selected
2034 this.confirm.el.response.connect((res) => {
2035 this.confirm.el.hide();
2036 if (res == Gtk.ResponseType.CANCEL) {
2039 project = (Project.Project) _this.projectsort.el.get_item(
2040 _this.projectselection.el.selected
2042 Project.Project.remove(project);
2043 _this.projectmodel.remove(project);
2044 _this.projectselection.el.selected = Gtk.INVALID_LIST_POSITION;
2047 this.confirm.showIt("Confirm Delete Project", "Are you sure you want to delete this project?");
2051 // user defined functions
2053 public class Xcls_Box55 : Object
2056 private DialogFiles _this;
2062 public Xcls_Box55(DialogFiles _owner )
2065 this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
2069 // set gobject values
2070 var child_1 = new Xcls_Image56( _this );
2072 this.el.append( child_1.el );
2073 var child_2 = new Xcls_Label57( _this );
2075 this.el.append( child_2.el );
2078 // user defined functions
2080 public class Xcls_Image56 : Object
2082 public Gtk.Image el;
2083 private DialogFiles _this;
2089 public Xcls_Image56(DialogFiles _owner )
2092 this.el = new Gtk.Image();
2096 // set gobject values
2097 this.el.icon_name = "user-trash";
2100 // user defined functions
2103 public class Xcls_Label57 : Object
2105 public Gtk.Label el;
2106 private DialogFiles _this;
2112 public Xcls_Label57(DialogFiles _owner )
2115 this.el = new Gtk.Label( "Delete Project" );
2119 // set gobject values
2122 // user defined functions
2127 public class Xcls_btn_addfile : Object
2129 public Gtk.Button el;
2130 private DialogFiles _this;
2136 public Xcls_btn_addfile(DialogFiles _owner )
2139 _this.btn_addfile = this;
2140 this.el = new Gtk.Button();
2144 // set gobject values
2145 var child_1 = new Xcls_Box59( _this );
2146 this.el.child = child_1.el;
2149 this.el.clicked.connect( () => {
2150 // create a new file in project..
2151 print("add file selected\n");
2153 if (_this.selectedProject == null) {
2157 var f = JsRender.JsRender.factory(_this.selectedProject.xtype, _this.selectedProject, "");
2158 _this.win.windowstate.file_details.show( f, _this.el, _this.new_window );
2159 } catch (JsRender.Error e) {}
2164 // user defined functions
2166 public class Xcls_Box59 : Object
2169 private DialogFiles _this;
2175 public Xcls_Box59(DialogFiles _owner )
2178 this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
2182 // set gobject values
2183 var child_1 = new Xcls_Image60( _this );
2185 this.el.append( child_1.el );
2186 var child_2 = new Xcls_Label61( _this );
2188 this.el.append( child_2.el );
2191 // user defined functions
2193 public class Xcls_Image60 : Object
2195 public Gtk.Image el;
2196 private DialogFiles _this;
2202 public Xcls_Image60(DialogFiles _owner )
2205 this.el = new Gtk.Image();
2209 // set gobject values
2210 this.el.icon_name = "document-new";
2211 this.el.margin_end = 4;
2214 // user defined functions
2217 public class Xcls_Label61 : Object
2219 public Gtk.Label el;
2220 private DialogFiles _this;
2226 public Xcls_Label61(DialogFiles _owner )
2229 this.el = new Gtk.Label( "New File" );
2233 // set gobject values
2236 // user defined functions
2241 public class Xcls_btn_delfile : Object
2243 public Gtk.Button el;
2244 private DialogFiles _this;
2248 public DialogConfirm confirm;
2251 public Xcls_btn_delfile(DialogFiles _owner )
2254 _this.btn_delfile = this;
2255 this.el = new Gtk.Button();
2258 this.confirm = null;
2260 // set gobject values
2261 var child_1 = new Xcls_Box63( _this );
2262 this.el.child = child_1.el;
2265 this.el.clicked.connect( ( ) => {
2267 if (this.confirm == null) {
2268 this.confirm = new DialogConfirm();
2269 this.confirm.el.set_transient_for(_this.el);
2272 GLib.debug("DELETE");
2274 var isel = _this.iconsel.selectedFile();
2277 GLib.debug("DELETE - no icons selected");
2279 isel = _this.treeselmodel.selectedFile();
2282 GLib.debug("DELETE - no tree item selected");
2283 return; // should nto happen..
2286 GLib.debug("DELETE - calling confirm.");
2287 this.confirm.el.response.connect((res) => {
2288 this.confirm.el.hide();
2289 if (res == Gtk.ResponseType.CANCEL) {
2293 isel = _this.iconsel.selectedFile();
2296 isel = _this.treeselmodel.selectedFile();
2299 return; // should nto happen..
2303 isel.project.deleteFile(isel);
2304 _this.gridmodel.remove(isel);
2307 isel.project.deleteFile(isel);
2310 this.confirm.showIt("Confirm Delete File",
2311 "Are you sure you want to delete this file?");
2318 // user defined functions
2320 public class Xcls_Box63 : Object
2323 private DialogFiles _this;
2329 public Xcls_Box63(DialogFiles _owner )
2332 this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
2336 // set gobject values
2337 var child_1 = new Xcls_Image64( _this );
2339 this.el.append( child_1.el );
2340 var child_2 = new Xcls_Label65( _this );
2342 this.el.append( child_2.el );
2345 // user defined functions
2347 public class Xcls_Image64 : Object
2349 public Gtk.Image el;
2350 private DialogFiles _this;
2356 public Xcls_Image64(DialogFiles _owner )
2359 this.el = new Gtk.Image();
2363 // set gobject values
2364 this.el.icon_name = "user-trash";
2367 // user defined functions
2370 public class Xcls_Label65 : Object
2372 public Gtk.Label el;
2373 private DialogFiles _this;
2379 public Xcls_Label65(DialogFiles _owner )
2382 this.el = new Gtk.Label( "Delete File" );
2386 // set gobject values
2389 // user defined functions