revert code that did not affect memory
[gitlive] / Ticket.bjs
1 {
2  "name" : "Ticket",
3  "parent" : "",
4  "title" : "",
5  "path" : "/home/alan/gitlive/gitlive/Ticket.bjs",
6  "permname" : "",
7  "modOrder" : "",
8  "build_module" : "gitlive",
9  "items" : [
10   {
11    "listeners" : {
12     "delete_event" : "(self, event) => {\n    this.el.hide();\n    return true; \n    //test  \n}\n ",
13     "response" : " (self, response_id) =>  { \n  \n\tGLib.debug(\"got %d\", (int) response_id);\n\tif (response_id < 1) {\n\t    _this.el.hide();\t\n\t    this.running = false; \n\t \treturn;\n\t}\n\t \n\t \n\tvar tid = RooTicket.singleton().createTicket(\n\t\n\t\t_this.project_id.selectedProjectId(),\n\t\n\t\t_this.milestone_id.selectedMilestoneId(),\n\t\t_this.priority_id.selectedPriorityId() ,\n\t\t_this.severity_id.selectedSeverityId() ,\t\t\n\t\t_this.classification_id.selectedClassificationId() ,\n\t\t_this.developer_id.selectedDeveloperId(),\n\t\t_this.summary.el.get_text() ,\n\t\t_this.description.el.buffer.text \n\t);\n\tthis.el.hide();\n    this.running = false; \n\tif (this.repo != null) {\n\t \tNewBranch.singleton().show(this.repo, new Gee.ArrayList<GitMonitorQueue>(), tid);\n \t}\n\n  \n\t \n}"
14    },
15    "default_width" : 500,
16    "$ deletable" : true,
17    "title" : "Create a Ticket",
18    "xtype" : "Dialog",
19    "# GitRepo? repo" : "null",
20    "|   void show" : "( GitRepo? repo   ) \n{\n     // this.el.set_gravity(Gdk.Gravity.NORTH);\n    if (this.running) { // should not happen!!\n    \tGLib.error(\"new branch show called, when already being displayed?\");\n\t}\n \tthis.running  = true;\n \n \t_this.el.show_all();\n\t\n\t_this.table.el.hide();\n\n\t_this.spinner.el.show();\n\t_this.spinner.el.start();\t\n\tthis.el.set_keep_above(true);    \n\tthis.el.move((Gdk.Screen.width() / 2)- 250 ,0);\n\tthis.el.set_default_size( 500,100); // not sure why it grows..\n\t\n\tGLib.debug(\"Showing dialog?\"); \n    Timeout.add_seconds(1, () => {\n\t\t\n\t\t \n\t\t//GitMonitor.gitmonitor.stop();\n\t\t\n\t\tthis.repo = repo;\n\t\t\n\t\t \n\t\tRooProject? curproj = null;\n\t\tif (this.repo != null) {\n\t\t\tcurproj = RooProject.getProjectByRepo(this.repo);\n\t\t}\n\t\t_this.prmodel.loadProjects(curproj == null ? \"\" : curproj.id);\n\t\tif (curproj != null) {\n\t \n\t\t\t\n\t\t\tvar rt = RooTicket.singleton();\n\t\t\trt.loadProjectOptions(curproj.id);\n\t\t\t\n\t\t\t_this.msmodel.loadMilestones();\n\t\t\t_this.primodel.loadPriorities();\n\t\t\t_this.sevmodel.loadSeverities();\n\t\t\t_this.clmodel.loadClassifications();\t\n\t\t\t_this.devmodel.loadDevelopers();\t\n\t\t\t\n\t\t}\n\t\t_this.summary.el.set_text(\"\");\n\t\t_this.description.el.buffer.text = \"\"; \n\t\t_this.spinner.el.stop();\n\t\t_this.spinner.el.hide();\t\n\n\t\tthis.table.el.show();\n\t    _this.summary.el.grab_focus();\n \n\t \treturn false;\n \t});\n \tthis.el.run();\n \t\n\n}",
21    "default_height" : 200,
22    "$ xns" : "Gtk",
23    "# bool running" : false,
24    "bool modal" : true,
25    "items" : [
26     {
27      "xtype" : "Box",
28      "$ pack" : "get_content_area().add",
29      "$ xns" : "Gtk",
30      "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
31      "items" : [
32       {
33        "id" : "table",
34        "bool homogeneous" : true,
35        "bool expand" : false,
36        "xtype" : "Table",
37        "* pack" : "pack_start,false,false,0",
38        "uint column_spacing" : 4,
39        "n_columns" : 4,
40        "$ xns" : "Gtk",
41        "n_rows" : 14,
42        "bool vexpand" : false,
43        "int margin" : 2,
44        "items" : [
45         {
46          "label" : "Project",
47          "$ visible" : true,
48          "Gtk.Align halign" : "Gtk.Align.START",
49          "* pack" : "attach_defaults,0,1,0,1",
50          "xtype" : "Label",
51          "$ xns" : "Gtk"
52         },
53         {
54          "label" : "Summary",
55          "$ visible" : true,
56          "Gtk.Align halign" : "Gtk.Align.START",
57          "* pack" : "attach_defaults,1,2,0,1",
58          "xtype" : "Label",
59          "x_options" : 4,
60          "$ xns" : "Gtk"
61         },
62         {
63          "listeners" : {
64           "changed" : "() => {\n\tif (this.loading) {\n\t\treturn;\n\t}\n\tvar project_id = this.selectedProjectId();\n\t\n\tvar rt = RooTicket.singleton();\n\trt.loadProjectOptions(project_id);\n\t\n\t_this.msmodel.loadMilestones();\n\t_this.primodel.loadPriorities();\n\t_this.sevmodel.loadSeverities();\n\t_this.clmodel.loadClassifications();\t\n\t_this.devmodel.loadDevelopers();\t\n\t\n\t// affects projects and milestones..\n\t\n\t\n\t/*if (this.loading) {\n\t\treturn;\n\t}\n\tvar ticket_id = this.selectedTicketId();\n\t\n\tvar name = RooTicket.singleton().usernameLocal();\n\t\n\tif (ticket_id == \"\" || ticket_id == null) {\n\t\n\t\tvar dt = new  DateTime.now_local();\n\t\t_this.name.el.set_text(\"wip_%s_%s\".printf(name,dt.format(\"%Y_%b_%d\")));\n\t\treturn;\n\t}\n\t\n\t\n\tvar ticket = RooTicket.singleton().getById(ticket_id);\n   \n\t_this.name.el.set_text(\"wip_%s_T%s_%s\".printf(name,ticket.id, ticket.summaryToBranchName()));\n\t\n\t//GLib.debug (//\"Selection: %s, %s\\n\", (string) val1, (string) val2);\n\t*/\n}"
65          },
66          "* ctor" : "new Gtk.ComboBox.with_entry()",
67          "| string selectedProjectId" : "() {\n\tGtk.TreeIter iter;\n\tValue val1;\n \n \n\tthis.el.get_active_iter (out iter);\n\t_this.prmodel.el.get_value (iter, 0, out val1);\n \n\n\treturn  (string) val1;\n\t\n\t\n\t\n\t\n}\n",
68          "id" : "project_id",
69          "* init" : "this.el.set_entry_text_column(1);",
70          "* pack" : "attach_defaults,0,1,1,2",
71          "xtype" : "ComboBox",
72          "# bool loading" : false,
73          "$ xns" : "Gtk",
74          "items" : [
75           {
76            "id" : "prcellrenderer",
77            "* pack" : "pack_start,true",
78            "xtype" : "CellRendererText",
79            "$ xns" : "Gtk"
80           },
81           {
82            "| void loadProjects" : "  (string id) {\n\n    \n    _this.project_id.loading = true;\n\n    this.el.clear();                                    \n    Gtk.TreeIter iter;\n    var el = this.el;\n    \n    el.append(out iter);\n\n    \n    el.set_value(iter, 0, \"\");\n    el.set_value(iter, 1, \"-- select a project --\");\n    if (id == \"\") {\n\t    _this.project_id.el.set_active_iter(iter);\n    }\n\n    foreach(var project in RooProject.projects()) {\n    \n        el.append(out iter);\n        \n        el.set_value(iter, 0, project.id);\n        el.set_value(iter, 1,  project.name );\n        if (id == project.id) {\n\t \t   _this.project_id.el.set_active_iter(iter);\n\t    }   \n        \n    }\n    \n    _this.project_id.loading = false;\n     //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);          \n                                     \n}\n",
83            "id" : "prmodel",
84            "* pack" : "set_model",
85            "xtype" : "ListStore",
86            "$ columns" : "typeof(string),typeof(string)",
87            "n_columns" : 2,
88            "$ xns" : "Gtk"
89           }
90          ]
91         },
92         {
93          "id" : "summary",
94          "$ visible" : true,
95          "xtype" : "Entry",
96          "* pack" : "attach_defaults,1,4,1,2",
97          "$ xns" : "Gtk"
98         },
99         {
100          "label" : "Milestone",
101          "Gtk.Align halign" : "Gtk.Align.START",
102          "xalign" : 0.90000000000000002,
103          "* pack" : "attach_defaults,0,1,2,3",
104          "xtype" : "Label",
105          "$ justify" : "Gtk.Justification.RIGHT",
106          "x_options" : 4,
107          "$ xns" : "Gtk"
108         },
109         {
110          "* ctor" : "new Gtk.ComboBox.with_entry()",
111          "id" : "milestone_id",
112          "* init" : "this.el.set_entry_text_column(1);",
113          "* pack" : "attach_defaults,0,1,3,4",
114          "xtype" : "ComboBox",
115          "# bool loading" : false,
116          "$ xns" : "Gtk",
117          "| string selectedMilestoneId" : "() {\n\tGtk.TreeIter iter;\n\tValue val1;\n \n \n\tthis.el.get_active_iter (out iter);\n\t_this.msmodel.el.get_value (iter, 0, out val1);\n \n\n\treturn  (string) val1;\n\t\n\t\n\t\n\t\n}\n",
118          "items" : [
119           {
120            "id" : "msmodel",
121            "xtype" : "ListStore",
122            "* pack" : "set_model",
123            "| void loadMilestones" : "  ( ) {\n\n    var rt = RooTicket.singleton();\n   // rt.loadProjects();\n    \n    _this.milestone_id.loading = true;\n\n    this.el.clear();                                    \n    Gtk.TreeIter iter;\n    var el = this.el;\n    \n    el.append(out iter);\n\n    \n    el.set_value(iter, 0, \"\");\n    el.set_value(iter, 1, \"-- select a milestone --\");\n    _this.milestone_id.el.set_active_iter(iter);    \n     \n    var projects = rt.milestones;\n    foreach(var project in projects) {\n    \n        el.append(out iter);\n        \n        el.set_value(iter, 0, project.id);\n        el.set_value(iter, 1,  project.display_name );\n      //  if (id == project.id) {\n\t //\t   _this.milestone.el.set_active_iter(iter);\n\t //   }   \n        \n    }\n    \n    \n    _this.milestone_id.loading = false;\n     //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);          \n                                     \n}\n",
124            "$ columns" : "typeof(string),typeof(string)",
125            "n_columns" : 2,
126            "$ xns" : "Gtk"
127           }
128          ]
129         },
130         {
131          "label" : "Description",
132          "Gtk.Align halign" : "Gtk.Align.START",
133          "* pack" : "attach_defaults,1,4,2,3",
134          "xtype" : "Label",
135          "x_options" : 4,
136          "$ xns" : "Gtk"
137         },
138         {
139          "id" : "description",
140          "xtype" : "TextView",
141          "* pack" : "attach_defaults,1,4,3,12",
142          "$ xns" : "Gtk",
143          "uint border_width" : 1
144         },
145         {
146          "label" : "Priority",
147          "Gtk.Align halign" : "Gtk.Align.START",
148          "xalign" : 0.90000000000000002,
149          "* pack" : "attach_defaults,0,1,4,5",
150          "xtype" : "Label",
151          "x_options" : 4,
152          "$ xns" : "Gtk"
153         },
154         {
155          "* ctor" : "new Gtk.ComboBox.with_entry()",
156          "id" : "priority_id",
157          "* init" : "this.el.set_entry_text_column(1);",
158          "* pack" : "attach_defaults,0,1,5,6",
159          "xtype" : "ComboBox",
160          "# bool loading" : false,
161          "$ xns" : "Gtk",
162          "| string selectedPriorityId" : "() {\n\tGtk.TreeIter iter;\n\tValue val1;\n \n \n\tthis.el.get_active_iter (out iter);\n\t_this.primodel.el.get_value (iter, 0, out val1);\n \n\n\treturn  (string) val1;\n\t\n\t\n\t\n\t\n}\n",
163          "items" : [
164           {
165            "id" : "primodel",
166            "| void loadPriorities" : "  ( ) {\n\n    var rt = RooTicket.singleton();\n   // rt.loadProjects();\n    \n    _this.priority_id.loading = true;\n\n    this.el.clear();                                    \n    Gtk.TreeIter iter;\n    var el = this.el;\n    \n    \n   var projects = rt.priorities;\n    foreach(var project in projects) {\n    \n        el.append(out iter);\n        \n        el.set_value(iter, 0, project.id);\n        el.set_value(iter, 1,  project.display_name );\n        if (\"normal\" == project.name) {\n\t \t   _this.priority_id.el.set_active_iter(iter);\n\t    }   \n        \n    }\n    \n    _this.priority_id.loading = false;\n           \n                                     \n}\n",
167            "* pack" : "set_model",
168            "xtype" : "ListStore",
169            "$ columns" : "typeof(string),typeof(string)",
170            "n_columns" : 2,
171            "$ xns" : "Gtk"
172           }
173          ]
174         },
175         {
176          "label" : "Severity",
177          "Gtk.Align halign" : "Gtk.Align.START",
178          "* pack" : "attach_defaults,0,1,6,7",
179          "xtype" : "Label",
180          "x_options" : 4,
181          "$ xns" : "Gtk"
182         },
183         {
184          "* ctor" : "new Gtk.ComboBox.with_entry()",
185          "id" : "severity_id",
186          "* init" : "this.el.set_entry_text_column(1);",
187          "* pack" : "attach_defaults,0,1,7,8",
188          "xtype" : "ComboBox",
189          "# bool loading" : false,
190          "$ xns" : "Gtk",
191          "| string selectedSeverityId" : "() {\n\tGtk.TreeIter iter;\n\tValue val1;\n \n \n\tthis.el.get_active_iter (out iter);\n\t_this.sevmodel.el.get_value (iter, 0, out val1);\n \n\n\treturn  (string) val1;\n\t\n\t\n\t\n\t\n}\n",
192          "items" : [
193           {
194            "| void loadSeverities" : "  () {\n\n    var rt = RooTicket.singleton();\n    //rt.loadProjects();\n    \n    _this.severity_id.loading = true;\n\n    this.el.clear();                                    \n    Gtk.TreeIter iter;\n    var el = this.el;\n     \n    var projects = rt.serverities;\n    foreach(var project in projects) {\n    \n        el.append(out iter);\n        \n        el.set_value(iter, 0, project.id);\n        el.set_value(iter, 1,  project.display_name );\n        if (\"normal\" == project.name) {\n\t \t   _this.severity_id.el.set_active_iter(iter);\n\t    }   \n        \n    }\n   \n    _this.severity_id.loading = false;\n     //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);          \n                                     \n}\n",
195            "id" : "sevmodel",
196            "* pack" : "set_model",
197            "xtype" : "ListStore",
198            "$ columns" : "typeof(string),typeof(string)",
199            "n_columns" : 2,
200            "$ xns" : "Gtk"
201           }
202          ]
203         },
204         {
205          "label" : "Classification",
206          "Gtk.Align halign" : "Gtk.Align.START",
207          "* pack" : "attach_defaults,0,1,8,9",
208          "xtype" : "Label",
209          "x_options" : 4,
210          "$ xns" : "Gtk"
211         },
212         {
213          "* ctor" : "new Gtk.ComboBox.with_entry()",
214          "id" : "classification_id",
215          "* init" : "this.el.set_entry_text_column(1);",
216          "* pack" : "attach_defaults,0,1,9,10",
217          "xtype" : "ComboBox",
218          "# bool loading" : false,
219          "$ xns" : "Gtk",
220          "| string selectedClassificationId" : "() {\n\tGtk.TreeIter iter;\n\tValue val1;\n \n \n\tthis.el.get_active_iter (out iter);\n\t_this.clmodel.el.get_value (iter, 0, out val1);\n \n\n\treturn  (string) val1;\n\t\n\t\n\t\n\t\n}\n",
221          "items" : [
222           {
223            "id" : "clmodel",
224            "| void loadClassifications" : "  ( ) {\n\n    var rt = RooTicket.singleton();\n    // rt.loadProjects();\n    \n    _this.classification_id.loading = true;\n\n    this.el.clear();                                    \n    Gtk.TreeIter iter;\n    var el = this.el;\n    \n    el.append(out iter);\n\n     \n    var projects = rt.classifications;\n    foreach(var project in projects) {\n    \n        el.append(out iter);\n        \n        el.set_value(iter, 0, project.id);\n        el.set_value(iter, 1,  project.display_name );\n        if (\"bug\" == project.name) {\n\t \t   _this.classification_id.el.set_active_iter(iter);\n\t    }   \n        \n    }\n    \n    _this.classification_id.loading = false;\n     //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);          \n                                     \n}\n",
225            "* pack" : "set_model",
226            "xtype" : "ListStore",
227            "$ columns" : "typeof(string),typeof(string)",
228            "n_columns" : 2,
229            "$ xns" : "Gtk"
230           }
231          ]
232         },
233         {
234          "label" : "Assign to",
235          "Gtk.Align halign" : "Gtk.Align.START",
236          "* pack" : "attach_defaults,0,1,10,11",
237          "xtype" : "Label",
238          "x_options" : 4,
239          "$ xns" : "Gtk"
240         },
241         {
242          "* ctor" : "new Gtk.ComboBox.with_entry()",
243          "id" : "developer_id",
244          "* init" : "this.el.set_entry_text_column(1);",
245          "* pack" : "attach_defaults,0,1,11,12",
246          "xtype" : "ComboBox",
247          "# bool loading" : false,
248          "| string selectedDeveloperId" : "() {\n\tGtk.TreeIter iter;\n\tValue val1;\n \n \n\tthis.el.get_active_iter (out iter);\n\t_this.devmodel.el.get_value (iter, 0, out val1);\n \n\n\treturn  (string) val1;\n\t\n\t\n\t\n\t\n}\n",
249          "$ xns" : "Gtk",
250          "items" : [
251           {
252            "id" : "devmodel",
253            "xtype" : "ListStore",
254            "* pack" : "set_model",
255            "$ columns" : "typeof(string),typeof(string)",
256            "n_columns" : 2,
257            "$ xns" : "Gtk",
258            "| void loadDevelopers" : "  ( ) {\n\n    var rt = RooTicket.singleton();\n    //rt.loadProjects();\n    \n    _this.developer_id.loading = true;\n\n    this.el.clear();                                    \n    Gtk.TreeIter iter;\n    var el = this.el;\n    \n    el.append(out iter);\n\n    \n    el.set_value(iter, 0, \"\");\n    el.set_value(iter, 1, \"-- select a developer --\");\n  //  if (id == \"\") {\n\t    _this.developer_id.el.set_active_iter(iter);\n   // }\n    \n    var peps = rt.developers;\n    foreach(var p in peps) {\n    \n        el.append(out iter);\n        \n        el.set_value(iter, 0, p.id);\n        el.set_value(iter, 1,  p.display_name );\n        if (rt.authuser_id == p.id) {\n\t \t   _this.developer_id.el.set_active_iter(iter);\n\t    }   \n    }\n \n    _this.developer_id.loading = false;\n     //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);          \n                                     \n}\n"
259           }
260          ]
261         },
262         {
263          "listeners" : {
264           "clicked" : "() => {\n\tGLib.debug(\"fire response = 1\");\n\t\n\t\n\tvar invalid = false;\n\t\n\t// validate first...\n\t_this.project_id.el.get_child().get_style_context().remove_class(\"warning\");\t\n\tif (_this.project_id.selectedProjectId() == \"\") {\n\t\t_this.project_id.el.get_child().get_style_context().add_class(\"warning\");\n\t\tinvalid = true;\n\t}\n\t\n\t_this.milestone_id.el.get_child().get_style_context().remove_class(\"warning\");\t\n\n\t_this.priority_id.el.get_child().get_style_context().remove_class(\"warning\");\t\n\tif (_this.priority_id.selectedPriorityId() == \"\") {\n\t\t_this.priority_id.el.get_child().get_style_context().add_class(\"warning\");\n\t\tinvalid = true;\n\t}\n\t\n\t_this.classification_id.el.get_child().get_style_context().remove_class(\"warning\");\t\n\tif (_this.classification_id.selectedClassificationId() == \"\") {\n\t\t_this.classification_id.el.get_child().get_style_context().add_class(\"warning\");\n\t\tinvalid = true;\n\t}\n\t\n\t_this.developer_id.el.get_child().get_style_context().remove_class(\"warning\");\t\n\tif (_this.developer_id.selectedDeveloperId() == \"\") {\n\t\t_this.developer_id.el.get_child().get_style_context().add_class(\"warning\");\n\t\tinvalid = true;\n\t}\n\t\n\t_this.summary.el.get_style_context().remove_class(\"warning\");\t\n\tif (_this.summary.el.get_text() == \"\") {\n\t\t_this.summary.el.get_style_context().add_class(\"warning\");\n\t\tinvalid = true;\n\t}\n\t\n\t_this.description.el.get_style_context().remove_class(\"warning\");\t\n \n\tif (invalid) {\n\t\treturn;\n\t}\n\tGLib.debug(\"for is valid\");\n\t\n\t_this.el.response(1);\n}"
265          },
266          "label" : "Create Ticket",
267          "* init" : "{\n   this.el.get_style_context().add_class(\"suggested-action\");\n}\n",
268          "xtype" : "Button",
269          "* pack" : "attach_defaults,0,4,13,14",
270          "$ xns" : "Gtk"
271         }
272        ]
273       },
274       {
275        "id" : "spinner",
276        "bool hexpand" : true,
277        "* pack" : "add",
278        "xtype" : "Spinner",
279        "$ xns" : "Gtk",
280        "bool vexpand" : true
281       }
282      ]
283     }
284    ]
285   }
286  ]
287 }