FixBug.bjs
[gitlive] / FixBug.bjs
1 {
2     "id": "file-gtk-18",
3     "name": "FixBug",
4     "parent": "",
5     "title": false,
6     "path": "/home/alan/gitlive/gitlive/FixBug.bjs",
7     "items": [
8         {
9             "|xns": "Gtk",
10             "xtype": "Dialog",
11             "default_height": 500,
12             "default_width": 600,
13             "|deletable": true,
14             "|modal": true,
15             "border_width": 3,
16             "title": "Project Properties",
17             "|show": "function(c) {\n       c = c || { name : '' , xtype : '' };\n    this.project  = c;\n    if (!this.el) {\n        this.init();\n    }\n    var _this = this;\n    [ 'xtype'  ].forEach(function(k) {\n        _this.get(k).setValue(typeof(c[k]) == 'undefined' ? '' : c[k]);\n    });\n\t// shouild set path..\n    \n    this.el.show_all();\n    this.success = c.success;\n}\n",
18             "listeners": {
19                 "destroy_event": "function (self, event) {\n     this.el.hide();\n                return false;\n}",
20                 "response": "function (self, id) {\n if (id < 1) {\n            this.el.hide();\n            return;\n        }\n        if (!this.get('xtype').getValue().length) {\n            this.get('/StandardErrorDialog').show(\"You have to set Project type\");             \n            return;\n        }\n        if (!this.get('dir').el.get_filename().length) {\n            this.get('/StandardErrorDialog').show(\"You have to select a folder\");             \n            return;\n        }\n\n        this.el.hide();\n        \n        \n        var fn = this.get('dir').el.get_filename();\n        \n        this.project.name  = GLib.basename(fn);\n        this.project.xtype  = this.get('xtype').getValue();\n        this.project.paths = {};\n        this.project.paths[fn] =  'dir' ;\n        \n        var pr = imports.Builder.Provider.ProjectManager.ProjectManager.update(this.project);\n        \n        this.success(pr);\n        Seed.print(id);\n}"
21             },
22             "items": [
23                 {
24                     "|xns": "Gtk",
25                     "xtype": "VBox",
26                     "|pack": " function(p,e) {\n            p.el.get_content_area().add(e.el)\n        }\n",
27                     "items": [
28                         {
29                             "|xns": "Gtk",
30                             "xtype": "HBox",
31                             "pack": "pack_start,false,true,3",
32                             "items": [
33                                 {
34                                     "|xns": "Gtk",
35                                     "xtype": "Label",
36                                     "pack": "pack_start,false,true,3",
37                                     "label": "Project type :"
38                                 },
39                                 {
40                                     "|xns": "Gtk",
41                                     "xtype": "ComboBox",
42                                     "pack": "pack_end,true,true,3",
43                                     "id": "xtype",
44                                     "|setValue": "function(v)\n                {\n                    var el = this.el;\n                    el.set_active(-1);\n                    this.get('model').data.forEach(function(n, ix) {\n                        if (v == n.xtype) {\n                            el.set_active(ix);\n                            return false;\n                        }\n                    });\n                }",
45                                     "|getValue": "function() {\n     var ix = this.el.get_active();\n            if (ix < 0 ) {\n                return '';\n            }\n            return this.get('model').data[ix].xtype;\n}\n",
46                                     "|init": "function() {\n    XObject.prototype.init.call(this);\n  this.el.add_attribute(this.items[0].el , 'markup', 1 );  \n}\n",
47                                     "items": [
48                                         {
49                                             "|xns": "Gtk",
50                                             "xtype": "CellRendererText",
51                                             "pack": "pack_start"
52                                         },
53                                         {
54                                             "|xns": "Gtk",
55                                             "xtype": "ListStore",
56                                             "pack": "set_model",
57                                             "|init": "function() {\n    XObject.prototype.init.call(this);\n\n                            this.el.set_column_types ( 2, [\n                                GObject.TYPE_STRING,  // real key\n                                GObject.TYPE_STRING // real type\n                                \n                                \n                            ] );\n                            \n                            this.data = [\n                                { xtype: 'Roo', desc : \"Roo Project\" },\n                                { xtype: 'Gtk', desc : \"Gtk Project\" },    \n                                //{ xtype: 'JS', desc : \"Javascript Class\" }\n                            ]\n                            \n                            this.loadData(this.data);\n                                \n}\n",
58                                             "|loadData": "function (data) {\n                                            \n            var iter = new Gtk.TreeIter();\n            var el = this.el;\n            data.forEach(function(p) {\n                \n                el.append(iter);\n                \n                 \n                el.set_value(iter, 0, p.xtype);\n                el.set_value(iter, 1, p.desc);\n                \n            });\n              \n                                     \n}\n",
59                                             "id": "model"
60                                         }
61                                     ]
62                                 }
63                             ]
64                         },
65                         {
66                             "|xns": "Gtk",
67                             "xtype": "FileChooserWidget",
68                             "pack": "pack_end,true,true,5",
69                             "|action": "Gtk.FileChooserAction.SELECT_FOLDER",
70                             "id": "dir",
71                             "|select_multiple": false
72                         }
73                     ]
74                 },
75                 {
76                     "|xns": "Gtk",
77                     "xtype": "Button",
78                     "pack": "add_action_widget,1",
79                     "label": "OK"
80                 },
81                 {
82                     "|xns": "Gtk",
83                     "xtype": "Button",
84                     "pack": "add_action_widget,0",
85                     "label": "Cancel"
86                 }
87             ]
88         }
89     ],
90     "permname": "",
91     "modOrder": "0"
92 }