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();
156 _this.summary.el.grab_focus();
164 public class Xcls_Box2 : Object
167 private Ticket _this;
173 public Xcls_Box2(Ticket _owner )
176 this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
180 // set gobject values
181 var child_0 = new Xcls_table( _this );
183 this.el.pack_start ( child_0.el , false,false,0 );
184 var child_1 = new Xcls_spinner( _this );
186 this.el.add ( child_1.el );
189 // user defined functions
191 public class Xcls_table : Object
194 private Ticket _this;
200 public Xcls_table(Ticket _owner )
204 this.el = new Gtk.Table( 14, 4, true );
208 // set gobject values
209 this.el.expand = false;
211 this.el.column_spacing = 4;
212 this.el.vexpand = false;
213 var child_0 = new Xcls_Label4( _this );
215 this.el.attach_defaults ( child_0.el , 0,1,0,1 );
216 var child_1 = new Xcls_Label5( _this );
218 this.el.attach_defaults ( child_1.el , 1,2,0,1 );
219 var child_2 = new Xcls_project_id( _this );
221 this.el.attach_defaults ( child_2.el , 0,1,1,2 );
222 var child_3 = new Xcls_summary( _this );
224 this.el.attach_defaults ( child_3.el , 1,4,1,2 );
225 var child_4 = new Xcls_Label10( _this );
227 this.el.attach_defaults ( child_4.el , 0,1,2,3 );
228 var child_5 = new Xcls_milestone_id( _this );
230 this.el.attach_defaults ( child_5.el , 0,1,3,4 );
231 var child_6 = new Xcls_Label13( _this );
233 this.el.attach_defaults ( child_6.el , 1,4,2,3 );
234 var child_7 = new Xcls_description( _this );
236 this.el.attach_defaults ( child_7.el , 1,4,3,12 );
237 var child_8 = new Xcls_Label15( _this );
239 this.el.attach_defaults ( child_8.el , 0,1,4,5 );
240 var child_9 = new Xcls_priority_id( _this );
242 this.el.attach_defaults ( child_9.el , 0,1,5,6 );
243 var child_10 = new Xcls_Label18( _this );
245 this.el.attach_defaults ( child_10.el , 0,1,6,7 );
246 var child_11 = new Xcls_severity_id( _this );
248 this.el.attach_defaults ( child_11.el , 0,1,7,8 );
249 var child_12 = new Xcls_Label21( _this );
251 this.el.attach_defaults ( child_12.el , 0,1,8,9 );
252 var child_13 = new Xcls_classification_id( _this );
254 this.el.attach_defaults ( child_13.el , 0,1,9,10 );
255 var child_14 = new Xcls_Label24( _this );
257 this.el.attach_defaults ( child_14.el , 0,1,10,11 );
258 var child_15 = new Xcls_developer_id( _this );
260 this.el.attach_defaults ( child_15.el , 0,1,11,12 );
261 var child_16 = new Xcls_Button27( _this );
263 this.el.attach_defaults ( child_16.el , 0,4,13,14 );
266 // user defined functions
268 public class Xcls_Label4 : Object
271 private Ticket _this;
277 public Xcls_Label4(Ticket _owner )
280 this.el = new Gtk.Label( "Project" );
284 // set gobject values
285 this.el.halign = Gtk.Align.START;
286 this.el.visible = true;
289 // user defined functions
292 public class Xcls_Label5 : Object
295 private Ticket _this;
301 public Xcls_Label5(Ticket _owner )
304 this.el = new Gtk.Label( "Summary" );
308 // set gobject values
309 this.el.halign = Gtk.Align.START;
310 this.el.visible = true;
313 // user defined functions
316 public class Xcls_project_id : Object
318 public Gtk.ComboBox el;
319 private Ticket _this;
326 public Xcls_project_id(Ticket _owner )
329 _this.project_id = this;
330 this.el = new Gtk.ComboBox.with_entry();
333 this.loading = false;
335 // set gobject values
336 var child_0 = new Xcls_prcellrenderer( _this );
338 this.el.pack_start ( child_0.el , true );
339 var child_1 = new Xcls_prmodel( _this );
341 this.el.set_model ( child_1.el );
345 this.el.set_entry_text_column(1);
348 this.el.changed.connect( () => {
352 var project_id = this.selectedProjectId();
354 var rt = RooTicket.singleton();
355 rt.loadProjectOptions(project_id);
357 _this.msmodel.loadMilestones();
358 _this.primodel.loadPriorities();
359 _this.sevmodel.loadSeverities();
360 _this.clmodel.loadClassifications();
361 _this.devmodel.loadDevelopers();
363 // affects projects and milestones..
366 /*if (this.loading) {
369 var ticket_id = this.selectedTicketId();
371 var name = RooTicket.singleton().usernameLocal();
373 if (ticket_id == "" || ticket_id == null) {
375 var dt = new DateTime.now_local();
376 _this.name.el.set_text("wip_%s_%s".printf(name,dt.format("%Y_%b_%d")));
381 var ticket = RooTicket.singleton().getById(ticket_id);
383 _this.name.el.set_text("wip_%s_T%s_%s".printf(name,ticket.id, ticket.summaryToBranchName()));
385 //GLib.debug (//"Selection: %s, %s\n", (string) val1, (string) val2);
390 // user defined functions
391 public string selectedProjectId () {
396 this.el.get_active_iter (out iter);
397 _this.prmodel.el.get_value (iter, 0, out val1);
400 return (string) val1;
407 public class Xcls_prcellrenderer : Object
409 public Gtk.CellRendererText el;
410 private Ticket _this;
416 public Xcls_prcellrenderer(Ticket _owner )
419 _this.prcellrenderer = this;
420 this.el = new Gtk.CellRendererText();
424 // set gobject values
427 // user defined functions
430 public class Xcls_prmodel : Object
432 public Gtk.ListStore el;
433 private Ticket _this;
439 public Xcls_prmodel(Ticket _owner )
442 _this.prmodel = this;
443 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
447 // set gobject values
450 // user defined functions
451 public void loadProjects (string id) {
454 _this.project_id.loading = true;
463 el.set_value(iter, 0, "");
464 el.set_value(iter, 1, "-- select a project --");
466 _this.project_id.el.set_active_iter(iter);
469 foreach(var project in RooProject.projects()) {
473 el.set_value(iter, 0, project.id);
474 el.set_value(iter, 1, project.name );
475 if (id == project.id) {
476 _this.project_id.el.set_active_iter(iter);
481 _this.project_id.loading = false;
482 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
488 public class Xcls_summary : Object
491 private Ticket _this;
497 public Xcls_summary(Ticket _owner )
500 _this.summary = this;
501 this.el = new Gtk.Entry();
505 // set gobject values
506 this.el.visible = true;
509 // user defined functions
512 public class Xcls_Label10 : Object
515 private Ticket _this;
521 public Xcls_Label10(Ticket _owner )
524 this.el = new Gtk.Label( "Milestone" );
528 // set gobject values
529 this.el.halign = Gtk.Align.START;
530 this.el.justify = Gtk.Justification.RIGHT;
531 this.el.xalign = 0.900000f;
534 // user defined functions
537 public class Xcls_milestone_id : Object
539 public Gtk.ComboBox el;
540 private Ticket _this;
547 public Xcls_milestone_id(Ticket _owner )
550 _this.milestone_id = this;
551 this.el = new Gtk.ComboBox.with_entry();
554 this.loading = false;
556 // set gobject values
557 var child_0 = new Xcls_msmodel( _this );
559 this.el.set_model ( child_0.el );
563 this.el.set_entry_text_column(1);
566 // user defined functions
567 public string selectedMilestoneId () {
572 this.el.get_active_iter (out iter);
573 _this.msmodel.el.get_value (iter, 0, out val1);
576 return (string) val1;
583 public class Xcls_msmodel : Object
585 public Gtk.ListStore el;
586 private Ticket _this;
592 public Xcls_msmodel(Ticket _owner )
595 _this.msmodel = this;
596 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
600 // set gobject values
603 // user defined functions
604 public void loadMilestones ( ) {
606 var rt = RooTicket.singleton();
607 // rt.loadProjects();
609 _this.milestone_id.loading = true;
618 el.set_value(iter, 0, "");
619 el.set_value(iter, 1, "-- select a milestone --");
620 _this.milestone_id.el.set_active_iter(iter);
622 var projects = rt.milestones;
623 foreach(var project in projects) {
627 el.set_value(iter, 0, project.id);
628 el.set_value(iter, 1, project.display_name );
629 // if (id == project.id) {
630 // _this.milestone.el.set_active_iter(iter);
636 _this.milestone_id.loading = false;
637 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
643 public class Xcls_Label13 : Object
646 private Ticket _this;
652 public Xcls_Label13(Ticket _owner )
655 this.el = new Gtk.Label( "Description" );
659 // set gobject values
660 this.el.halign = Gtk.Align.START;
663 // user defined functions
666 public class Xcls_description : Object
668 public Gtk.TextView el;
669 private Ticket _this;
675 public Xcls_description(Ticket _owner )
678 _this.description = this;
679 this.el = new Gtk.TextView();
683 // set gobject values
684 this.el.border_width = 1;
687 // user defined functions
690 public class Xcls_Label15 : Object
693 private Ticket _this;
699 public Xcls_Label15(Ticket _owner )
702 this.el = new Gtk.Label( "Priority" );
706 // set gobject values
707 this.el.halign = Gtk.Align.START;
708 this.el.xalign = 0.900000f;
711 // user defined functions
714 public class Xcls_priority_id : Object
716 public Gtk.ComboBox el;
717 private Ticket _this;
724 public Xcls_priority_id(Ticket _owner )
727 _this.priority_id = this;
728 this.el = new Gtk.ComboBox.with_entry();
731 this.loading = false;
733 // set gobject values
734 var child_0 = new Xcls_primodel( _this );
736 this.el.set_model ( child_0.el );
740 this.el.set_entry_text_column(1);
743 // user defined functions
744 public string selectedPriorityId () {
749 this.el.get_active_iter (out iter);
750 _this.primodel.el.get_value (iter, 0, out val1);
753 return (string) val1;
760 public class Xcls_primodel : Object
762 public Gtk.ListStore el;
763 private Ticket _this;
769 public Xcls_primodel(Ticket _owner )
772 _this.primodel = this;
773 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
777 // set gobject values
780 // user defined functions
781 public void loadPriorities ( ) {
783 var rt = RooTicket.singleton();
784 // rt.loadProjects();
786 _this.priority_id.loading = true;
793 var projects = rt.priorities;
794 foreach(var project in projects) {
798 el.set_value(iter, 0, project.id);
799 el.set_value(iter, 1, project.display_name );
800 if ("normal" == project.name) {
801 _this.priority_id.el.set_active_iter(iter);
806 _this.priority_id.loading = false;
813 public class Xcls_Label18 : Object
816 private Ticket _this;
822 public Xcls_Label18(Ticket _owner )
825 this.el = new Gtk.Label( "Severity" );
829 // set gobject values
830 this.el.halign = Gtk.Align.START;
833 // user defined functions
836 public class Xcls_severity_id : Object
838 public Gtk.ComboBox el;
839 private Ticket _this;
846 public Xcls_severity_id(Ticket _owner )
849 _this.severity_id = this;
850 this.el = new Gtk.ComboBox.with_entry();
853 this.loading = false;
855 // set gobject values
856 var child_0 = new Xcls_sevmodel( _this );
858 this.el.set_model ( child_0.el );
862 this.el.set_entry_text_column(1);
865 // user defined functions
866 public string selectedSeverityId () {
871 this.el.get_active_iter (out iter);
872 _this.sevmodel.el.get_value (iter, 0, out val1);
875 return (string) val1;
882 public class Xcls_sevmodel : Object
884 public Gtk.ListStore el;
885 private Ticket _this;
891 public Xcls_sevmodel(Ticket _owner )
894 _this.sevmodel = this;
895 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
899 // set gobject values
902 // user defined functions
903 public void loadSeverities () {
905 var rt = RooTicket.singleton();
908 _this.severity_id.loading = true;
914 var projects = rt.serverities;
915 foreach(var project in projects) {
919 el.set_value(iter, 0, project.id);
920 el.set_value(iter, 1, project.display_name );
921 if ("normal" == project.name) {
922 _this.severity_id.el.set_active_iter(iter);
927 _this.severity_id.loading = false;
928 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
934 public class Xcls_Label21 : Object
937 private Ticket _this;
943 public Xcls_Label21(Ticket _owner )
946 this.el = new Gtk.Label( "Classification" );
950 // set gobject values
951 this.el.halign = Gtk.Align.START;
954 // user defined functions
957 public class Xcls_classification_id : Object
959 public Gtk.ComboBox el;
960 private Ticket _this;
967 public Xcls_classification_id(Ticket _owner )
970 _this.classification_id = this;
971 this.el = new Gtk.ComboBox.with_entry();
974 this.loading = false;
976 // set gobject values
977 var child_0 = new Xcls_clmodel( _this );
979 this.el.set_model ( child_0.el );
983 this.el.set_entry_text_column(1);
986 // user defined functions
987 public string selectedClassificationId () {
992 this.el.get_active_iter (out iter);
993 _this.clmodel.el.get_value (iter, 0, out val1);
996 return (string) val1;
1003 public class Xcls_clmodel : Object
1005 public Gtk.ListStore el;
1006 private Ticket _this;
1012 public Xcls_clmodel(Ticket _owner )
1015 _this.clmodel = this;
1016 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
1020 // set gobject values
1023 // user defined functions
1024 public void loadClassifications ( ) {
1026 var rt = RooTicket.singleton();
1027 // rt.loadProjects();
1029 _this.classification_id.loading = true;
1035 el.append(out iter);
1038 var projects = rt.classifications;
1039 foreach(var project in projects) {
1041 el.append(out iter);
1043 el.set_value(iter, 0, project.id);
1044 el.set_value(iter, 1, project.display_name );
1045 if ("bug" == project.name) {
1046 _this.classification_id.el.set_active_iter(iter);
1051 _this.classification_id.loading = false;
1052 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
1058 public class Xcls_Label24 : Object
1060 public Gtk.Label el;
1061 private Ticket _this;
1067 public Xcls_Label24(Ticket _owner )
1070 this.el = new Gtk.Label( "Assign to" );
1074 // set gobject values
1075 this.el.halign = Gtk.Align.START;
1078 // user defined functions
1081 public class Xcls_developer_id : Object
1083 public Gtk.ComboBox el;
1084 private Ticket _this;
1088 public bool loading;
1091 public Xcls_developer_id(Ticket _owner )
1094 _this.developer_id = this;
1095 this.el = new Gtk.ComboBox.with_entry();
1098 this.loading = false;
1100 // set gobject values
1101 var child_0 = new Xcls_devmodel( _this );
1103 this.el.set_model ( child_0.el );
1107 this.el.set_entry_text_column(1);
1110 // user defined functions
1111 public string selectedDeveloperId () {
1116 this.el.get_active_iter (out iter);
1117 _this.devmodel.el.get_value (iter, 0, out val1);
1120 return (string) val1;
1127 public class Xcls_devmodel : Object
1129 public Gtk.ListStore el;
1130 private Ticket _this;
1136 public Xcls_devmodel(Ticket _owner )
1139 _this.devmodel = this;
1140 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
1144 // set gobject values
1147 // user defined functions
1148 public void loadDevelopers ( ) {
1150 var rt = RooTicket.singleton();
1151 //rt.loadProjects();
1153 _this.developer_id.loading = true;
1159 el.append(out iter);
1162 el.set_value(iter, 0, "");
1163 el.set_value(iter, 1, "-- select a developer --");
1165 _this.developer_id.el.set_active_iter(iter);
1168 var peps = rt.developers;
1169 foreach(var p in peps) {
1171 el.append(out iter);
1173 el.set_value(iter, 0, p.id);
1174 el.set_value(iter, 1, p.display_name );
1175 if (rt.authuser_id == p.id) {
1176 _this.developer_id.el.set_active_iter(iter);
1180 _this.developer_id.loading = false;
1181 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
1187 public class Xcls_Button27 : Object
1189 public Gtk.Button el;
1190 private Ticket _this;
1196 public Xcls_Button27(Ticket _owner )
1199 this.el = new Gtk.Button();
1203 // set gobject values
1204 this.el.label = "Create Ticket";
1209 this.el.get_style_context().add_class("suggested-action");
1213 this.el.clicked.connect( () => {
1214 GLib.debug("fire response = 1");
1217 var invalid = false;
1219 // validate first...
1220 _this.project_id.el.get_child().get_style_context().remove_class("warning");
1221 if (_this.project_id.selectedProjectId() == "") {
1222 _this.project_id.el.get_child().get_style_context().add_class("warning");
1226 _this.milestone_id.el.get_child().get_style_context().remove_class("warning");
1228 _this.priority_id.el.get_child().get_style_context().remove_class("warning");
1229 if (_this.priority_id.selectedPriorityId() == "") {
1230 _this.priority_id.el.get_child().get_style_context().add_class("warning");
1234 _this.classification_id.el.get_child().get_style_context().remove_class("warning");
1235 if (_this.classification_id.selectedClassificationId() == "") {
1236 _this.classification_id.el.get_child().get_style_context().add_class("warning");
1240 _this.developer_id.el.get_child().get_style_context().remove_class("warning");
1241 if (_this.developer_id.selectedDeveloperId() == "") {
1242 _this.developer_id.el.get_child().get_style_context().add_class("warning");
1246 _this.summary.el.get_style_context().remove_class("warning");
1247 if (_this.summary.el.get_text() == "") {
1248 _this.summary.el.get_style_context().add_class("warning");
1252 _this.description.el.get_style_context().remove_class("warning");
1257 GLib.debug("for is valid");
1259 _this.el.response(1);
1263 // user defined functions
1267 public class Xcls_spinner : Object
1269 public Gtk.Spinner el;
1270 private Ticket _this;
1276 public Xcls_spinner(Ticket _owner )
1279 _this.spinner = this;
1280 this.el = new Gtk.Spinner();
1284 // set gobject values
1285 this.el.hexpand = true;
1286 this.el.vexpand = true;
1289 // user defined functions