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;
30 public Xcls_spinner spinner;
40 this.el = new Gtk.Dialog();
47 this.el.title = "Create a Ticket";
48 this.el.default_height = 200;
49 this.el.default_width = 500;
50 this.el.deletable = true;
52 var child_0 = new Xcls_Box2( _this );
54 this.el.get_content_area().add ( child_0.el );
57 this.el.delete_event.connect( (self, event) => {
62 this.el.response.connect( (self, response_id) => {
64 GLib.debug("got %d", (int) response_id);
65 if (response_id < 1) {
72 var tid = RooTicket.singleton().createTicket(
74 _this.project_id.selectedProjectId(),
76 _this.milestone_id.selectedMilestoneId(),
77 _this.priority_id.selectedPriorityId() ,
78 _this.classification_id.selectedClassificationId() ,
79 _this.developer_id.selectedDeveloperId(),
80 _this.summary.el.get_text() ,
81 _this.description.el.buffer.text
85 if (this.repo != null) {
86 NewBranch.singleton().show(this.repo, new Gee.ArrayList<GitMonitorQueue>(), tid);
94 // user defined functions
95 public void show ( GitRepo? repo )
97 // this.el.set_gravity(Gdk.Gravity.NORTH);
98 if (this.running) { // should not happen!!
99 GLib.error("new branch show called, when already being displayed?");
104 //GitMonitor.gitmonitor.stop();
111 this.el.move((Gdk.Screen.width() / 2)- 250 ,0);
112 this.el.set_default_size( 500,200); // not sure why it grows..
113 GLib.debug("Loading tickets");
117 this.el.set_keep_above(true);
120 RooProject? curproj = null;
121 if (this.repo != null) {
122 curproj = RooProject.getProjectByRepo(this.repo);
124 _this.prmodel.loadProjects(curproj == null ? "" : curproj.id);
125 if (curproj != null) {
128 var rt = RooTicket.singleton();
129 rt.loadProjectOptions(curproj.id);
131 _this.msmodel.loadMilestones();
132 _this.primodel.loadPriorities();
133 _this.sevmodel.loadSeverities();
134 _this.clmodel.loadClassifications();
135 _this.devmodel.loadDevelopers();
138 _this.summary.el.set_text("");
139 _this.description.el.buffer.text = "";
145 public class Xcls_Box2 : Object
148 private Ticket _this;
154 public Xcls_Box2(Ticket _owner )
157 this.el = new Gtk.Box( null, 0 );
161 // set gobject values
162 var child_0 = new Xcls_Table3( _this );
164 this.el.pack_start ( child_0.el , false,false,0 );
165 var child_1 = new Xcls_spinner( _this );
167 this.el.add ( child_1.el );
170 // user defined functions
172 public class Xcls_Table3 : Object
175 private Ticket _this;
181 public Xcls_Table3(Ticket _owner )
184 this.el = new Gtk.Table( 14, 4, true );
188 // set gobject values
189 this.el.expand = false;
191 this.el.column_spacing = 4;
192 this.el.vexpand = false;
193 var child_0 = new Xcls_Label4( _this );
195 this.el.attach_defaults ( child_0.el , 0,1,0,1 );
196 var child_1 = new Xcls_Label5( _this );
198 this.el.attach_defaults ( child_1.el , 1,2,0,1 );
199 var child_2 = new Xcls_project_id( _this );
201 this.el.attach_defaults ( child_2.el , 0,1,1,2 );
202 var child_3 = new Xcls_summary( _this );
204 this.el.attach_defaults ( child_3.el , 1,4,1,2 );
205 var child_4 = new Xcls_Label10( _this );
207 this.el.attach_defaults ( child_4.el , 0,1,2,3 );
208 var child_5 = new Xcls_milestone_id( _this );
210 this.el.attach_defaults ( child_5.el , 0,1,3,4 );
211 var child_6 = new Xcls_Label13( _this );
213 this.el.attach_defaults ( child_6.el , 1,4,2,3 );
214 var child_7 = new Xcls_description( _this );
216 this.el.attach_defaults ( child_7.el , 1,4,3,12 );
217 var child_8 = new Xcls_Label15( _this );
219 this.el.attach_defaults ( child_8.el , 0,1,4,5 );
220 var child_9 = new Xcls_priority_id( _this );
222 this.el.attach_defaults ( child_9.el , 0,1,5,6 );
223 var child_10 = new Xcls_Label18( _this );
225 this.el.attach_defaults ( child_10.el , 0,1,6,7 );
226 var child_11 = new Xcls_severity_id( _this );
228 this.el.attach_defaults ( child_11.el , 0,1,7,8 );
229 var child_12 = new Xcls_Label21( _this );
231 this.el.attach_defaults ( child_12.el , 0,1,8,9 );
232 var child_13 = new Xcls_classification_id( _this );
234 this.el.attach_defaults ( child_13.el , 0,1,9,10 );
235 var child_14 = new Xcls_Label24( _this );
237 this.el.attach_defaults ( child_14.el , 0,1,10,11 );
238 var child_15 = new Xcls_developer_id( _this );
240 this.el.attach_defaults ( child_15.el , 0,1,11,12 );
241 var child_16 = new Xcls_Button27( _this );
243 this.el.attach_defaults ( child_16.el , 0,4,13,14 );
246 // user defined functions
248 public class Xcls_Label4 : Object
251 private Ticket _this;
257 public Xcls_Label4(Ticket _owner )
260 this.el = new Gtk.Label( "Project" );
264 // set gobject values
265 this.el.halign = Gtk.Align.START;
266 this.el.visible = true;
269 // user defined functions
272 public class Xcls_Label5 : Object
275 private Ticket _this;
281 public Xcls_Label5(Ticket _owner )
284 this.el = new Gtk.Label( "Summary" );
288 // set gobject values
289 this.el.halign = Gtk.Align.START;
290 this.el.visible = true;
293 // user defined functions
296 public class Xcls_project_id : Object
298 public Gtk.ComboBox el;
299 private Ticket _this;
306 public Xcls_project_id(Ticket _owner )
309 _this.project_id = this;
310 this.el = new Gtk.ComboBox.with_entry();
313 this.loading = false;
315 // set gobject values
316 var child_0 = new Xcls_prcellrenderer( _this );
318 this.el.pack_start ( child_0.el , true );
319 var child_1 = new Xcls_prmodel( _this );
321 this.el.set_model ( child_1.el );
325 this.el.set_entry_text_column(1);
328 this.el.changed.connect( () => {
332 var project_id = this.selectedProjectId();
334 var rt = RooTicket.singleton();
335 rt.loadProjectOptions(project_id);
337 _this.msmodel.loadMilestones();
338 _this.primodel.loadPriorities();
339 _this.sevmodel.loadSeverities();
340 _this.clmodel.loadClassifications();
341 _this.devmodel.loadDevelopers();
343 // affects projects and milestones..
346 /*if (this.loading) {
349 var ticket_id = this.selectedTicketId();
351 var name = RooTicket.singleton().usernameLocal();
353 if (ticket_id == "" || ticket_id == null) {
355 var dt = new DateTime.now_local();
356 _this.name.el.set_text("wip_%s_%s".printf(name,dt.format("%Y_%b_%d")));
361 var ticket = RooTicket.singleton().getById(ticket_id);
363 _this.name.el.set_text("wip_%s_T%s_%s".printf(name,ticket.id, ticket.summaryToBranchName()));
365 //GLib.debug (//"Selection: %s, %s\n", (string) val1, (string) val2);
370 // user defined functions
371 public string selectedProjectId () {
376 this.el.get_active_iter (out iter);
377 _this.prmodel.el.get_value (iter, 0, out val1);
380 return (string) val1;
387 public class Xcls_prcellrenderer : Object
389 public Gtk.CellRendererText el;
390 private Ticket _this;
396 public Xcls_prcellrenderer(Ticket _owner )
399 _this.prcellrenderer = this;
400 this.el = new Gtk.CellRendererText();
404 // set gobject values
407 // user defined functions
410 public class Xcls_prmodel : Object
412 public Gtk.ListStore el;
413 private Ticket _this;
419 public Xcls_prmodel(Ticket _owner )
422 _this.prmodel = this;
423 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
427 // set gobject values
430 // user defined functions
431 public void loadProjects (string id) {
434 _this.project_id.loading = true;
443 el.set_value(iter, 0, "");
444 el.set_value(iter, 1, "-- select a project --");
446 _this.project_id.el.set_active_iter(iter);
449 foreach(var project in RooProject.projects()) {
453 el.set_value(iter, 0, project.id);
454 el.set_value(iter, 1, project.name );
455 if (id == project.id) {
456 _this.project_id.el.set_active_iter(iter);
461 _this.project_id.loading = false;
462 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
468 public class Xcls_summary : Object
471 private Ticket _this;
477 public Xcls_summary(Ticket _owner )
480 _this.summary = this;
481 this.el = new Gtk.Entry();
485 // set gobject values
486 this.el.visible = true;
489 // user defined functions
492 public class Xcls_Label10 : Object
495 private Ticket _this;
501 public Xcls_Label10(Ticket _owner )
504 this.el = new Gtk.Label( "Milestone" );
508 // set gobject values
509 this.el.halign = Gtk.Align.START;
510 this.el.justify = Gtk.Justification.RIGHT;
511 this.el.xalign = 0.900000f;
514 // user defined functions
517 public class Xcls_milestone_id : Object
519 public Gtk.ComboBox el;
520 private Ticket _this;
527 public Xcls_milestone_id(Ticket _owner )
530 _this.milestone_id = this;
531 this.el = new Gtk.ComboBox.with_entry();
534 this.loading = false;
536 // set gobject values
537 var child_0 = new Xcls_msmodel( _this );
539 this.el.set_model ( child_0.el );
543 this.el.set_entry_text_column(1);
546 // user defined functions
547 public string selectedMilestoneId () {
552 this.el.get_active_iter (out iter);
553 _this.msmodel.el.get_value (iter, 0, out val1);
556 return (string) val1;
563 public class Xcls_msmodel : Object
565 public Gtk.ListStore el;
566 private Ticket _this;
572 public Xcls_msmodel(Ticket _owner )
575 _this.msmodel = this;
576 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
580 // set gobject values
583 // user defined functions
584 public void loadMilestones ( ) {
586 var rt = RooTicket.singleton();
587 // rt.loadProjects();
589 _this.milestone_id.loading = true;
598 el.set_value(iter, 0, "");
599 el.set_value(iter, 1, "-- select a milestone --");
600 _this.milestone_id.el.set_active_iter(iter);
602 var projects = rt.milestones;
603 foreach(var project in projects) {
607 el.set_value(iter, 0, project.id);
608 el.set_value(iter, 1, project.display_name );
609 // if (id == project.id) {
610 // _this.milestone.el.set_active_iter(iter);
616 _this.milestone_id.loading = false;
617 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
623 public class Xcls_Label13 : Object
626 private Ticket _this;
632 public Xcls_Label13(Ticket _owner )
635 this.el = new Gtk.Label( "Description" );
639 // set gobject values
640 this.el.halign = Gtk.Align.START;
643 // user defined functions
646 public class Xcls_description : Object
648 public Gtk.TextView el;
649 private Ticket _this;
655 public Xcls_description(Ticket _owner )
658 _this.description = this;
659 this.el = new Gtk.TextView();
663 // set gobject values
664 this.el.border_width = 1;
667 // user defined functions
670 public class Xcls_Label15 : Object
673 private Ticket _this;
679 public Xcls_Label15(Ticket _owner )
682 this.el = new Gtk.Label( "Priority" );
686 // set gobject values
687 this.el.halign = Gtk.Align.START;
688 this.el.xalign = 0.900000f;
691 // user defined functions
694 public class Xcls_priority_id : Object
696 public Gtk.ComboBox el;
697 private Ticket _this;
704 public Xcls_priority_id(Ticket _owner )
707 _this.priority_id = this;
708 this.el = new Gtk.ComboBox.with_entry();
711 this.loading = false;
713 // set gobject values
714 var child_0 = new Xcls_primodel( _this );
716 this.el.set_model ( child_0.el );
720 this.el.set_entry_text_column(1);
723 // user defined functions
724 public string selectedPriorityId () {
729 this.el.get_active_iter (out iter);
730 _this.primodel.el.get_value (iter, 0, out val1);
733 return (string) val1;
740 public class Xcls_primodel : Object
742 public Gtk.ListStore el;
743 private Ticket _this;
749 public Xcls_primodel(Ticket _owner )
752 _this.primodel = this;
753 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
757 // set gobject values
760 // user defined functions
761 public void loadPriorities ( ) {
763 var rt = RooTicket.singleton();
764 // rt.loadProjects();
766 _this.priority_id.loading = true;
773 var projects = rt.priorities;
774 foreach(var project in projects) {
778 el.set_value(iter, 0, project.id);
779 el.set_value(iter, 1, project.display_name );
780 if ("normal" == project.name) {
781 _this.priority_id.el.set_active_iter(iter);
786 _this.priority_id.loading = false;
793 public class Xcls_Label18 : Object
796 private Ticket _this;
802 public Xcls_Label18(Ticket _owner )
805 this.el = new Gtk.Label( "Severity" );
809 // set gobject values
810 this.el.halign = Gtk.Align.START;
813 // user defined functions
816 public class Xcls_severity_id : Object
818 public Gtk.ComboBox el;
819 private Ticket _this;
826 public Xcls_severity_id(Ticket _owner )
829 _this.severity_id = this;
830 this.el = new Gtk.ComboBox.with_entry();
833 this.loading = false;
835 // set gobject values
836 var child_0 = new Xcls_sevmodel( _this );
838 this.el.set_model ( child_0.el );
842 this.el.set_entry_text_column(1);
845 // user defined functions
846 public string selectedSeverityId () {
851 this.el.get_active_iter (out iter);
852 _this.sevmodel.el.get_value (iter, 0, out val1);
855 return (string) val1;
862 public class Xcls_sevmodel : Object
864 public Gtk.ListStore el;
865 private Ticket _this;
871 public Xcls_sevmodel(Ticket _owner )
874 _this.sevmodel = this;
875 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
879 // set gobject values
882 // user defined functions
883 public void loadSeverities () {
885 var rt = RooTicket.singleton();
888 _this.severity_id.loading = true;
894 var projects = rt.serverities;
895 foreach(var project in projects) {
899 el.set_value(iter, 0, project.id);
900 el.set_value(iter, 1, project.display_name );
901 if ("normal" == project.name) {
902 _this.severity_id.el.set_active_iter(iter);
907 _this.severity_id.loading = false;
908 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
914 public class Xcls_Label21 : Object
917 private Ticket _this;
923 public Xcls_Label21(Ticket _owner )
926 this.el = new Gtk.Label( "Classification" );
930 // set gobject values
931 this.el.halign = Gtk.Align.START;
934 // user defined functions
937 public class Xcls_classification_id : Object
939 public Gtk.ComboBox el;
940 private Ticket _this;
947 public Xcls_classification_id(Ticket _owner )
950 _this.classification_id = this;
951 this.el = new Gtk.ComboBox.with_entry();
954 this.loading = false;
956 // set gobject values
957 var child_0 = new Xcls_clmodel( _this );
959 this.el.set_model ( child_0.el );
963 this.el.set_entry_text_column(1);
966 // user defined functions
967 public string selectedClassificationId () {
972 this.el.get_active_iter (out iter);
973 _this.clmodel.el.get_value (iter, 0, out val1);
976 return (string) val1;
983 public class Xcls_clmodel : Object
985 public Gtk.ListStore el;
986 private Ticket _this;
992 public Xcls_clmodel(Ticket _owner )
995 _this.clmodel = this;
996 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
1000 // set gobject values
1003 // user defined functions
1004 public void loadClassifications ( ) {
1006 var rt = RooTicket.singleton();
1007 // rt.loadProjects();
1009 _this.classification_id.loading = true;
1015 el.append(out iter);
1018 var projects = rt.classifications;
1019 foreach(var project in projects) {
1021 el.append(out iter);
1023 el.set_value(iter, 0, project.id);
1024 el.set_value(iter, 1, project.display_name );
1025 if ("bug" == project.name) {
1026 _this.classification_id.el.set_active_iter(iter);
1031 _this.classification_id.loading = false;
1032 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
1038 public class Xcls_Label24 : Object
1040 public Gtk.Label el;
1041 private Ticket _this;
1047 public Xcls_Label24(Ticket _owner )
1050 this.el = new Gtk.Label( "Assign to" );
1054 // set gobject values
1055 this.el.halign = Gtk.Align.START;
1058 // user defined functions
1061 public class Xcls_developer_id : Object
1063 public Gtk.ComboBox el;
1064 private Ticket _this;
1068 public bool loading;
1071 public Xcls_developer_id(Ticket _owner )
1074 _this.developer_id = this;
1075 this.el = new Gtk.ComboBox.with_entry();
1078 this.loading = false;
1080 // set gobject values
1081 var child_0 = new Xcls_devmodel( _this );
1083 this.el.set_model ( child_0.el );
1087 this.el.set_entry_text_column(1);
1090 // user defined functions
1091 public string selectedDeveloperId () {
1096 this.el.get_active_iter (out iter);
1097 _this.devmodel.el.get_value (iter, 0, out val1);
1100 return (string) val1;
1107 public class Xcls_devmodel : Object
1109 public Gtk.ListStore el;
1110 private Ticket _this;
1116 public Xcls_devmodel(Ticket _owner )
1119 _this.devmodel = this;
1120 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
1124 // set gobject values
1127 // user defined functions
1128 public void loadDevelopers ( ) {
1130 var rt = RooTicket.singleton();
1131 //rt.loadProjects();
1133 _this.developer_id.loading = true;
1139 el.append(out iter);
1142 el.set_value(iter, 0, "");
1143 el.set_value(iter, 1, "-- select a developer --");
1145 _this.developer_id.el.set_active_iter(iter);
1148 var projects = rt.developers;
1149 foreach(var project in projects) {
1151 el.append(out iter);
1153 el.set_value(iter, 0, project.id);
1154 el.set_value(iter, 1, project.display_name );
1155 // if (id == project.id) {
1156 // _this.projectsel.el.set_active_iter(iter);
1161 _this.developer_id.loading = false;
1162 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
1168 public class Xcls_Button27 : Object
1170 public Gtk.Button el;
1171 private Ticket _this;
1177 public Xcls_Button27(Ticket _owner )
1180 this.el = new Gtk.Button();
1184 // set gobject values
1185 this.el.label = "Create Ticket";
1190 this.el.get_style_context().add_class("suggested-action");
1194 this.el.clicked.connect( () => {
1195 GLib.debug("fire response = 1");
1198 var invalid = false;
1200 // validate first...
1201 _this.project_id.el.get_child().get_style_context().remove_class("warning");
1202 if (_this.project_id.selectedProjectId() == "") {
1203 _this.project_id.el.get_child().get_style_context().add_class("warning");
1207 _this.milestone_id.el.get_child().get_style_context().remove_class("warning");
1208 if (_this.milestone_id.selectedMilestoneId() == "") {
1209 _this.milestone_id.el.get_child().get_style_context().add_class("warning");
1213 _this.priority_id.el.get_child().get_style_context().remove_class("warning");
1214 if (_this.priority_id.selectedPriorityId() == "") {
1215 _this.priority_id.el.get_child().get_style_context().add_class("warning");
1219 _this.classification_id.el.get_child().get_style_context().remove_class("warning");
1220 if (_this.classification_id.selectedClassificationId() == "") {
1221 _this.classification_id.el.get_child().get_style_context().add_class("warning");
1225 _this.developer_id.el.get_child().get_style_context().remove_class("warning");
1226 if (_this.developer_id.selectedDeveloperId() == "") {
1227 _this.developer_id.el.get_child().get_style_context().add_class("warning");
1231 _this.summary.el.get_style_context().remove_class("warning");
1232 if (_this.summary.el.get_text() == "") {
1233 _this.summary.el.get_style_context().add_class("warning");
1237 _this.description.el.get_style_context().remove_class("warning");
1238 if (_this.description.el.buffer.text == "") {
1239 _this.description.el.get_style_context().add_class("warning");
1247 GLib.debug("for is valid");
1249 _this.el.response(1);
1253 // user defined functions
1257 public class Xcls_spinner : Object
1259 public Gtk.Spinner el;
1260 private Ticket _this;
1266 public Xcls_spinner(Ticket _owner )
1269 _this.spinner = this;
1270 this.el = new Gtk.Spinner();
1274 // set gobject values
1275 this.el.hexpand = true;
1276 this.el.vexpand = true;
1279 // user defined functions