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 = RooProject.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();
137 _this.summary.el.set_text("");
138 _this.description.el.buffer.text = "";
144 public class Xcls_VBox2 : Object
147 private Ticket _this;
153 public Xcls_VBox2(Ticket _owner )
156 this.el = new Gtk.VBox( true, 0 );
160 // set gobject values
161 var child_0 = new Xcls_Table3( _this );
163 this.el.pack_start ( child_0.el , false,false,0 );
166 // user defined functions
168 public class Xcls_Table3 : Object
171 private Ticket _this;
177 public Xcls_Table3(Ticket _owner )
180 this.el = new Gtk.Table( 14, 4, true );
184 // set gobject values
185 this.el.expand = false;
187 this.el.column_spacing = 4;
188 this.el.vexpand = false;
189 var child_0 = new Xcls_Label4( _this );
191 this.el.attach_defaults ( child_0.el , 0,1,0,1 );
192 var child_1 = new Xcls_Label5( _this );
194 this.el.attach_defaults ( child_1.el , 1,2,0,1 );
195 var child_2 = new Xcls_project_id( _this );
197 this.el.attach_defaults ( child_2.el , 0,1,1,2 );
198 var child_3 = new Xcls_summary( _this );
200 this.el.attach_defaults ( child_3.el , 1,4,1,2 );
201 var child_4 = new Xcls_Label10( _this );
203 this.el.attach_defaults ( child_4.el , 0,1,2,3 );
204 var child_5 = new Xcls_milestone_id( _this );
206 this.el.attach_defaults ( child_5.el , 0,1,3,4 );
207 var child_6 = new Xcls_Label13( _this );
209 this.el.attach_defaults ( child_6.el , 1,4,2,3 );
210 var child_7 = new Xcls_description( _this );
212 this.el.attach_defaults ( child_7.el , 1,4,3,12 );
213 var child_8 = new Xcls_Label15( _this );
215 this.el.attach_defaults ( child_8.el , 0,1,4,5 );
216 var child_9 = new Xcls_priority_id( _this );
218 this.el.attach_defaults ( child_9.el , 0,1,5,6 );
219 var child_10 = new Xcls_Label18( _this );
221 this.el.attach_defaults ( child_10.el , 0,1,6,7 );
222 var child_11 = new Xcls_severity_id( _this );
224 this.el.attach_defaults ( child_11.el , 0,1,7,8 );
225 var child_12 = new Xcls_Label21( _this );
227 this.el.attach_defaults ( child_12.el , 0,1,8,9 );
228 var child_13 = new Xcls_classification_id( _this );
230 this.el.attach_defaults ( child_13.el , 0,1,9,10 );
231 var child_14 = new Xcls_Label24( _this );
233 this.el.attach_defaults ( child_14.el , 0,1,10,11 );
234 var child_15 = new Xcls_developer_id( _this );
236 this.el.attach_defaults ( child_15.el , 0,1,11,12 );
237 var child_16 = new Xcls_Button27( _this );
239 this.el.attach_defaults ( child_16.el , 0,4,13,14 );
242 // user defined functions
244 public class Xcls_Label4 : Object
247 private Ticket _this;
253 public Xcls_Label4(Ticket _owner )
256 this.el = new Gtk.Label( "Project" );
260 // set gobject values
261 this.el.halign = Gtk.Align.START;
262 this.el.visible = true;
265 // user defined functions
268 public class Xcls_Label5 : Object
271 private Ticket _this;
277 public Xcls_Label5(Ticket _owner )
280 this.el = new Gtk.Label( "Summary" );
284 // set gobject values
285 this.el.halign = Gtk.Align.START;
286 this.el.visible = true;
289 // user defined functions
292 public class Xcls_project_id : Object
294 public Gtk.ComboBox el;
295 private Ticket _this;
302 public Xcls_project_id(Ticket _owner )
305 _this.project_id = this;
306 this.el = new Gtk.ComboBox.with_entry();
309 this.loading = false;
311 // set gobject values
312 var child_0 = new Xcls_prcellrenderer( _this );
314 this.el.pack_start ( child_0.el , true );
315 var child_1 = new Xcls_prmodel( _this );
317 this.el.set_model ( child_1.el );
321 this.el.set_entry_text_column(1);
324 this.el.changed.connect( () => {
328 var project_id = this.selectedProjectId();
330 var rt = RooTicket.singleton();
331 rt.loadProjectOptions(project_id);
333 _this.msmodel.loadMilestones();
334 _this.primodel.loadPriorities();
335 _this.sevmodel.loadSeverities();
336 _this.clmodel.loadClassifications();
337 _this.devmodel.loadDevelopers();
339 // affects projects and milestones..
342 /*if (this.loading) {
345 var ticket_id = this.selectedTicketId();
347 var name = RooTicket.singleton().usernameLocal();
349 if (ticket_id == "" || ticket_id == null) {
351 var dt = new DateTime.now_local();
352 _this.name.el.set_text("wip_%s_%s".printf(name,dt.format("%Y_%b_%d")));
357 var ticket = RooTicket.singleton().getById(ticket_id);
359 _this.name.el.set_text("wip_%s_T%s_%s".printf(name,ticket.id, ticket.summaryToBranchName()));
361 //GLib.debug (//"Selection: %s, %s\n", (string) val1, (string) val2);
366 // user defined functions
367 public string selectedProjectId () {
372 this.el.get_active_iter (out iter);
373 _this.prmodel.el.get_value (iter, 0, out val1);
376 return (string) val1;
383 public class Xcls_prcellrenderer : Object
385 public Gtk.CellRendererText el;
386 private Ticket _this;
392 public Xcls_prcellrenderer(Ticket _owner )
395 _this.prcellrenderer = this;
396 this.el = new Gtk.CellRendererText();
400 // set gobject values
403 // user defined functions
406 public class Xcls_prmodel : Object
408 public Gtk.ListStore el;
409 private Ticket _this;
415 public Xcls_prmodel(Ticket _owner )
418 _this.prmodel = this;
419 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
423 // set gobject values
426 // user defined functions
427 public void loadProjects (string id) {
430 _this.project_id.loading = true;
439 el.set_value(iter, 0, "");
440 el.set_value(iter, 1, "-- select a project --");
442 _this.project_id.el.set_active_iter(iter);
445 foreach(var project in RooProject.projects()) {
449 el.set_value(iter, 0, project.id);
450 el.set_value(iter, 1, project.name );
451 if (id == project.id) {
452 _this.project_id.el.set_active_iter(iter);
457 _this.project_id.loading = false;
458 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
464 public class Xcls_summary : Object
467 private Ticket _this;
473 public Xcls_summary(Ticket _owner )
476 _this.summary = this;
477 this.el = new Gtk.Entry();
481 // set gobject values
482 this.el.visible = true;
485 // user defined functions
488 public class Xcls_Label10 : Object
491 private Ticket _this;
497 public Xcls_Label10(Ticket _owner )
500 this.el = new Gtk.Label( "Milestone" );
504 // set gobject values
505 this.el.halign = Gtk.Align.START;
506 this.el.justify = Gtk.Justification.RIGHT;
507 this.el.xalign = 0.900000f;
510 // user defined functions
513 public class Xcls_milestone_id : Object
515 public Gtk.ComboBox el;
516 private Ticket _this;
523 public Xcls_milestone_id(Ticket _owner )
526 _this.milestone_id = this;
527 this.el = new Gtk.ComboBox.with_entry();
530 this.loading = false;
532 // set gobject values
533 var child_0 = new Xcls_msmodel( _this );
535 this.el.set_model ( child_0.el );
539 this.el.set_entry_text_column(1);
542 // user defined functions
543 public string selectedMilestoneId () {
548 this.el.get_active_iter (out iter);
549 _this.msmodel.el.get_value (iter, 0, out val1);
552 return (string) val1;
559 public class Xcls_msmodel : Object
561 public Gtk.ListStore el;
562 private Ticket _this;
568 public Xcls_msmodel(Ticket _owner )
571 _this.msmodel = this;
572 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
576 // set gobject values
579 // user defined functions
580 public void loadMilestones ( ) {
582 var rt = RooTicket.singleton();
583 // rt.loadProjects();
585 _this.milestone_id.loading = true;
594 el.set_value(iter, 0, "");
595 el.set_value(iter, 1, "-- select a milestone --");
596 _this.milestone_id.el.set_active_iter(iter);
598 var projects = rt.milestones;
599 foreach(var project in projects) {
603 el.set_value(iter, 0, project.id);
604 el.set_value(iter, 1, project.display_name );
605 // if (id == project.id) {
606 // _this.milestone.el.set_active_iter(iter);
612 _this.milestone_id.loading = false;
613 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
619 public class Xcls_Label13 : Object
622 private Ticket _this;
628 public Xcls_Label13(Ticket _owner )
631 this.el = new Gtk.Label( "Description" );
635 // set gobject values
636 this.el.halign = Gtk.Align.START;
639 // user defined functions
642 public class Xcls_description : Object
644 public Gtk.TextView el;
645 private Ticket _this;
651 public Xcls_description(Ticket _owner )
654 _this.description = this;
655 this.el = new Gtk.TextView();
659 // set gobject values
660 this.el.border_width = 1;
663 // user defined functions
666 public class Xcls_Label15 : Object
669 private Ticket _this;
675 public Xcls_Label15(Ticket _owner )
678 this.el = new Gtk.Label( "Priority" );
682 // set gobject values
683 this.el.halign = Gtk.Align.START;
684 this.el.xalign = 0.900000f;
687 // user defined functions
690 public class Xcls_priority_id : Object
692 public Gtk.ComboBox el;
693 private Ticket _this;
700 public Xcls_priority_id(Ticket _owner )
703 _this.priority_id = this;
704 this.el = new Gtk.ComboBox.with_entry();
707 this.loading = false;
709 // set gobject values
710 var child_0 = new Xcls_primodel( _this );
712 this.el.set_model ( child_0.el );
716 this.el.set_entry_text_column(1);
719 // user defined functions
720 public string selectedPriorityId () {
725 this.el.get_active_iter (out iter);
726 _this.primodel.el.get_value (iter, 0, out val1);
729 return (string) val1;
736 public class Xcls_primodel : Object
738 public Gtk.ListStore el;
739 private Ticket _this;
745 public Xcls_primodel(Ticket _owner )
748 _this.primodel = this;
749 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
753 // set gobject values
756 // user defined functions
757 public void loadPriorities ( ) {
759 var rt = RooTicket.singleton();
760 // rt.loadProjects();
762 _this.priority_id.loading = true;
769 var projects = rt.priorities;
770 foreach(var project in projects) {
774 el.set_value(iter, 0, project.id);
775 el.set_value(iter, 1, project.display_name );
776 if ("normal" == project.name) {
777 _this.priority_id.el.set_active_iter(iter);
782 _this.priority_id.loading = false;
789 public class Xcls_Label18 : Object
792 private Ticket _this;
798 public Xcls_Label18(Ticket _owner )
801 this.el = new Gtk.Label( "Severity" );
805 // set gobject values
806 this.el.halign = Gtk.Align.START;
809 // user defined functions
812 public class Xcls_severity_id : Object
814 public Gtk.ComboBox el;
815 private Ticket _this;
822 public Xcls_severity_id(Ticket _owner )
825 _this.severity_id = this;
826 this.el = new Gtk.ComboBox.with_entry();
829 this.loading = false;
831 // set gobject values
832 var child_0 = new Xcls_sevmodel( _this );
834 this.el.set_model ( child_0.el );
838 this.el.set_entry_text_column(1);
841 // user defined functions
842 public string selectedSeverityId () {
847 this.el.get_active_iter (out iter);
848 _this.sevmodel.el.get_value (iter, 0, out val1);
851 return (string) val1;
858 public class Xcls_sevmodel : Object
860 public Gtk.ListStore el;
861 private Ticket _this;
867 public Xcls_sevmodel(Ticket _owner )
870 _this.sevmodel = this;
871 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
875 // set gobject values
878 // user defined functions
879 public void loadSeverities () {
881 var rt = RooTicket.singleton();
884 _this.severity_id.loading = true;
890 var projects = rt.serverities;
891 foreach(var project in projects) {
895 el.set_value(iter, 0, project.id);
896 el.set_value(iter, 1, project.display_name );
897 if ("normal" == project.name) {
898 _this.severity_id.el.set_active_iter(iter);
903 _this.severity_id.loading = false;
904 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
910 public class Xcls_Label21 : Object
913 private Ticket _this;
919 public Xcls_Label21(Ticket _owner )
922 this.el = new Gtk.Label( "Classification" );
926 // set gobject values
927 this.el.halign = Gtk.Align.START;
930 // user defined functions
933 public class Xcls_classification_id : Object
935 public Gtk.ComboBox el;
936 private Ticket _this;
943 public Xcls_classification_id(Ticket _owner )
946 _this.classification_id = this;
947 this.el = new Gtk.ComboBox.with_entry();
950 this.loading = false;
952 // set gobject values
953 var child_0 = new Xcls_clmodel( _this );
955 this.el.set_model ( child_0.el );
959 this.el.set_entry_text_column(1);
962 // user defined functions
963 public string selectedClassificationId () {
968 this.el.get_active_iter (out iter);
969 _this.clmodel.el.get_value (iter, 0, out val1);
972 return (string) val1;
979 public class Xcls_clmodel : Object
981 public Gtk.ListStore el;
982 private Ticket _this;
988 public Xcls_clmodel(Ticket _owner )
991 _this.clmodel = this;
992 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
996 // set gobject values
999 // user defined functions
1000 public void loadClassifications ( ) {
1002 var rt = RooTicket.singleton();
1003 // rt.loadProjects();
1005 _this.classification_id.loading = true;
1011 el.append(out iter);
1014 var projects = rt.classifications;
1015 foreach(var project in projects) {
1017 el.append(out iter);
1019 el.set_value(iter, 0, project.id);
1020 el.set_value(iter, 1, project.display_name );
1021 if ("bug" == project.name) {
1022 _this.classification_id.el.set_active_iter(iter);
1027 _this.classification_id.loading = false;
1028 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
1034 public class Xcls_Label24 : Object
1036 public Gtk.Label el;
1037 private Ticket _this;
1043 public Xcls_Label24(Ticket _owner )
1046 this.el = new Gtk.Label( "Assign to" );
1050 // set gobject values
1051 this.el.halign = Gtk.Align.START;
1054 // user defined functions
1057 public class Xcls_developer_id : Object
1059 public Gtk.ComboBox el;
1060 private Ticket _this;
1064 public bool loading;
1067 public Xcls_developer_id(Ticket _owner )
1070 _this.developer_id = this;
1071 this.el = new Gtk.ComboBox.with_entry();
1074 this.loading = false;
1076 // set gobject values
1077 var child_0 = new Xcls_devmodel( _this );
1079 this.el.set_model ( child_0.el );
1083 this.el.set_entry_text_column(1);
1086 // user defined functions
1087 public string selectedDeveloperId () {
1092 this.el.get_active_iter (out iter);
1093 _this.devmodel.el.get_value (iter, 0, out val1);
1096 return (string) val1;
1103 public class Xcls_devmodel : Object
1105 public Gtk.ListStore el;
1106 private Ticket _this;
1112 public Xcls_devmodel(Ticket _owner )
1115 _this.devmodel = this;
1116 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
1120 // set gobject values
1123 // user defined functions
1124 public void loadDevelopers ( ) {
1126 var rt = RooTicket.singleton();
1127 //rt.loadProjects();
1129 _this.developer_id.loading = true;
1135 el.append(out iter);
1138 el.set_value(iter, 0, "");
1139 el.set_value(iter, 1, "-- select a developer --");
1141 _this.developer_id.el.set_active_iter(iter);
1144 var projects = rt.developers;
1145 foreach(var project in projects) {
1147 el.append(out iter);
1149 el.set_value(iter, 0, project.id);
1150 el.set_value(iter, 1, project.display_name );
1151 // if (id == project.id) {
1152 // _this.projectsel.el.set_active_iter(iter);
1157 _this.developer_id.loading = false;
1158 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
1164 public class Xcls_Button27 : Object
1166 public Gtk.Button el;
1167 private Ticket _this;
1173 public Xcls_Button27(Ticket _owner )
1176 this.el = new Gtk.Button();
1180 // set gobject values
1181 this.el.label = "Create Ticket";
1186 this.el.get_style_context().add_class("suggested-action");
1190 this.el.clicked.connect( () => {
1191 GLib.debug("fire response = 1");
1194 var invalid = false;
1196 // validate first...
1197 _this.project_id.el.get_child().get_style_context().remove_class("warning");
1198 if (_this.project_id.selectedProjectId() == "") {
1199 _this.project_id.el.get_child().get_style_context().add_class("warning");
1203 _this.milestone_id.el.get_child().get_style_context().remove_class("warning");
1204 if (_this.milestone_id.selectedMilestoneId() == "") {
1205 _this.milestone_id.el.get_child().get_style_context().add_class("warning");
1209 _this.priority_id.el.get_child().get_style_context().remove_class("warning");
1210 if (_this.priority_id.selectedPriorityId() == "") {
1211 _this.priority_id.el.get_child().get_style_context().add_class("warning");
1215 _this.classification_id.el.get_child().get_style_context().remove_class("warning");
1216 if (_this.classification_id.selectedClassificationId() == "") {
1217 _this.classification_id.el.get_child().get_style_context().add_class("warning");
1221 _this.developer_id.el.get_child().get_style_context().remove_class("warning");
1222 if (_this.developer_id.selectedDeveloperId() == "") {
1223 _this.developer_id.el.get_child().get_style_context().add_class("warning");
1227 _this.summary.el.get_style_context().remove_class("warning");
1228 if (_this.summary.el.get_text() == "") {
1229 _this.summary.el.get_style_context().add_class("warning");
1233 _this.description.el.get_style_context().remove_class("warning");
1234 if (_this.description.el.buffer.text == "") {
1235 _this.description.el.get_style_context().add_class("warning");
1243 GLib.debug("for is valid");
1245 _this.el.response(1);
1249 // user defined functions