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
84 if (this.repo != null) {
85 NewBranch.singleton().show(this.repo, new Gee.ArrayList<GitMonitorQueue>(), tid);
93 // user defined functions
94 public void show ( GitRepo? repo )
96 // this.el.set_gravity(Gdk.Gravity.NORTH);
97 if (this.running) { // should not happen!!
98 GLib.error("new branch show called, when already being displayed?");
103 //GitMonitor.gitmonitor.stop();
110 this.el.move((Gdk.Screen.width() / 2)- 250 ,0);
111 this.el.set_default_size( 500,200); // not sure why it grows..
112 GLib.debug("Loading tickets");
116 this.el.set_keep_above(true);
119 RooProject? curproj = null;
120 if (this.repo != null) {
121 curproj = RooTicket.singleton().getProjectByRepo(this.repo);
123 _this.prmodel.loadProjects(curproj == null ? "" : curproj.id);
124 if (curproj != null) {
127 var rt = RooTicket.singleton();
128 rt.loadProjectOptions(curproj.id);
130 _this.msmodel.loadMilestones();
131 _this.primodel.loadPriorities();
132 _this.sevmodel.loadSeverities();
133 _this.clmodel.loadClassifications();
134 _this.devmodel.loadDevelopers();
141 public class Xcls_VBox2 : Object
144 private Ticket _this;
150 public Xcls_VBox2(Ticket _owner )
153 this.el = new Gtk.VBox( true, 0 );
157 // set gobject values
158 var child_0 = new Xcls_Table3( _this );
160 this.el.pack_start ( child_0.el , false,false,0 );
163 // user defined functions
165 public class Xcls_Table3 : Object
168 private Ticket _this;
174 public Xcls_Table3(Ticket _owner )
177 this.el = new Gtk.Table( 14, 4, true );
181 // set gobject values
182 this.el.expand = false;
184 this.el.column_spacing = 4;
185 this.el.vexpand = false;
186 var child_0 = new Xcls_Label4( _this );
188 this.el.attach_defaults ( child_0.el , 0,1,0,1 );
189 var child_1 = new Xcls_Label5( _this );
191 this.el.attach_defaults ( child_1.el , 1,2,0,1 );
192 var child_2 = new Xcls_project_id( _this );
194 this.el.attach_defaults ( child_2.el , 0,1,1,2 );
195 var child_3 = new Xcls_summary( _this );
197 this.el.attach_defaults ( child_3.el , 1,4,1,2 );
198 var child_4 = new Xcls_Label10( _this );
200 this.el.attach_defaults ( child_4.el , 0,1,2,3 );
201 var child_5 = new Xcls_milestone_id( _this );
203 this.el.attach_defaults ( child_5.el , 0,1,3,4 );
204 var child_6 = new Xcls_Label13( _this );
206 this.el.attach_defaults ( child_6.el , 1,4,2,3 );
207 var child_7 = new Xcls_description( _this );
209 this.el.attach_defaults ( child_7.el , 1,4,3,12 );
210 var child_8 = new Xcls_Label15( _this );
212 this.el.attach_defaults ( child_8.el , 0,1,4,5 );
213 var child_9 = new Xcls_priority_id( _this );
215 this.el.attach_defaults ( child_9.el , 0,1,5,6 );
216 var child_10 = new Xcls_Label18( _this );
218 this.el.attach_defaults ( child_10.el , 0,1,6,7 );
219 var child_11 = new Xcls_severity_id( _this );
221 this.el.attach_defaults ( child_11.el , 0,1,7,8 );
222 var child_12 = new Xcls_Label21( _this );
224 this.el.attach_defaults ( child_12.el , 0,1,8,9 );
225 var child_13 = new Xcls_classification_id( _this );
227 this.el.attach_defaults ( child_13.el , 0,1,9,10 );
228 var child_14 = new Xcls_Label24( _this );
230 this.el.attach_defaults ( child_14.el , 0,1,10,11 );
231 var child_15 = new Xcls_developer_id( _this );
233 this.el.attach_defaults ( child_15.el , 0,1,11,12 );
234 var child_16 = new Xcls_Button27( _this );
236 this.el.attach_defaults ( child_16.el , 0,4,13,14 );
239 // user defined functions
241 public class Xcls_Label4 : Object
244 private Ticket _this;
250 public Xcls_Label4(Ticket _owner )
253 this.el = new Gtk.Label( "Project" );
257 // set gobject values
258 this.el.halign = Gtk.Align.START;
259 this.el.visible = true;
262 // user defined functions
265 public class Xcls_Label5 : Object
268 private Ticket _this;
274 public Xcls_Label5(Ticket _owner )
277 this.el = new Gtk.Label( "Summary" );
281 // set gobject values
282 this.el.halign = Gtk.Align.START;
283 this.el.visible = true;
286 // user defined functions
289 public class Xcls_project_id : Object
291 public Gtk.ComboBox el;
292 private Ticket _this;
299 public Xcls_project_id(Ticket _owner )
302 _this.project_id = this;
303 this.el = new Gtk.ComboBox.with_entry();
306 this.loading = false;
308 // set gobject values
309 var child_0 = new Xcls_prcellrenderer( _this );
311 this.el.pack_start ( child_0.el , true );
312 var child_1 = new Xcls_prmodel( _this );
314 this.el.set_model ( child_1.el );
318 this.el.set_entry_text_column(1);
321 this.el.changed.connect( () => {
325 var project_id = this.selectedProjectId();
327 var rt = RooTicket.singleton();
328 rt.loadProjectOptions(project_id);
330 _this.msmodel.loadMilestones();
331 _this.primodel.loadPriorities();
332 _this.sevmodel.loadSeverities();
333 _this.clmodel.loadClassifications();
334 _this.devmodel.loadDevelopers();
336 // affects projects and milestones..
339 /*if (this.loading) {
342 var ticket_id = this.selectedTicketId();
344 var name = RooTicket.singleton().usernameLocal();
346 if (ticket_id == "" || ticket_id == null) {
348 var dt = new DateTime.now_local();
349 _this.name.el.set_text("wip_%s_%s".printf(name,dt.format("%Y_%b_%d")));
354 var ticket = RooTicket.singleton().getById(ticket_id);
356 _this.name.el.set_text("wip_%s_T%s_%s".printf(name,ticket.id, ticket.summaryToBranchName()));
358 //GLib.debug (//"Selection: %s, %s\n", (string) val1, (string) val2);
363 // user defined functions
364 public string selectedProjectId () {
369 this.el.get_active_iter (out iter);
370 _this.prmodel.el.get_value (iter, 0, out val1);
373 return (string) val1;
380 public class Xcls_prcellrenderer : Object
382 public Gtk.CellRendererText el;
383 private Ticket _this;
389 public Xcls_prcellrenderer(Ticket _owner )
392 _this.prcellrenderer = this;
393 this.el = new Gtk.CellRendererText();
397 // set gobject values
400 // user defined functions
403 public class Xcls_prmodel : Object
405 public Gtk.ListStore el;
406 private Ticket _this;
412 public Xcls_prmodel(Ticket _owner )
415 _this.prmodel = this;
416 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
420 // set gobject values
423 // user defined functions
424 public void loadProjects (string id) {
426 var rt = RooTicket.singleton();
429 _this.project_id.loading = true;
438 el.set_value(iter, 0, "");
439 el.set_value(iter, 1, "-- select a project --");
441 _this.project_id.el.set_active_iter(iter);
443 var projects = rt.projects;
444 foreach(var project in projects) {
448 el.set_value(iter, 0, project.id);
449 el.set_value(iter, 1, project.name );
450 if (id == project.id) {
451 _this.project_id.el.set_active_iter(iter);
456 _this.project_id.loading = false;
457 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
463 public class Xcls_summary : Object
466 private Ticket _this;
472 public Xcls_summary(Ticket _owner )
475 _this.summary = this;
476 this.el = new Gtk.Entry();
480 // set gobject values
481 this.el.visible = true;
484 // user defined functions
487 public class Xcls_Label10 : Object
490 private Ticket _this;
496 public Xcls_Label10(Ticket _owner )
499 this.el = new Gtk.Label( "Milestone" );
503 // set gobject values
504 this.el.halign = Gtk.Align.START;
505 this.el.justify = Gtk.Justification.RIGHT;
506 this.el.xalign = 0.900000f;
509 // user defined functions
512 public class Xcls_milestone_id : Object
514 public Gtk.ComboBox el;
515 private Ticket _this;
522 public Xcls_milestone_id(Ticket _owner )
525 _this.milestone_id = this;
526 this.el = new Gtk.ComboBox.with_entry();
529 this.loading = false;
531 // set gobject values
532 var child_0 = new Xcls_msmodel( _this );
534 this.el.set_model ( child_0.el );
538 this.el.set_entry_text_column(1);
541 // user defined functions
542 public string selectedMilestoneId () {
547 this.el.get_active_iter (out iter);
548 _this.msmodel.el.get_value (iter, 0, out val1);
551 return (string) val1;
558 public class Xcls_msmodel : Object
560 public Gtk.ListStore el;
561 private Ticket _this;
567 public Xcls_msmodel(Ticket _owner )
570 _this.msmodel = this;
571 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
575 // set gobject values
578 // user defined functions
579 public void loadMilestones ( ) {
581 var rt = RooTicket.singleton();
582 // rt.loadProjects();
584 _this.milestone_id.loading = true;
593 el.set_value(iter, 0, "");
594 el.set_value(iter, 1, "-- select a milestone --");
595 _this.milestone_id.el.set_active_iter(iter);
597 var projects = rt.milestones;
598 foreach(var project in projects) {
602 el.set_value(iter, 0, project.id);
603 el.set_value(iter, 1, project.display_name );
604 // if (id == project.id) {
605 // _this.milestone.el.set_active_iter(iter);
611 _this.milestone_id.loading = false;
612 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
618 public class Xcls_Label13 : Object
621 private Ticket _this;
627 public Xcls_Label13(Ticket _owner )
630 this.el = new Gtk.Label( "Description" );
634 // set gobject values
635 this.el.halign = Gtk.Align.START;
638 // user defined functions
641 public class Xcls_description : Object
643 public Gtk.TextView el;
644 private Ticket _this;
650 public Xcls_description(Ticket _owner )
653 _this.description = this;
654 this.el = new Gtk.TextView();
658 // set gobject values
659 this.el.border_width = 1;
662 // user defined functions
665 public class Xcls_Label15 : Object
668 private Ticket _this;
674 public Xcls_Label15(Ticket _owner )
677 this.el = new Gtk.Label( "Priority" );
681 // set gobject values
682 this.el.halign = Gtk.Align.START;
683 this.el.xalign = 0.900000f;
686 // user defined functions
689 public class Xcls_priority_id : Object
691 public Gtk.ComboBox el;
692 private Ticket _this;
699 public Xcls_priority_id(Ticket _owner )
702 _this.priority_id = this;
703 this.el = new Gtk.ComboBox.with_entry();
706 this.loading = false;
708 // set gobject values
709 var child_0 = new Xcls_primodel( _this );
711 this.el.set_model ( child_0.el );
715 this.el.set_entry_text_column(1);
718 // user defined functions
719 public string selectedPriorityId () {
724 this.el.get_active_iter (out iter);
725 _this.primodel.el.get_value (iter, 0, out val1);
728 return (string) val1;
735 public class Xcls_primodel : Object
737 public Gtk.ListStore el;
738 private Ticket _this;
744 public Xcls_primodel(Ticket _owner )
747 _this.primodel = this;
748 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
752 // set gobject values
755 // user defined functions
756 public void loadPriorities ( ) {
758 var rt = RooTicket.singleton();
759 // rt.loadProjects();
761 _this.priority_id.loading = true;
768 var projects = rt.priorities;
769 foreach(var project in projects) {
773 el.set_value(iter, 0, project.id);
774 el.set_value(iter, 1, project.display_name );
775 if ("normal" == project.name) {
776 _this.priority_id.el.set_active_iter(iter);
781 _this.priority_id.loading = false;
788 public class Xcls_Label18 : Object
791 private Ticket _this;
797 public Xcls_Label18(Ticket _owner )
800 this.el = new Gtk.Label( "Severity" );
804 // set gobject values
805 this.el.halign = Gtk.Align.START;
808 // user defined functions
811 public class Xcls_severity_id : Object
813 public Gtk.ComboBox el;
814 private Ticket _this;
821 public Xcls_severity_id(Ticket _owner )
824 _this.severity_id = this;
825 this.el = new Gtk.ComboBox.with_entry();
828 this.loading = false;
830 // set gobject values
831 var child_0 = new Xcls_sevmodel( _this );
833 this.el.set_model ( child_0.el );
837 this.el.set_entry_text_column(1);
840 // user defined functions
841 public string selectedSeverityId () {
846 this.el.get_active_iter (out iter);
847 _this.sevmodel.el.get_value (iter, 0, out val1);
850 return (string) val1;
857 public class Xcls_sevmodel : Object
859 public Gtk.ListStore el;
860 private Ticket _this;
866 public Xcls_sevmodel(Ticket _owner )
869 _this.sevmodel = this;
870 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
874 // set gobject values
877 // user defined functions
878 public void loadSeverities () {
880 var rt = RooTicket.singleton();
883 _this.severity_id.loading = true;
889 var projects = rt.serverities;
890 foreach(var project in projects) {
894 el.set_value(iter, 0, project.id);
895 el.set_value(iter, 1, project.display_name );
896 if ("normal" == project.name) {
897 _this.severity_id.el.set_active_iter(iter);
902 _this.severity_id.loading = false;
903 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
909 public class Xcls_Label21 : Object
912 private Ticket _this;
918 public Xcls_Label21(Ticket _owner )
921 this.el = new Gtk.Label( "Classification" );
925 // set gobject values
926 this.el.halign = Gtk.Align.START;
929 // user defined functions
932 public class Xcls_classification_id : Object
934 public Gtk.ComboBox el;
935 private Ticket _this;
942 public Xcls_classification_id(Ticket _owner )
945 _this.classification_id = this;
946 this.el = new Gtk.ComboBox.with_entry();
949 this.loading = false;
951 // set gobject values
952 var child_0 = new Xcls_clmodel( _this );
954 this.el.set_model ( child_0.el );
958 this.el.set_entry_text_column(1);
961 // user defined functions
962 public string selectedClassificationId () {
967 this.el.get_active_iter (out iter);
968 _this.clmodel.el.get_value (iter, 0, out val1);
971 return (string) val1;
978 public class Xcls_clmodel : Object
980 public Gtk.ListStore el;
981 private Ticket _this;
987 public Xcls_clmodel(Ticket _owner )
990 _this.clmodel = this;
991 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
995 // set gobject values
998 // user defined functions
999 public void loadClassifications ( ) {
1001 var rt = RooTicket.singleton();
1002 // rt.loadProjects();
1004 _this.classification_id.loading = true;
1010 el.append(out iter);
1013 var projects = rt.classifications;
1014 foreach(var project in projects) {
1016 el.append(out iter);
1018 el.set_value(iter, 0, project.id);
1019 el.set_value(iter, 1, project.display_name );
1020 if ("bug" == project.name) {
1021 _this.classification_id.el.set_active_iter(iter);
1026 _this.classification_id.loading = false;
1027 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
1033 public class Xcls_Label24 : Object
1035 public Gtk.Label el;
1036 private Ticket _this;
1042 public Xcls_Label24(Ticket _owner )
1045 this.el = new Gtk.Label( "Assign to" );
1049 // set gobject values
1050 this.el.halign = Gtk.Align.START;
1053 // user defined functions
1056 public class Xcls_developer_id : Object
1058 public Gtk.ComboBox el;
1059 private Ticket _this;
1063 public bool loading;
1066 public Xcls_developer_id(Ticket _owner )
1069 _this.developer_id = this;
1070 this.el = new Gtk.ComboBox.with_entry();
1073 this.loading = false;
1075 // set gobject values
1076 var child_0 = new Xcls_devmodel( _this );
1078 this.el.set_model ( child_0.el );
1082 this.el.set_entry_text_column(1);
1085 // user defined functions
1086 public string selectedDeveloperId () {
1091 this.el.get_active_iter (out iter);
1092 _this.devmodel.el.get_value (iter, 0, out val1);
1095 return (string) val1;
1102 public class Xcls_devmodel : Object
1104 public Gtk.ListStore el;
1105 private Ticket _this;
1111 public Xcls_devmodel(Ticket _owner )
1114 _this.devmodel = this;
1115 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
1119 // set gobject values
1122 // user defined functions
1123 public void loadDevelopers ( ) {
1125 var rt = RooTicket.singleton();
1126 //rt.loadProjects();
1128 _this.developer_id.loading = true;
1134 el.append(out iter);
1137 el.set_value(iter, 0, "");
1138 el.set_value(iter, 1, "-- select a developer --");
1140 _this.developer_id.el.set_active_iter(iter);
1143 var projects = rt.developers;
1144 foreach(var project in projects) {
1146 el.append(out iter);
1148 el.set_value(iter, 0, project.id);
1149 el.set_value(iter, 1, project.display_name );
1150 // if (id == project.id) {
1151 // _this.projectsel.el.set_active_iter(iter);
1156 _this.developer_id.loading = false;
1157 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
1163 public class Xcls_Button27 : Object
1165 public Gtk.Button el;
1166 private Ticket _this;
1172 public Xcls_Button27(Ticket _owner )
1175 this.el = new Gtk.Button();
1179 // set gobject values
1180 this.el.label = "Create Ticket";
1185 this.el.get_style_context().add_class("suggested-action");
1189 this.el.clicked.connect( () => {
1190 GLib.debug("fire response = 1");
1193 var invalid = false;
1195 // validate first...
1196 _this.project_id.el.get_child().get_style_context().remove_class("warning");
1197 if (_this.project_id.selectedProjectId() == "") {
1198 _this.project_id.el.get_child().get_style_context().add_class("warning");
1202 _this.milestone_id.el.get_child().get_style_context().remove_class("warning");
1203 if (_this.milestone_id.selectedMilestoneId() == "") {
1204 _this.milestone_id.el.get_child().get_style_context().add_class("warning");
1208 _this.priority_id.el.get_child().get_style_context().remove_class("warning");
1209 if (_this.priority_id.selectedPriorityId() == "") {
1210 _this.priority_id.el.get_child().get_style_context().add_class("warning");
1214 _this.classification_id.el.get_child().get_style_context().remove_class("warning");
1215 if (_this.classification_id.selectedClassificationId() == "") {
1216 _this.classification_id.el.get_child().get_style_context().add_class("warning");
1220 _this.developer_id.el.get_child().get_style_context().remove_class("warning");
1221 if (_this.developer_id.selectedDeveloperId() == "") {
1222 _this.developer_id.el.get_child().get_style_context().add_class("warning");
1226 _this.summary.el.get_style_context().remove_class("warning");
1227 if (_this.summary.el.get_text() == "") {
1228 _this.summary.el.get_style_context().add_class("warning");
1232 _this.description.el.get_style_context().remove_class("warning");
1233 if (_this.description.el.buffer.text == "") {
1234 _this.description.el.get_style_context().add_class("warning");
1242 GLib.debug("for is valid");
1244 _this.el.response(1);
1248 // user defined functions