3 public class Ticket : Object
8 public static Ticket singleton()
10 if (_Ticket == null) {
11 _Ticket= new Ticket();
15 public Xcls_table table;
16 public Xcls_project_id project_id;
17 public Xcls_prcellrenderer prcellrenderer;
18 public Xcls_prmodel prmodel;
19 public Xcls_summary summary;
20 public Xcls_milestone_id milestone_id;
21 public Xcls_msmodel msmodel;
22 public Xcls_description description;
23 public Xcls_priority_id priority_id;
24 public Xcls_primodel primodel;
25 public Xcls_severity_id severity_id;
26 public Xcls_sevmodel sevmodel;
27 public Xcls_classification_id classification_id;
28 public Xcls_clmodel clmodel;
29 public Xcls_developer_id developer_id;
30 public Xcls_devmodel devmodel;
31 public Xcls_spinner spinner;
41 this.el = new Gtk.Dialog();
48 this.el.title = "Create a Ticket";
49 this.el.default_height = 200;
50 this.el.default_width = 500;
51 this.el.deletable = true;
53 var child_0 = new Xcls_Box2( _this );
55 this.el.get_content_area().add ( child_0.el );
58 this.el.delete_event.connect( (self, event) => {
63 this.el.response.connect( (self, response_id) => {
65 GLib.debug("got %d", (int) response_id);
66 if (response_id < 1) {
73 var tid = RooTicket.singleton().createTicket(
75 _this.project_id.selectedProjectId(),
77 _this.milestone_id.selectedMilestoneId(),
78 _this.priority_id.selectedPriorityId() ,
79 _this.severity_id.selectedSeverityId() ,
80 _this.classification_id.selectedClassificationId() ,
81 _this.developer_id.selectedDeveloperId(),
82 _this.summary.el.get_text() ,
83 _this.description.el.buffer.text
87 if (this.repo != null) {
88 NewBranch.singleton().show(this.repo, new Gee.ArrayList<GitMonitorQueue>(), tid);
96 // user defined functions
97 public void show ( GitRepo? repo )
99 // this.el.set_gravity(Gdk.Gravity.NORTH);
100 if (this.running) { // should not happen!!
101 GLib.error("new branch show called, when already being displayed?");
107 _this.table.el.hide();
109 _this.spinner.el.show();
110 _this.spinner.el.start();
111 this.el.set_keep_above(true);
112 this.el.move((Gdk.Screen.width() / 2)- 250 ,0);
113 this.el.set_default_size( 500,200); // not sure why it grows..
115 GLib.debug("Showing dialog?");
116 Timeout.add_seconds(1, () => {
121 //GitMonitor.gitmonitor.stop();
128 // GLib.debug("Loading tickets");
132 RooProject? curproj = null;
133 if (this.repo != null) {
134 curproj = RooProject.getProjectByRepo(this.repo);
136 _this.prmodel.loadProjects(curproj == null ? "" : curproj.id);
137 if (curproj != null) {
140 var rt = RooTicket.singleton();
141 rt.loadProjectOptions(curproj.id);
143 _this.msmodel.loadMilestones();
144 _this.primodel.loadPriorities();
145 _this.sevmodel.loadSeverities();
146 _this.clmodel.loadClassifications();
147 _this.devmodel.loadDevelopers();
150 _this.summary.el.set_text("");
151 _this.description.el.buffer.text = "";
152 _this.spinner.el.stop();
153 _this.spinner.el.hide();
155 this.table.el.show();
168 public class Xcls_Box2 : Object
171 private Ticket _this;
177 public Xcls_Box2(Ticket _owner )
180 this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
184 // set gobject values
185 var child_0 = new Xcls_table( _this );
187 this.el.pack_start ( child_0.el , false,false,0 );
188 var child_1 = new Xcls_spinner( _this );
190 this.el.add ( child_1.el );
193 // user defined functions
195 public class Xcls_table : Object
198 private Ticket _this;
204 public Xcls_table(Ticket _owner )
208 this.el = new Gtk.Table( 14, 4, true );
212 // set gobject values
213 this.el.expand = false;
215 this.el.column_spacing = 4;
216 this.el.vexpand = false;
217 var child_0 = new Xcls_Label4( _this );
219 this.el.attach_defaults ( child_0.el , 0,1,0,1 );
220 var child_1 = new Xcls_Label5( _this );
222 this.el.attach_defaults ( child_1.el , 1,2,0,1 );
223 var child_2 = new Xcls_project_id( _this );
225 this.el.attach_defaults ( child_2.el , 0,1,1,2 );
226 var child_3 = new Xcls_summary( _this );
228 this.el.attach_defaults ( child_3.el , 1,4,1,2 );
229 var child_4 = new Xcls_Label10( _this );
231 this.el.attach_defaults ( child_4.el , 0,1,2,3 );
232 var child_5 = new Xcls_milestone_id( _this );
234 this.el.attach_defaults ( child_5.el , 0,1,3,4 );
235 var child_6 = new Xcls_Label13( _this );
237 this.el.attach_defaults ( child_6.el , 1,4,2,3 );
238 var child_7 = new Xcls_description( _this );
240 this.el.attach_defaults ( child_7.el , 1,4,3,12 );
241 var child_8 = new Xcls_Label15( _this );
243 this.el.attach_defaults ( child_8.el , 0,1,4,5 );
244 var child_9 = new Xcls_priority_id( _this );
246 this.el.attach_defaults ( child_9.el , 0,1,5,6 );
247 var child_10 = new Xcls_Label18( _this );
249 this.el.attach_defaults ( child_10.el , 0,1,6,7 );
250 var child_11 = new Xcls_severity_id( _this );
252 this.el.attach_defaults ( child_11.el , 0,1,7,8 );
253 var child_12 = new Xcls_Label21( _this );
255 this.el.attach_defaults ( child_12.el , 0,1,8,9 );
256 var child_13 = new Xcls_classification_id( _this );
258 this.el.attach_defaults ( child_13.el , 0,1,9,10 );
259 var child_14 = new Xcls_Label24( _this );
261 this.el.attach_defaults ( child_14.el , 0,1,10,11 );
262 var child_15 = new Xcls_developer_id( _this );
264 this.el.attach_defaults ( child_15.el , 0,1,11,12 );
265 var child_16 = new Xcls_Button27( _this );
267 this.el.attach_defaults ( child_16.el , 0,4,13,14 );
270 // user defined functions
272 public class Xcls_Label4 : Object
275 private Ticket _this;
281 public Xcls_Label4(Ticket _owner )
284 this.el = new Gtk.Label( "Project" );
288 // set gobject values
289 this.el.halign = Gtk.Align.START;
290 this.el.visible = true;
293 // user defined functions
296 public class Xcls_Label5 : Object
299 private Ticket _this;
305 public Xcls_Label5(Ticket _owner )
308 this.el = new Gtk.Label( "Summary" );
312 // set gobject values
313 this.el.halign = Gtk.Align.START;
314 this.el.visible = true;
317 // user defined functions
320 public class Xcls_project_id : Object
322 public Gtk.ComboBox el;
323 private Ticket _this;
330 public Xcls_project_id(Ticket _owner )
333 _this.project_id = this;
334 this.el = new Gtk.ComboBox.with_entry();
337 this.loading = false;
339 // set gobject values
340 var child_0 = new Xcls_prcellrenderer( _this );
342 this.el.pack_start ( child_0.el , true );
343 var child_1 = new Xcls_prmodel( _this );
345 this.el.set_model ( child_1.el );
349 this.el.set_entry_text_column(1);
352 this.el.changed.connect( () => {
356 var project_id = this.selectedProjectId();
358 var rt = RooTicket.singleton();
359 rt.loadProjectOptions(project_id);
361 _this.msmodel.loadMilestones();
362 _this.primodel.loadPriorities();
363 _this.sevmodel.loadSeverities();
364 _this.clmodel.loadClassifications();
365 _this.devmodel.loadDevelopers();
367 // affects projects and milestones..
370 /*if (this.loading) {
373 var ticket_id = this.selectedTicketId();
375 var name = RooTicket.singleton().usernameLocal();
377 if (ticket_id == "" || ticket_id == null) {
379 var dt = new DateTime.now_local();
380 _this.name.el.set_text("wip_%s_%s".printf(name,dt.format("%Y_%b_%d")));
385 var ticket = RooTicket.singleton().getById(ticket_id);
387 _this.name.el.set_text("wip_%s_T%s_%s".printf(name,ticket.id, ticket.summaryToBranchName()));
389 //GLib.debug (//"Selection: %s, %s\n", (string) val1, (string) val2);
394 // user defined functions
395 public string selectedProjectId () {
400 this.el.get_active_iter (out iter);
401 _this.prmodel.el.get_value (iter, 0, out val1);
404 return (string) val1;
411 public class Xcls_prcellrenderer : Object
413 public Gtk.CellRendererText el;
414 private Ticket _this;
420 public Xcls_prcellrenderer(Ticket _owner )
423 _this.prcellrenderer = this;
424 this.el = new Gtk.CellRendererText();
428 // set gobject values
431 // user defined functions
434 public class Xcls_prmodel : Object
436 public Gtk.ListStore el;
437 private Ticket _this;
443 public Xcls_prmodel(Ticket _owner )
446 _this.prmodel = this;
447 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
451 // set gobject values
454 // user defined functions
455 public void loadProjects (string id) {
458 _this.project_id.loading = true;
467 el.set_value(iter, 0, "");
468 el.set_value(iter, 1, "-- select a project --");
470 _this.project_id.el.set_active_iter(iter);
473 foreach(var project in RooProject.projects()) {
477 el.set_value(iter, 0, project.id);
478 el.set_value(iter, 1, project.name );
479 if (id == project.id) {
480 _this.project_id.el.set_active_iter(iter);
485 _this.project_id.loading = false;
486 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
492 public class Xcls_summary : Object
495 private Ticket _this;
501 public Xcls_summary(Ticket _owner )
504 _this.summary = this;
505 this.el = new Gtk.Entry();
509 // set gobject values
510 this.el.visible = true;
513 // user defined functions
516 public class Xcls_Label10 : Object
519 private Ticket _this;
525 public Xcls_Label10(Ticket _owner )
528 this.el = new Gtk.Label( "Milestone" );
532 // set gobject values
533 this.el.halign = Gtk.Align.START;
534 this.el.justify = Gtk.Justification.RIGHT;
535 this.el.xalign = 0.900000f;
538 // user defined functions
541 public class Xcls_milestone_id : Object
543 public Gtk.ComboBox el;
544 private Ticket _this;
551 public Xcls_milestone_id(Ticket _owner )
554 _this.milestone_id = this;
555 this.el = new Gtk.ComboBox.with_entry();
558 this.loading = false;
560 // set gobject values
561 var child_0 = new Xcls_msmodel( _this );
563 this.el.set_model ( child_0.el );
567 this.el.set_entry_text_column(1);
570 // user defined functions
571 public string selectedMilestoneId () {
576 this.el.get_active_iter (out iter);
577 _this.msmodel.el.get_value (iter, 0, out val1);
580 return (string) val1;
587 public class Xcls_msmodel : Object
589 public Gtk.ListStore el;
590 private Ticket _this;
596 public Xcls_msmodel(Ticket _owner )
599 _this.msmodel = this;
600 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
604 // set gobject values
607 // user defined functions
608 public void loadMilestones ( ) {
610 var rt = RooTicket.singleton();
611 // rt.loadProjects();
613 _this.milestone_id.loading = true;
622 el.set_value(iter, 0, "");
623 el.set_value(iter, 1, "-- select a milestone --");
624 _this.milestone_id.el.set_active_iter(iter);
626 var projects = rt.milestones;
627 foreach(var project in projects) {
631 el.set_value(iter, 0, project.id);
632 el.set_value(iter, 1, project.display_name );
633 // if (id == project.id) {
634 // _this.milestone.el.set_active_iter(iter);
640 _this.milestone_id.loading = false;
641 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
647 public class Xcls_Label13 : Object
650 private Ticket _this;
656 public Xcls_Label13(Ticket _owner )
659 this.el = new Gtk.Label( "Description" );
663 // set gobject values
664 this.el.halign = Gtk.Align.START;
667 // user defined functions
670 public class Xcls_description : Object
672 public Gtk.TextView el;
673 private Ticket _this;
679 public Xcls_description(Ticket _owner )
682 _this.description = this;
683 this.el = new Gtk.TextView();
687 // set gobject values
688 this.el.border_width = 1;
691 // user defined functions
694 public class Xcls_Label15 : Object
697 private Ticket _this;
703 public Xcls_Label15(Ticket _owner )
706 this.el = new Gtk.Label( "Priority" );
710 // set gobject values
711 this.el.halign = Gtk.Align.START;
712 this.el.xalign = 0.900000f;
715 // user defined functions
718 public class Xcls_priority_id : Object
720 public Gtk.ComboBox el;
721 private Ticket _this;
728 public Xcls_priority_id(Ticket _owner )
731 _this.priority_id = this;
732 this.el = new Gtk.ComboBox.with_entry();
735 this.loading = false;
737 // set gobject values
738 var child_0 = new Xcls_primodel( _this );
740 this.el.set_model ( child_0.el );
744 this.el.set_entry_text_column(1);
747 // user defined functions
748 public string selectedPriorityId () {
753 this.el.get_active_iter (out iter);
754 _this.primodel.el.get_value (iter, 0, out val1);
757 return (string) val1;
764 public class Xcls_primodel : Object
766 public Gtk.ListStore el;
767 private Ticket _this;
773 public Xcls_primodel(Ticket _owner )
776 _this.primodel = this;
777 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
781 // set gobject values
784 // user defined functions
785 public void loadPriorities ( ) {
787 var rt = RooTicket.singleton();
788 // rt.loadProjects();
790 _this.priority_id.loading = true;
797 var projects = rt.priorities;
798 foreach(var project in projects) {
802 el.set_value(iter, 0, project.id);
803 el.set_value(iter, 1, project.display_name );
804 if ("normal" == project.name) {
805 _this.priority_id.el.set_active_iter(iter);
810 _this.priority_id.loading = false;
817 public class Xcls_Label18 : Object
820 private Ticket _this;
826 public Xcls_Label18(Ticket _owner )
829 this.el = new Gtk.Label( "Severity" );
833 // set gobject values
834 this.el.halign = Gtk.Align.START;
837 // user defined functions
840 public class Xcls_severity_id : Object
842 public Gtk.ComboBox el;
843 private Ticket _this;
850 public Xcls_severity_id(Ticket _owner )
853 _this.severity_id = this;
854 this.el = new Gtk.ComboBox.with_entry();
857 this.loading = false;
859 // set gobject values
860 var child_0 = new Xcls_sevmodel( _this );
862 this.el.set_model ( child_0.el );
866 this.el.set_entry_text_column(1);
869 // user defined functions
870 public string selectedSeverityId () {
875 this.el.get_active_iter (out iter);
876 _this.sevmodel.el.get_value (iter, 0, out val1);
879 return (string) val1;
886 public class Xcls_sevmodel : Object
888 public Gtk.ListStore el;
889 private Ticket _this;
895 public Xcls_sevmodel(Ticket _owner )
898 _this.sevmodel = this;
899 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
903 // set gobject values
906 // user defined functions
907 public void loadSeverities () {
909 var rt = RooTicket.singleton();
912 _this.severity_id.loading = true;
918 var projects = rt.serverities;
919 foreach(var project in projects) {
923 el.set_value(iter, 0, project.id);
924 el.set_value(iter, 1, project.display_name );
925 if ("normal" == project.name) {
926 _this.severity_id.el.set_active_iter(iter);
931 _this.severity_id.loading = false;
932 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
938 public class Xcls_Label21 : Object
941 private Ticket _this;
947 public Xcls_Label21(Ticket _owner )
950 this.el = new Gtk.Label( "Classification" );
954 // set gobject values
955 this.el.halign = Gtk.Align.START;
958 // user defined functions
961 public class Xcls_classification_id : Object
963 public Gtk.ComboBox el;
964 private Ticket _this;
971 public Xcls_classification_id(Ticket _owner )
974 _this.classification_id = this;
975 this.el = new Gtk.ComboBox.with_entry();
978 this.loading = false;
980 // set gobject values
981 var child_0 = new Xcls_clmodel( _this );
983 this.el.set_model ( child_0.el );
987 this.el.set_entry_text_column(1);
990 // user defined functions
991 public string selectedClassificationId () {
996 this.el.get_active_iter (out iter);
997 _this.clmodel.el.get_value (iter, 0, out val1);
1000 return (string) val1;
1007 public class Xcls_clmodel : Object
1009 public Gtk.ListStore el;
1010 private Ticket _this;
1016 public Xcls_clmodel(Ticket _owner )
1019 _this.clmodel = this;
1020 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
1024 // set gobject values
1027 // user defined functions
1028 public void loadClassifications ( ) {
1030 var rt = RooTicket.singleton();
1031 // rt.loadProjects();
1033 _this.classification_id.loading = true;
1039 el.append(out iter);
1042 var projects = rt.classifications;
1043 foreach(var project in projects) {
1045 el.append(out iter);
1047 el.set_value(iter, 0, project.id);
1048 el.set_value(iter, 1, project.display_name );
1049 if ("bug" == project.name) {
1050 _this.classification_id.el.set_active_iter(iter);
1055 _this.classification_id.loading = false;
1056 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
1062 public class Xcls_Label24 : Object
1064 public Gtk.Label el;
1065 private Ticket _this;
1071 public Xcls_Label24(Ticket _owner )
1074 this.el = new Gtk.Label( "Assign to" );
1078 // set gobject values
1079 this.el.halign = Gtk.Align.START;
1082 // user defined functions
1085 public class Xcls_developer_id : Object
1087 public Gtk.ComboBox el;
1088 private Ticket _this;
1092 public bool loading;
1095 public Xcls_developer_id(Ticket _owner )
1098 _this.developer_id = this;
1099 this.el = new Gtk.ComboBox.with_entry();
1102 this.loading = false;
1104 // set gobject values
1105 var child_0 = new Xcls_devmodel( _this );
1107 this.el.set_model ( child_0.el );
1111 this.el.set_entry_text_column(1);
1114 // user defined functions
1115 public string selectedDeveloperId () {
1120 this.el.get_active_iter (out iter);
1121 _this.devmodel.el.get_value (iter, 0, out val1);
1124 return (string) val1;
1131 public class Xcls_devmodel : Object
1133 public Gtk.ListStore el;
1134 private Ticket _this;
1140 public Xcls_devmodel(Ticket _owner )
1143 _this.devmodel = this;
1144 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
1148 // set gobject values
1151 // user defined functions
1152 public void loadDevelopers ( ) {
1154 var rt = RooTicket.singleton();
1155 //rt.loadProjects();
1157 _this.developer_id.loading = true;
1163 el.append(out iter);
1166 el.set_value(iter, 0, "");
1167 el.set_value(iter, 1, "-- select a developer --");
1169 _this.developer_id.el.set_active_iter(iter);
1172 var projects = rt.developers;
1173 foreach(var project in projects) {
1175 el.append(out iter);
1177 el.set_value(iter, 0, project.id);
1178 el.set_value(iter, 1, project.display_name );
1179 // if (id == project.id) {
1180 // _this.projectsel.el.set_active_iter(iter);
1185 _this.developer_id.loading = false;
1186 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
1192 public class Xcls_Button27 : Object
1194 public Gtk.Button el;
1195 private Ticket _this;
1201 public Xcls_Button27(Ticket _owner )
1204 this.el = new Gtk.Button();
1208 // set gobject values
1209 this.el.label = "Create Ticket";
1214 this.el.get_style_context().add_class("suggested-action");
1218 this.el.clicked.connect( () => {
1219 GLib.debug("fire response = 1");
1222 var invalid = false;
1224 // validate first...
1225 _this.project_id.el.get_child().get_style_context().remove_class("warning");
1226 if (_this.project_id.selectedProjectId() == "") {
1227 _this.project_id.el.get_child().get_style_context().add_class("warning");
1231 _this.milestone_id.el.get_child().get_style_context().remove_class("warning");
1232 if (_this.milestone_id.selectedMilestoneId() == "") {
1233 _this.milestone_id.el.get_child().get_style_context().add_class("warning");
1237 _this.priority_id.el.get_child().get_style_context().remove_class("warning");
1238 if (_this.priority_id.selectedPriorityId() == "") {
1239 _this.priority_id.el.get_child().get_style_context().add_class("warning");
1243 _this.classification_id.el.get_child().get_style_context().remove_class("warning");
1244 if (_this.classification_id.selectedClassificationId() == "") {
1245 _this.classification_id.el.get_child().get_style_context().add_class("warning");
1249 _this.developer_id.el.get_child().get_style_context().remove_class("warning");
1250 if (_this.developer_id.selectedDeveloperId() == "") {
1251 _this.developer_id.el.get_child().get_style_context().add_class("warning");
1255 _this.summary.el.get_style_context().remove_class("warning");
1256 if (_this.summary.el.get_text() == "") {
1257 _this.summary.el.get_style_context().add_class("warning");
1261 _this.description.el.get_style_context().remove_class("warning");
1262 if (_this.description.el.buffer.text == "") {
1263 _this.description.el.get_style_context().add_class("warning");
1271 GLib.debug("for is valid");
1273 _this.el.response(1);
1277 // user defined functions
1281 public class Xcls_spinner : Object
1283 public Gtk.Spinner el;
1284 private Ticket _this;
1290 public Xcls_spinner(Ticket _owner )
1293 _this.spinner = this;
1294 this.el = new Gtk.Spinner();
1298 // set gobject values
1299 this.el.hexpand = true;
1300 this.el.vexpand = true;
1303 // user defined functions