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) {
78 // user defined functions
79 public void show ( GitRepo? repo )
81 // this.el.set_gravity(Gdk.Gravity.NORTH);
82 if (this.running) { // should not happen!!
83 GLib.error("new branch show called, when already being displayed?");
88 //GitMonitor.gitmonitor.stop();
95 this.el.move((Gdk.Screen.width() / 2)- 250 ,0);
96 this.el.set_default_size( 500,200); // not sure why it grows..
97 GLib.debug("Loading tickets");
101 this.el.set_keep_above(true);
104 RooProject? curproj = null;
105 if (this.repo != null) {
106 curproj = RooTicket.singleton().getProjectByRepo(this.repo);
108 _this.prmodel.loadProjects(curproj == null ? "" : curproj.id);
114 public class Xcls_VBox2 : Object
117 private Ticket _this;
123 public Xcls_VBox2(Ticket _owner )
126 this.el = new Gtk.VBox( true, 0 );
130 // set gobject values
131 var child_0 = new Xcls_Table3( _this );
133 this.el.pack_start ( child_0.el , false,false,0 );
136 // user defined functions
138 public class Xcls_Table3 : Object
141 private Ticket _this;
147 public Xcls_Table3(Ticket _owner )
150 this.el = new Gtk.Table( 14, 4, true );
154 // set gobject values
155 this.el.expand = false;
157 this.el.column_spacing = 4;
158 this.el.vexpand = false;
159 var child_0 = new Xcls_Label4( _this );
161 this.el.attach_defaults ( child_0.el , 0,1,0,1 );
162 var child_1 = new Xcls_Label5( _this );
164 this.el.attach_defaults ( child_1.el , 1,2,0,1 );
165 var child_2 = new Xcls_project_id( _this );
167 this.el.attach_defaults ( child_2.el , 0,1,1,2 );
168 var child_3 = new Xcls_summary( _this );
170 this.el.attach_defaults ( child_3.el , 1,4,1,2 );
171 var child_4 = new Xcls_Label10( _this );
173 this.el.attach_defaults ( child_4.el , 0,1,2,3 );
174 var child_5 = new Xcls_milestone_id( _this );
176 this.el.attach_defaults ( child_5.el , 0,1,3,4 );
177 var child_6 = new Xcls_Label13( _this );
179 this.el.attach_defaults ( child_6.el , 1,4,2,3 );
180 var child_7 = new Xcls_description( _this );
182 this.el.attach_defaults ( child_7.el , 1,4,3,12 );
183 var child_8 = new Xcls_Label15( _this );
185 this.el.attach_defaults ( child_8.el , 0,1,4,5 );
186 var child_9 = new Xcls_priority_id( _this );
188 this.el.attach_defaults ( child_9.el , 0,1,5,6 );
189 var child_10 = new Xcls_Label18( _this );
191 this.el.attach_defaults ( child_10.el , 0,1,6,7 );
192 var child_11 = new Xcls_severity_id( _this );
194 this.el.attach_defaults ( child_11.el , 0,1,7,8 );
195 var child_12 = new Xcls_Label21( _this );
197 this.el.attach_defaults ( child_12.el , 0,1,8,9 );
198 var child_13 = new Xcls_classification_id( _this );
200 this.el.attach_defaults ( child_13.el , 0,1,9,10 );
201 var child_14 = new Xcls_Label24( _this );
203 this.el.attach_defaults ( child_14.el , 0,1,10,11 );
204 var child_15 = new Xcls_developer_id( _this );
206 this.el.attach_defaults ( child_15.el , 0,1,11,12 );
207 var child_16 = new Xcls_Button27( _this );
209 this.el.attach_defaults ( child_16.el , 0,4,13,14 );
212 // user defined functions
214 public class Xcls_Label4 : Object
217 private Ticket _this;
223 public Xcls_Label4(Ticket _owner )
226 this.el = new Gtk.Label( "Project" );
230 // set gobject values
231 this.el.halign = Gtk.Align.START;
232 this.el.visible = true;
235 // user defined functions
238 public class Xcls_Label5 : Object
241 private Ticket _this;
247 public Xcls_Label5(Ticket _owner )
250 this.el = new Gtk.Label( "Summary" );
254 // set gobject values
255 this.el.halign = Gtk.Align.START;
256 this.el.visible = true;
259 // user defined functions
262 public class Xcls_project_id : Object
264 public Gtk.ComboBox el;
265 private Ticket _this;
272 public Xcls_project_id(Ticket _owner )
275 _this.project_id = this;
276 this.el = new Gtk.ComboBox.with_entry();
279 this.loading = false;
281 // set gobject values
282 var child_0 = new Xcls_prcellrenderer( _this );
284 this.el.pack_start ( child_0.el , true );
285 var child_1 = new Xcls_prmodel( _this );
287 this.el.set_model ( child_1.el );
291 this.el.set_entry_text_column(1);
294 this.el.changed.connect( () => {
298 var project_id = this.selectedProjectId();
300 var rt = RooTicket.singleton();
301 rt.loadProjectOptions(project_id);
303 _this.milestone_id.loadMilestones();
304 _this.priority_id.loadPriorities();
305 _this.severity_id.loadSeverities();
306 _this.classification_id.loadClassifications();
307 // affects projects and milestones..
310 /*if (this.loading) {
313 var ticket_id = this.selectedTicketId();
315 var name = RooTicket.singleton().usernameLocal();
317 if (ticket_id == "" || ticket_id == null) {
319 var dt = new DateTime.now_local();
320 _this.name.el.set_text("wip_%s_%s".printf(name,dt.format("%Y_%b_%d")));
325 var ticket = RooTicket.singleton().getById(ticket_id);
327 _this.name.el.set_text("wip_%s_T%s_%s".printf(name,ticket.id, ticket.summaryToBranchName()));
329 //GLib.debug (//"Selection: %s, %s\n", (string) val1, (string) val2);
334 // user defined functions
335 public string selectedProjectId () {
340 this.el.get_active_iter (out iter);
341 _this.prmodel.el.get_value (iter, 0, out val1);
344 return (string) val1;
351 public class Xcls_prcellrenderer : Object
353 public Gtk.CellRendererText el;
354 private Ticket _this;
360 public Xcls_prcellrenderer(Ticket _owner )
363 _this.prcellrenderer = this;
364 this.el = new Gtk.CellRendererText();
368 // set gobject values
371 // user defined functions
374 public class Xcls_prmodel : Object
376 public Gtk.ListStore el;
377 private Ticket _this;
383 public Xcls_prmodel(Ticket _owner )
386 _this.prmodel = this;
387 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
391 // set gobject values
394 // user defined functions
395 public void loadProjects (string id) {
397 var rt = RooTicket.singleton();
400 _this.project_id.loading = true;
409 el.set_value(iter, 0, "");
410 el.set_value(iter, 1, "-- select a project --");
412 _this.project_id.el.set_active_iter(iter);
414 var projects = rt.projects;
415 foreach(var project in projects) {
419 el.set_value(iter, 0, project.id);
420 el.set_value(iter, 1, project.name );
421 if (id == project.id) {
422 _this.project_id.el.set_active_iter(iter);
427 _this.project_id.loading = false;
428 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
434 public class Xcls_summary : Object
437 private Ticket _this;
443 public Xcls_summary(Ticket _owner )
446 _this.summary = this;
447 this.el = new Gtk.Entry();
451 // set gobject values
452 this.el.visible = true;
455 // user defined functions
458 public class Xcls_Label10 : Object
461 private Ticket _this;
467 public Xcls_Label10(Ticket _owner )
470 this.el = new Gtk.Label( "Milestone" );
474 // set gobject values
475 this.el.halign = Gtk.Align.START;
476 this.el.justify = Gtk.Justification.RIGHT;
477 this.el.xalign = 0.900000f;
480 // user defined functions
483 public class Xcls_milestone_id : Object
485 public Gtk.ComboBox el;
486 private Ticket _this;
493 public Xcls_milestone_id(Ticket _owner )
496 _this.milestone_id = this;
497 this.el = new Gtk.ComboBox.with_entry();
500 this.loading = false;
502 // set gobject values
503 var child_0 = new Xcls_msmodel( _this );
505 this.el.set_model ( child_0.el );
509 this.el.set_entry_text_column(1);
512 // user defined functions
513 public string selectedMilestoneId () {
518 this.el.get_active_iter (out iter);
519 _this.msmodel.el.get_value (iter, 0, out val1);
522 return (string) val1;
529 public class Xcls_msmodel : Object
531 public Gtk.ListStore el;
532 private Ticket _this;
538 public Xcls_msmodel(Ticket _owner )
541 _this.msmodel = this;
542 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
546 // set gobject values
549 // user defined functions
550 public void loadMilestones (string id) {
552 var rt = RooTicket.singleton();
553 // rt.loadProjects();
555 _this.milestone_id.loading = true;
564 el.set_value(iter, 0, "");
565 el.set_value(iter, 1, "-- select a milestone --");
566 _this.milestone_id.el.set_active_iter(iter);
571 var projects = rt.projects;
572 foreach(var project in projects) {
576 el.set_value(iter, 0, project.id);
577 el.set_value(iter, 1, project.name );
578 if (id == project.id) {
579 _this.milestone.el.set_active_iter(iter);
585 _this.milestone_id.loading = false;
586 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
592 public class Xcls_Label13 : Object
595 private Ticket _this;
601 public Xcls_Label13(Ticket _owner )
604 this.el = new Gtk.Label( "Description" );
608 // set gobject values
609 this.el.halign = Gtk.Align.START;
612 // user defined functions
615 public class Xcls_description : Object
617 public Gtk.TextView el;
618 private Ticket _this;
624 public Xcls_description(Ticket _owner )
627 _this.description = this;
628 this.el = new Gtk.TextView();
632 // set gobject values
633 this.el.border_width = 1;
636 // user defined functions
639 public class Xcls_Label15 : Object
642 private Ticket _this;
648 public Xcls_Label15(Ticket _owner )
651 this.el = new Gtk.Label( "Priority" );
655 // set gobject values
656 this.el.halign = Gtk.Align.START;
657 this.el.xalign = 0.900000f;
660 // user defined functions
663 public class Xcls_priority_id : Object
665 public Gtk.ComboBox el;
666 private Ticket _this;
673 public Xcls_priority_id(Ticket _owner )
676 _this.priority_id = this;
677 this.el = new Gtk.ComboBox.with_entry();
680 this.loading = false;
682 // set gobject values
683 var child_0 = new Xcls_primodel( _this );
685 this.el.set_model ( child_0.el );
689 this.el.set_entry_text_column(1);
692 // user defined functions
693 public string selectedPriorityId () {
698 this.el.get_active_iter (out iter);
699 _this.primodel.el.get_value (iter, 0, out val1);
702 return (string) val1;
709 public class Xcls_primodel : Object
711 public Gtk.ListStore el;
712 private Ticket _this;
718 public Xcls_primodel(Ticket _owner )
721 _this.primodel = this;
722 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
726 // set gobject values
729 // user defined functions
730 public void loadPriority (string id) {
732 var rt = RooTicket.singleton();
733 // rt.loadProjects();
735 _this.priority_id.loading = true;
744 el.set_value(iter, 0, "");
745 el.set_value(iter, 1, "-- select priority --");
747 _this.priority_id.el.set_active_iter(iter);
749 /*var projects = rt.projects;
750 foreach(var project in projects) {
754 el.set_value(iter, 0, project.id);
755 el.set_value(iter, 1, project.name );
756 if (id == project.id) {
757 _this.priority_id.el.set_active_iter(iter);
762 _this.priority_id.loading = false;
769 public class Xcls_Label18 : Object
772 private Ticket _this;
778 public Xcls_Label18(Ticket _owner )
781 this.el = new Gtk.Label( "Severity" );
785 // set gobject values
786 this.el.halign = Gtk.Align.START;
789 // user defined functions
792 public class Xcls_severity_id : Object
794 public Gtk.ComboBox el;
795 private Ticket _this;
802 public Xcls_severity_id(Ticket _owner )
805 _this.severity_id = this;
806 this.el = new Gtk.ComboBox.with_entry();
809 this.loading = false;
811 // set gobject values
812 var child_0 = new Xcls_sevmodel( _this );
814 this.el.set_model ( child_0.el );
818 this.el.set_entry_text_column(1);
821 // user defined functions
822 public string selectedSeverityId () {
827 this.el.get_active_iter (out iter);
828 _this.sevmodel.el.get_value (iter, 0, out val1);
831 return (string) val1;
838 public class Xcls_sevmodel : Object
840 public Gtk.ListStore el;
841 private Ticket _this;
847 public Xcls_sevmodel(Ticket _owner )
850 _this.sevmodel = this;
851 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
855 // set gobject values
858 // user defined functions
859 public void loadProjects (string id) {
861 var rt = RooTicket.singleton();
864 _this.severity_id.loading = true;
873 el.set_value(iter, 0, "");
874 el.set_value(iter, 1, "-- select severity --");
876 _this.severity_id.el.set_active_iter(iter);
879 var projects = rt.projects;
880 foreach(var project in projects) {
884 el.set_value(iter, 0, project.id);
885 el.set_value(iter, 1, project.name );
886 if (id == project.id) {
887 _this.projectsel.el.set_active_iter(iter);
892 _this.severity_id.loading = false;
893 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
899 public class Xcls_Label21 : Object
902 private Ticket _this;
908 public Xcls_Label21(Ticket _owner )
911 this.el = new Gtk.Label( "Classification" );
915 // set gobject values
916 this.el.halign = Gtk.Align.START;
919 // user defined functions
922 public class Xcls_classification_id : Object
924 public Gtk.ComboBox el;
925 private Ticket _this;
932 public Xcls_classification_id(Ticket _owner )
935 _this.classification_id = this;
936 this.el = new Gtk.ComboBox.with_entry();
939 this.loading = false;
941 // set gobject values
942 var child_0 = new Xcls_clmodel( _this );
944 this.el.set_model ( child_0.el );
948 this.el.set_entry_text_column(1);
951 // user defined functions
952 public string selectedProjectId () {
957 this.el.get_active_iter (out iter);
958 _this.prmodel.el.get_value (iter, 0, out val1);
961 return (string) val1;
968 public class Xcls_clmodel : Object
970 public Gtk.ListStore el;
971 private Ticket _this;
977 public Xcls_clmodel(Ticket _owner )
980 _this.clmodel = this;
981 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
985 // set gobject values
988 // user defined functions
989 public void loadClassifications (string id) {
991 var rt = RooTicket.singleton();
992 // rt.loadProjects();
994 _this.classification_id.loading = true;
1000 el.append(out iter);
1003 el.set_value(iter, 0, "");
1004 el.set_value(iter, 1, "-- select a project --");
1006 _this.classification_id.el.set_active_iter(iter);
1009 var projects = rt.projects;
1010 foreach(var project in projects) {
1012 el.append(out iter);
1014 el.set_value(iter, 0, project.id);
1015 el.set_value(iter, 1, project.name );
1016 if (id == project.id) {
1017 _this.classification_id.el.set_active_iter(iter);
1022 _this.classification_id.loading = false;
1023 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
1029 public class Xcls_Label24 : Object
1031 public Gtk.Label el;
1032 private Ticket _this;
1038 public Xcls_Label24(Ticket _owner )
1041 this.el = new Gtk.Label( "Assign to" );
1045 // set gobject values
1046 this.el.halign = Gtk.Align.START;
1049 // user defined functions
1052 public class Xcls_developer_id : Object
1054 public Gtk.ComboBox el;
1055 private Ticket _this;
1059 public bool loading;
1062 public Xcls_developer_id(Ticket _owner )
1065 _this.developer_id = this;
1066 this.el = new Gtk.ComboBox.with_entry();
1069 this.loading = false;
1071 // set gobject values
1072 var child_0 = new Xcls_devmodel( _this );
1074 this.el.set_model ( child_0.el );
1078 this.el.set_entry_text_column(1);
1081 // user defined functions
1082 public string selectedDeveloperId () {
1087 this.el.get_active_iter (out iter);
1088 _this.devmodel.el.get_value (iter, 0, out val1);
1091 return (string) val1;
1098 public class Xcls_devmodel : Object
1100 public Gtk.ListStore el;
1101 private Ticket _this;
1107 public Xcls_devmodel(Ticket _owner )
1110 _this.devmodel = this;
1111 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
1115 // set gobject values
1118 // user defined functions
1119 public void loadDevelopers (string id) {
1121 var rt = RooTicket.singleton();
1122 //rt.loadProjects();
1124 _this.developer_id.loading = true;
1130 el.append(out iter);
1133 el.set_value(iter, 0, "");
1134 el.set_value(iter, 1, "-- select a project --");
1136 _this.developer_id.el.set_active_iter(iter);
1139 var projects = rt.projects;
1140 foreach(var project in projects) {
1142 el.append(out iter);
1144 el.set_value(iter, 0, project.id);
1145 el.set_value(iter, 1, project.name );
1146 if (id == project.id) {
1147 _this.projectsel.el.set_active_iter(iter);
1152 _this.developer_id.loading = false;
1153 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
1159 public class Xcls_Button27 : Object
1161 public Gtk.Button el;
1162 private Ticket _this;
1168 public Xcls_Button27(Ticket _owner )
1171 this.el = new Gtk.Button();
1175 // set gobject values
1176 this.el.label = "Create Ticket";
1181 this.el.get_style_context().add_class("suggested-action");
1185 this.el.clicked.connect( () => {
1186 GLib.debug("fire response = 1");
1187 _this.el.response(1);
1191 // user defined functions