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.classification_id.selectedClassificationId() ,
80 _this.developer_id.selectedDeveloperId(),
81 _this.summary.el.get_text() ,
82 _this.description.el.buffer.text
86 if (this.repo != null) {
87 NewBranch.singleton().show(this.repo, new Gee.ArrayList<GitMonitorQueue>(), tid);
95 // user defined functions
96 public void show ( GitRepo? repo )
98 // this.el.set_gravity(Gdk.Gravity.NORTH);
99 if (this.running) { // should not happen!!
100 GLib.error("new branch show called, when already being displayed?");
105 this.el.set_keep_above(true);
106 _this.table.el.hide();
108 _this.spinner.el.show();
109 _this.spinner.el.start();
114 //GitMonitor.gitmonitor.stop();
121 this.el.move((Gdk.Screen.width() / 2)- 250 ,0);
122 this.el.set_default_size( 500,200); // not sure why it grows..
123 GLib.debug("Loading tickets");
127 RooProject? curproj = null;
128 if (this.repo != null) {
129 curproj = RooProject.getProjectByRepo(this.repo);
131 _this.prmodel.loadProjects(curproj == null ? "" : curproj.id);
132 if (curproj != null) {
135 var rt = RooTicket.singleton();
136 rt.loadProjectOptions(curproj.id);
138 _this.msmodel.loadMilestones();
139 _this.primodel.loadPriorities();
140 _this.sevmodel.loadSeverities();
141 _this.clmodel.loadClassifications();
142 _this.devmodel.loadDevelopers();
145 _this.summary.el.set_text("");
146 _this.description.el.buffer.text = "";
149 this.el.table.el.show();
150 this.el.table.el.hide();
158 public class Xcls_Box2 : Object
161 private Ticket _this;
167 public Xcls_Box2(Ticket _owner )
170 this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
174 // set gobject values
175 var child_0 = new Xcls_table( _this );
177 this.el.pack_start ( child_0.el , false,false,0 );
178 var child_1 = new Xcls_spinner( _this );
180 this.el.add ( child_1.el );
183 // user defined functions
185 public class Xcls_table : Object
188 private Ticket _this;
194 public Xcls_table(Ticket _owner )
198 this.el = new Gtk.Table( 14, 4, true );
202 // set gobject values
203 this.el.expand = false;
205 this.el.column_spacing = 4;
206 this.el.vexpand = false;
207 var child_0 = new Xcls_Label4( _this );
209 this.el.attach_defaults ( child_0.el , 0,1,0,1 );
210 var child_1 = new Xcls_Label5( _this );
212 this.el.attach_defaults ( child_1.el , 1,2,0,1 );
213 var child_2 = new Xcls_project_id( _this );
215 this.el.attach_defaults ( child_2.el , 0,1,1,2 );
216 var child_3 = new Xcls_summary( _this );
218 this.el.attach_defaults ( child_3.el , 1,4,1,2 );
219 var child_4 = new Xcls_Label10( _this );
221 this.el.attach_defaults ( child_4.el , 0,1,2,3 );
222 var child_5 = new Xcls_milestone_id( _this );
224 this.el.attach_defaults ( child_5.el , 0,1,3,4 );
225 var child_6 = new Xcls_Label13( _this );
227 this.el.attach_defaults ( child_6.el , 1,4,2,3 );
228 var child_7 = new Xcls_description( _this );
230 this.el.attach_defaults ( child_7.el , 1,4,3,12 );
231 var child_8 = new Xcls_Label15( _this );
233 this.el.attach_defaults ( child_8.el , 0,1,4,5 );
234 var child_9 = new Xcls_priority_id( _this );
236 this.el.attach_defaults ( child_9.el , 0,1,5,6 );
237 var child_10 = new Xcls_Label18( _this );
239 this.el.attach_defaults ( child_10.el , 0,1,6,7 );
240 var child_11 = new Xcls_severity_id( _this );
242 this.el.attach_defaults ( child_11.el , 0,1,7,8 );
243 var child_12 = new Xcls_Label21( _this );
245 this.el.attach_defaults ( child_12.el , 0,1,8,9 );
246 var child_13 = new Xcls_classification_id( _this );
248 this.el.attach_defaults ( child_13.el , 0,1,9,10 );
249 var child_14 = new Xcls_Label24( _this );
251 this.el.attach_defaults ( child_14.el , 0,1,10,11 );
252 var child_15 = new Xcls_developer_id( _this );
254 this.el.attach_defaults ( child_15.el , 0,1,11,12 );
255 var child_16 = new Xcls_Button27( _this );
257 this.el.attach_defaults ( child_16.el , 0,4,13,14 );
260 // user defined functions
262 public class Xcls_Label4 : Object
265 private Ticket _this;
271 public Xcls_Label4(Ticket _owner )
274 this.el = new Gtk.Label( "Project" );
278 // set gobject values
279 this.el.halign = Gtk.Align.START;
280 this.el.visible = true;
283 // user defined functions
286 public class Xcls_Label5 : Object
289 private Ticket _this;
295 public Xcls_Label5(Ticket _owner )
298 this.el = new Gtk.Label( "Summary" );
302 // set gobject values
303 this.el.halign = Gtk.Align.START;
304 this.el.visible = true;
307 // user defined functions
310 public class Xcls_project_id : Object
312 public Gtk.ComboBox el;
313 private Ticket _this;
320 public Xcls_project_id(Ticket _owner )
323 _this.project_id = this;
324 this.el = new Gtk.ComboBox.with_entry();
327 this.loading = false;
329 // set gobject values
330 var child_0 = new Xcls_prcellrenderer( _this );
332 this.el.pack_start ( child_0.el , true );
333 var child_1 = new Xcls_prmodel( _this );
335 this.el.set_model ( child_1.el );
339 this.el.set_entry_text_column(1);
342 this.el.changed.connect( () => {
346 var project_id = this.selectedProjectId();
348 var rt = RooTicket.singleton();
349 rt.loadProjectOptions(project_id);
351 _this.msmodel.loadMilestones();
352 _this.primodel.loadPriorities();
353 _this.sevmodel.loadSeverities();
354 _this.clmodel.loadClassifications();
355 _this.devmodel.loadDevelopers();
357 // affects projects and milestones..
360 /*if (this.loading) {
363 var ticket_id = this.selectedTicketId();
365 var name = RooTicket.singleton().usernameLocal();
367 if (ticket_id == "" || ticket_id == null) {
369 var dt = new DateTime.now_local();
370 _this.name.el.set_text("wip_%s_%s".printf(name,dt.format("%Y_%b_%d")));
375 var ticket = RooTicket.singleton().getById(ticket_id);
377 _this.name.el.set_text("wip_%s_T%s_%s".printf(name,ticket.id, ticket.summaryToBranchName()));
379 //GLib.debug (//"Selection: %s, %s\n", (string) val1, (string) val2);
384 // user defined functions
385 public string selectedProjectId () {
390 this.el.get_active_iter (out iter);
391 _this.prmodel.el.get_value (iter, 0, out val1);
394 return (string) val1;
401 public class Xcls_prcellrenderer : Object
403 public Gtk.CellRendererText el;
404 private Ticket _this;
410 public Xcls_prcellrenderer(Ticket _owner )
413 _this.prcellrenderer = this;
414 this.el = new Gtk.CellRendererText();
418 // set gobject values
421 // user defined functions
424 public class Xcls_prmodel : Object
426 public Gtk.ListStore el;
427 private Ticket _this;
433 public Xcls_prmodel(Ticket _owner )
436 _this.prmodel = this;
437 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
441 // set gobject values
444 // user defined functions
445 public void loadProjects (string id) {
448 _this.project_id.loading = true;
457 el.set_value(iter, 0, "");
458 el.set_value(iter, 1, "-- select a project --");
460 _this.project_id.el.set_active_iter(iter);
463 foreach(var project in RooProject.projects()) {
467 el.set_value(iter, 0, project.id);
468 el.set_value(iter, 1, project.name );
469 if (id == project.id) {
470 _this.project_id.el.set_active_iter(iter);
475 _this.project_id.loading = false;
476 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
482 public class Xcls_summary : Object
485 private Ticket _this;
491 public Xcls_summary(Ticket _owner )
494 _this.summary = this;
495 this.el = new Gtk.Entry();
499 // set gobject values
500 this.el.visible = true;
503 // user defined functions
506 public class Xcls_Label10 : Object
509 private Ticket _this;
515 public Xcls_Label10(Ticket _owner )
518 this.el = new Gtk.Label( "Milestone" );
522 // set gobject values
523 this.el.halign = Gtk.Align.START;
524 this.el.justify = Gtk.Justification.RIGHT;
525 this.el.xalign = 0.900000f;
528 // user defined functions
531 public class Xcls_milestone_id : Object
533 public Gtk.ComboBox el;
534 private Ticket _this;
541 public Xcls_milestone_id(Ticket _owner )
544 _this.milestone_id = this;
545 this.el = new Gtk.ComboBox.with_entry();
548 this.loading = false;
550 // set gobject values
551 var child_0 = new Xcls_msmodel( _this );
553 this.el.set_model ( child_0.el );
557 this.el.set_entry_text_column(1);
560 // user defined functions
561 public string selectedMilestoneId () {
566 this.el.get_active_iter (out iter);
567 _this.msmodel.el.get_value (iter, 0, out val1);
570 return (string) val1;
577 public class Xcls_msmodel : Object
579 public Gtk.ListStore el;
580 private Ticket _this;
586 public Xcls_msmodel(Ticket _owner )
589 _this.msmodel = this;
590 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
594 // set gobject values
597 // user defined functions
598 public void loadMilestones ( ) {
600 var rt = RooTicket.singleton();
601 // rt.loadProjects();
603 _this.milestone_id.loading = true;
612 el.set_value(iter, 0, "");
613 el.set_value(iter, 1, "-- select a milestone --");
614 _this.milestone_id.el.set_active_iter(iter);
616 var projects = rt.milestones;
617 foreach(var project in projects) {
621 el.set_value(iter, 0, project.id);
622 el.set_value(iter, 1, project.display_name );
623 // if (id == project.id) {
624 // _this.milestone.el.set_active_iter(iter);
630 _this.milestone_id.loading = false;
631 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
637 public class Xcls_Label13 : Object
640 private Ticket _this;
646 public Xcls_Label13(Ticket _owner )
649 this.el = new Gtk.Label( "Description" );
653 // set gobject values
654 this.el.halign = Gtk.Align.START;
657 // user defined functions
660 public class Xcls_description : Object
662 public Gtk.TextView el;
663 private Ticket _this;
669 public Xcls_description(Ticket _owner )
672 _this.description = this;
673 this.el = new Gtk.TextView();
677 // set gobject values
678 this.el.border_width = 1;
681 // user defined functions
684 public class Xcls_Label15 : Object
687 private Ticket _this;
693 public Xcls_Label15(Ticket _owner )
696 this.el = new Gtk.Label( "Priority" );
700 // set gobject values
701 this.el.halign = Gtk.Align.START;
702 this.el.xalign = 0.900000f;
705 // user defined functions
708 public class Xcls_priority_id : Object
710 public Gtk.ComboBox el;
711 private Ticket _this;
718 public Xcls_priority_id(Ticket _owner )
721 _this.priority_id = this;
722 this.el = new Gtk.ComboBox.with_entry();
725 this.loading = false;
727 // set gobject values
728 var child_0 = new Xcls_primodel( _this );
730 this.el.set_model ( child_0.el );
734 this.el.set_entry_text_column(1);
737 // user defined functions
738 public string selectedPriorityId () {
743 this.el.get_active_iter (out iter);
744 _this.primodel.el.get_value (iter, 0, out val1);
747 return (string) val1;
754 public class Xcls_primodel : Object
756 public Gtk.ListStore el;
757 private Ticket _this;
763 public Xcls_primodel(Ticket _owner )
766 _this.primodel = this;
767 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
771 // set gobject values
774 // user defined functions
775 public void loadPriorities ( ) {
777 var rt = RooTicket.singleton();
778 // rt.loadProjects();
780 _this.priority_id.loading = true;
787 var projects = rt.priorities;
788 foreach(var project in projects) {
792 el.set_value(iter, 0, project.id);
793 el.set_value(iter, 1, project.display_name );
794 if ("normal" == project.name) {
795 _this.priority_id.el.set_active_iter(iter);
800 _this.priority_id.loading = false;
807 public class Xcls_Label18 : Object
810 private Ticket _this;
816 public Xcls_Label18(Ticket _owner )
819 this.el = new Gtk.Label( "Severity" );
823 // set gobject values
824 this.el.halign = Gtk.Align.START;
827 // user defined functions
830 public class Xcls_severity_id : Object
832 public Gtk.ComboBox el;
833 private Ticket _this;
840 public Xcls_severity_id(Ticket _owner )
843 _this.severity_id = this;
844 this.el = new Gtk.ComboBox.with_entry();
847 this.loading = false;
849 // set gobject values
850 var child_0 = new Xcls_sevmodel( _this );
852 this.el.set_model ( child_0.el );
856 this.el.set_entry_text_column(1);
859 // user defined functions
860 public string selectedSeverityId () {
865 this.el.get_active_iter (out iter);
866 _this.sevmodel.el.get_value (iter, 0, out val1);
869 return (string) val1;
876 public class Xcls_sevmodel : Object
878 public Gtk.ListStore el;
879 private Ticket _this;
885 public Xcls_sevmodel(Ticket _owner )
888 _this.sevmodel = this;
889 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
893 // set gobject values
896 // user defined functions
897 public void loadSeverities () {
899 var rt = RooTicket.singleton();
902 _this.severity_id.loading = true;
908 var projects = rt.serverities;
909 foreach(var project in projects) {
913 el.set_value(iter, 0, project.id);
914 el.set_value(iter, 1, project.display_name );
915 if ("normal" == project.name) {
916 _this.severity_id.el.set_active_iter(iter);
921 _this.severity_id.loading = false;
922 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
928 public class Xcls_Label21 : Object
931 private Ticket _this;
937 public Xcls_Label21(Ticket _owner )
940 this.el = new Gtk.Label( "Classification" );
944 // set gobject values
945 this.el.halign = Gtk.Align.START;
948 // user defined functions
951 public class Xcls_classification_id : Object
953 public Gtk.ComboBox el;
954 private Ticket _this;
961 public Xcls_classification_id(Ticket _owner )
964 _this.classification_id = this;
965 this.el = new Gtk.ComboBox.with_entry();
968 this.loading = false;
970 // set gobject values
971 var child_0 = new Xcls_clmodel( _this );
973 this.el.set_model ( child_0.el );
977 this.el.set_entry_text_column(1);
980 // user defined functions
981 public string selectedClassificationId () {
986 this.el.get_active_iter (out iter);
987 _this.clmodel.el.get_value (iter, 0, out val1);
990 return (string) val1;
997 public class Xcls_clmodel : Object
999 public Gtk.ListStore el;
1000 private Ticket _this;
1006 public Xcls_clmodel(Ticket _owner )
1009 _this.clmodel = this;
1010 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
1014 // set gobject values
1017 // user defined functions
1018 public void loadClassifications ( ) {
1020 var rt = RooTicket.singleton();
1021 // rt.loadProjects();
1023 _this.classification_id.loading = true;
1029 el.append(out iter);
1032 var projects = rt.classifications;
1033 foreach(var project in projects) {
1035 el.append(out iter);
1037 el.set_value(iter, 0, project.id);
1038 el.set_value(iter, 1, project.display_name );
1039 if ("bug" == project.name) {
1040 _this.classification_id.el.set_active_iter(iter);
1045 _this.classification_id.loading = false;
1046 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
1052 public class Xcls_Label24 : Object
1054 public Gtk.Label el;
1055 private Ticket _this;
1061 public Xcls_Label24(Ticket _owner )
1064 this.el = new Gtk.Label( "Assign to" );
1068 // set gobject values
1069 this.el.halign = Gtk.Align.START;
1072 // user defined functions
1075 public class Xcls_developer_id : Object
1077 public Gtk.ComboBox el;
1078 private Ticket _this;
1082 public bool loading;
1085 public Xcls_developer_id(Ticket _owner )
1088 _this.developer_id = this;
1089 this.el = new Gtk.ComboBox.with_entry();
1092 this.loading = false;
1094 // set gobject values
1095 var child_0 = new Xcls_devmodel( _this );
1097 this.el.set_model ( child_0.el );
1101 this.el.set_entry_text_column(1);
1104 // user defined functions
1105 public string selectedDeveloperId () {
1110 this.el.get_active_iter (out iter);
1111 _this.devmodel.el.get_value (iter, 0, out val1);
1114 return (string) val1;
1121 public class Xcls_devmodel : Object
1123 public Gtk.ListStore el;
1124 private Ticket _this;
1130 public Xcls_devmodel(Ticket _owner )
1133 _this.devmodel = this;
1134 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
1138 // set gobject values
1141 // user defined functions
1142 public void loadDevelopers ( ) {
1144 var rt = RooTicket.singleton();
1145 //rt.loadProjects();
1147 _this.developer_id.loading = true;
1153 el.append(out iter);
1156 el.set_value(iter, 0, "");
1157 el.set_value(iter, 1, "-- select a developer --");
1159 _this.developer_id.el.set_active_iter(iter);
1162 var projects = rt.developers;
1163 foreach(var project in projects) {
1165 el.append(out iter);
1167 el.set_value(iter, 0, project.id);
1168 el.set_value(iter, 1, project.display_name );
1169 // if (id == project.id) {
1170 // _this.projectsel.el.set_active_iter(iter);
1175 _this.developer_id.loading = false;
1176 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
1182 public class Xcls_Button27 : Object
1184 public Gtk.Button el;
1185 private Ticket _this;
1191 public Xcls_Button27(Ticket _owner )
1194 this.el = new Gtk.Button();
1198 // set gobject values
1199 this.el.label = "Create Ticket";
1204 this.el.get_style_context().add_class("suggested-action");
1208 this.el.clicked.connect( () => {
1209 GLib.debug("fire response = 1");
1212 var invalid = false;
1214 // validate first...
1215 _this.project_id.el.get_child().get_style_context().remove_class("warning");
1216 if (_this.project_id.selectedProjectId() == "") {
1217 _this.project_id.el.get_child().get_style_context().add_class("warning");
1221 _this.milestone_id.el.get_child().get_style_context().remove_class("warning");
1222 if (_this.milestone_id.selectedMilestoneId() == "") {
1223 _this.milestone_id.el.get_child().get_style_context().add_class("warning");
1227 _this.priority_id.el.get_child().get_style_context().remove_class("warning");
1228 if (_this.priority_id.selectedPriorityId() == "") {
1229 _this.priority_id.el.get_child().get_style_context().add_class("warning");
1233 _this.classification_id.el.get_child().get_style_context().remove_class("warning");
1234 if (_this.classification_id.selectedClassificationId() == "") {
1235 _this.classification_id.el.get_child().get_style_context().add_class("warning");
1239 _this.developer_id.el.get_child().get_style_context().remove_class("warning");
1240 if (_this.developer_id.selectedDeveloperId() == "") {
1241 _this.developer_id.el.get_child().get_style_context().add_class("warning");
1245 _this.summary.el.get_style_context().remove_class("warning");
1246 if (_this.summary.el.get_text() == "") {
1247 _this.summary.el.get_style_context().add_class("warning");
1251 _this.description.el.get_style_context().remove_class("warning");
1252 if (_this.description.el.buffer.text == "") {
1253 _this.description.el.get_style_context().add_class("warning");
1261 GLib.debug("for is valid");
1263 _this.el.response(1);
1267 // user defined functions
1271 public class Xcls_spinner : Object
1273 public Gtk.Spinner el;
1274 private Ticket _this;
1280 public Xcls_spinner(Ticket _owner )
1283 _this.spinner = this;
1284 this.el = new Gtk.Spinner();
1288 // set gobject values
1289 this.el.hexpand = true;
1290 this.el.vexpand = true;
1293 // user defined functions