:Revert "fix line numbering issues with vala generator - hopefully fixes completion...
[roobuilder] / src / Builder4 / ValaProjectSettingsPopover.bjs
index 907773c..7eb6815 100644 (file)
@@ -3,12 +3,12 @@
  "gen_extended" : false,
  "items" : [
   {
+   "$ Project.Callback doneObj" : "null",
    "$ xns" : "Gtk",
-   "Gtk.PositionType position" : "Gtk.PositionType.RIGHT",
    "Project.Gtk project" : "null",
    "Project.GtkValaSettings? selected_target" : "null",
    "Xcls_MainWindow window" : "null",
-   "bool autohide" : false,
+   "bool cg_loading" : false,
    "bool done" : false,
    "bool modal" : true,
    "items" : [
        "* prop" : "title_widget",
        "string label" : "Change Vala  Compile settings",
        "xtype" : "Label"
-      },
-      {
-       "$ xns" : "Gtk",
-       "* pack" : "pack_end",
-       "string icon_name" : "",
-       "string label" : "Create / Recreate Build files (configure.ac / makefile.am etc)",
-       "xtype" : "Button"
       }
      ],
      "xtype" : "HeaderBar"
                   "bind" : [
                    "(listitem) => {",
                    " ",
-                   "\tvar lbl = (Gtk.Box)  ((Gtk.ListItem)listitem).get_child();",
+                   "\tvar lbl = (Gtk.Label)  ((Gtk.ListItem)listitem).get_child();",
                    "\t   ",
                    "\tvar item = (Project.VapiSelection)  ((Gtk.ListItem)listitem).get_item();",
                    "",
                      "    expand.set_hide_expander(  jr.childfiles.n_items < 1);",
                      " \texpand.set_list_row(lr);",
                      " ",
-                     "   expand.set_hide_expander(  jr.xtype != \"Dir\" );",
+                     "  \texpand.set_hide_expander(  jr.xtype != \"Dir\" );",
                      " \t expand.set_list_row(lr);",
                      " ",
                      " \t// bind image...",
                      "\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 ",
-                     " \tjr.bind_property(\"compile_group_selected\",",
-                     "                    btn, \"active\",",
-                     "                   GLib.BindingFlags.SYNC_CREATE); ",
+                     " \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 ",
+                     "\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 GLib.debug(\"loading dirs into project list\");",
                   "\t cg.loading_ui = true;",
-                  "\t ",
+                  "\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 );",
-                  "",
                   " ",
                   "}",
                   ""
                     "bind" : [
                      "(listitem) => {",
                      " ",
-                     "\tvar lbl = (Gtk.Box)  ((Gtk.ListItem)listitem).get_child();",
+                     "\tvar lbl = (Gtk.Label)  ((Gtk.ListItem)listitem).get_child();",
                      "\t   ",
                      "\tvar item = (Project.GtkValaSettings)  ((Gtk.ListItem)listitem).get_item();",
                      "",
            "_this.project.save(); ",
            " ",
            "\t// what about .js ?",
-           "   _this.done = true;",
-           "\t_this.el.hide();",
-           "",
-           "// hopefull this will work with bjs files..",
-           "\t",
+           "_this.done = true;",
+           "_this.el.hide();",
+           "if (_this.doneObj != null) {",
+           "\t_this.doneObj.call(_this.project);",
+           "}",
            " ",
            "   ",
            "}"
      "\t\treturn true;",
      "\t}",
      "\treturn false;",
+     "\t",
      "}",
      ""
     ],
      "() => {",
      "\t  if (!this.done) {",
      "    _this.el.show();",
-     "  ",
      "  }",
      "}"
     ]
     "}"
    ],
    "| void show" : [
-    "(Gtk.Window pwin, Project.Gtk project) {",
+    "(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(",
     "//\tGtk.Allocation rect;",
     "\t//btn.get_allocation(out rect);",
     " //   this.el.set_pointing_to(rect);",
-    "\tthis.el.set_transient_for(pwin);",
+    " 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);",