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?");
106 _this.table.el.hide();
108 _this.spinner.el.show();
109 _this.spinner.el.start();
110 this.el.set_keep_above(true);
111 this.el.move((Gdk.Screen.width() / 2)- 250 ,0);
112 this.el.set_default_size( 500,200); // not sure why it grows..
114 GLib.debug("Showing dialog?");
115 Timeout.add_seconds(1, () => {
120 //GitMonitor.gitmonitor.stop();
127 // GLib.debug("Loading tickets");
131 RooProject? curproj = null;
132 if (this.repo != null) {
133 curproj = RooProject.getProjectByRepo(this.repo);
135 _this.prmodel.loadProjects(curproj == null ? "" : curproj.id);
136 if (curproj != null) {
139 var rt = RooTicket.singleton();
140 rt.loadProjectOptions(curproj.id);
142 _this.msmodel.loadMilestones();
143 _this.primodel.loadPriorities();
144 _this.sevmodel.loadSeverities();
145 _this.clmodel.loadClassifications();
146 _this.devmodel.loadDevelopers();
149 _this.summary.el.set_text("");
150 _this.description.el.buffer.text = "";
151 _this.spinner.el.stop();
152 _this.spinner.el.hide();
154 this.table.el.show();
167 public class Xcls_Box2 : Object
170 private Ticket _this;
176 public Xcls_Box2(Ticket _owner )
179 this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
183 // set gobject values
184 var child_0 = new Xcls_table( _this );
186 this.el.pack_start ( child_0.el , false,false,0 );
187 var child_1 = new Xcls_spinner( _this );
189 this.el.add ( child_1.el );
192 // user defined functions
194 public class Xcls_table : Object
197 private Ticket _this;
203 public Xcls_table(Ticket _owner )
207 this.el = new Gtk.Table( 14, 4, true );
211 // set gobject values
212 this.el.expand = false;
214 this.el.column_spacing = 4;
215 this.el.vexpand = false;
216 var child_0 = new Xcls_Label4( _this );
218 this.el.attach_defaults ( child_0.el , 0,1,0,1 );
219 var child_1 = new Xcls_Label5( _this );
221 this.el.attach_defaults ( child_1.el , 1,2,0,1 );
222 var child_2 = new Xcls_project_id( _this );
224 this.el.attach_defaults ( child_2.el , 0,1,1,2 );
225 var child_3 = new Xcls_summary( _this );
227 this.el.attach_defaults ( child_3.el , 1,4,1,2 );
228 var child_4 = new Xcls_Label10( _this );
230 this.el.attach_defaults ( child_4.el , 0,1,2,3 );
231 var child_5 = new Xcls_milestone_id( _this );
233 this.el.attach_defaults ( child_5.el , 0,1,3,4 );
234 var child_6 = new Xcls_Label13( _this );
236 this.el.attach_defaults ( child_6.el , 1,4,2,3 );
237 var child_7 = new Xcls_description( _this );
239 this.el.attach_defaults ( child_7.el , 1,4,3,12 );
240 var child_8 = new Xcls_Label15( _this );
242 this.el.attach_defaults ( child_8.el , 0,1,4,5 );
243 var child_9 = new Xcls_priority_id( _this );
245 this.el.attach_defaults ( child_9.el , 0,1,5,6 );
246 var child_10 = new Xcls_Label18( _this );
248 this.el.attach_defaults ( child_10.el , 0,1,6,7 );
249 var child_11 = new Xcls_severity_id( _this );
251 this.el.attach_defaults ( child_11.el , 0,1,7,8 );
252 var child_12 = new Xcls_Label21( _this );
254 this.el.attach_defaults ( child_12.el , 0,1,8,9 );
255 var child_13 = new Xcls_classification_id( _this );
257 this.el.attach_defaults ( child_13.el , 0,1,9,10 );
258 var child_14 = new Xcls_Label24( _this );
260 this.el.attach_defaults ( child_14.el , 0,1,10,11 );
261 var child_15 = new Xcls_developer_id( _this );
263 this.el.attach_defaults ( child_15.el , 0,1,11,12 );
264 var child_16 = new Xcls_Button27( _this );
266 this.el.attach_defaults ( child_16.el , 0,4,13,14 );
269 // user defined functions
271 public class Xcls_Label4 : Object
274 private Ticket _this;
280 public Xcls_Label4(Ticket _owner )
283 this.el = new Gtk.Label( "Project" );
287 // set gobject values
288 this.el.halign = Gtk.Align.START;
289 this.el.visible = true;
292 // user defined functions
295 public class Xcls_Label5 : Object
298 private Ticket _this;
304 public Xcls_Label5(Ticket _owner )
307 this.el = new Gtk.Label( "Summary" );
311 // set gobject values
312 this.el.halign = Gtk.Align.START;
313 this.el.visible = true;
316 // user defined functions
319 public class Xcls_project_id : Object
321 public Gtk.ComboBox el;
322 private Ticket _this;
329 public Xcls_project_id(Ticket _owner )
332 _this.project_id = this;
333 this.el = new Gtk.ComboBox.with_entry();
336 this.loading = false;
338 // set gobject values
339 var child_0 = new Xcls_prcellrenderer( _this );
341 this.el.pack_start ( child_0.el , true );
342 var child_1 = new Xcls_prmodel( _this );
344 this.el.set_model ( child_1.el );
348 this.el.set_entry_text_column(1);
351 this.el.changed.connect( () => {
355 var project_id = this.selectedProjectId();
357 var rt = RooTicket.singleton();
358 rt.loadProjectOptions(project_id);
360 _this.msmodel.loadMilestones();
361 _this.primodel.loadPriorities();
362 _this.sevmodel.loadSeverities();
363 _this.clmodel.loadClassifications();
364 _this.devmodel.loadDevelopers();
366 // affects projects and milestones..
369 /*if (this.loading) {
372 var ticket_id = this.selectedTicketId();
374 var name = RooTicket.singleton().usernameLocal();
376 if (ticket_id == "" || ticket_id == null) {
378 var dt = new DateTime.now_local();
379 _this.name.el.set_text("wip_%s_%s".printf(name,dt.format("%Y_%b_%d")));
384 var ticket = RooTicket.singleton().getById(ticket_id);
386 _this.name.el.set_text("wip_%s_T%s_%s".printf(name,ticket.id, ticket.summaryToBranchName()));
388 //GLib.debug (//"Selection: %s, %s\n", (string) val1, (string) val2);
393 // user defined functions
394 public string selectedProjectId () {
399 this.el.get_active_iter (out iter);
400 _this.prmodel.el.get_value (iter, 0, out val1);
403 return (string) val1;
410 public class Xcls_prcellrenderer : Object
412 public Gtk.CellRendererText el;
413 private Ticket _this;
419 public Xcls_prcellrenderer(Ticket _owner )
422 _this.prcellrenderer = this;
423 this.el = new Gtk.CellRendererText();
427 // set gobject values
430 // user defined functions
433 public class Xcls_prmodel : Object
435 public Gtk.ListStore el;
436 private Ticket _this;
442 public Xcls_prmodel(Ticket _owner )
445 _this.prmodel = this;
446 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
450 // set gobject values
453 // user defined functions
454 public void loadProjects (string id) {
457 _this.project_id.loading = true;
466 el.set_value(iter, 0, "");
467 el.set_value(iter, 1, "-- select a project --");
469 _this.project_id.el.set_active_iter(iter);
472 foreach(var project in RooProject.projects()) {
476 el.set_value(iter, 0, project.id);
477 el.set_value(iter, 1, project.name );
478 if (id == project.id) {
479 _this.project_id.el.set_active_iter(iter);
484 _this.project_id.loading = false;
485 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
491 public class Xcls_summary : Object
494 private Ticket _this;
500 public Xcls_summary(Ticket _owner )
503 _this.summary = this;
504 this.el = new Gtk.Entry();
508 // set gobject values
509 this.el.visible = true;
512 // user defined functions
515 public class Xcls_Label10 : Object
518 private Ticket _this;
524 public Xcls_Label10(Ticket _owner )
527 this.el = new Gtk.Label( "Milestone" );
531 // set gobject values
532 this.el.halign = Gtk.Align.START;
533 this.el.justify = Gtk.Justification.RIGHT;
534 this.el.xalign = 0.900000f;
537 // user defined functions
540 public class Xcls_milestone_id : Object
542 public Gtk.ComboBox el;
543 private Ticket _this;
550 public Xcls_milestone_id(Ticket _owner )
553 _this.milestone_id = this;
554 this.el = new Gtk.ComboBox.with_entry();
557 this.loading = false;
559 // set gobject values
560 var child_0 = new Xcls_msmodel( _this );
562 this.el.set_model ( child_0.el );
566 this.el.set_entry_text_column(1);
569 // user defined functions
570 public string selectedMilestoneId () {
575 this.el.get_active_iter (out iter);
576 _this.msmodel.el.get_value (iter, 0, out val1);
579 return (string) val1;
586 public class Xcls_msmodel : Object
588 public Gtk.ListStore el;
589 private Ticket _this;
595 public Xcls_msmodel(Ticket _owner )
598 _this.msmodel = this;
599 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
603 // set gobject values
606 // user defined functions
607 public void loadMilestones ( ) {
609 var rt = RooTicket.singleton();
610 // rt.loadProjects();
612 _this.milestone_id.loading = true;
621 el.set_value(iter, 0, "");
622 el.set_value(iter, 1, "-- select a milestone --");
623 _this.milestone_id.el.set_active_iter(iter);
625 var projects = rt.milestones;
626 foreach(var project in projects) {
630 el.set_value(iter, 0, project.id);
631 el.set_value(iter, 1, project.display_name );
632 // if (id == project.id) {
633 // _this.milestone.el.set_active_iter(iter);
639 _this.milestone_id.loading = false;
640 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
646 public class Xcls_Label13 : Object
649 private Ticket _this;
655 public Xcls_Label13(Ticket _owner )
658 this.el = new Gtk.Label( "Description" );
662 // set gobject values
663 this.el.halign = Gtk.Align.START;
666 // user defined functions
669 public class Xcls_description : Object
671 public Gtk.TextView el;
672 private Ticket _this;
678 public Xcls_description(Ticket _owner )
681 _this.description = this;
682 this.el = new Gtk.TextView();
686 // set gobject values
687 this.el.border_width = 1;
690 // user defined functions
693 public class Xcls_Label15 : Object
696 private Ticket _this;
702 public Xcls_Label15(Ticket _owner )
705 this.el = new Gtk.Label( "Priority" );
709 // set gobject values
710 this.el.halign = Gtk.Align.START;
711 this.el.xalign = 0.900000f;
714 // user defined functions
717 public class Xcls_priority_id : Object
719 public Gtk.ComboBox el;
720 private Ticket _this;
727 public Xcls_priority_id(Ticket _owner )
730 _this.priority_id = this;
731 this.el = new Gtk.ComboBox.with_entry();
734 this.loading = false;
736 // set gobject values
737 var child_0 = new Xcls_primodel( _this );
739 this.el.set_model ( child_0.el );
743 this.el.set_entry_text_column(1);
746 // user defined functions
747 public string selectedPriorityId () {
752 this.el.get_active_iter (out iter);
753 _this.primodel.el.get_value (iter, 0, out val1);
756 return (string) val1;
763 public class Xcls_primodel : Object
765 public Gtk.ListStore el;
766 private Ticket _this;
772 public Xcls_primodel(Ticket _owner )
775 _this.primodel = this;
776 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
780 // set gobject values
783 // user defined functions
784 public void loadPriorities ( ) {
786 var rt = RooTicket.singleton();
787 // rt.loadProjects();
789 _this.priority_id.loading = true;
796 var projects = rt.priorities;
797 foreach(var project in projects) {
801 el.set_value(iter, 0, project.id);
802 el.set_value(iter, 1, project.display_name );
803 if ("normal" == project.name) {
804 _this.priority_id.el.set_active_iter(iter);
809 _this.priority_id.loading = false;
816 public class Xcls_Label18 : Object
819 private Ticket _this;
825 public Xcls_Label18(Ticket _owner )
828 this.el = new Gtk.Label( "Severity" );
832 // set gobject values
833 this.el.halign = Gtk.Align.START;
836 // user defined functions
839 public class Xcls_severity_id : Object
841 public Gtk.ComboBox el;
842 private Ticket _this;
849 public Xcls_severity_id(Ticket _owner )
852 _this.severity_id = this;
853 this.el = new Gtk.ComboBox.with_entry();
856 this.loading = false;
858 // set gobject values
859 var child_0 = new Xcls_sevmodel( _this );
861 this.el.set_model ( child_0.el );
865 this.el.set_entry_text_column(1);
868 // user defined functions
869 public string selectedSeverityId () {
874 this.el.get_active_iter (out iter);
875 _this.sevmodel.el.get_value (iter, 0, out val1);
878 return (string) val1;
885 public class Xcls_sevmodel : Object
887 public Gtk.ListStore el;
888 private Ticket _this;
894 public Xcls_sevmodel(Ticket _owner )
897 _this.sevmodel = this;
898 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
902 // set gobject values
905 // user defined functions
906 public void loadSeverities () {
908 var rt = RooTicket.singleton();
911 _this.severity_id.loading = true;
917 var projects = rt.serverities;
918 foreach(var project in projects) {
922 el.set_value(iter, 0, project.id);
923 el.set_value(iter, 1, project.display_name );
924 if ("normal" == project.name) {
925 _this.severity_id.el.set_active_iter(iter);
930 _this.severity_id.loading = false;
931 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
937 public class Xcls_Label21 : Object
940 private Ticket _this;
946 public Xcls_Label21(Ticket _owner )
949 this.el = new Gtk.Label( "Classification" );
953 // set gobject values
954 this.el.halign = Gtk.Align.START;
957 // user defined functions
960 public class Xcls_classification_id : Object
962 public Gtk.ComboBox el;
963 private Ticket _this;
970 public Xcls_classification_id(Ticket _owner )
973 _this.classification_id = this;
974 this.el = new Gtk.ComboBox.with_entry();
977 this.loading = false;
979 // set gobject values
980 var child_0 = new Xcls_clmodel( _this );
982 this.el.set_model ( child_0.el );
986 this.el.set_entry_text_column(1);
989 // user defined functions
990 public string selectedClassificationId () {
995 this.el.get_active_iter (out iter);
996 _this.clmodel.el.get_value (iter, 0, out val1);
999 return (string) val1;
1006 public class Xcls_clmodel : Object
1008 public Gtk.ListStore el;
1009 private Ticket _this;
1015 public Xcls_clmodel(Ticket _owner )
1018 _this.clmodel = this;
1019 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
1023 // set gobject values
1026 // user defined functions
1027 public void loadClassifications ( ) {
1029 var rt = RooTicket.singleton();
1030 // rt.loadProjects();
1032 _this.classification_id.loading = true;
1038 el.append(out iter);
1041 var projects = rt.classifications;
1042 foreach(var project in projects) {
1044 el.append(out iter);
1046 el.set_value(iter, 0, project.id);
1047 el.set_value(iter, 1, project.display_name );
1048 if ("bug" == project.name) {
1049 _this.classification_id.el.set_active_iter(iter);
1054 _this.classification_id.loading = false;
1055 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
1061 public class Xcls_Label24 : Object
1063 public Gtk.Label el;
1064 private Ticket _this;
1070 public Xcls_Label24(Ticket _owner )
1073 this.el = new Gtk.Label( "Assign to" );
1077 // set gobject values
1078 this.el.halign = Gtk.Align.START;
1081 // user defined functions
1084 public class Xcls_developer_id : Object
1086 public Gtk.ComboBox el;
1087 private Ticket _this;
1091 public bool loading;
1094 public Xcls_developer_id(Ticket _owner )
1097 _this.developer_id = this;
1098 this.el = new Gtk.ComboBox.with_entry();
1101 this.loading = false;
1103 // set gobject values
1104 var child_0 = new Xcls_devmodel( _this );
1106 this.el.set_model ( child_0.el );
1110 this.el.set_entry_text_column(1);
1113 // user defined functions
1114 public string selectedDeveloperId () {
1119 this.el.get_active_iter (out iter);
1120 _this.devmodel.el.get_value (iter, 0, out val1);
1123 return (string) val1;
1130 public class Xcls_devmodel : Object
1132 public Gtk.ListStore el;
1133 private Ticket _this;
1139 public Xcls_devmodel(Ticket _owner )
1142 _this.devmodel = this;
1143 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
1147 // set gobject values
1150 // user defined functions
1151 public void loadDevelopers ( ) {
1153 var rt = RooTicket.singleton();
1154 //rt.loadProjects();
1156 _this.developer_id.loading = true;
1162 el.append(out iter);
1165 el.set_value(iter, 0, "");
1166 el.set_value(iter, 1, "-- select a developer --");
1168 _this.developer_id.el.set_active_iter(iter);
1171 var projects = rt.developers;
1172 foreach(var project in projects) {
1174 el.append(out iter);
1176 el.set_value(iter, 0, project.id);
1177 el.set_value(iter, 1, project.display_name );
1178 // if (id == project.id) {
1179 // _this.projectsel.el.set_active_iter(iter);
1184 _this.developer_id.loading = false;
1185 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
1191 public class Xcls_Button27 : Object
1193 public Gtk.Button el;
1194 private Ticket _this;
1200 public Xcls_Button27(Ticket _owner )
1203 this.el = new Gtk.Button();
1207 // set gobject values
1208 this.el.label = "Create Ticket";
1213 this.el.get_style_context().add_class("suggested-action");
1217 this.el.clicked.connect( () => {
1218 GLib.debug("fire response = 1");
1221 var invalid = false;
1223 // validate first...
1224 _this.project_id.el.get_child().get_style_context().remove_class("warning");
1225 if (_this.project_id.selectedProjectId() == "") {
1226 _this.project_id.el.get_child().get_style_context().add_class("warning");
1230 _this.milestone_id.el.get_child().get_style_context().remove_class("warning");
1231 if (_this.milestone_id.selectedMilestoneId() == "") {
1232 _this.milestone_id.el.get_child().get_style_context().add_class("warning");
1236 _this.priority_id.el.get_child().get_style_context().remove_class("warning");
1237 if (_this.priority_id.selectedPriorityId() == "") {
1238 _this.priority_id.el.get_child().get_style_context().add_class("warning");
1242 _this.classification_id.el.get_child().get_style_context().remove_class("warning");
1243 if (_this.classification_id.selectedClassificationId() == "") {
1244 _this.classification_id.el.get_child().get_style_context().add_class("warning");
1248 _this.developer_id.el.get_child().get_style_context().remove_class("warning");
1249 if (_this.developer_id.selectedDeveloperId() == "") {
1250 _this.developer_id.el.get_child().get_style_context().add_class("warning");
1254 _this.summary.el.get_style_context().remove_class("warning");
1255 if (_this.summary.el.get_text() == "") {
1256 _this.summary.el.get_style_context().add_class("warning");
1260 _this.description.el.get_style_context().remove_class("warning");
1261 if (_this.description.el.buffer.text == "") {
1262 _this.description.el.get_style_context().add_class("warning");
1270 GLib.debug("for is valid");
1272 _this.el.response(1);
1276 // user defined functions
1280 public class Xcls_spinner : Object
1282 public Gtk.Spinner el;
1283 private Ticket _this;
1289 public Xcls_spinner(Ticket _owner )
1292 _this.spinner = this;
1293 this.el = new Gtk.Spinner();
1297 // set gobject values
1298 this.el.hexpand = true;
1299 this.el.vexpand = true;
1302 // user defined functions