3 public class Ticket : Object
8 public static Ticket singleton()
10 if (_Ticket == null) {
11 _Ticket= new Ticket();
15 public Xcls_project_id project_id;
16 public Xcls_prcellrenderer prcellrenderer;
17 public Xcls_prmodel prmodel;
18 public Xcls_summary summary;
19 public Xcls_milestone_id milestone_id;
20 public Xcls_msmodel msmodel;
21 public Xcls_description description;
22 public Xcls_priority_id priority_id;
23 public Xcls_primodel primodel;
24 public Xcls_severity_id severity_id;
25 public Xcls_sevmodel sevmodel;
26 public Xcls_classification_id classification_id;
27 public Xcls_clmodel clmodel;
28 public Xcls_developer_id developer_id;
29 public Xcls_devmodel devmodel;
39 this.el = new Gtk.Dialog();
46 this.el.title = "Create a Ticket";
47 this.el.default_height = 200;
48 this.el.default_width = 500;
49 this.el.deletable = true;
51 var child_0 = new Xcls_VBox2( _this );
53 this.el.get_content_area().add ( child_0.el );
56 this.el.delete_event.connect( (self, event) => {
61 this.el.response.connect( (self, response_id) => {
63 GLib.debug("got %d", (int) response_id);
64 if (response_id < 1) {
71 var tid = RooTicket.singleton().createTicket(
73 _this.project_id.selectedProjectId(),
75 _this.milestone_id.selectedMilestoneId(),
76 _this.priority_id.selectedPriorityId() ,
77 _this.classification_id.selectedClassificationId() ,
78 _this.developer_id.selectedDeveloperId(),
79 _this.summary.el.get_text() ,
80 _this.description.el.buffer.text
83 if (this.repo != null) {
84 NewBranch.singleton().show(this.repo, new Gee.ArrayList<GitMonitorQueue>(), tid);
92 // user defined functions
93 public void show ( GitRepo? repo )
95 // this.el.set_gravity(Gdk.Gravity.NORTH);
96 if (this.running) { // should not happen!!
97 GLib.error("new branch show called, when already being displayed?");
102 //GitMonitor.gitmonitor.stop();
109 this.el.move((Gdk.Screen.width() / 2)- 250 ,0);
110 this.el.set_default_size( 500,200); // not sure why it grows..
111 GLib.debug("Loading tickets");
115 this.el.set_keep_above(true);
118 RooProject? curproj = null;
119 if (this.repo != null) {
120 curproj = RooTicket.singleton().getProjectByRepo(this.repo);
122 _this.prmodel.loadProjects(curproj == null ? "" : curproj.id);
123 if (curproj != null) {
126 var rt = RooTicket.singleton();
127 rt.loadProjectOptions(curproj.id);
129 _this.msmodel.loadMilestones();
130 _this.primodel.loadPriorities();
131 _this.sevmodel.loadSeverities();
132 _this.clmodel.loadClassifications();
133 _this.devmodel.loadDevelopers();
140 public class Xcls_VBox2 : Object
143 private Ticket _this;
149 public Xcls_VBox2(Ticket _owner )
152 this.el = new Gtk.VBox( true, 0 );
156 // set gobject values
157 var child_0 = new Xcls_Table3( _this );
159 this.el.pack_start ( child_0.el , false,false,0 );
162 // user defined functions
164 public class Xcls_Table3 : Object
167 private Ticket _this;
173 public Xcls_Table3(Ticket _owner )
176 this.el = new Gtk.Table( 14, 4, true );
180 // set gobject values
181 this.el.expand = false;
183 this.el.column_spacing = 4;
184 this.el.vexpand = false;
185 var child_0 = new Xcls_Label4( _this );
187 this.el.attach_defaults ( child_0.el , 0,1,0,1 );
188 var child_1 = new Xcls_Label5( _this );
190 this.el.attach_defaults ( child_1.el , 1,2,0,1 );
191 var child_2 = new Xcls_project_id( _this );
193 this.el.attach_defaults ( child_2.el , 0,1,1,2 );
194 var child_3 = new Xcls_summary( _this );
196 this.el.attach_defaults ( child_3.el , 1,4,1,2 );
197 var child_4 = new Xcls_Label10( _this );
199 this.el.attach_defaults ( child_4.el , 0,1,2,3 );
200 var child_5 = new Xcls_milestone_id( _this );
202 this.el.attach_defaults ( child_5.el , 0,1,3,4 );
203 var child_6 = new Xcls_Label13( _this );
205 this.el.attach_defaults ( child_6.el , 1,4,2,3 );
206 var child_7 = new Xcls_description( _this );
208 this.el.attach_defaults ( child_7.el , 1,4,3,12 );
209 var child_8 = new Xcls_Label15( _this );
211 this.el.attach_defaults ( child_8.el , 0,1,4,5 );
212 var child_9 = new Xcls_priority_id( _this );
214 this.el.attach_defaults ( child_9.el , 0,1,5,6 );
215 var child_10 = new Xcls_Label18( _this );
217 this.el.attach_defaults ( child_10.el , 0,1,6,7 );
218 var child_11 = new Xcls_severity_id( _this );
220 this.el.attach_defaults ( child_11.el , 0,1,7,8 );
221 var child_12 = new Xcls_Label21( _this );
223 this.el.attach_defaults ( child_12.el , 0,1,8,9 );
224 var child_13 = new Xcls_classification_id( _this );
226 this.el.attach_defaults ( child_13.el , 0,1,9,10 );
227 var child_14 = new Xcls_Label24( _this );
229 this.el.attach_defaults ( child_14.el , 0,1,10,11 );
230 var child_15 = new Xcls_developer_id( _this );
232 this.el.attach_defaults ( child_15.el , 0,1,11,12 );
233 var child_16 = new Xcls_Button27( _this );
235 this.el.attach_defaults ( child_16.el , 0,4,13,14 );
238 // user defined functions
240 public class Xcls_Label4 : Object
243 private Ticket _this;
249 public Xcls_Label4(Ticket _owner )
252 this.el = new Gtk.Label( "Project" );
256 // set gobject values
257 this.el.halign = Gtk.Align.START;
258 this.el.visible = true;
261 // user defined functions
264 public class Xcls_Label5 : Object
267 private Ticket _this;
273 public Xcls_Label5(Ticket _owner )
276 this.el = new Gtk.Label( "Summary" );
280 // set gobject values
281 this.el.halign = Gtk.Align.START;
282 this.el.visible = true;
285 // user defined functions
288 public class Xcls_project_id : Object
290 public Gtk.ComboBox el;
291 private Ticket _this;
298 public Xcls_project_id(Ticket _owner )
301 _this.project_id = this;
302 this.el = new Gtk.ComboBox.with_entry();
305 this.loading = false;
307 // set gobject values
308 var child_0 = new Xcls_prcellrenderer( _this );
310 this.el.pack_start ( child_0.el , true );
311 var child_1 = new Xcls_prmodel( _this );
313 this.el.set_model ( child_1.el );
317 this.el.set_entry_text_column(1);
320 this.el.changed.connect( () => {
324 var project_id = this.selectedProjectId();
326 var rt = RooTicket.singleton();
327 rt.loadProjectOptions(project_id);
329 _this.msmodel.loadMilestones();
330 _this.primodel.loadPriorities();
331 _this.sevmodel.loadSeverities();
332 _this.clmodel.loadClassifications();
333 _this.devmodel.loadDevelopers();
335 // affects projects and milestones..
338 /*if (this.loading) {
341 var ticket_id = this.selectedTicketId();
343 var name = RooTicket.singleton().usernameLocal();
345 if (ticket_id == "" || ticket_id == null) {
347 var dt = new DateTime.now_local();
348 _this.name.el.set_text("wip_%s_%s".printf(name,dt.format("%Y_%b_%d")));
353 var ticket = RooTicket.singleton().getById(ticket_id);
355 _this.name.el.set_text("wip_%s_T%s_%s".printf(name,ticket.id, ticket.summaryToBranchName()));
357 //GLib.debug (//"Selection: %s, %s\n", (string) val1, (string) val2);
362 // user defined functions
363 public string selectedProjectId () {
368 this.el.get_active_iter (out iter);
369 _this.prmodel.el.get_value (iter, 0, out val1);
372 return (string) val1;
379 public class Xcls_prcellrenderer : Object
381 public Gtk.CellRendererText el;
382 private Ticket _this;
388 public Xcls_prcellrenderer(Ticket _owner )
391 _this.prcellrenderer = this;
392 this.el = new Gtk.CellRendererText();
396 // set gobject values
399 // user defined functions
402 public class Xcls_prmodel : Object
404 public Gtk.ListStore el;
405 private Ticket _this;
411 public Xcls_prmodel(Ticket _owner )
414 _this.prmodel = this;
415 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
419 // set gobject values
422 // user defined functions
423 public void loadProjects (string id) {
425 var rt = RooTicket.singleton();
428 _this.project_id.loading = true;
437 el.set_value(iter, 0, "");
438 el.set_value(iter, 1, "-- select a project --");
440 _this.project_id.el.set_active_iter(iter);
442 var projects = rt.projects;
443 foreach(var project in projects) {
447 el.set_value(iter, 0, project.id);
448 el.set_value(iter, 1, project.name );
449 if (id == project.id) {
450 _this.project_id.el.set_active_iter(iter);
455 _this.project_id.loading = false;
456 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
462 public class Xcls_summary : Object
465 private Ticket _this;
471 public Xcls_summary(Ticket _owner )
474 _this.summary = this;
475 this.el = new Gtk.Entry();
479 // set gobject values
480 this.el.visible = true;
483 // user defined functions
486 public class Xcls_Label10 : Object
489 private Ticket _this;
495 public Xcls_Label10(Ticket _owner )
498 this.el = new Gtk.Label( "Milestone" );
502 // set gobject values
503 this.el.halign = Gtk.Align.START;
504 this.el.justify = Gtk.Justification.RIGHT;
505 this.el.xalign = 0.900000f;
508 // user defined functions
511 public class Xcls_milestone_id : Object
513 public Gtk.ComboBox el;
514 private Ticket _this;
521 public Xcls_milestone_id(Ticket _owner )
524 _this.milestone_id = this;
525 this.el = new Gtk.ComboBox.with_entry();
528 this.loading = false;
530 // set gobject values
531 var child_0 = new Xcls_msmodel( _this );
533 this.el.set_model ( child_0.el );
537 this.el.set_entry_text_column(1);
540 // user defined functions
541 public string selectedMilestoneId () {
546 this.el.get_active_iter (out iter);
547 _this.msmodel.el.get_value (iter, 0, out val1);
550 return (string) val1;
557 public class Xcls_msmodel : Object
559 public Gtk.ListStore el;
560 private Ticket _this;
566 public Xcls_msmodel(Ticket _owner )
569 _this.msmodel = this;
570 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
574 // set gobject values
577 // user defined functions
578 public void loadMilestones ( ) {
580 var rt = RooTicket.singleton();
581 // rt.loadProjects();
583 _this.milestone_id.loading = true;
592 el.set_value(iter, 0, "");
593 el.set_value(iter, 1, "-- select a milestone --");
594 _this.milestone_id.el.set_active_iter(iter);
596 var projects = rt.milestones;
597 foreach(var project in projects) {
601 el.set_value(iter, 0, project.id);
602 el.set_value(iter, 1, project.display_name );
603 // if (id == project.id) {
604 // _this.milestone.el.set_active_iter(iter);
610 _this.milestone_id.loading = false;
611 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
617 public class Xcls_Label13 : Object
620 private Ticket _this;
626 public Xcls_Label13(Ticket _owner )
629 this.el = new Gtk.Label( "Description" );
633 // set gobject values
634 this.el.halign = Gtk.Align.START;
637 // user defined functions
640 public class Xcls_description : Object
642 public Gtk.TextView el;
643 private Ticket _this;
649 public Xcls_description(Ticket _owner )
652 _this.description = this;
653 this.el = new Gtk.TextView();
657 // set gobject values
658 this.el.border_width = 1;
661 // user defined functions
664 public class Xcls_Label15 : Object
667 private Ticket _this;
673 public Xcls_Label15(Ticket _owner )
676 this.el = new Gtk.Label( "Priority" );
680 // set gobject values
681 this.el.halign = Gtk.Align.START;
682 this.el.xalign = 0.900000f;
685 // user defined functions
688 public class Xcls_priority_id : Object
690 public Gtk.ComboBox el;
691 private Ticket _this;
698 public Xcls_priority_id(Ticket _owner )
701 _this.priority_id = this;
702 this.el = new Gtk.ComboBox.with_entry();
705 this.loading = false;
707 // set gobject values
708 var child_0 = new Xcls_primodel( _this );
710 this.el.set_model ( child_0.el );
714 this.el.set_entry_text_column(1);
717 // user defined functions
718 public string selectedPriorityId () {
723 this.el.get_active_iter (out iter);
724 _this.primodel.el.get_value (iter, 0, out val1);
727 return (string) val1;
734 public class Xcls_primodel : Object
736 public Gtk.ListStore el;
737 private Ticket _this;
743 public Xcls_primodel(Ticket _owner )
746 _this.primodel = this;
747 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
751 // set gobject values
754 // user defined functions
755 public void loadPriorities ( ) {
757 var rt = RooTicket.singleton();
758 // rt.loadProjects();
760 _this.priority_id.loading = true;
767 var projects = rt.priorities;
768 foreach(var project in projects) {
772 el.set_value(iter, 0, project.id);
773 el.set_value(iter, 1, project.display_name );
774 if ("normal" == project.name) {
775 _this.priority_id.el.set_active_iter(iter);
780 _this.priority_id.loading = false;
787 public class Xcls_Label18 : Object
790 private Ticket _this;
796 public Xcls_Label18(Ticket _owner )
799 this.el = new Gtk.Label( "Severity" );
803 // set gobject values
804 this.el.halign = Gtk.Align.START;
807 // user defined functions
810 public class Xcls_severity_id : Object
812 public Gtk.ComboBox el;
813 private Ticket _this;
820 public Xcls_severity_id(Ticket _owner )
823 _this.severity_id = this;
824 this.el = new Gtk.ComboBox.with_entry();
827 this.loading = false;
829 // set gobject values
830 var child_0 = new Xcls_sevmodel( _this );
832 this.el.set_model ( child_0.el );
836 this.el.set_entry_text_column(1);
839 // user defined functions
840 public string selectedSeverityId () {
845 this.el.get_active_iter (out iter);
846 _this.sevmodel.el.get_value (iter, 0, out val1);
849 return (string) val1;
856 public class Xcls_sevmodel : Object
858 public Gtk.ListStore el;
859 private Ticket _this;
865 public Xcls_sevmodel(Ticket _owner )
868 _this.sevmodel = this;
869 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
873 // set gobject values
876 // user defined functions
877 public void loadSeverities () {
879 var rt = RooTicket.singleton();
882 _this.severity_id.loading = true;
888 var projects = rt.serverities;
889 foreach(var project in projects) {
893 el.set_value(iter, 0, project.id);
894 el.set_value(iter, 1, project.display_name );
895 if ("normal" == project.name) {
896 _this.severity_id.el.set_active_iter(iter);
901 _this.severity_id.loading = false;
902 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
908 public class Xcls_Label21 : Object
911 private Ticket _this;
917 public Xcls_Label21(Ticket _owner )
920 this.el = new Gtk.Label( "Classification" );
924 // set gobject values
925 this.el.halign = Gtk.Align.START;
928 // user defined functions
931 public class Xcls_classification_id : Object
933 public Gtk.ComboBox el;
934 private Ticket _this;
941 public Xcls_classification_id(Ticket _owner )
944 _this.classification_id = this;
945 this.el = new Gtk.ComboBox.with_entry();
948 this.loading = false;
950 // set gobject values
951 var child_0 = new Xcls_clmodel( _this );
953 this.el.set_model ( child_0.el );
957 this.el.set_entry_text_column(1);
960 // user defined functions
961 public string selectedClassificationId () {
966 this.el.get_active_iter (out iter);
967 _this.clmodel.el.get_value (iter, 0, out val1);
970 return (string) val1;
977 public class Xcls_clmodel : Object
979 public Gtk.ListStore el;
980 private Ticket _this;
986 public Xcls_clmodel(Ticket _owner )
989 _this.clmodel = this;
990 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
994 // set gobject values
997 // user defined functions
998 public void loadClassifications ( ) {
1000 var rt = RooTicket.singleton();
1001 // rt.loadProjects();
1003 _this.classification_id.loading = true;
1009 el.append(out iter);
1012 var projects = rt.classifications;
1013 foreach(var project in projects) {
1015 el.append(out iter);
1017 el.set_value(iter, 0, project.id);
1018 el.set_value(iter, 1, project.display_name );
1019 if ("bug" == project.name) {
1020 _this.classification_id.el.set_active_iter(iter);
1025 _this.classification_id.loading = false;
1026 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
1032 public class Xcls_Label24 : Object
1034 public Gtk.Label el;
1035 private Ticket _this;
1041 public Xcls_Label24(Ticket _owner )
1044 this.el = new Gtk.Label( "Assign to" );
1048 // set gobject values
1049 this.el.halign = Gtk.Align.START;
1052 // user defined functions
1055 public class Xcls_developer_id : Object
1057 public Gtk.ComboBox el;
1058 private Ticket _this;
1062 public bool loading;
1065 public Xcls_developer_id(Ticket _owner )
1068 _this.developer_id = this;
1069 this.el = new Gtk.ComboBox.with_entry();
1072 this.loading = false;
1074 // set gobject values
1075 var child_0 = new Xcls_devmodel( _this );
1077 this.el.set_model ( child_0.el );
1081 this.el.set_entry_text_column(1);
1084 // user defined functions
1085 public string selectedDeveloperId () {
1090 this.el.get_active_iter (out iter);
1091 _this.devmodel.el.get_value (iter, 0, out val1);
1094 return (string) val1;
1101 public class Xcls_devmodel : Object
1103 public Gtk.ListStore el;
1104 private Ticket _this;
1110 public Xcls_devmodel(Ticket _owner )
1113 _this.devmodel = this;
1114 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
1118 // set gobject values
1121 // user defined functions
1122 public void loadDevelopers ( ) {
1124 var rt = RooTicket.singleton();
1125 //rt.loadProjects();
1127 _this.developer_id.loading = true;
1133 el.append(out iter);
1136 el.set_value(iter, 0, "");
1137 el.set_value(iter, 1, "-- select a developer --");
1139 _this.developer_id.el.set_active_iter(iter);
1142 var projects = rt.developers;
1143 foreach(var project in projects) {
1145 el.append(out iter);
1147 el.set_value(iter, 0, project.id);
1148 el.set_value(iter, 1, project.display_name );
1149 // if (id == project.id) {
1150 // _this.projectsel.el.set_active_iter(iter);
1155 _this.developer_id.loading = false;
1156 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
1162 public class Xcls_Button27 : Object
1164 public Gtk.Button el;
1165 private Ticket _this;
1171 public Xcls_Button27(Ticket _owner )
1174 this.el = new Gtk.Button();
1178 // set gobject values
1179 this.el.label = "Create Ticket";
1184 this.el.get_style_context().add_class("suggested-action");
1188 this.el.clicked.connect( () => {
1189 GLib.debug("fire response = 1");
1192 var invalid = false;
1194 // validate first...
1195 _this.project_id.el.get_child().get_style_context().remove_class("warning");
1196 if (_this.project_id.selectedProjectId() == "") {
1197 _this.project_id.el.get_child().get_style_context().add_class("warning");
1201 _this.milestone_id.el.get_child().get_style_context().remove_class("warning");
1202 if (_this.milestone_id.selectedMilestoneId() == "") {
1203 _this.milestone_id.el.get_child().get_style_context().add_class("warning");
1207 _this.priority_id.el.get_child().get_style_context().remove_class("warning");
1208 if (_this.priority_id.selectedPriorityId() == "") {
1209 _this.priority_id.el.get_child().get_style_context().add_class("warning");
1213 _this.classification_id.el.get_child().get_style_context().remove_class("warning");
1214 if (_this.classification_id.selectedClassificationId() == "") {
1215 _this.classification_id.el.get_child().get_style_context().add_class("warning");
1219 _this.developer_id.el.get_child().get_style_context().remove_class("warning");
1220 if (_this.developer_id.selectedDeveloperId() == "") {
1221 _this.developer_id.el.get_child().get_style_context().add_class("warning");
1225 _this.summary.el.get_style_context().remove_class("warning");
1226 if (_this.summary.el.get_text() == "") {
1227 _this.summary.el.get_style_context().add_class("warning");
1231 _this.description.el.get_style_context().remove_class("warning");
1232 if (_this.description.el.buffer.text == "") {
1233 _this.description.el.get_style_context().add_class("warning");
1241 GLib.debug("for is valid");
1243 _this.el.response(1);
1247 // user defined functions