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 //GitMonitor.gitmonitor.stop();
112 this.el.move((Gdk.Screen.width() / 2)- 250 ,0);
113 this.el.set_default_size( 500,200); // not sure why it grows..
114 GLib.debug("Loading tickets");
118 this.el.set_keep_above(true);
121 RooProject? curproj = null;
122 if (this.repo != null) {
123 curproj = RooProject.getProjectByRepo(this.repo);
125 _this.prmodel.loadProjects(curproj == null ? "" : curproj.id);
126 if (curproj != null) {
129 var rt = RooTicket.singleton();
130 rt.loadProjectOptions(curproj.id);
132 _this.msmodel.loadMilestones();
133 _this.primodel.loadPriorities();
134 _this.sevmodel.loadSeverities();
135 _this.clmodel.loadClassifications();
136 _this.devmodel.loadDevelopers();
139 _this.summary.el.set_text("");
140 _this.description.el.buffer.text = "";
146 public class Xcls_Box2 : Object
149 private Ticket _this;
155 public Xcls_Box2(Ticket _owner )
158 this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
162 // set gobject values
163 var child_0 = new Xcls_table( _this );
165 this.el.pack_start ( child_0.el , false,false,0 );
166 var child_1 = new Xcls_spinner( _this );
168 this.el.add ( child_1.el );
171 // user defined functions
173 public class Xcls_table : Object
176 private Ticket _this;
182 public Xcls_table(Ticket _owner )
186 this.el = new Gtk.Table( 14, 4, true );
190 // set gobject values
191 this.el.expand = false;
193 this.el.column_spacing = 4;
194 this.el.vexpand = false;
195 var child_0 = new Xcls_Label4( _this );
197 this.el.attach_defaults ( child_0.el , 0,1,0,1 );
198 var child_1 = new Xcls_Label5( _this );
200 this.el.attach_defaults ( child_1.el , 1,2,0,1 );
201 var child_2 = new Xcls_project_id( _this );
203 this.el.attach_defaults ( child_2.el , 0,1,1,2 );
204 var child_3 = new Xcls_summary( _this );
206 this.el.attach_defaults ( child_3.el , 1,4,1,2 );
207 var child_4 = new Xcls_Label10( _this );
209 this.el.attach_defaults ( child_4.el , 0,1,2,3 );
210 var child_5 = new Xcls_milestone_id( _this );
212 this.el.attach_defaults ( child_5.el , 0,1,3,4 );
213 var child_6 = new Xcls_Label13( _this );
215 this.el.attach_defaults ( child_6.el , 1,4,2,3 );
216 var child_7 = new Xcls_description( _this );
218 this.el.attach_defaults ( child_7.el , 1,4,3,12 );
219 var child_8 = new Xcls_Label15( _this );
221 this.el.attach_defaults ( child_8.el , 0,1,4,5 );
222 var child_9 = new Xcls_priority_id( _this );
224 this.el.attach_defaults ( child_9.el , 0,1,5,6 );
225 var child_10 = new Xcls_Label18( _this );
227 this.el.attach_defaults ( child_10.el , 0,1,6,7 );
228 var child_11 = new Xcls_severity_id( _this );
230 this.el.attach_defaults ( child_11.el , 0,1,7,8 );
231 var child_12 = new Xcls_Label21( _this );
233 this.el.attach_defaults ( child_12.el , 0,1,8,9 );
234 var child_13 = new Xcls_classification_id( _this );
236 this.el.attach_defaults ( child_13.el , 0,1,9,10 );
237 var child_14 = new Xcls_Label24( _this );
239 this.el.attach_defaults ( child_14.el , 0,1,10,11 );
240 var child_15 = new Xcls_developer_id( _this );
242 this.el.attach_defaults ( child_15.el , 0,1,11,12 );
243 var child_16 = new Xcls_Button27( _this );
245 this.el.attach_defaults ( child_16.el , 0,4,13,14 );
248 // user defined functions
250 public class Xcls_Label4 : Object
253 private Ticket _this;
259 public Xcls_Label4(Ticket _owner )
262 this.el = new Gtk.Label( "Project" );
266 // set gobject values
267 this.el.halign = Gtk.Align.START;
268 this.el.visible = true;
271 // user defined functions
274 public class Xcls_Label5 : Object
277 private Ticket _this;
283 public Xcls_Label5(Ticket _owner )
286 this.el = new Gtk.Label( "Summary" );
290 // set gobject values
291 this.el.halign = Gtk.Align.START;
292 this.el.visible = true;
295 // user defined functions
298 public class Xcls_project_id : Object
300 public Gtk.ComboBox el;
301 private Ticket _this;
308 public Xcls_project_id(Ticket _owner )
311 _this.project_id = this;
312 this.el = new Gtk.ComboBox.with_entry();
315 this.loading = false;
317 // set gobject values
318 var child_0 = new Xcls_prcellrenderer( _this );
320 this.el.pack_start ( child_0.el , true );
321 var child_1 = new Xcls_prmodel( _this );
323 this.el.set_model ( child_1.el );
327 this.el.set_entry_text_column(1);
330 this.el.changed.connect( () => {
334 var project_id = this.selectedProjectId();
336 var rt = RooTicket.singleton();
337 rt.loadProjectOptions(project_id);
339 _this.msmodel.loadMilestones();
340 _this.primodel.loadPriorities();
341 _this.sevmodel.loadSeverities();
342 _this.clmodel.loadClassifications();
343 _this.devmodel.loadDevelopers();
345 // affects projects and milestones..
348 /*if (this.loading) {
351 var ticket_id = this.selectedTicketId();
353 var name = RooTicket.singleton().usernameLocal();
355 if (ticket_id == "" || ticket_id == null) {
357 var dt = new DateTime.now_local();
358 _this.name.el.set_text("wip_%s_%s".printf(name,dt.format("%Y_%b_%d")));
363 var ticket = RooTicket.singleton().getById(ticket_id);
365 _this.name.el.set_text("wip_%s_T%s_%s".printf(name,ticket.id, ticket.summaryToBranchName()));
367 //GLib.debug (//"Selection: %s, %s\n", (string) val1, (string) val2);
372 // user defined functions
373 public string selectedProjectId () {
378 this.el.get_active_iter (out iter);
379 _this.prmodel.el.get_value (iter, 0, out val1);
382 return (string) val1;
389 public class Xcls_prcellrenderer : Object
391 public Gtk.CellRendererText el;
392 private Ticket _this;
398 public Xcls_prcellrenderer(Ticket _owner )
401 _this.prcellrenderer = this;
402 this.el = new Gtk.CellRendererText();
406 // set gobject values
409 // user defined functions
412 public class Xcls_prmodel : Object
414 public Gtk.ListStore el;
415 private Ticket _this;
421 public Xcls_prmodel(Ticket _owner )
424 _this.prmodel = this;
425 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
429 // set gobject values
432 // user defined functions
433 public void loadProjects (string id) {
436 _this.project_id.loading = true;
445 el.set_value(iter, 0, "");
446 el.set_value(iter, 1, "-- select a project --");
448 _this.project_id.el.set_active_iter(iter);
451 foreach(var project in RooProject.projects()) {
455 el.set_value(iter, 0, project.id);
456 el.set_value(iter, 1, project.name );
457 if (id == project.id) {
458 _this.project_id.el.set_active_iter(iter);
463 _this.project_id.loading = false;
464 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
470 public class Xcls_summary : Object
473 private Ticket _this;
479 public Xcls_summary(Ticket _owner )
482 _this.summary = this;
483 this.el = new Gtk.Entry();
487 // set gobject values
488 this.el.visible = true;
491 // user defined functions
494 public class Xcls_Label10 : Object
497 private Ticket _this;
503 public Xcls_Label10(Ticket _owner )
506 this.el = new Gtk.Label( "Milestone" );
510 // set gobject values
511 this.el.halign = Gtk.Align.START;
512 this.el.justify = Gtk.Justification.RIGHT;
513 this.el.xalign = 0.900000f;
516 // user defined functions
519 public class Xcls_milestone_id : Object
521 public Gtk.ComboBox el;
522 private Ticket _this;
529 public Xcls_milestone_id(Ticket _owner )
532 _this.milestone_id = this;
533 this.el = new Gtk.ComboBox.with_entry();
536 this.loading = false;
538 // set gobject values
539 var child_0 = new Xcls_msmodel( _this );
541 this.el.set_model ( child_0.el );
545 this.el.set_entry_text_column(1);
548 // user defined functions
549 public string selectedMilestoneId () {
554 this.el.get_active_iter (out iter);
555 _this.msmodel.el.get_value (iter, 0, out val1);
558 return (string) val1;
565 public class Xcls_msmodel : Object
567 public Gtk.ListStore el;
568 private Ticket _this;
574 public Xcls_msmodel(Ticket _owner )
577 _this.msmodel = this;
578 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
582 // set gobject values
585 // user defined functions
586 public void loadMilestones ( ) {
588 var rt = RooTicket.singleton();
589 // rt.loadProjects();
591 _this.milestone_id.loading = true;
600 el.set_value(iter, 0, "");
601 el.set_value(iter, 1, "-- select a milestone --");
602 _this.milestone_id.el.set_active_iter(iter);
604 var projects = rt.milestones;
605 foreach(var project in projects) {
609 el.set_value(iter, 0, project.id);
610 el.set_value(iter, 1, project.display_name );
611 // if (id == project.id) {
612 // _this.milestone.el.set_active_iter(iter);
618 _this.milestone_id.loading = false;
619 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
625 public class Xcls_Label13 : Object
628 private Ticket _this;
634 public Xcls_Label13(Ticket _owner )
637 this.el = new Gtk.Label( "Description" );
641 // set gobject values
642 this.el.halign = Gtk.Align.START;
645 // user defined functions
648 public class Xcls_description : Object
650 public Gtk.TextView el;
651 private Ticket _this;
657 public Xcls_description(Ticket _owner )
660 _this.description = this;
661 this.el = new Gtk.TextView();
665 // set gobject values
666 this.el.border_width = 1;
669 // user defined functions
672 public class Xcls_Label15 : Object
675 private Ticket _this;
681 public Xcls_Label15(Ticket _owner )
684 this.el = new Gtk.Label( "Priority" );
688 // set gobject values
689 this.el.halign = Gtk.Align.START;
690 this.el.xalign = 0.900000f;
693 // user defined functions
696 public class Xcls_priority_id : Object
698 public Gtk.ComboBox el;
699 private Ticket _this;
706 public Xcls_priority_id(Ticket _owner )
709 _this.priority_id = this;
710 this.el = new Gtk.ComboBox.with_entry();
713 this.loading = false;
715 // set gobject values
716 var child_0 = new Xcls_primodel( _this );
718 this.el.set_model ( child_0.el );
722 this.el.set_entry_text_column(1);
725 // user defined functions
726 public string selectedPriorityId () {
731 this.el.get_active_iter (out iter);
732 _this.primodel.el.get_value (iter, 0, out val1);
735 return (string) val1;
742 public class Xcls_primodel : Object
744 public Gtk.ListStore el;
745 private Ticket _this;
751 public Xcls_primodel(Ticket _owner )
754 _this.primodel = this;
755 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
759 // set gobject values
762 // user defined functions
763 public void loadPriorities ( ) {
765 var rt = RooTicket.singleton();
766 // rt.loadProjects();
768 _this.priority_id.loading = true;
775 var projects = rt.priorities;
776 foreach(var project in projects) {
780 el.set_value(iter, 0, project.id);
781 el.set_value(iter, 1, project.display_name );
782 if ("normal" == project.name) {
783 _this.priority_id.el.set_active_iter(iter);
788 _this.priority_id.loading = false;
795 public class Xcls_Label18 : Object
798 private Ticket _this;
804 public Xcls_Label18(Ticket _owner )
807 this.el = new Gtk.Label( "Severity" );
811 // set gobject values
812 this.el.halign = Gtk.Align.START;
815 // user defined functions
818 public class Xcls_severity_id : Object
820 public Gtk.ComboBox el;
821 private Ticket _this;
828 public Xcls_severity_id(Ticket _owner )
831 _this.severity_id = this;
832 this.el = new Gtk.ComboBox.with_entry();
835 this.loading = false;
837 // set gobject values
838 var child_0 = new Xcls_sevmodel( _this );
840 this.el.set_model ( child_0.el );
844 this.el.set_entry_text_column(1);
847 // user defined functions
848 public string selectedSeverityId () {
853 this.el.get_active_iter (out iter);
854 _this.sevmodel.el.get_value (iter, 0, out val1);
857 return (string) val1;
864 public class Xcls_sevmodel : Object
866 public Gtk.ListStore el;
867 private Ticket _this;
873 public Xcls_sevmodel(Ticket _owner )
876 _this.sevmodel = this;
877 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
881 // set gobject values
884 // user defined functions
885 public void loadSeverities () {
887 var rt = RooTicket.singleton();
890 _this.severity_id.loading = true;
896 var projects = rt.serverities;
897 foreach(var project in projects) {
901 el.set_value(iter, 0, project.id);
902 el.set_value(iter, 1, project.display_name );
903 if ("normal" == project.name) {
904 _this.severity_id.el.set_active_iter(iter);
909 _this.severity_id.loading = false;
910 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
916 public class Xcls_Label21 : Object
919 private Ticket _this;
925 public Xcls_Label21(Ticket _owner )
928 this.el = new Gtk.Label( "Classification" );
932 // set gobject values
933 this.el.halign = Gtk.Align.START;
936 // user defined functions
939 public class Xcls_classification_id : Object
941 public Gtk.ComboBox el;
942 private Ticket _this;
949 public Xcls_classification_id(Ticket _owner )
952 _this.classification_id = this;
953 this.el = new Gtk.ComboBox.with_entry();
956 this.loading = false;
958 // set gobject values
959 var child_0 = new Xcls_clmodel( _this );
961 this.el.set_model ( child_0.el );
965 this.el.set_entry_text_column(1);
968 // user defined functions
969 public string selectedClassificationId () {
974 this.el.get_active_iter (out iter);
975 _this.clmodel.el.get_value (iter, 0, out val1);
978 return (string) val1;
985 public class Xcls_clmodel : Object
987 public Gtk.ListStore el;
988 private Ticket _this;
994 public Xcls_clmodel(Ticket _owner )
997 _this.clmodel = this;
998 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
1002 // set gobject values
1005 // user defined functions
1006 public void loadClassifications ( ) {
1008 var rt = RooTicket.singleton();
1009 // rt.loadProjects();
1011 _this.classification_id.loading = true;
1017 el.append(out iter);
1020 var projects = rt.classifications;
1021 foreach(var project in projects) {
1023 el.append(out iter);
1025 el.set_value(iter, 0, project.id);
1026 el.set_value(iter, 1, project.display_name );
1027 if ("bug" == project.name) {
1028 _this.classification_id.el.set_active_iter(iter);
1033 _this.classification_id.loading = false;
1034 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
1040 public class Xcls_Label24 : Object
1042 public Gtk.Label el;
1043 private Ticket _this;
1049 public Xcls_Label24(Ticket _owner )
1052 this.el = new Gtk.Label( "Assign to" );
1056 // set gobject values
1057 this.el.halign = Gtk.Align.START;
1060 // user defined functions
1063 public class Xcls_developer_id : Object
1065 public Gtk.ComboBox el;
1066 private Ticket _this;
1070 public bool loading;
1073 public Xcls_developer_id(Ticket _owner )
1076 _this.developer_id = this;
1077 this.el = new Gtk.ComboBox.with_entry();
1080 this.loading = false;
1082 // set gobject values
1083 var child_0 = new Xcls_devmodel( _this );
1085 this.el.set_model ( child_0.el );
1089 this.el.set_entry_text_column(1);
1092 // user defined functions
1093 public string selectedDeveloperId () {
1098 this.el.get_active_iter (out iter);
1099 _this.devmodel.el.get_value (iter, 0, out val1);
1102 return (string) val1;
1109 public class Xcls_devmodel : Object
1111 public Gtk.ListStore el;
1112 private Ticket _this;
1118 public Xcls_devmodel(Ticket _owner )
1121 _this.devmodel = this;
1122 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
1126 // set gobject values
1129 // user defined functions
1130 public void loadDevelopers ( ) {
1132 var rt = RooTicket.singleton();
1133 //rt.loadProjects();
1135 _this.developer_id.loading = true;
1141 el.append(out iter);
1144 el.set_value(iter, 0, "");
1145 el.set_value(iter, 1, "-- select a developer --");
1147 _this.developer_id.el.set_active_iter(iter);
1150 var projects = rt.developers;
1151 foreach(var project in projects) {
1153 el.append(out iter);
1155 el.set_value(iter, 0, project.id);
1156 el.set_value(iter, 1, project.display_name );
1157 // if (id == project.id) {
1158 // _this.projectsel.el.set_active_iter(iter);
1163 _this.developer_id.loading = false;
1164 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
1170 public class Xcls_Button27 : Object
1172 public Gtk.Button el;
1173 private Ticket _this;
1179 public Xcls_Button27(Ticket _owner )
1182 this.el = new Gtk.Button();
1186 // set gobject values
1187 this.el.label = "Create Ticket";
1192 this.el.get_style_context().add_class("suggested-action");
1196 this.el.clicked.connect( () => {
1197 GLib.debug("fire response = 1");
1200 var invalid = false;
1202 // validate first...
1203 _this.project_id.el.get_child().get_style_context().remove_class("warning");
1204 if (_this.project_id.selectedProjectId() == "") {
1205 _this.project_id.el.get_child().get_style_context().add_class("warning");
1209 _this.milestone_id.el.get_child().get_style_context().remove_class("warning");
1210 if (_this.milestone_id.selectedMilestoneId() == "") {
1211 _this.milestone_id.el.get_child().get_style_context().add_class("warning");
1215 _this.priority_id.el.get_child().get_style_context().remove_class("warning");
1216 if (_this.priority_id.selectedPriorityId() == "") {
1217 _this.priority_id.el.get_child().get_style_context().add_class("warning");
1221 _this.classification_id.el.get_child().get_style_context().remove_class("warning");
1222 if (_this.classification_id.selectedClassificationId() == "") {
1223 _this.classification_id.el.get_child().get_style_context().add_class("warning");
1227 _this.developer_id.el.get_child().get_style_context().remove_class("warning");
1228 if (_this.developer_id.selectedDeveloperId() == "") {
1229 _this.developer_id.el.get_child().get_style_context().add_class("warning");
1233 _this.summary.el.get_style_context().remove_class("warning");
1234 if (_this.summary.el.get_text() == "") {
1235 _this.summary.el.get_style_context().add_class("warning");
1239 _this.description.el.get_style_context().remove_class("warning");
1240 if (_this.description.el.buffer.text == "") {
1241 _this.description.el.get_style_context().add_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