{ "build_module" : "builder", "gen_extended" : false, "items" : [ { "$ Project.Callback doneObj" : "null", "$ xns" : "Gtk", "Project.Gtk project" : "null", "Project.GtkValaSettings? selected_target" : "null", "Xcls_MainWindow window" : "null", "bool cg_loading" : false, "bool done" : false, "bool modal" : true, "items" : [ { "$ xns" : "Gtk", "* prop" : "titlebar", "* title" : "Edit Project Details", "items" : [ { "$ xns" : "Gtk", "* prop" : "title_widget", "string label" : "Change Vala Compile settings", "xtype" : "Label" } ], "xtype" : "HeaderBar" }, { "$ xns" : "Gtk", "* pack" : "set_child", "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL", "bool hexpand" : true, "bool vexpand" : true, "items" : [ { "$ xns" : "Gtk", "bool vexpand" : true, "id" : "notebook", "items" : [ { "$ xns" : "Gtk", "* pack" : false, "id" : "label_global", "utf8 label" : "Global", "xtype" : "Label" }, { "$ xns" : "Gtk", "* pack" : false, "id" : "label_targets", "utf8 label" : "Targets", "xtype" : "Label" }, { "$ xns" : "Gtk", "* pack" : "append_page,_this.label_global.el", "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL", "gboolean homogeneous" : false, "items" : [ { "$ xns" : "Gtk", "Gtk.Align halign" : "Gtk.Align.START", "bool hexpand" : true, "utf8 label" : "compile flags", "xtype" : "Label" }, { "$ xns" : "Gtk", "id" : "compile_flags", "listeners" : { "changed" : [ "() => {", " ", " _this.project.compile_flags = this.el.buffer.text;", " _this.project.save();", "// _this.project.save();", "", "}" ] }, "utf8 placeholder_text" : "eg. -g --valasrc $BASEDIR ", "xtype" : "Entry" }, { "$ xns" : "Gtk", "Gtk.PolicyType hscrollbar_policy" : "Gtk.PolicyType.AUTOMATIC", "Gtk.PolicyType vscrollbar_policy" : "Gtk.PolicyType.AUTOMATIC", "bool has_frame" : true, "bool hexpand" : true, "bool vexpand" : true, "id" : "vapi_scroll", "items" : [ { "$ xns" : "Gtk", "* prop" : "child", "items" : [ { "$ xns" : "Gtk", "* prop" : "model", "items" : [ { "$ xns" : "Gtk", "* prop" : "model", "items" : [ { "$ xns" : "Gtk", "* prop" : "model", "items" : [ { "$ xns" : "GLib", "* prop" : "model", "GLib.Type item_type" : "typeof(Project.VapiSelection)", "id" : "vapimodel", "xtype" : "ListStore" }, { "$ xns" : "Gtk", "* prop" : "sorter", "items" : [ { "$ xns" : "Gtk", "* prop" : "expression", "GLib.Type this_type" : "typeof(Project.VapiSelection)", "string property_name" : "sortkey", "xtype" : "PropertyExpression" } ], "xtype" : "StringSorter" } ], "xtype" : "SortListModel" }, { "$ xns" : "Gtk", "* prop" : "filter", "id" : "vapi_filter", "items" : [ { "$ xns" : "Gtk", "* prop" : "expression", "GLib.Type this_type" : "typeof(Project.VapiSelection)", "string property_name" : "sortkey", "xtype" : "PropertyExpression" } ], "xtype" : "StringFilter" } ], "xtype" : "FilterListModel" } ], "xtype" : "NoSelection" }, { "$ xns" : "Gtk", "* pack" : "append_column", "bool expand" : true, "items" : [ { "$ xns" : "Gtk", "* prop" : "factory", "listeners" : { "bind" : [ "(listitem) => {", " ", "\tvar lbl = (Gtk.Label) ((Gtk.ListItem)listitem).get_child();", "\t ", "\tvar item = (Project.VapiSelection) ((Gtk.ListItem)listitem).get_item();", "", "\titem.bind_property(\"name\",", " lbl, \"label\",", " GLib.BindingFlags.SYNC_CREATE);", "", "\t ", "}", "" ], "setup" : [ "(item) => {", "\t//var j = (JsRender.JsRender) item;", "\tvar gi = (Gtk.ListItem)item;", "\t ", "\tvar lbl = new Gtk.Label(\"\");", "\tlbl.halign = Gtk.Align.START;", "\tgi.set_child(lbl);", "", "", "", "}", "" ] }, "xtype" : "SignalListItemFactory" } ], "string title" : "Vapi Package", "xtype" : "ColumnViewColumn" }, { "$ xns" : "Gtk", "* pack" : "append_column", "items" : [ { "$ xns" : "Gtk", "* prop" : "factory", "listeners" : { "bind" : [ "(listitem) => {", "\t //GLib.debug(\"listitme is is %s\", ((Gtk.ListItem)listitem).get_type().name());", "\t", "\t", "\t", "\t//var expand = (Gtk.TreeExpander) ((Gtk.ListItem)listitem).get_child();", "\tvar btn = (Gtk.CheckButton) ((Gtk.ListItem)listitem).get_child();", "\t ", " ", "\tvar vs = (Project.VapiSelection)((Gtk.ListItem)listitem).get_item();", "", "\t//GLib.debug(\"change %s to %s\", lbl.label, np.name);", "", "\tbtn.active = vs.selected; ", "\t", "\tvs.btn = btn;", " \t// bind image...", " \t", "}" ], "setup" : [ "", "(listitem) => {", "", "\tvar btn = new Gtk.CheckButton();", " ", "\t((Gtk.ListItem)listitem).set_child(btn);", "\t", "\tbtn.toggled.connect(() => {", "\t ", "\t\tvar jr = (Project.VapiSelection) ((Gtk.ListItem)listitem).get_item();", "\t\tjr.selected = btn.active;", "\t});", "}", "" ] }, "xtype" : "SignalListItemFactory" } ], "string title" : "use", "xtype" : "ColumnViewColumn" } ], "xtype" : "ColumnView" } ], "xtype" : "ScrolledWindow" }, { "$ xns" : "Gtk", "id" : "vapi_search", "listeners" : { "search_changed" : [ "( ) => {", "", " _this.vapi_filter.el.set_search(this.el.get_text());", " ", "}", "" ] }, "string placeholder_text" : "Search Libraries (Vapi)", "uint search_delay" : 500, "xtype" : "SearchEntry" } ], "xtype" : "Box" }, { "$ xns" : "Gtk", "* pack" : "append_page,_this.label_targets.el", "Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL", "bool vexpand" : true, "gint position" : 300, "items" : [ { "$ xns" : "Gtk", "* pack" : "set_end_child", "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL", "gboolean homogeneous" : false, "id" : "set_vbox", "items" : [ { "$ xns" : "Gtk", "bool vexpand" : true, "items" : [ { "$ xns" : "Gtk", "* prop" : "child", "id" : "treeview", "items" : [ { "$ xns" : "Gtk", "* prop" : "model", "id" : "treeselmodel", "items" : [ { "$ xns" : "Gtk", "* prop" : "model", "items" : [ { "$ xns" : "Gtk", "* init" : [ "{", "\t//this.el.set_sorter(new Gtk.TreeListRowSorter(_this.treeview.el.sorter));", "}", "" ], "* prop" : "model", "id" : "treelistsort", "items" : [ { "$ xns" : "Gtk", "* prop" : "model", "Gtk.TreeListModelCreateModelFunc create_func" : [ "(item) => {", "\t//GLib.debug(\"liststore got %s\", item.get_type().name());", "\treturn ((JsRender.JsRender)item).childfiles;", "} " ], "bool autoexpand" : true, "bool passthrough" : false, "id" : "treelistmodel", "items" : [ { "$ xns" : "GLib", "* prop" : "root", "GLib.Type item_type" : "typeof(JsRender.JsRender)", "id" : "treemodel", "xtype" : "ListStore" } ], "xtype" : "TreeListModel" }, { "$ xns" : "Gtk", "* prop" : "sorter", "items" : [ { "$ xns" : "Gtk", "* prop" : "sorter", "items" : [ { "$ xns" : "Gtk", "* prop" : "expression", "GLib.Type this_type" : "typeof(JsRender.JsRender)", "string property_name" : "name", "xtype" : "PropertyExpression" } ], "xtype" : "StringSorter" } ], "xtype" : "TreeListRowSorter" } ], "xtype" : "SortListModel" }, { "$ xns" : "Gtk", "* prop" : "filter", "Gtk.CustomFilterFunc match_func" : [ "(item) => { ", "\t", "\tvar tr = ((Gtk.TreeListRow)item).get_item();", "\t//GLib.debug(\"filter %s\", tr.get_type().name());", "\tvar j = (JsRender.JsRender) tr;", "\tif (j.xtype == \"Gtk\") {", "\t\treturn true;", "\t}", "\tif (j.xtype != \"Dir\") {", "\t\treturn j.path.has_suffix(\".vala\") || j.path.has_suffix(\".c\");", "\t}", "\t// dirs..", "\t ", "\tfor (var i =0 ; i < j.childfiles.n_items; i++) {", "\t\tvar f = (JsRender.JsRender) j.childfiles.get_item(i);", "\t\tif (f.xtype == \"Gtk\") {", "\t\t\treturn true;", "\t\t}", "\t\tif (f.path.has_suffix(\".vala\") || f.path.has_suffix(\".c\")) {", "\t\t\treturn true;", "\t\t}", "\t}", "\treturn false;", "", "}" ], "xtype" : "CustomFilter" } ], "xtype" : "FilterListModel" } ], "xtype" : "SingleSelection" }, { "$ xns" : "Gtk", "* init" : [ "{", "\t this.el.set_sorter( new Gtk.StringSorter(", "\t \tnew Gtk.PropertyExpression(typeof(JsRender.JsRender), null, \"name\")", " \t));", "\t\t;", "\t\t", "}", "" ], "* pack" : "append_column", "bool expand" : true, "bool resizable" : true, "id" : "name", "items" : [ { "$ xns" : "Gtk", "* prop" : "factory", "listeners" : { "bind" : [ "(listitem) => {", "\t //GLib.debug(\"listitme is is %s\", ((Gtk.ListItem)listitem).get_type().name());", "\t", "\t", "\t", "\t//var expand = (Gtk.TreeExpander) ((Gtk.ListItem)listitem).get_child();", "\tvar expand = (Gtk.TreeExpander) ((Gtk.ListItem)listitem).get_child();", "\t ", " ", "\tvar lbl = (Gtk.Label) expand.child;", "\t", "\t if (lbl.label != \"\") { // do not update", "\t \treturn;", " \t}", "\t", "", "\tvar lr = (Gtk.TreeListRow)((Gtk.ListItem)listitem).get_item();", "\tvar jr = (JsRender.JsRender) lr.get_item();", "\t//GLib.debug(\"change %s to %s\", lbl.label, np.name);", "\tlbl.label = jr.name; // for dir's we could hsow the sub path..", "\tlbl.tooltip_markup = jr.path;", "\t ", " expand.set_hide_expander( jr.childfiles.n_items < 1);", " \texpand.set_list_row(lr);", " ", " \texpand.set_hide_expander( jr.xtype != \"Dir\" );", " \t expand.set_list_row(lr);", " ", " \t// bind image...", " \t", "}", "" ], "setup" : [ "(listitem) => {", "\t", "\tvar expand = new Gtk.TreeExpander();", "\t ", "\texpand.set_indent_for_depth(true);", "\texpand.set_indent_for_icon(true);", "\t ", "\tvar lbl = new Gtk.Label(\"\");", "\tlbl.use_markup = true;", "\t", "\t", " \tlbl.justify = Gtk.Justification.LEFT;", " \tlbl.xalign = 0;", "", " ", "\texpand.set_child(lbl);", "\t((Gtk.ListItem)listitem).set_child(expand);", "\t((Gtk.ListItem)listitem).activatable = false;", "}", "" ] }, "xtype" : "SignalListItemFactory" } ], "string title" : "Other Files", "xtype" : "ColumnViewColumn" }, { "$ xns" : "Gtk", "* pack" : "append_column", "items" : [ { "$ xns" : "Gtk", "* prop" : "factory", "listeners" : { "bind" : [ "(listitem) => {", "\t //GLib.debug(\"listitme is is %s\", ((Gtk.ListItem)listitem).get_type().name());", "\t", "\t", "\t", "\t//var expand = (Gtk.TreeExpander) ((Gtk.ListItem)listitem).get_child();", "\tvar btn = (Gtk.CheckButton) ((Gtk.ListItem)listitem).get_child();", "\t ", " ", "\tvar lr = (Gtk.TreeListRow)((Gtk.ListItem)listitem).get_item();", "\tvar jr = (JsRender.JsRender) lr.get_item();", "\t//GLib.debug(\"change %s to %s\", lbl.label, np.name);", "", "\t//btn.active = jr.compile_group_selected;", "\tbtn.active = _this.selected_target.has_file(jr);", "\t", " \t//jr.bind_property(\"compile_group_selected\",", " // btn, \"active\",", " // GLib.BindingFlags.BIDIRECTIONAL); ", " \t// bind image...", " \t", "}" ], "setup" : [ "(listitem) => {", "", "\tvar btn = new Gtk.CheckButton();", " ", "\t((Gtk.ListItem)listitem).set_child(btn);", "\t", "\tbtn.toggled.connect(() => {", "\t \tif (_this.cg_loading) {", "\t \t\treturn;", " \t\t}", "\t\tvar lr = (Gtk.TreeListRow)((Gtk.ListItem)listitem).get_item();", "\t\tvar jr = (JsRender.JsRender) lr.get_item();", "\t\tjr.compile_group_selected = btn.active;", "\t\t", "\t\t", "\t});", "}", "" ] }, "xtype" : "SignalListItemFactory" } ], "string title" : "use", "xtype" : "ColumnViewColumn" } ], "xtype" : "ColumnView" } ], "xtype" : "ScrolledWindow" } ], "xtype" : "Box" }, { "$ xns" : "Gtk", "* prop" : "start_child", "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL", "int spacing" : 0, "items" : [ { "$ xns" : "Gtk", "Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL", "bool hexpand" : true, "int spacing" : 0, "items" : [ { "$ xns" : "Gtk", "bool hexpand" : true, "listeners" : { "clicked" : [ "() => {", " ", " if (_this.project.compilegroups.has_key(\"NEW GROUP\")) {", " return;", " }", " var cg = new Project.GtkValaSettings(_this.project, \"NEW GROUP\");", " _this.project.compilegroups.set(cg.name, cg);", " _this.project.loadTargetsIntoStore(_this.target_model.el);", " // select it.. ?? should load it??", " for(var i =0;i < _this.target_model.el.n_items; i++) {", " \tvar ncg = (Project.GtkValaSettings) _this.target_model.el.get_item(i);", " \tif (ncg.name == cg.name) {", " \t\t_this.target_sel.el.selected = i;", " \t\t_this.target_sel.selectTarget(cg);", " \t\tbreak;", " \t\t}", "\t} ", "\t", "\t", "\t ", "}" ] }, "utf8 label" : "Add Compile Target", "xtype" : "Button" }, { "$ xns" : "Gtk", "bool hexpand" : true, "listeners" : { "clicked" : [ "() => {", " // load the new values.", "\tif (_this.target_sel.el.selected == Gtk.INVALID_LIST_POSITION) {", "\t\tGLib.debug(\"nothing selected\");", "\t\treturn;", "\t}", "\t", "\t ", "\t// add the directory..", "\tvar cg = (Project.GtkValaSettings) _this.target_model.el.get_item(_this.target_sel.el.selected);", "\t ", "\t ", "\tGLib.debug(\"remove: %s\\n\", cg.name);", "\tif (!_this.project.compilegroups.unset(cg.name)) {", "\t\tGLib.debug(\"remove failed\");", "\t}", " \t_this.project.loadTargetsIntoStore(_this.target_model.el);", "}" ] }, "utf8 label" : "Remove Target", "xtype" : "Button" } ], "xtype" : "Box" }, { "$ xns" : "Gtk", "* init" : [ "{ ", "this.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);", "", "}", "" ], "bool vexpand" : true, "items" : [ { "$ xns" : "Gtk", "* prop" : "child", "items" : [ { "$ xns" : "Gtk", "* prop" : "model", "id" : "target_sel", "items" : [ { "$ xns" : "GLib", "* prop" : "model", "GLib.Type item_type" : "typeof(Project.GtkValaSettings)", "id" : "target_model", "xtype" : "ListStore" } ], "listeners" : { "selection_changed" : [ "(position, n_items) => {", "", "\t ", "\t// load the new values.", "\tif (this.el.selected == Gtk.INVALID_LIST_POSITION) {", "\t\tthis.selectTarget(null);", "\t\treturn;", "\t}", "\tthis.selectTarget(null);", "\t", " ", "", "\t// add the directory..", "\tvar cg = (Project.GtkValaSettings) _this.target_model.el.get_item(this.el.selected);", "\t", "\tthis.selectTarget(cg);", " ", "}", "" ] }, "xtype" : "SingleSelection", "| void selectTarget" : [ "(Project.GtkValaSettings? cg) {", "// load the new values", "\t _this.selected_target = cg; ", "\t _this.project.active_cg = cg;", "\t ", "", "\tif (cg == null) {", "\t\t ", "\t\t_this.set_vbox.el.hide();\t", "\t\t_this.set_vboxb.el.hide();\t", "\t\treturn;", "\t}", "\t", "\t", "\t_this.set_vbox.el.show();", "\t_this.set_vboxb.el.show();", "\t// add the directory..", " ", "\t ", "\t GLib.debug(\"loading dirs into project list\");", "\t cg.loading_ui = true;", "\t _this.cg_loading = true;", "", "\t _this.treeview.el.set_model(new Gtk.SingleSelection(null));", "\t _this.project.loadDirsIntoStore(_this.treemodel.el);", " \t _this.treeview.el.set_model(_this.treeselmodel.el);", "\t ", "\t cg.loading_ui = false;", "\t ", "\t _this.cg_loading = false;", "\t GLib.debug(\"Set name to %s\", cg.name);", "\t ", " \t_this.build_name.el.buffer.set_text(cg.name.data);", " ", " ", "\t_this.build_execute_args.el.buffer.set_text( cg.execute_args.data );", " ", "}", "" ] }, { "$ xns" : "Gtk", "* pack" : "append_column", "bool expand" : true, "items" : [ { "$ xns" : "Gtk", "* prop" : "factory", "listeners" : { "bind" : [ "(listitem) => {", " ", "\tvar lbl = (Gtk.Label) ((Gtk.ListItem)listitem).get_child();", "\t ", "\tvar item = (Project.GtkValaSettings) ((Gtk.ListItem)listitem).get_item();", "", "\titem.bind_property(\"name\",", " lbl, \"label\",", " GLib.BindingFlags.SYNC_CREATE);", "", "\t ", "}", "" ], "setup" : [ "(item) => {", "\t//var j = (JsRender.JsRender) item;", "\tvar gi = (Gtk.ListItem)item;", "\t ", "\tvar lbl = new Gtk.Label(\"\");", "\tlbl.halign = Gtk.Align.START;", "\tgi.set_child(lbl);", "", "", "", "}", "" ] }, "xtype" : "SignalListItemFactory" } ], "string title" : "Build Target", "xtype" : "ColumnViewColumn" } ], "xtype" : "ColumnView" } ], "xtype" : "ScrolledWindow" }, { "$ xns" : "Gtk", "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL", "id" : "set_vboxb", "int spacing" : 0, "items" : [ { "$ xns" : "Gtk", "utf8 label" : "Build Name (executable name)", "xtype" : "Label" }, { "$ xns" : "Gtk", "id" : "build_name", "listeners" : { "changed" : [ "() => {", "\tif (_this.selected_target == null) {", "\t\treturn;", "\t}", "\tvar name = this.el.text;", "\t// name ischanging.. probably always..", "\tif (_this.selected_target.name != name) {", "\t\t_this.project.compilegroups.unset(_this.selected_target.name);", "\t\t_this.project.compilegroups.set(name, _this.selected_target);", "\t}", "", "\t_this.selected_target.name = this.el.buffer.text;", "}" ] }, "xtype" : "Entry" }, { "$ xns" : "Gtk", "utf8 label" : "test argments - when run after a build", "xtype" : "Label" }, { "$ xns" : "Gtk", "id" : "build_execute_args", "listeners" : { "changed" : [ "() => {", " if (_this.selected_target == null) {", " return;", " }", " _this.selected_target.execute_args = this.el.buffer.text;", " ", "}" ] }, "string placeholder_text" : "eg. -f somefile -g ", "xtype" : "Entry" } ], "xtype" : "Box" } ], "xtype" : "Box" } ], "xtype" : "Paned" } ], "xtype" : "Notebook" }, { "$ Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL", "$ xns" : "Gtk", "bool hexpand" : true, "int margin_bottom" : 4, "int margin_end" : 4, "int margin_start" : 4, "int margin_top" : 4, "items" : [ { "$ xns" : "Gtk", "listeners" : { "clicked" : [ "() => { ", "", " _this.done = true;", " _this.el.hide(); ", "}" ] }, "string label" : "Cancel", "xtype" : "Button" }, { "$ xns" : "Gtk", "bool hexpand" : true, "string label" : "", "xtype" : "Label" }, { "$ xns" : "Gtk", "css_classes" : "{ \"suggested-action\" }", "id" : "save_btn", "listeners" : { "clicked" : [ "( ) => { ", "", " ", "_this.project.save(); ", " ", "\t// what about .js ?", "_this.done = true;", "_this.el.hide();", "if (_this.doneObj != null) {", "\t_this.doneObj.call(_this.project);", "}", " ", " ", "}" ] }, "string label" : "Save", "xtype" : "Button" } ], "xtype" : "Box" } ], "xtype" : "Box" } ], "listeners" : { "close_request" : [ "( ) => {", "\tif (!this.done) {", "\t\treturn true;", "\t}", "\treturn false;", "\t", "}", "" ], "hide" : [ "() => {", "\t if (!this.done) {", " _this.el.show();", " }", "}" ] }, "uint border_width" : 0, "xtype" : "Window", "| void save" : [ "() {", " this.project.save(); ", "}" ], "| void show" : [ "(Gtk.Window pwin, Project.Gtk project, Project.Callback? doneObj) {", " ", " //print(\"ValaProjectSettings show\\n\");", " this.doneObj = doneObj;", " this.project= project;", "\t ", " this.compile_flags.el.buffer.set_text(", " \tproject.compile_flags.data", "\t);", "\t ", " project.loadVapiIntoStore(_this.vapimodel.el);", " GLib.Timeout.add(500, () => {", " \t\t this.vapi_scroll.el.vadjustment.value = 0;\t ", "\t return false;", " });", " ", " ", " \t", " \tproject.loadTargetsIntoStore(this.target_model.el);", "\t", " \t_this.target_sel.el.selected = Gtk.INVALID_LIST_POSITION;", "\t_this.target_sel.selectTarget(null);", "//\tGtk.Allocation rect;", "\t//btn.get_allocation(out rect);", " // this.el.set_pointing_to(rect);", " this.el.application = pwin.application; // ??? make it modal?", "\t this.el.set_transient_for(pwin);", "\t ", "\t// window + header?", "\t// print(\"SHOWALL - POPIP\\n\");", "\tthis.el.set_size_request(800,800);", "\tthis.el.show();", "\tthis.notebook.el.page = 0; // first page.", "\t", "\t//this.view.el.grab_focus();", "", "}", "" ] } ], "name" : "ValaProjectSettingsPopover" }