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, () => {
119 //GitMonitor.gitmonitor.stop();
124 RooProject? curproj = null;
125 if (this.repo != null) {
126 curproj = RooProject.getProjectByRepo(this.repo);
128 _this.prmodel.loadProjects(curproj == null ? "" : curproj.id);
129 if (curproj != null) {
132 var rt = RooTicket.singleton();
133 rt.loadProjectOptions(curproj.id);
135 _this.msmodel.loadMilestones();
136 _this.primodel.loadPriorities();
137 _this.sevmodel.loadSeverities();
138 _this.clmodel.loadClassifications();
139 _this.devmodel.loadDevelopers();
142 _this.summary.el.set_text("");
143 _this.description.el.buffer.text = "";
144 _this.spinner.el.stop();
145 _this.spinner.el.hide();
147 this.table.el.show();
148 _this.summary.el.grab_focus();
156 public class Xcls_Box2 : Object
159 private Ticket _this;
165 public Xcls_Box2(Ticket _owner )
168 this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
172 // set gobject values
173 var child_0 = new Xcls_table( _this );
175 this.el.pack_start ( child_0.el , false,false,0 );
176 var child_1 = new Xcls_spinner( _this );
178 this.el.add ( child_1.el );
181 // user defined functions
183 public class Xcls_table : Object
186 private Ticket _this;
192 public Xcls_table(Ticket _owner )
196 this.el = new Gtk.Table( 14, 4, true );
200 // set gobject values
201 this.el.expand = false;
203 this.el.column_spacing = 4;
204 this.el.vexpand = false;
205 var child_0 = new Xcls_Label4( _this );
207 this.el.attach_defaults ( child_0.el , 0,1,0,1 );
208 var child_1 = new Xcls_Label5( _this );
210 this.el.attach_defaults ( child_1.el , 1,2,0,1 );
211 var child_2 = new Xcls_project_id( _this );
213 this.el.attach_defaults ( child_2.el , 0,1,1,2 );
214 var child_3 = new Xcls_summary( _this );
216 this.el.attach_defaults ( child_3.el , 1,4,1,2 );
217 var child_4 = new Xcls_Label10( _this );
219 this.el.attach_defaults ( child_4.el , 0,1,2,3 );
220 var child_5 = new Xcls_milestone_id( _this );
222 this.el.attach_defaults ( child_5.el , 0,1,3,4 );
223 var child_6 = new Xcls_Label13( _this );
225 this.el.attach_defaults ( child_6.el , 1,4,2,3 );
226 var child_7 = new Xcls_description( _this );
228 this.el.attach_defaults ( child_7.el , 1,4,3,12 );
229 var child_8 = new Xcls_Label15( _this );
231 this.el.attach_defaults ( child_8.el , 0,1,4,5 );
232 var child_9 = new Xcls_priority_id( _this );
234 this.el.attach_defaults ( child_9.el , 0,1,5,6 );
235 var child_10 = new Xcls_Label18( _this );
237 this.el.attach_defaults ( child_10.el , 0,1,6,7 );
238 var child_11 = new Xcls_severity_id( _this );
240 this.el.attach_defaults ( child_11.el , 0,1,7,8 );
241 var child_12 = new Xcls_Label21( _this );
243 this.el.attach_defaults ( child_12.el , 0,1,8,9 );
244 var child_13 = new Xcls_classification_id( _this );
246 this.el.attach_defaults ( child_13.el , 0,1,9,10 );
247 var child_14 = new Xcls_Label24( _this );
249 this.el.attach_defaults ( child_14.el , 0,1,10,11 );
250 var child_15 = new Xcls_developer_id( _this );
252 this.el.attach_defaults ( child_15.el , 0,1,11,12 );
253 var child_16 = new Xcls_Button27( _this );
255 this.el.attach_defaults ( child_16.el , 0,4,13,14 );
258 // user defined functions
260 public class Xcls_Label4 : Object
263 private Ticket _this;
269 public Xcls_Label4(Ticket _owner )
272 this.el = new Gtk.Label( "Project" );
276 // set gobject values
277 this.el.halign = Gtk.Align.START;
278 this.el.visible = true;
281 // user defined functions
284 public class Xcls_Label5 : Object
287 private Ticket _this;
293 public Xcls_Label5(Ticket _owner )
296 this.el = new Gtk.Label( "Summary" );
300 // set gobject values
301 this.el.halign = Gtk.Align.START;
302 this.el.visible = true;
305 // user defined functions
308 public class Xcls_project_id : Object
310 public Gtk.ComboBox el;
311 private Ticket _this;
318 public Xcls_project_id(Ticket _owner )
321 _this.project_id = this;
322 this.el = new Gtk.ComboBox.with_entry();
325 this.loading = false;
327 // set gobject values
328 var child_0 = new Xcls_prcellrenderer( _this );
330 this.el.pack_start ( child_0.el , true );
331 var child_1 = new Xcls_prmodel( _this );
333 this.el.set_model ( child_1.el );
337 this.el.set_entry_text_column(1);
340 this.el.changed.connect( () => {
344 var project_id = this.selectedProjectId();
346 var rt = RooTicket.singleton();
347 rt.loadProjectOptions(project_id);
349 _this.msmodel.loadMilestones();
350 _this.primodel.loadPriorities();
351 _this.sevmodel.loadSeverities();
352 _this.clmodel.loadClassifications();
353 _this.devmodel.loadDevelopers();
355 // affects projects and milestones..
358 /*if (this.loading) {
361 var ticket_id = this.selectedTicketId();
363 var name = RooTicket.singleton().usernameLocal();
365 if (ticket_id == "" || ticket_id == null) {
367 var dt = new DateTime.now_local();
368 _this.name.el.set_text("wip_%s_%s".printf(name,dt.format("%Y_%b_%d")));
373 var ticket = RooTicket.singleton().getById(ticket_id);
375 _this.name.el.set_text("wip_%s_T%s_%s".printf(name,ticket.id, ticket.summaryToBranchName()));
377 //GLib.debug (//"Selection: %s, %s\n", (string) val1, (string) val2);
382 // user defined functions
383 public string selectedProjectId () {
388 this.el.get_active_iter (out iter);
389 _this.prmodel.el.get_value (iter, 0, out val1);
392 return (string) val1;
399 public class Xcls_prcellrenderer : Object
401 public Gtk.CellRendererText el;
402 private Ticket _this;
408 public Xcls_prcellrenderer(Ticket _owner )
411 _this.prcellrenderer = this;
412 this.el = new Gtk.CellRendererText();
416 // set gobject values
419 // user defined functions
422 public class Xcls_prmodel : Object
424 public Gtk.ListStore el;
425 private Ticket _this;
431 public Xcls_prmodel(Ticket _owner )
434 _this.prmodel = this;
435 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
439 // set gobject values
442 // user defined functions
443 public void loadProjects (string id) {
446 _this.project_id.loading = true;
455 el.set_value(iter, 0, "");
456 el.set_value(iter, 1, "-- select a project --");
458 _this.project_id.el.set_active_iter(iter);
461 foreach(var project in RooProject.projects()) {
465 el.set_value(iter, 0, project.id);
466 el.set_value(iter, 1, project.name );
467 if (id == project.id) {
468 _this.project_id.el.set_active_iter(iter);
473 _this.project_id.loading = false;
474 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
480 public class Xcls_summary : Object
483 private Ticket _this;
489 public Xcls_summary(Ticket _owner )
492 _this.summary = this;
493 this.el = new Gtk.Entry();
497 // set gobject values
498 this.el.visible = true;
501 // user defined functions
504 public class Xcls_Label10 : Object
507 private Ticket _this;
513 public Xcls_Label10(Ticket _owner )
516 this.el = new Gtk.Label( "Milestone" );
520 // set gobject values
521 this.el.halign = Gtk.Align.START;
522 this.el.justify = Gtk.Justification.RIGHT;
523 this.el.xalign = 0.900000f;
526 // user defined functions
529 public class Xcls_milestone_id : Object
531 public Gtk.ComboBox el;
532 private Ticket _this;
539 public Xcls_milestone_id(Ticket _owner )
542 _this.milestone_id = this;
543 this.el = new Gtk.ComboBox.with_entry();
546 this.loading = false;
548 // set gobject values
549 var child_0 = new Xcls_msmodel( _this );
551 this.el.set_model ( child_0.el );
555 this.el.set_entry_text_column(1);
558 // user defined functions
559 public string selectedMilestoneId () {
564 this.el.get_active_iter (out iter);
565 _this.msmodel.el.get_value (iter, 0, out val1);
568 return (string) val1;
575 public class Xcls_msmodel : Object
577 public Gtk.ListStore el;
578 private Ticket _this;
584 public Xcls_msmodel(Ticket _owner )
587 _this.msmodel = this;
588 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
592 // set gobject values
595 // user defined functions
596 public void loadMilestones ( ) {
598 var rt = RooTicket.singleton();
599 // rt.loadProjects();
601 _this.milestone_id.loading = true;
610 el.set_value(iter, 0, "");
611 el.set_value(iter, 1, "-- select a milestone --");
612 _this.milestone_id.el.set_active_iter(iter);
614 var projects = rt.milestones;
615 foreach(var project in projects) {
619 el.set_value(iter, 0, project.id);
620 el.set_value(iter, 1, project.display_name );
621 // if (id == project.id) {
622 // _this.milestone.el.set_active_iter(iter);
628 _this.milestone_id.loading = false;
629 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
635 public class Xcls_Label13 : Object
638 private Ticket _this;
644 public Xcls_Label13(Ticket _owner )
647 this.el = new Gtk.Label( "Description" );
651 // set gobject values
652 this.el.halign = Gtk.Align.START;
655 // user defined functions
658 public class Xcls_description : Object
660 public Gtk.TextView el;
661 private Ticket _this;
667 public Xcls_description(Ticket _owner )
670 _this.description = this;
671 this.el = new Gtk.TextView();
675 // set gobject values
676 this.el.border_width = 1;
679 // user defined functions
682 public class Xcls_Label15 : Object
685 private Ticket _this;
691 public Xcls_Label15(Ticket _owner )
694 this.el = new Gtk.Label( "Priority" );
698 // set gobject values
699 this.el.halign = Gtk.Align.START;
700 this.el.xalign = 0.900000f;
703 // user defined functions
706 public class Xcls_priority_id : Object
708 public Gtk.ComboBox el;
709 private Ticket _this;
716 public Xcls_priority_id(Ticket _owner )
719 _this.priority_id = this;
720 this.el = new Gtk.ComboBox.with_entry();
723 this.loading = false;
725 // set gobject values
726 var child_0 = new Xcls_primodel( _this );
728 this.el.set_model ( child_0.el );
732 this.el.set_entry_text_column(1);
735 // user defined functions
736 public string selectedPriorityId () {
741 this.el.get_active_iter (out iter);
742 _this.primodel.el.get_value (iter, 0, out val1);
745 return (string) val1;
752 public class Xcls_primodel : Object
754 public Gtk.ListStore el;
755 private Ticket _this;
761 public Xcls_primodel(Ticket _owner )
764 _this.primodel = this;
765 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
769 // set gobject values
772 // user defined functions
773 public void loadPriorities ( ) {
775 var rt = RooTicket.singleton();
776 // rt.loadProjects();
778 _this.priority_id.loading = true;
785 var projects = rt.priorities;
786 foreach(var project in projects) {
790 el.set_value(iter, 0, project.id);
791 el.set_value(iter, 1, project.display_name );
792 if ("normal" == project.name) {
793 _this.priority_id.el.set_active_iter(iter);
798 _this.priority_id.loading = false;
805 public class Xcls_Label18 : Object
808 private Ticket _this;
814 public Xcls_Label18(Ticket _owner )
817 this.el = new Gtk.Label( "Severity" );
821 // set gobject values
822 this.el.halign = Gtk.Align.START;
825 // user defined functions
828 public class Xcls_severity_id : Object
830 public Gtk.ComboBox el;
831 private Ticket _this;
838 public Xcls_severity_id(Ticket _owner )
841 _this.severity_id = this;
842 this.el = new Gtk.ComboBox.with_entry();
845 this.loading = false;
847 // set gobject values
848 var child_0 = new Xcls_sevmodel( _this );
850 this.el.set_model ( child_0.el );
854 this.el.set_entry_text_column(1);
857 // user defined functions
858 public string selectedSeverityId () {
863 this.el.get_active_iter (out iter);
864 _this.sevmodel.el.get_value (iter, 0, out val1);
867 return (string) val1;
874 public class Xcls_sevmodel : Object
876 public Gtk.ListStore el;
877 private Ticket _this;
883 public Xcls_sevmodel(Ticket _owner )
886 _this.sevmodel = this;
887 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
891 // set gobject values
894 // user defined functions
895 public void loadSeverities () {
897 var rt = RooTicket.singleton();
900 _this.severity_id.loading = true;
906 var projects = rt.serverities;
907 foreach(var project in projects) {
911 el.set_value(iter, 0, project.id);
912 el.set_value(iter, 1, project.display_name );
913 if ("normal" == project.name) {
914 _this.severity_id.el.set_active_iter(iter);
919 _this.severity_id.loading = false;
920 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
926 public class Xcls_Label21 : Object
929 private Ticket _this;
935 public Xcls_Label21(Ticket _owner )
938 this.el = new Gtk.Label( "Classification" );
942 // set gobject values
943 this.el.halign = Gtk.Align.START;
946 // user defined functions
949 public class Xcls_classification_id : Object
951 public Gtk.ComboBox el;
952 private Ticket _this;
959 public Xcls_classification_id(Ticket _owner )
962 _this.classification_id = this;
963 this.el = new Gtk.ComboBox.with_entry();
966 this.loading = false;
968 // set gobject values
969 var child_0 = new Xcls_clmodel( _this );
971 this.el.set_model ( child_0.el );
975 this.el.set_entry_text_column(1);
978 // user defined functions
979 public string selectedClassificationId () {
984 this.el.get_active_iter (out iter);
985 _this.clmodel.el.get_value (iter, 0, out val1);
988 return (string) val1;
995 public class Xcls_clmodel : Object
997 public Gtk.ListStore el;
998 private Ticket _this;
1004 public Xcls_clmodel(Ticket _owner )
1007 _this.clmodel = this;
1008 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
1012 // set gobject values
1015 // user defined functions
1016 public void loadClassifications ( ) {
1018 var rt = RooTicket.singleton();
1019 // rt.loadProjects();
1021 _this.classification_id.loading = true;
1027 el.append(out iter);
1030 var projects = rt.classifications;
1031 foreach(var project in projects) {
1033 el.append(out iter);
1035 el.set_value(iter, 0, project.id);
1036 el.set_value(iter, 1, project.display_name );
1037 if ("bug" == project.name) {
1038 _this.classification_id.el.set_active_iter(iter);
1043 _this.classification_id.loading = false;
1044 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
1050 public class Xcls_Label24 : Object
1052 public Gtk.Label el;
1053 private Ticket _this;
1059 public Xcls_Label24(Ticket _owner )
1062 this.el = new Gtk.Label( "Assign to" );
1066 // set gobject values
1067 this.el.halign = Gtk.Align.START;
1070 // user defined functions
1073 public class Xcls_developer_id : Object
1075 public Gtk.ComboBox el;
1076 private Ticket _this;
1080 public bool loading;
1083 public Xcls_developer_id(Ticket _owner )
1086 _this.developer_id = this;
1087 this.el = new Gtk.ComboBox.with_entry();
1090 this.loading = false;
1092 // set gobject values
1093 var child_0 = new Xcls_devmodel( _this );
1095 this.el.set_model ( child_0.el );
1099 this.el.set_entry_text_column(1);
1102 // user defined functions
1103 public string selectedDeveloperId () {
1108 this.el.get_active_iter (out iter);
1109 _this.devmodel.el.get_value (iter, 0, out val1);
1112 return (string) val1;
1119 public class Xcls_devmodel : Object
1121 public Gtk.ListStore el;
1122 private Ticket _this;
1128 public Xcls_devmodel(Ticket _owner )
1131 _this.devmodel = this;
1132 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
1136 // set gobject values
1139 // user defined functions
1140 public void loadDevelopers ( ) {
1142 var rt = RooTicket.singleton();
1143 //rt.loadProjects();
1145 _this.developer_id.loading = true;
1151 el.append(out iter);
1154 el.set_value(iter, 0, "");
1155 el.set_value(iter, 1, "-- select a developer --");
1157 _this.developer_id.el.set_active_iter(iter);
1160 var peps = rt.developers;
1161 foreach(var p in peps) {
1163 el.append(out iter);
1165 el.set_value(iter, 0, p.id);
1166 el.set_value(iter, 1, p.display_name );
1167 if (rt.authuser_id == p.id) {
1168 _this.developer_id.el.set_active_iter(iter);
1172 _this.developer_id.loading = false;
1173 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
1179 public class Xcls_Button27 : Object
1181 public Gtk.Button el;
1182 private Ticket _this;
1188 public Xcls_Button27(Ticket _owner )
1191 this.el = new Gtk.Button();
1195 // set gobject values
1196 this.el.label = "Create Ticket";
1201 this.el.get_style_context().add_class("suggested-action");
1205 this.el.clicked.connect( () => {
1206 GLib.debug("fire response = 1");
1209 var invalid = false;
1211 // validate first...
1212 _this.project_id.el.get_child().get_style_context().remove_class("warning");
1213 if (_this.project_id.selectedProjectId() == "") {
1214 _this.project_id.el.get_child().get_style_context().add_class("warning");
1218 _this.milestone_id.el.get_child().get_style_context().remove_class("warning");
1220 _this.priority_id.el.get_child().get_style_context().remove_class("warning");
1221 if (_this.priority_id.selectedPriorityId() == "") {
1222 _this.priority_id.el.get_child().get_style_context().add_class("warning");
1226 _this.classification_id.el.get_child().get_style_context().remove_class("warning");
1227 if (_this.classification_id.selectedClassificationId() == "") {
1228 _this.classification_id.el.get_child().get_style_context().add_class("warning");
1232 _this.developer_id.el.get_child().get_style_context().remove_class("warning");
1233 if (_this.developer_id.selectedDeveloperId() == "") {
1234 _this.developer_id.el.get_child().get_style_context().add_class("warning");
1238 _this.summary.el.get_style_context().remove_class("warning");
1239 if (_this.summary.el.get_text() == "") {
1240 _this.summary.el.get_style_context().add_class("warning");
1244 _this.description.el.get_style_context().remove_class("warning");
1249 GLib.debug("for is valid");
1251 _this.el.response(1);
1255 // user defined functions
1259 public class Xcls_spinner : Object
1261 public Gtk.Spinner el;
1262 private Ticket _this;
1268 public Xcls_spinner(Ticket _owner )
1271 _this.spinner = this;
1272 this.el = new Gtk.Spinner();
1276 // set gobject values
1277 this.el.hexpand = true;
1278 this.el.vexpand = true;
1281 // user defined functions