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 = RooTicket.singleton().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) {
429 var rt = RooTicket.singleton();
432 _this.project_id.loading = true;
441 el.set_value(iter, 0, "");
442 el.set_value(iter, 1, "-- select a project --");
444 _this.project_id.el.set_active_iter(iter);
446 var projects = rt.projects;
447 foreach(var project in projects) {
451 el.set_value(iter, 0, project.id);
452 el.set_value(iter, 1, project.name );
453 if (id == project.id) {
454 _this.project_id.el.set_active_iter(iter);
459 _this.project_id.loading = false;
460 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
466 public class Xcls_summary : Object
469 private Ticket _this;
475 public Xcls_summary(Ticket _owner )
478 _this.summary = this;
479 this.el = new Gtk.Entry();
483 // set gobject values
484 this.el.visible = true;
487 // user defined functions
490 public class Xcls_Label10 : Object
493 private Ticket _this;
499 public Xcls_Label10(Ticket _owner )
502 this.el = new Gtk.Label( "Milestone" );
506 // set gobject values
507 this.el.halign = Gtk.Align.START;
508 this.el.justify = Gtk.Justification.RIGHT;
509 this.el.xalign = 0.900000f;
512 // user defined functions
515 public class Xcls_milestone_id : Object
517 public Gtk.ComboBox el;
518 private Ticket _this;
525 public Xcls_milestone_id(Ticket _owner )
528 _this.milestone_id = this;
529 this.el = new Gtk.ComboBox.with_entry();
532 this.loading = false;
534 // set gobject values
535 var child_0 = new Xcls_msmodel( _this );
537 this.el.set_model ( child_0.el );
541 this.el.set_entry_text_column(1);
544 // user defined functions
545 public string selectedMilestoneId () {
550 this.el.get_active_iter (out iter);
551 _this.msmodel.el.get_value (iter, 0, out val1);
554 return (string) val1;
561 public class Xcls_msmodel : Object
563 public Gtk.ListStore el;
564 private Ticket _this;
570 public Xcls_msmodel(Ticket _owner )
573 _this.msmodel = this;
574 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
578 // set gobject values
581 // user defined functions
582 public void loadMilestones ( ) {
584 var rt = RooTicket.singleton();
585 // rt.loadProjects();
587 _this.milestone_id.loading = true;
596 el.set_value(iter, 0, "");
597 el.set_value(iter, 1, "-- select a milestone --");
598 _this.milestone_id.el.set_active_iter(iter);
600 var projects = rt.milestones;
601 foreach(var project in projects) {
605 el.set_value(iter, 0, project.id);
606 el.set_value(iter, 1, project.display_name );
607 // if (id == project.id) {
608 // _this.milestone.el.set_active_iter(iter);
614 _this.milestone_id.loading = false;
615 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
621 public class Xcls_Label13 : Object
624 private Ticket _this;
630 public Xcls_Label13(Ticket _owner )
633 this.el = new Gtk.Label( "Description" );
637 // set gobject values
638 this.el.halign = Gtk.Align.START;
641 // user defined functions
644 public class Xcls_description : Object
646 public Gtk.TextView el;
647 private Ticket _this;
653 public Xcls_description(Ticket _owner )
656 _this.description = this;
657 this.el = new Gtk.TextView();
661 // set gobject values
662 this.el.border_width = 1;
665 // user defined functions
668 public class Xcls_Label15 : Object
671 private Ticket _this;
677 public Xcls_Label15(Ticket _owner )
680 this.el = new Gtk.Label( "Priority" );
684 // set gobject values
685 this.el.halign = Gtk.Align.START;
686 this.el.xalign = 0.900000f;
689 // user defined functions
692 public class Xcls_priority_id : Object
694 public Gtk.ComboBox el;
695 private Ticket _this;
702 public Xcls_priority_id(Ticket _owner )
705 _this.priority_id = this;
706 this.el = new Gtk.ComboBox.with_entry();
709 this.loading = false;
711 // set gobject values
712 var child_0 = new Xcls_primodel( _this );
714 this.el.set_model ( child_0.el );
718 this.el.set_entry_text_column(1);
721 // user defined functions
722 public string selectedPriorityId () {
727 this.el.get_active_iter (out iter);
728 _this.primodel.el.get_value (iter, 0, out val1);
731 return (string) val1;
738 public class Xcls_primodel : Object
740 public Gtk.ListStore el;
741 private Ticket _this;
747 public Xcls_primodel(Ticket _owner )
750 _this.primodel = this;
751 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
755 // set gobject values
758 // user defined functions
759 public void loadPriorities ( ) {
761 var rt = RooTicket.singleton();
762 // rt.loadProjects();
764 _this.priority_id.loading = true;
771 var projects = rt.priorities;
772 foreach(var project in projects) {
776 el.set_value(iter, 0, project.id);
777 el.set_value(iter, 1, project.display_name );
778 if ("normal" == project.name) {
779 _this.priority_id.el.set_active_iter(iter);
784 _this.priority_id.loading = false;
791 public class Xcls_Label18 : Object
794 private Ticket _this;
800 public Xcls_Label18(Ticket _owner )
803 this.el = new Gtk.Label( "Severity" );
807 // set gobject values
808 this.el.halign = Gtk.Align.START;
811 // user defined functions
814 public class Xcls_severity_id : Object
816 public Gtk.ComboBox el;
817 private Ticket _this;
824 public Xcls_severity_id(Ticket _owner )
827 _this.severity_id = this;
828 this.el = new Gtk.ComboBox.with_entry();
831 this.loading = false;
833 // set gobject values
834 var child_0 = new Xcls_sevmodel( _this );
836 this.el.set_model ( child_0.el );
840 this.el.set_entry_text_column(1);
843 // user defined functions
844 public string selectedSeverityId () {
849 this.el.get_active_iter (out iter);
850 _this.sevmodel.el.get_value (iter, 0, out val1);
853 return (string) val1;
860 public class Xcls_sevmodel : Object
862 public Gtk.ListStore el;
863 private Ticket _this;
869 public Xcls_sevmodel(Ticket _owner )
872 _this.sevmodel = this;
873 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
877 // set gobject values
880 // user defined functions
881 public void loadSeverities () {
883 var rt = RooTicket.singleton();
886 _this.severity_id.loading = true;
892 var projects = rt.serverities;
893 foreach(var project in projects) {
897 el.set_value(iter, 0, project.id);
898 el.set_value(iter, 1, project.display_name );
899 if ("normal" == project.name) {
900 _this.severity_id.el.set_active_iter(iter);
905 _this.severity_id.loading = false;
906 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
912 public class Xcls_Label21 : Object
915 private Ticket _this;
921 public Xcls_Label21(Ticket _owner )
924 this.el = new Gtk.Label( "Classification" );
928 // set gobject values
929 this.el.halign = Gtk.Align.START;
932 // user defined functions
935 public class Xcls_classification_id : Object
937 public Gtk.ComboBox el;
938 private Ticket _this;
945 public Xcls_classification_id(Ticket _owner )
948 _this.classification_id = this;
949 this.el = new Gtk.ComboBox.with_entry();
952 this.loading = false;
954 // set gobject values
955 var child_0 = new Xcls_clmodel( _this );
957 this.el.set_model ( child_0.el );
961 this.el.set_entry_text_column(1);
964 // user defined functions
965 public string selectedClassificationId () {
970 this.el.get_active_iter (out iter);
971 _this.clmodel.el.get_value (iter, 0, out val1);
974 return (string) val1;
981 public class Xcls_clmodel : Object
983 public Gtk.ListStore el;
984 private Ticket _this;
990 public Xcls_clmodel(Ticket _owner )
993 _this.clmodel = this;
994 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
998 // set gobject values
1001 // user defined functions
1002 public void loadClassifications ( ) {
1004 var rt = RooTicket.singleton();
1005 // rt.loadProjects();
1007 _this.classification_id.loading = true;
1013 el.append(out iter);
1016 var projects = rt.classifications;
1017 foreach(var project in projects) {
1019 el.append(out iter);
1021 el.set_value(iter, 0, project.id);
1022 el.set_value(iter, 1, project.display_name );
1023 if ("bug" == project.name) {
1024 _this.classification_id.el.set_active_iter(iter);
1029 _this.classification_id.loading = false;
1030 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
1036 public class Xcls_Label24 : Object
1038 public Gtk.Label el;
1039 private Ticket _this;
1045 public Xcls_Label24(Ticket _owner )
1048 this.el = new Gtk.Label( "Assign to" );
1052 // set gobject values
1053 this.el.halign = Gtk.Align.START;
1056 // user defined functions
1059 public class Xcls_developer_id : Object
1061 public Gtk.ComboBox el;
1062 private Ticket _this;
1066 public bool loading;
1069 public Xcls_developer_id(Ticket _owner )
1072 _this.developer_id = this;
1073 this.el = new Gtk.ComboBox.with_entry();
1076 this.loading = false;
1078 // set gobject values
1079 var child_0 = new Xcls_devmodel( _this );
1081 this.el.set_model ( child_0.el );
1085 this.el.set_entry_text_column(1);
1088 // user defined functions
1089 public string selectedDeveloperId () {
1094 this.el.get_active_iter (out iter);
1095 _this.devmodel.el.get_value (iter, 0, out val1);
1098 return (string) val1;
1105 public class Xcls_devmodel : Object
1107 public Gtk.ListStore el;
1108 private Ticket _this;
1114 public Xcls_devmodel(Ticket _owner )
1117 _this.devmodel = this;
1118 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
1122 // set gobject values
1125 // user defined functions
1126 public void loadDevelopers ( ) {
1128 var rt = RooTicket.singleton();
1129 //rt.loadProjects();
1131 _this.developer_id.loading = true;
1137 el.append(out iter);
1140 el.set_value(iter, 0, "");
1141 el.set_value(iter, 1, "-- select a developer --");
1143 _this.developer_id.el.set_active_iter(iter);
1146 var projects = rt.developers;
1147 foreach(var project in projects) {
1149 el.append(out iter);
1151 el.set_value(iter, 0, project.id);
1152 el.set_value(iter, 1, project.display_name );
1153 // if (id == project.id) {
1154 // _this.projectsel.el.set_active_iter(iter);
1159 _this.developer_id.loading = false;
1160 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
1166 public class Xcls_Button27 : Object
1168 public Gtk.Button el;
1169 private Ticket _this;
1175 public Xcls_Button27(Ticket _owner )
1178 this.el = new Gtk.Button();
1182 // set gobject values
1183 this.el.label = "Create Ticket";
1188 this.el.get_style_context().add_class("suggested-action");
1192 this.el.clicked.connect( () => {
1193 GLib.debug("fire response = 1");
1196 var invalid = false;
1198 // validate first...
1199 _this.project_id.el.get_child().get_style_context().remove_class("warning");
1200 if (_this.project_id.selectedProjectId() == "") {
1201 _this.project_id.el.get_child().get_style_context().add_class("warning");
1205 _this.milestone_id.el.get_child().get_style_context().remove_class("warning");
1206 if (_this.milestone_id.selectedMilestoneId() == "") {
1207 _this.milestone_id.el.get_child().get_style_context().add_class("warning");
1211 _this.priority_id.el.get_child().get_style_context().remove_class("warning");
1212 if (_this.priority_id.selectedPriorityId() == "") {
1213 _this.priority_id.el.get_child().get_style_context().add_class("warning");
1217 _this.classification_id.el.get_child().get_style_context().remove_class("warning");
1218 if (_this.classification_id.selectedClassificationId() == "") {
1219 _this.classification_id.el.get_child().get_style_context().add_class("warning");
1223 _this.developer_id.el.get_child().get_style_context().remove_class("warning");
1224 if (_this.developer_id.selectedDeveloperId() == "") {
1225 _this.developer_id.el.get_child().get_style_context().add_class("warning");
1229 _this.summary.el.get_style_context().remove_class("warning");
1230 if (_this.summary.el.get_text() == "") {
1231 _this.summary.el.get_style_context().add_class("warning");
1235 _this.description.el.get_style_context().remove_class("warning");
1236 if (_this.description.el.buffer.text == "") {
1237 _this.description.el.get_style_context().add_class("warning");
1245 GLib.debug("for is valid");
1247 _this.el.response(1);
1251 // user defined functions