src/Builder4/ValaProjectSettingsPopover.bjs
[roobuilder] / src / Builder4 / ValaProjectSettingsPopover.bjs
1 {
2  "name" : "ValaProjectSettingsPopover",
3  "parent" : "",
4  "title" : "",
5  "path" : "/home/alan/gitlive/roobuilder/src/Builder4/ValaProjectSettingsPopover.bjs",
6  "permname" : "",
7  "modOrder" : "",
8  "build_module" : "builder",
9  "items" : [
10   {
11    "listeners" : {
12     "hide" : "() => {\n\t_this.project.writeConfig();\n\n}"
13    },
14    "id" : "ValaProjectSettingsPopover",
15    "Xcls_MainWindow window" : "null",
16    "| void show" : "(Gtk.Widget btn, Project.Gtk project) {\n     \n    //print(\"ValaProjectSettings show\\n\");\n    \n    this.project=  project;\n\n    this.compile_flags.el.text = _this.project.compilegroups.get(\"_default_\").compile_flags;\n    \n    this.default_directory_tree_store.load();    \n    this.default_packages_tree_store.load();            \n    this.targets_tree_store.load();\n    this.files_tree_store.load();\n\n\n\tthis.el.set_modal(true);\n\tthis.el.set_relative_to(btn);\n\n\tthis.el.set_position(Gtk.PositionType.RIGHT);\n\n\t// window + header?\n\t// print(\"SHOWALL - POPIP\\n\");\n\tthis.el.set_size_request(800,500);\n\tthis.el.show_all();\n\t//this.view.el.grab_focus();\n\n}\n",
17    "Project.Gtk project" : "null",
18    "xtype" : "Popover",
19    "Gtk.PositionType position" : "Gtk.PositionType.RIGHT",
20    "| void save" : "()  {\n    this.project.writeConfig(); \n}",
21    "$ xns" : "Gtk",
22    "bool modal" : true,
23    "uint border_width" : 0,
24    "items" : [
25     {
26      "bool hexpand" : true,
27      "* pack" : "add",
28      "xtype" : "Box",
29      "$ xns" : "Gtk",
30      "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
31      "items" : [
32       {
33        "* pack" : "pack_start,true,true,0",
34        "xtype" : "Notebook",
35        "$ xns" : "Gtk",
36        "items" : [
37         {
38          "id" : "label_global",
39          "xtype" : "Label",
40          "* pack" : false,
41          "$ xns" : "Gtk",
42          "utf8 label" : "Global"
43         },
44         {
45          "id" : "label_targets",
46          "* pack" : false,
47          "xtype" : "Label",
48          "$ xns" : "Gtk",
49          "utf8 label" : "Targets"
50         },
51         {
52          "xtype" : "Box",
53          "* pack" : "append_page,_this.label_global.el",
54          "gboolean homogeneous" : false,
55          "$ xns" : "Gtk",
56          "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
57          "items" : [
58           {
59            "xtype" : "Label",
60            "* pack" : "pack_start,false,false,0",
61            "$ xns" : "Gtk",
62            "utf8 label" : "compile flags"
63           },
64           {
65            "listeners" : {
66             "changed" : "() => {\n    \n   _this.project.compilegroups.get(\"_default_\").compile_flags = this.el.text;\n   _this.project.writeConfig();\n//    _this.project.save();\n\n}"
67            },
68            "id" : "compile_flags",
69            "xtype" : "Entry",
70            "* pack" : "pack_start,false,false,0",
71            "$ xns" : "Gtk",
72            "utf8 placeholder_text" : "eg. -g --valasrc $BASEDIR "
73           },
74           {
75            "* pack" : "pack_start,true,true,0",
76            "xtype" : "Paned",
77            "$ xns" : "Gtk",
78            "int position" : 300,
79            "Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
80            "items" : [
81             {
82              "bool hexpand" : true,
83              "xtype" : "ScrolledWindow",
84              "* pack" : "add",
85              "$ xns" : "Gtk",
86              "items" : [
87               {
88                "gboolean headers_visible" : true,
89                "* pack" : "add",
90                "xtype" : "TreeView",
91                "string id" : "default_packages_tree",
92                "$ xns" : "Gtk",
93                "items" : [
94                 {
95                  "id" : "default_packages_tree_store",
96                  "* pack" : "set_model",
97                  "xtype" : "ListStore",
98                  "$ n_columns" : 2,
99                  "| void load" : "() {\n \n    var def = _this.project.compilegroups.get(\"_default_\");\n    var items  = def.packages;\n    \n    this.el.clear();\n    var pal = (Palete.Gtk) _this.project.palete;\n    var pkgs = pal.packages(_this.project);\n    print(\"ValaProjectSettings:packages load %d\\n\", pkgs.size);\n\n    Gtk.TreeIter citer;\n\n    for(var i =0 ; i < pkgs.size; i++) {\n         this.el.append(out citer);   \n         \n        this.el.set_value(citer, 0,   pkgs.get(i) ); // title \n        this.el.set_value(citer, 1,   items.contains(pkgs.get(i)) );\n    }\n    this.el.set_sort_column_id(0,Gtk.SortType.ASCENDING);\n    \n}\n",
100                  "$ columns" : "    typeof(string),  // 0 key type\n      typeof(bool)",
101                  "$ xns" : "Gtk"
102                 },
103                 {
104                  "utf8 title" : "package name",
105                  "* init" : " \n this.el.add_attribute(_this.packages_render.el , \"text\", 0 );\n  ",
106                  "* pack" : "append_column",
107                  "xtype" : "TreeViewColumn",
108                  "gboolean resizable" : true,
109                  "gboolean expand" : true,
110                  "$ xns" : "Gtk",
111                  "items" : [
112                   {
113                    "id" : "packages_render",
114                    "* pack" : "pack_start,false",
115                    "xtype" : "CellRendererText",
116                    "$ xns" : "Gtk"
117                   }
118                  ]
119                 },
120                 {
121                  "utf8 title" : "use",
122                  "* init" : "{\n this.el.add_attribute(_this.packages_render_use.el , \"active\", 1 );\n }",
123                  "* pack" : "append_column",
124                  "xtype" : "TreeViewColumn",
125                  "gboolean resizable" : false,
126                  "$ xns" : "Gtk",
127                  "gint fixed_width" : 50,
128                  "items" : [
129                   {
130                    "listeners" : {
131                     "toggled" : "(  path_string) =>  { \n    var m = _this.default_packages_tree_store.el;\n   Gtk.TreeIter iter;\n   Gtk.TreePath path = new Gtk.TreePath.from_string (path_string);\n   m.get_iter (out iter, path);\n   GLib.Value val;\n   m.get_value(iter, 1, out val);\n   m.set_value(iter, 1,  ((bool) val) ? false :true); \n     GLib.Value fval;  \n   m.get_value(iter, 0, out fval);\n   var fn = (string)fval;\n    \n    var def = _this.project.compilegroups.get(\"_default_\");\n    var items  = def.packages;\n    if ((bool)val) {\n        // renive\n        items.remove(fn);\n    } else {\n        items.add(fn);\n    }\n    \n}"
132                    },
133                    "id" : "packages_render_use",
134                    "xtype" : "CellRendererToggle",
135                    "* pack" : "pack_start,false",
136                    "$ xns" : "Gtk",
137                    "gboolean activatable" : true
138                   }
139                  ]
140                 }
141                ]
142               }
143              ]
144             },
145             {
146              "bool hexpand" : true,
147              "xtype" : "ScrolledWindow",
148              "* pack" : "add2",
149              "$ xns" : "Gtk",
150              "items" : [
151               {
152                "listeners" : {
153                 "button_press_event" : " ( ev) => {\n    //console.log(\"button press?\");\n   \n    \n    if (ev.type != Gdk.EventType.BUTTON_PRESS  || ev.button != 3) {\n        //print(\"click\" + ev.type);\n        return false;\n    }\n    //Gtk.TreePath res;\n    //if (!this.el.get_path_at_pos((int)ev.x,(int)ev.y, out res, null, null, null) ) {\n    //    return true;\n    //}\n     \n  //  this.el.get_selection().select_path(res);\n     \n      //if (!this.get('/LeftTreeMenu').el)  { \n      //      this.get('/LeftTreeMenu').init(); \n      //  }\n        \n     _this.default_directory_menu.el.set_screen(Gdk.Screen.get_default());\n     _this.default_directory_menu.el.show_all();\n      _this.default_directory_menu.el.popup(null, null, null,  3, ev.time);\n     //   print(\"click:\" + res.path.to_string());\n      return true;\n}"
154                },
155                "gboolean headers_visible" : true,
156                "id" : "default_directory_tree",
157                "* pack" : "add",
158                "xtype" : "TreeView",
159                "$ xns" : "Gtk",
160                "items" : [
161                 {
162                  "id" : "default_directory_tree_store",
163                  "* pack" : "set_model",
164                  "xtype" : "ListStore",
165                  "$ n_columns" : 1,
166                  "| void load" : "() {\n \n  this.el.clear();\n  \n    \n     var def = _this.project.compilegroups.get(\"_default_\");\n     var items  = def.sources;\n     \n \n    Gtk.TreeIter citer;\n\n    for(var i =0 ; i < items.size; i++) {\n         this.el.append(out citer);   \n         \n        this.el.set_value(citer, 0,   items.get(i) ); // title \n        //this.el.set_value(citer, 1,   items.get(i) );\n    }\n    this.el.set_sort_column_id(0,Gtk.SortType.ASCENDING);\n    \n}\n",
167                  "$ columns" : "    typeof(string)\n     ",
168                  "$ xns" : "Gtk"
169                 },
170                 {
171                  "utf8 title" : "Available Directories (right click to add)",
172                  "* init" : "\n this.el.add_attribute(_this.directory_render.el , \"text\", 0 );\n   ",
173                  "* pack" : "append_column",
174                  "xtype" : "TreeViewColumn",
175                  "gboolean resizable" : true,
176                  "$ xns" : "Gtk",
177                  "items" : [
178                   {
179                    "id" : "directory_render",
180                    "* pack" : "pack_start,false",
181                    "xtype" : "CellRendererText",
182                    "$ xns" : "Gtk"
183                   }
184                  ]
185                 }
186                ]
187               },
188               {
189                "id" : "default_directory_menu",
190                "xtype" : "Menu",
191                "$ xns" : "Gtk",
192                "items" : [
193                 {
194                  "listeners" : {
195                   "activate" : "()  => {\n    \n    var  chooser = new Gtk.FileChooserDialog (\n\t\"Add a directory\", _this.window.el, Gtk.FileChooserAction.SELECT_FOLDER ,\n\t\"_Cancel\",\n\tGtk.ResponseType.CANCEL,\n\t\"_Add\",\n\tGtk.ResponseType.ACCEPT);\n    if (chooser.run () != Gtk.ResponseType.ACCEPT) {\n        chooser.close ();\n           return;\n       }\n       chooser.close ();\n       // add the directory..\n       var fn = _this.project.relPath(chooser.get_filename());\n       _this.project.compilegroups.get(\"_default_\").sources.add(fn);\n       _this.default_directory_tree_store.load();\n}"
196                  },
197                  "* pack" : "add",
198                  "xtype" : "MenuItem",
199                  "$ xns" : "Gtk",
200                  "utf8 label" : "Add Directory"
201                 },
202                 {
203                  "listeners" : {
204                   "activate" : "()  => {\n    \n    var  chooser = new Gtk.FileChooserDialog (\n\t\"Add a directory\", _this.window.el, Gtk.FileChooserAction.OPEN ,\n\t\"_Cancel\",\n\tGtk.ResponseType.CANCEL,\n\t\"_Add\",\n\tGtk.ResponseType.ACCEPT);\n    if (chooser.run () != Gtk.ResponseType.ACCEPT) {\n        chooser.close ();\n           return;\n       }\n       chooser.close ();\n       // add the directory..\n       var fn = _this.project.relPath(chooser.get_filename());\n       _this.project.compilegroups.get(\"_default_\").sources.add(fn);\n       _this.default_directory_tree_store.load();\n}"
205                  },
206                  "* pack" : "add",
207                  "xtype" : "MenuItem",
208                  "$ xns" : "Gtk",
209                  "utf8 label" : "Add File"
210                 },
211                 {
212                  "* pack" : "add",
213                  "xtype" : "SeparatorMenuItem",
214                  "$ xns" : "Gtk"
215                 },
216                 {
217                  "listeners" : {
218                   "activate" : "()  => {\n    \n     //\n        Gtk.TreeModel mod;\n        Gtk.TreeIter iter;\n        if (!_this.default_directory_tree.el.get_selection().get_selected(out mod, out iter)) {\n               print(\"nothing selected\\n\");\n            return;\n        }\n\n            \n       // add the directory..\n       \n       \n       GLib.Value val;\n        mod.get_value(iter,0, out val);\n       var fn =  (string) val;\n       \n       print(\"remove: %s\\n\", fn);\n       if (!_this.project.compilegroups.get(\"_default_\").sources.remove(fn)) {\n                  print(\"remove failed\");\n              }\n       _this.default_directory_tree_store.load();\n}"
219                  },
220                  "* pack" : "add",
221                  "xtype" : "MenuItem",
222                  "$ xns" : "Gtk",
223                  "utf8 label" : "Remove File/Directory"
224                 }
225                ]
226               }
227              ]
228             }
229            ]
230           }
231          ]
232         },
233         {
234          "gint position" : 300,
235          "xtype" : "Paned",
236          "* pack" : "append_page,_this.label_targets.el",
237          "$ xns" : "Gtk",
238          "Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
239          "items" : [
240           {
241            "* init" : "{  \nthis.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);\n\n}\n",
242            "xtype" : "ScrolledWindow",
243            "* pack" : "add1",
244            "$ xns" : "Gtk",
245            "items" : [
246             {
247              "id" : "targets_tree_menu",
248              "* pack" : "add",
249              "xtype" : "Menu",
250              "$ xns" : "Gtk",
251              "items" : [
252               {
253                "listeners" : {
254                 "activate" : "()  => {\n    \n       if (_this.project.compilegroups.has_key(\"NEW GROUP\")) {\n        return;\n    }\n      \n       // add the directory..\n       \n       _this.project.compilegroups.set(\"NEW GROUP\", new Project.GtkValaSettings(\"NEW GROUP\"));\n       _this.targets_tree_store.load();\n}"
255                },
256                "* pack" : "add",
257                "xtype" : "MenuItem",
258                "$ xns" : "Gtk",
259                "utf8 label" : "Add Compile Target"
260               },
261               {
262                "* pack" : "add",
263                "xtype" : "SeparatorMenuItem",
264                "$ xns" : "Gtk"
265               },
266               {
267                "listeners" : {
268                 "activate" : "()  => {\n    \n     //\n        Gtk.TreeModel mod;\n        Gtk.TreeIter iter;\n        if (!_this.targets_tree.el.get_selection().get_selected(out mod, out iter)) {\n               print(\"nothing selected\\n\");\n            return;\n        }\n\n            \n       // add the directory..\n       \n       \n       GLib.Value val;\n        mod.get_value(iter,0, out val);\n       var fn =  (string) val;\n       \n       print(\"remove: %s\\n\", fn);\n       if (!_this.project.compilegroups.unset(fn)) {\n                  print(\"remove failed\");\n      }\n       _this.targets_tree_store.load();\n}"
269                },
270                "* pack" : "add",
271                "xtype" : "MenuItem",
272                "$ xns" : "Gtk",
273                "utf8 label" : "Remove Target"
274               }
275              ]
276             },
277             {
278              "listeners" : {
279               "button_press_event" : " ( ev) => {\n    //console.log(\"button press?\");\n   \n    \n    if (ev.type != Gdk.EventType.BUTTON_PRESS  || ev.button != 3) {\n        //print(\"click\" + ev.type);\n        return false;\n    }\n    //Gtk.TreePath res;\n    //if (!this.el.get_path_at_pos((int)ev.x,(int)ev.y, out res, null, null, null) ) {\n    //    return true;\n    //}\n     \n  //  this.el.get_selection().select_path(res);\n     \n      //if (!this.get('/LeftTreeMenu').el)  { \n      //      this.get('/LeftTreeMenu').init(); \n      //  }\n        \n     _this.targets_tree_menu.el.set_screen(Gdk.Screen.get_default());\n     _this.targets_tree_menu.el.show_all();\n      _this.targets_tree_menu.el.popup(null, null, null,  3, ev.time);\n     //   print(\"click:\" + res.path.to_string());\n      return true;\n}",
280               "cursor_changed" : " ( ) => {\n\n    if (this.cursor != \"\") {\n         // save the values..\n     }\n     \n     // load the new values.\n     \n\n         Gtk.TreeModel mod;\n        Gtk.TreeIter iter;\n        if (!this.el.get_selection().get_selected(out mod, out iter)) {\n            print(\"nothing selected\\n\");\n            // should disable the right hand side..\n            _this.set_vbox.el.hide();\n            return;\n        }\n        _this.set_vbox.el.show();\n            \n       // add the directory..\n       \n       \n       GLib.Value val;\n        mod.get_value(iter,0, out val);\n       var fn =  (string) val;\n       \n       this.cursor = fn;\n       var cg = _this.project.compilegroups.get(fn);\n       \n       _this.build_pack_target.el.set_text(cg.target_bin);\n       _this.build_compile_flags.el.set_text(cg.compile_flags);\n\t\t_this.build_execute_args.el.set_text(cg.execute_args);\n       \n       _this.set_vbox.cgroup = cg;\n       _this.files_tree_store.update();\n       \n       // load the srouces\n       \n\n  }"
281              },
282              "id" : "targets_tree",
283              "# string cursor" : "",
284              "* pack" : "add",
285              "xtype" : "TreeView",
286              "$ xns" : "Gtk",
287              "items" : [
288               {
289                "id" : "targets_tree_store",
290                "xtype" : "ListStore",
291                "* pack" : "set_model",
292                "$ n_columns" : 2,
293                "| void load" : "() {\n \n  this.el.clear();\n  \n    \n     var cg = _this.project.compilegroups;\n     \n   _this.targets_tree.cursor = \"\";\n    Gtk.TreeIter citer;\n    var iter = cg.map_iterator();\n   while(iter.next()) {\n        var key = iter.get_key();\n        if (key == \"_default_\") {\n            continue;\n        }\n    \n         this.el.append(out citer);   \n         \n        this.el.set_value(citer, 0,   key ); // title \n        //this.el.set_value(citer, 1,   items.get(i) );\n    };\n    this.el.set_sort_column_id(0,Gtk.SortType.ASCENDING);\n    _this.set_vbox.el.hide();\n}\n",
294                "$ columns" : "    typeof(string),  // 0 key type\n     typeof(string) // ??\n     ",
295                "$ xns" : "Gtk"
296               },
297               {
298                "utf8 title" : "name",
299                "* init" : " {\n     this.el.add_attribute(_this.targets_render.el , \"text\", 0 );\n }",
300                "* pack" : "append_column",
301                "xtype" : "TreeViewColumn",
302                "gboolean resizable" : true,
303                "$ xns" : "Gtk",
304                "items" : [
305                 {
306                  "listeners" : {
307                   "edited" : "  (path, newtext) => {\n     \n     Gtk.TreeIter  iter;\n        _this.targets_tree_store.el.get_iter(out iter, new Gtk.TreePath.from_string(path));\n       GLib.Value gval;\n        _this.targets_tree_store.el.get_value(iter,0, out gval);\n        var oldval = (string)gval;\n       if (oldval == newtext) {\n          return;\n        }\n         var cg = _this.project.compilegroups.get(oldval);\n        cg.name = newtext;\n        _this.project.compilegroups.unset(oldval);\n        _this.project.compilegroups.set(newtext, cg);\n       _this.targets_tree_store.load();\n  }"
308                  },
309                  "id" : "targets_render",
310                  "xtype" : "CellRendererText",
311                  "* pack" : "pack_start,false",
312                  "$ xns" : "Gtk",
313                  "gboolean editable" : true
314                 }
315                ]
316               }
317              ]
318             }
319            ]
320           },
321           {
322            "id" : "set_vbox",
323            "xtype" : "Box",
324            "* pack" : "add2",
325            "gboolean homogeneous" : false,
326            "$ xns" : "Gtk",
327            "# Project.GtkValaSettings cgroup" : "null",
328            "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
329            "items" : [
330             {
331              "xtype" : "Label",
332              "* pack" : "pack_start,false,false,0",
333              "$ xns" : "Gtk",
334              "utf8 label" : "target filename"
335             },
336             {
337              "listeners" : {
338               "changed" : "()  => {\n        if (_this.targets_tree.cursor.length < 1) {\n        return;\n    }\n    _this.project.compilegroups.get(_this.targets_tree.cursor).target_bin = this.el.text;\n}"
339              },
340              "id" : "build_pack_target",
341              "xtype" : "Entry",
342              "* pack" : "pack_start,false,false,0",
343              "$ xns" : "Gtk"
344             },
345             {
346              "xtype" : "Label",
347              "* pack" : "pack_start,false,false,0",
348              "$ xns" : "Gtk",
349              "utf8 label" : "compile flags"
350             },
351             {
352              "listeners" : {
353               "changed" : "() => {\n    if (_this.targets_tree.cursor.length < 1) {\n        return;\n    }\n    _this.project.compilegroups.get(_this.targets_tree.cursor).compile_flags = this.el.text;\n}"
354              },
355              "id" : "build_compile_flags",
356              "xtype" : "Entry",
357              "* pack" : "pack_start,false,false,0",
358              "$ xns" : "Gtk"
359             },
360             {
361              "xtype" : "Label",
362              "* pack" : "pack_start,false,false,0",
363              "$ xns" : "Gtk",
364              "utf8 label" : "test argments - when run after a build"
365             },
366             {
367              "listeners" : {
368               "changed" : "() => {\n    if (_this.targets_tree.cursor.length < 1) {\n        return;\n    }\n    _this.project.compilegroups.get(_this.targets_tree.cursor).execute_args = this.el.text;\n}"
369              },
370              "id" : "build_execute_args",
371              "string placeholder_text" : "eg.  -f somefile -g ",
372              "xtype" : "Entry",
373              "* pack" : "pack_start,false,false,0",
374              "$ xns" : "Gtk"
375             },
376             {
377              "xtype" : "Label",
378              "* pack" : "pack_start,false,false,0",
379              "$ xns" : "Gtk",
380              "utf8 label" : "Files to compile"
381             },
382             {
383              "* pack" : "pack_start,true,true,0",
384              "xtype" : "ScrolledWindow",
385              "$ xns" : "Gtk",
386              "items" : [
387               {
388                "xtype" : "TreeView",
389                "* pack" : "add",
390                "string id" : "files_tree",
391                "$ xns" : "Gtk",
392                "items" : [
393                 {
394                  "id" : "files_tree_store",
395                  "xtype" : "ListStore",
396                  "* pack" : "set_model",
397                  "| void updateDir" : "(string dname, bool bval) {\n  \n  Gtk.TreeIter citer;\n\n    var cg =   _this.set_vbox.cgroup;\n  for(var i =0 ; i < this.el.iter_n_children(null); i++) {\n        this.el.iter_nth_child(out citer,null,i);\n\n        GLib.Value val;\n        this.el.get_value(citer,0, out val);\n        var fn = (string) val;\n        \n        if ( Path.get_dirname (fn) == dname) {\n        \n            this.el.set_value(citer, 3,   bval ); // checked \n           \n     \n     \n            if (!bval) {\n                // renive\n                if (cg.sources.contains(fn)) {\n                    cg.sources.remove(fn);\n                }\n            } else {\n                if (!cg.sources.contains(fn)) {\n                    cg.sources.add(fn);\n                }\n            }\n            \n            \n        }\n    }\n\n}\n",
398                  "$ n_columns" : 4,
399                  "| void load" : "() {\n \n      this.el.clear();\n  \n    \n     var def = _this.project.compilegroups.get(\"_default_\");\n     var items  = def.sources;\n     \n     \n     \n     \n \n    Gtk.TreeIter citer;\n\n    for(var i =0 ; i < items.size; i++) {\n    \n         var files = _this.project.filesForCompile(items.get(i), false);\n         if (files.size < 1) {\n            continue;\n         }\n    \n         this.el.append(out citer);   \n         \n        this.el.set_value(citer, 0,   items.get(i) ); // title \n        this.el.set_value(citer, 1,   \"<span foreground=\\\"green\\\" font_weight=\\\"bold\\\">\" + \n                    GLib.Markup.escape_text(items.get(i)) + \"</span>\"\n            ); // title \n        print(\"ADD item %s\", items.get(i));\n        this.el.set_value(citer, 2,   \"dir\"); // type         \n        this.el.set_value(citer, 3,   false ); // checked \n\n       \n        \n         for(var j =0 ; j < files.size; j++) {\n            this.el.append(out citer);   \n             print(\"ADD item %s\", files.get(j));\n            this.el.set_value(citer, 0,   files.get(j) ); // title \n            this.el.set_value(citer, 1,   GLib.Markup.escape_text( Path.get_basename (files.get(j))) ); // title             \n            this.el.set_value(citer, 2,   \"file\"); // type         \n            this.el.set_value(citer, 3,   false ); // checked \n\n        }\n        \n        \n        //this.el.set_value(citer, 1,   items.get(i) );\n    }\n    this.el.set_sort_column_id(0,Gtk.SortType.ASCENDING);\n    \n}\n ",
400                  "$ columns" : "    typeof(string),  // 0 file name\n        typeof(string),  // 0 basename\n     typeof(string), // type (dir orfile)\n     typeof(bool)  // is checked.\n     ",
401                  "$ xns" : "Gtk",
402                  "| void update" : "() {\n\n\n    Gtk.TreeIter citer;\n\n    for(var i =0 ; i < this.el.iter_n_children(null); i++) {\n        this.el.iter_nth_child(out citer,null,i);\n\n        GLib.Value val;\n        this.el.get_value(citer,0, out val);\n        var fn = (string) val;\n        \n        var active = false;\n        if (_this.set_vbox.cgroup.sources.contains(fn)) {\n            active = true;\n        }\n        \n        this.el.set_value(citer, 3,   active ); // checked \n    }\n\n\n}\n"
403                 },
404                 {
405                  "utf8 title" : "name",
406                  "* init" : "\n this.el.add_attribute(_this.files_render.el , \"markup\", 1 ); // basnemae\n \n/*  this.el.add_attribute(_this.files_render.el , \"markup\", 2 );\n*/",
407                  "* pack" : "append_column",
408                  "xtype" : "TreeViewColumn",
409                  "gboolean resizable" : true,
410                  "$ xns" : "Gtk",
411                  "items" : [
412                   {
413                    "id" : "files_render",
414                    "* pack" : "pack_start,false",
415                    "xtype" : "CellRendererText",
416                    "$ xns" : "Gtk"
417                   }
418                  ]
419                 },
420                 {
421                  "utf8 title" : "use",
422                  "* init" : "{\n this.el.add_attribute(_this.files_render_use.el , \"active\", 3 );\n }",
423                  "* pack" : "append_column",
424                  "xtype" : "TreeViewColumn",
425                  "gboolean resizable" : false,
426                  "$ xns" : "Gtk",
427                  "gint fixed_width" : 50,
428                  "items" : [
429                   {
430                    "listeners" : {
431                     "toggled" : "(  path_string) =>  { \n\n\n\n    var m = _this.files_tree_store.el;\n   Gtk.TreeIter iter;\n   Gtk.TreePath path = new Gtk.TreePath.from_string (path_string);\n   m.get_iter (out iter, path);\n   GLib.Value val;\n   m.get_value(iter, 3, out val);\n   m.set_value(iter, 3,  ((bool) val) ? false :true); \n   \n   // type.\n   GLib.Value ftval;  \n   m.get_value(iter, 2, out ftval);\n   var ftype = (string)ftval;   \n   \n   // full name...  \n   GLib.Value fval;     \n   m.get_value(iter, 0, out fval);\n   var fn = (string)fval;\n    \n    \n    var cg =   _this.set_vbox.cgroup;\n    // what's the sleected target?\n    // update the list..\n    // if ftype is a dir == then toggle all the bellow.\n    \n    if (ftype == \"dir\") {\n        _this.files_tree_store.updateDir(fn,  ((bool) val) ? false :true);\n    }\n    \n    // if ftype is a file .. see if all the files in that directory are check and check the dir.\n\n     \n    if ((bool)val) {\n        // renive\n        cg.sources.remove(fn);\n    } else {\n        cg.sources.add(fn);\n    }\n    \n}"
432                    },
433                    "id" : "files_render_use",
434                    "xtype" : "CellRendererToggle",
435                    "* pack" : "pack_start,false",
436                    "$ xns" : "Gtk",
437                    "gboolean activatable" : true
438                   }
439                  ]
440                 }
441                ]
442               }
443              ]
444             }
445            ]
446           }
447          ]
448         }
449        ]
450       }
451      ]
452     }
453    ]
454   }
455  ]
456 }