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.selectProjectId(),
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
91 // user defined functions
92 public void show ( GitRepo? repo )
94 // this.el.set_gravity(Gdk.Gravity.NORTH);
95 if (this.running) { // should not happen!!
96 GLib.error("new branch show called, when already being displayed?");
101 //GitMonitor.gitmonitor.stop();
108 this.el.move((Gdk.Screen.width() / 2)- 250 ,0);
109 this.el.set_default_size( 500,200); // not sure why it grows..
110 GLib.debug("Loading tickets");
114 this.el.set_keep_above(true);
117 RooProject? curproj = null;
118 if (this.repo != null) {
119 curproj = RooTicket.singleton().getProjectByRepo(this.repo);
121 _this.prmodel.loadProjects(curproj == null ? "" : curproj.id);
127 public class Xcls_VBox2 : Object
130 private Ticket _this;
136 public Xcls_VBox2(Ticket _owner )
139 this.el = new Gtk.VBox( true, 0 );
143 // set gobject values
144 var child_0 = new Xcls_Table3( _this );
146 this.el.pack_start ( child_0.el , false,false,0 );
149 // user defined functions
151 public class Xcls_Table3 : Object
154 private Ticket _this;
160 public Xcls_Table3(Ticket _owner )
163 this.el = new Gtk.Table( 14, 4, true );
167 // set gobject values
168 this.el.expand = false;
170 this.el.column_spacing = 4;
171 this.el.vexpand = false;
172 var child_0 = new Xcls_Label4( _this );
174 this.el.attach_defaults ( child_0.el , 0,1,0,1 );
175 var child_1 = new Xcls_Label5( _this );
177 this.el.attach_defaults ( child_1.el , 1,2,0,1 );
178 var child_2 = new Xcls_project_id( _this );
180 this.el.attach_defaults ( child_2.el , 0,1,1,2 );
181 var child_3 = new Xcls_summary( _this );
183 this.el.attach_defaults ( child_3.el , 1,4,1,2 );
184 var child_4 = new Xcls_Label10( _this );
186 this.el.attach_defaults ( child_4.el , 0,1,2,3 );
187 var child_5 = new Xcls_milestone_id( _this );
189 this.el.attach_defaults ( child_5.el , 0,1,3,4 );
190 var child_6 = new Xcls_Label13( _this );
192 this.el.attach_defaults ( child_6.el , 1,4,2,3 );
193 var child_7 = new Xcls_description( _this );
195 this.el.attach_defaults ( child_7.el , 1,4,3,12 );
196 var child_8 = new Xcls_Label15( _this );
198 this.el.attach_defaults ( child_8.el , 0,1,4,5 );
199 var child_9 = new Xcls_priority_id( _this );
201 this.el.attach_defaults ( child_9.el , 0,1,5,6 );
202 var child_10 = new Xcls_Label18( _this );
204 this.el.attach_defaults ( child_10.el , 0,1,6,7 );
205 var child_11 = new Xcls_severity_id( _this );
207 this.el.attach_defaults ( child_11.el , 0,1,7,8 );
208 var child_12 = new Xcls_Label21( _this );
210 this.el.attach_defaults ( child_12.el , 0,1,8,9 );
211 var child_13 = new Xcls_classification_id( _this );
213 this.el.attach_defaults ( child_13.el , 0,1,9,10 );
214 var child_14 = new Xcls_Label24( _this );
216 this.el.attach_defaults ( child_14.el , 0,1,10,11 );
217 var child_15 = new Xcls_developer_id( _this );
219 this.el.attach_defaults ( child_15.el , 0,1,11,12 );
220 var child_16 = new Xcls_Button27( _this );
222 this.el.attach_defaults ( child_16.el , 0,4,13,14 );
225 // user defined functions
227 public class Xcls_Label4 : Object
230 private Ticket _this;
236 public Xcls_Label4(Ticket _owner )
239 this.el = new Gtk.Label( "Project" );
243 // set gobject values
244 this.el.halign = Gtk.Align.START;
245 this.el.visible = true;
248 // user defined functions
251 public class Xcls_Label5 : Object
254 private Ticket _this;
260 public Xcls_Label5(Ticket _owner )
263 this.el = new Gtk.Label( "Summary" );
267 // set gobject values
268 this.el.halign = Gtk.Align.START;
269 this.el.visible = true;
272 // user defined functions
275 public class Xcls_project_id : Object
277 public Gtk.ComboBox el;
278 private Ticket _this;
285 public Xcls_project_id(Ticket _owner )
288 _this.project_id = this;
289 this.el = new Gtk.ComboBox.with_entry();
292 this.loading = false;
294 // set gobject values
295 var child_0 = new Xcls_prcellrenderer( _this );
297 this.el.pack_start ( child_0.el , true );
298 var child_1 = new Xcls_prmodel( _this );
300 this.el.set_model ( child_1.el );
304 this.el.set_entry_text_column(1);
307 this.el.changed.connect( () => {
311 var project_id = this.selectedProjectId();
313 var rt = RooTicket.singleton();
314 rt.loadProjectOptions(project_id);
316 _this.msmodel.loadMilestones();
317 _this.primodel.loadPriorities();
318 _this.sevmodel.loadSeverities();
319 _this.clmodel.loadClassifications();
320 _this.devmodel.loadDevelopers();
322 // affects projects and milestones..
325 /*if (this.loading) {
328 var ticket_id = this.selectedTicketId();
330 var name = RooTicket.singleton().usernameLocal();
332 if (ticket_id == "" || ticket_id == null) {
334 var dt = new DateTime.now_local();
335 _this.name.el.set_text("wip_%s_%s".printf(name,dt.format("%Y_%b_%d")));
340 var ticket = RooTicket.singleton().getById(ticket_id);
342 _this.name.el.set_text("wip_%s_T%s_%s".printf(name,ticket.id, ticket.summaryToBranchName()));
344 //GLib.debug (//"Selection: %s, %s\n", (string) val1, (string) val2);
349 // user defined functions
350 public string selectedProjectId () {
355 this.el.get_active_iter (out iter);
356 _this.prmodel.el.get_value (iter, 0, out val1);
359 return (string) val1;
366 public class Xcls_prcellrenderer : Object
368 public Gtk.CellRendererText el;
369 private Ticket _this;
375 public Xcls_prcellrenderer(Ticket _owner )
378 _this.prcellrenderer = this;
379 this.el = new Gtk.CellRendererText();
383 // set gobject values
386 // user defined functions
389 public class Xcls_prmodel : Object
391 public Gtk.ListStore el;
392 private Ticket _this;
398 public Xcls_prmodel(Ticket _owner )
401 _this.prmodel = this;
402 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
406 // set gobject values
409 // user defined functions
410 public void loadProjects (string id) {
412 var rt = RooTicket.singleton();
415 _this.project_id.loading = true;
424 el.set_value(iter, 0, "");
425 el.set_value(iter, 1, "-- select a project --");
427 _this.project_id.el.set_active_iter(iter);
429 var projects = rt.projects;
430 foreach(var project in projects) {
434 el.set_value(iter, 0, project.id);
435 el.set_value(iter, 1, project.name );
436 if (id == project.id) {
437 _this.project_id.el.set_active_iter(iter);
442 _this.project_id.loading = false;
443 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
449 public class Xcls_summary : Object
452 private Ticket _this;
458 public Xcls_summary(Ticket _owner )
461 _this.summary = this;
462 this.el = new Gtk.Entry();
466 // set gobject values
467 this.el.visible = true;
470 // user defined functions
473 public class Xcls_Label10 : Object
476 private Ticket _this;
482 public Xcls_Label10(Ticket _owner )
485 this.el = new Gtk.Label( "Milestone" );
489 // set gobject values
490 this.el.halign = Gtk.Align.START;
491 this.el.justify = Gtk.Justification.RIGHT;
492 this.el.xalign = 0.900000f;
495 // user defined functions
498 public class Xcls_milestone_id : Object
500 public Gtk.ComboBox el;
501 private Ticket _this;
508 public Xcls_milestone_id(Ticket _owner )
511 _this.milestone_id = this;
512 this.el = new Gtk.ComboBox.with_entry();
515 this.loading = false;
517 // set gobject values
518 var child_0 = new Xcls_msmodel( _this );
520 this.el.set_model ( child_0.el );
524 this.el.set_entry_text_column(1);
527 // user defined functions
528 public string selectedMilestoneId () {
533 this.el.get_active_iter (out iter);
534 _this.msmodel.el.get_value (iter, 0, out val1);
537 return (string) val1;
544 public class Xcls_msmodel : Object
546 public Gtk.ListStore el;
547 private Ticket _this;
553 public Xcls_msmodel(Ticket _owner )
556 _this.msmodel = this;
557 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
561 // set gobject values
564 // user defined functions
565 public void loadMilestones ( ) {
567 var rt = RooTicket.singleton();
568 // rt.loadProjects();
570 _this.milestone_id.loading = true;
579 el.set_value(iter, 0, "");
580 el.set_value(iter, 1, "-- select a milestone --");
581 _this.milestone_id.el.set_active_iter(iter);
583 var projects = rt.milestones;
584 foreach(var project in projects) {
588 el.set_value(iter, 0, project.id);
589 el.set_value(iter, 1, project.display_name );
590 // if (id == project.id) {
591 // _this.milestone.el.set_active_iter(iter);
597 _this.milestone_id.loading = false;
598 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
604 public class Xcls_Label13 : Object
607 private Ticket _this;
613 public Xcls_Label13(Ticket _owner )
616 this.el = new Gtk.Label( "Description" );
620 // set gobject values
621 this.el.halign = Gtk.Align.START;
624 // user defined functions
627 public class Xcls_description : Object
629 public Gtk.TextView el;
630 private Ticket _this;
636 public Xcls_description(Ticket _owner )
639 _this.description = this;
640 this.el = new Gtk.TextView();
644 // set gobject values
645 this.el.border_width = 1;
648 // user defined functions
651 public class Xcls_Label15 : Object
654 private Ticket _this;
660 public Xcls_Label15(Ticket _owner )
663 this.el = new Gtk.Label( "Priority" );
667 // set gobject values
668 this.el.halign = Gtk.Align.START;
669 this.el.xalign = 0.900000f;
672 // user defined functions
675 public class Xcls_priority_id : Object
677 public Gtk.ComboBox el;
678 private Ticket _this;
685 public Xcls_priority_id(Ticket _owner )
688 _this.priority_id = this;
689 this.el = new Gtk.ComboBox.with_entry();
692 this.loading = false;
694 // set gobject values
695 var child_0 = new Xcls_primodel( _this );
697 this.el.set_model ( child_0.el );
701 this.el.set_entry_text_column(1);
704 // user defined functions
705 public string selectedPriorityId () {
710 this.el.get_active_iter (out iter);
711 _this.primodel.el.get_value (iter, 0, out val1);
714 return (string) val1;
721 public class Xcls_primodel : Object
723 public Gtk.ListStore el;
724 private Ticket _this;
730 public Xcls_primodel(Ticket _owner )
733 _this.primodel = this;
734 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
738 // set gobject values
741 // user defined functions
742 public void loadPriorities ( ) {
744 var rt = RooTicket.singleton();
745 // rt.loadProjects();
747 _this.priority_id.loading = true;
754 var projects = rt.priorities;
755 foreach(var project in projects) {
759 el.set_value(iter, 0, project.id);
760 el.set_value(iter, 1, project.display_name );
761 if ("normal" == project.name) {
762 _this.priority_id.el.set_active_iter(iter);
767 _this.priority_id.loading = false;
774 public class Xcls_Label18 : Object
777 private Ticket _this;
783 public Xcls_Label18(Ticket _owner )
786 this.el = new Gtk.Label( "Severity" );
790 // set gobject values
791 this.el.halign = Gtk.Align.START;
794 // user defined functions
797 public class Xcls_severity_id : Object
799 public Gtk.ComboBox el;
800 private Ticket _this;
807 public Xcls_severity_id(Ticket _owner )
810 _this.severity_id = this;
811 this.el = new Gtk.ComboBox.with_entry();
814 this.loading = false;
816 // set gobject values
817 var child_0 = new Xcls_sevmodel( _this );
819 this.el.set_model ( child_0.el );
823 this.el.set_entry_text_column(1);
826 // user defined functions
827 public string selectedSeverityId () {
832 this.el.get_active_iter (out iter);
833 _this.sevmodel.el.get_value (iter, 0, out val1);
836 return (string) val1;
843 public class Xcls_sevmodel : Object
845 public Gtk.ListStore el;
846 private Ticket _this;
852 public Xcls_sevmodel(Ticket _owner )
855 _this.sevmodel = this;
856 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
860 // set gobject values
863 // user defined functions
864 public void loadSeverities () {
866 var rt = RooTicket.singleton();
869 _this.severity_id.loading = true;
875 var projects = rt.serverities;
876 foreach(var project in projects) {
880 el.set_value(iter, 0, project.id);
881 el.set_value(iter, 1, project.display_name );
882 if ("normal" == project.name) {
883 _this.severity_id.el.set_active_iter(iter);
888 _this.severity_id.loading = false;
889 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
895 public class Xcls_Label21 : Object
898 private Ticket _this;
904 public Xcls_Label21(Ticket _owner )
907 this.el = new Gtk.Label( "Classification" );
911 // set gobject values
912 this.el.halign = Gtk.Align.START;
915 // user defined functions
918 public class Xcls_classification_id : Object
920 public Gtk.ComboBox el;
921 private Ticket _this;
928 public Xcls_classification_id(Ticket _owner )
931 _this.classification_id = this;
932 this.el = new Gtk.ComboBox.with_entry();
935 this.loading = false;
937 // set gobject values
938 var child_0 = new Xcls_clmodel( _this );
940 this.el.set_model ( child_0.el );
944 this.el.set_entry_text_column(1);
947 // user defined functions
948 public string selectedClassificationId () {
953 this.el.get_active_iter (out iter);
954 _this.clmodel.el.get_value (iter, 0, out val1);
957 return (string) val1;
964 public class Xcls_clmodel : Object
966 public Gtk.ListStore el;
967 private Ticket _this;
973 public Xcls_clmodel(Ticket _owner )
976 _this.clmodel = this;
977 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
981 // set gobject values
984 // user defined functions
985 public void loadClassifications ( ) {
987 var rt = RooTicket.singleton();
988 // rt.loadProjects();
990 _this.classification_id.loading = true;
999 var projects = rt.classifications;
1000 foreach(var project in projects) {
1002 el.append(out iter);
1004 el.set_value(iter, 0, project.id);
1005 el.set_value(iter, 1, project.display_name );
1006 if ("bug" == project.name) {
1007 _this.classification_id.el.set_active_iter(iter);
1012 _this.classification_id.loading = false;
1013 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
1019 public class Xcls_Label24 : Object
1021 public Gtk.Label el;
1022 private Ticket _this;
1028 public Xcls_Label24(Ticket _owner )
1031 this.el = new Gtk.Label( "Assign to" );
1035 // set gobject values
1036 this.el.halign = Gtk.Align.START;
1039 // user defined functions
1042 public class Xcls_developer_id : Object
1044 public Gtk.ComboBox el;
1045 private Ticket _this;
1049 public bool loading;
1052 public Xcls_developer_id(Ticket _owner )
1055 _this.developer_id = this;
1056 this.el = new Gtk.ComboBox.with_entry();
1059 this.loading = false;
1061 // set gobject values
1062 var child_0 = new Xcls_devmodel( _this );
1064 this.el.set_model ( child_0.el );
1068 this.el.set_entry_text_column(1);
1071 // user defined functions
1072 public string selectedDeveloperId () {
1077 this.el.get_active_iter (out iter);
1078 _this.devmodel.el.get_value (iter, 0, out val1);
1081 return (string) val1;
1088 public class Xcls_devmodel : Object
1090 public Gtk.ListStore el;
1091 private Ticket _this;
1097 public Xcls_devmodel(Ticket _owner )
1100 _this.devmodel = this;
1101 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
1105 // set gobject values
1108 // user defined functions
1109 public void loadDevelopers ( ) {
1111 var rt = RooTicket.singleton();
1112 //rt.loadProjects();
1114 _this.developer_id.loading = true;
1120 el.append(out iter);
1123 el.set_value(iter, 0, "");
1124 el.set_value(iter, 1, "-- select a developer --");
1126 _this.developer_id.el.set_active_iter(iter);
1129 var projects = rt.developers;
1130 foreach(var project in projects) {
1132 el.append(out iter);
1134 el.set_value(iter, 0, project.id);
1135 el.set_value(iter, 1, project.display_name );
1136 // if (id == project.id) {
1137 // _this.projectsel.el.set_active_iter(iter);
1142 _this.developer_id.loading = false;
1143 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
1149 public class Xcls_Button27 : Object
1151 public Gtk.Button el;
1152 private Ticket _this;
1158 public Xcls_Button27(Ticket _owner )
1161 this.el = new Gtk.Button();
1165 // set gobject values
1166 this.el.label = "Create Ticket";
1171 this.el.get_style_context().add_class("suggested-action");
1175 this.el.clicked.connect( () => {
1176 GLib.debug("fire response = 1");
1179 var invalid = false;
1181 // validate first...
1182 _this.project_id.el.get_child().get_style_context().remove_class("warning");
1183 if (_this.project_id.selectedProjectId() == "") {
1184 _this.project_id.el.get_child().get_style_context().add_class("warning");
1188 _this.milestone_id.el.get_child().get_style_context().remove_class("warning");
1189 if (_this.milestone_id.selectedMilestoneId() == "") {
1190 _this.milestone_id.el.get_child().get_style_context().add_class("warning");
1194 _this.priority_id.el.get_child().get_style_context().remove_class("warning");
1195 if (_this.priority_id.selectedPriorityId() == "") {
1196 _this.priority_id.el.get_child().get_style_context().add_class("warning");
1200 _this.classification_id.el.get_child().get_style_context().remove_class("warning");
1201 if (_this.classification_id.selectedClassificationId() == "") {
1202 _this.classification_id.el.get_child().get_style_context().add_class("warning");
1206 _this.developer_id.el.get_child().get_style_context().remove_class("warning");
1207 if (_this.developer_id.selectedDeveloperId() == "") {
1208 _this.developer_id.el.get_child().get_style_context().add_class("warning");
1212 _this.summary.el.get_style_context().remove_class("warning");
1213 if (_this.summary.el.get_text() == "") {
1214 _this.summary.el.get_style_context().add_class("warning");
1218 _this.description.el.get_style_context().remove_class("warning");
1219 if (_this.description.el.buffer.text == "") {
1220 _this.description.el.get_style_context().add_class("warning");
1228 GLib.debug("for is valid");
1230 _this.el.response(1);
1234 // user defined functions