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 while(Gtk.events_pending()) {
116 Gtk.main_iteration();
122 //GitMonitor.gitmonitor.stop();
129 // GLib.debug("Loading tickets");
133 RooProject? curproj = null;
134 if (this.repo != null) {
135 curproj = RooProject.getProjectByRepo(this.repo);
137 _this.prmodel.loadProjects(curproj == null ? "" : curproj.id);
138 if (curproj != null) {
141 var rt = RooTicket.singleton();
142 rt.loadProjectOptions(curproj.id);
144 _this.msmodel.loadMilestones();
145 _this.primodel.loadPriorities();
146 _this.sevmodel.loadSeverities();
147 _this.clmodel.loadClassifications();
148 _this.devmodel.loadDevelopers();
151 _this.summary.el.set_text("");
152 _this.description.el.buffer.text = "";
153 _this.spinner.el.stop();
154 _this.spinner.el.hide();
156 this.table.el.show();
165 public class Xcls_Box2 : Object
168 private Ticket _this;
174 public Xcls_Box2(Ticket _owner )
177 this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
181 // set gobject values
182 var child_0 = new Xcls_table( _this );
184 this.el.pack_start ( child_0.el , false,false,0 );
185 var child_1 = new Xcls_spinner( _this );
187 this.el.add ( child_1.el );
190 // user defined functions
192 public class Xcls_table : Object
195 private Ticket _this;
201 public Xcls_table(Ticket _owner )
205 this.el = new Gtk.Table( 14, 4, true );
209 // set gobject values
210 this.el.expand = false;
212 this.el.column_spacing = 4;
213 this.el.vexpand = false;
214 var child_0 = new Xcls_Label4( _this );
216 this.el.attach_defaults ( child_0.el , 0,1,0,1 );
217 var child_1 = new Xcls_Label5( _this );
219 this.el.attach_defaults ( child_1.el , 1,2,0,1 );
220 var child_2 = new Xcls_project_id( _this );
222 this.el.attach_defaults ( child_2.el , 0,1,1,2 );
223 var child_3 = new Xcls_summary( _this );
225 this.el.attach_defaults ( child_3.el , 1,4,1,2 );
226 var child_4 = new Xcls_Label10( _this );
228 this.el.attach_defaults ( child_4.el , 0,1,2,3 );
229 var child_5 = new Xcls_milestone_id( _this );
231 this.el.attach_defaults ( child_5.el , 0,1,3,4 );
232 var child_6 = new Xcls_Label13( _this );
234 this.el.attach_defaults ( child_6.el , 1,4,2,3 );
235 var child_7 = new Xcls_description( _this );
237 this.el.attach_defaults ( child_7.el , 1,4,3,12 );
238 var child_8 = new Xcls_Label15( _this );
240 this.el.attach_defaults ( child_8.el , 0,1,4,5 );
241 var child_9 = new Xcls_priority_id( _this );
243 this.el.attach_defaults ( child_9.el , 0,1,5,6 );
244 var child_10 = new Xcls_Label18( _this );
246 this.el.attach_defaults ( child_10.el , 0,1,6,7 );
247 var child_11 = new Xcls_severity_id( _this );
249 this.el.attach_defaults ( child_11.el , 0,1,7,8 );
250 var child_12 = new Xcls_Label21( _this );
252 this.el.attach_defaults ( child_12.el , 0,1,8,9 );
253 var child_13 = new Xcls_classification_id( _this );
255 this.el.attach_defaults ( child_13.el , 0,1,9,10 );
256 var child_14 = new Xcls_Label24( _this );
258 this.el.attach_defaults ( child_14.el , 0,1,10,11 );
259 var child_15 = new Xcls_developer_id( _this );
261 this.el.attach_defaults ( child_15.el , 0,1,11,12 );
262 var child_16 = new Xcls_Button27( _this );
264 this.el.attach_defaults ( child_16.el , 0,4,13,14 );
267 // user defined functions
269 public class Xcls_Label4 : Object
272 private Ticket _this;
278 public Xcls_Label4(Ticket _owner )
281 this.el = new Gtk.Label( "Project" );
285 // set gobject values
286 this.el.halign = Gtk.Align.START;
287 this.el.visible = true;
290 // user defined functions
293 public class Xcls_Label5 : Object
296 private Ticket _this;
302 public Xcls_Label5(Ticket _owner )
305 this.el = new Gtk.Label( "Summary" );
309 // set gobject values
310 this.el.halign = Gtk.Align.START;
311 this.el.visible = true;
314 // user defined functions
317 public class Xcls_project_id : Object
319 public Gtk.ComboBox el;
320 private Ticket _this;
327 public Xcls_project_id(Ticket _owner )
330 _this.project_id = this;
331 this.el = new Gtk.ComboBox.with_entry();
334 this.loading = false;
336 // set gobject values
337 var child_0 = new Xcls_prcellrenderer( _this );
339 this.el.pack_start ( child_0.el , true );
340 var child_1 = new Xcls_prmodel( _this );
342 this.el.set_model ( child_1.el );
346 this.el.set_entry_text_column(1);
349 this.el.changed.connect( () => {
353 var project_id = this.selectedProjectId();
355 var rt = RooTicket.singleton();
356 rt.loadProjectOptions(project_id);
358 _this.msmodel.loadMilestones();
359 _this.primodel.loadPriorities();
360 _this.sevmodel.loadSeverities();
361 _this.clmodel.loadClassifications();
362 _this.devmodel.loadDevelopers();
364 // affects projects and milestones..
367 /*if (this.loading) {
370 var ticket_id = this.selectedTicketId();
372 var name = RooTicket.singleton().usernameLocal();
374 if (ticket_id == "" || ticket_id == null) {
376 var dt = new DateTime.now_local();
377 _this.name.el.set_text("wip_%s_%s".printf(name,dt.format("%Y_%b_%d")));
382 var ticket = RooTicket.singleton().getById(ticket_id);
384 _this.name.el.set_text("wip_%s_T%s_%s".printf(name,ticket.id, ticket.summaryToBranchName()));
386 //GLib.debug (//"Selection: %s, %s\n", (string) val1, (string) val2);
391 // user defined functions
392 public string selectedProjectId () {
397 this.el.get_active_iter (out iter);
398 _this.prmodel.el.get_value (iter, 0, out val1);
401 return (string) val1;
408 public class Xcls_prcellrenderer : Object
410 public Gtk.CellRendererText el;
411 private Ticket _this;
417 public Xcls_prcellrenderer(Ticket _owner )
420 _this.prcellrenderer = this;
421 this.el = new Gtk.CellRendererText();
425 // set gobject values
428 // user defined functions
431 public class Xcls_prmodel : Object
433 public Gtk.ListStore el;
434 private Ticket _this;
440 public Xcls_prmodel(Ticket _owner )
443 _this.prmodel = this;
444 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
448 // set gobject values
451 // user defined functions
452 public void loadProjects (string id) {
455 _this.project_id.loading = true;
464 el.set_value(iter, 0, "");
465 el.set_value(iter, 1, "-- select a project --");
467 _this.project_id.el.set_active_iter(iter);
470 foreach(var project in RooProject.projects()) {
474 el.set_value(iter, 0, project.id);
475 el.set_value(iter, 1, project.name );
476 if (id == project.id) {
477 _this.project_id.el.set_active_iter(iter);
482 _this.project_id.loading = false;
483 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
489 public class Xcls_summary : Object
492 private Ticket _this;
498 public Xcls_summary(Ticket _owner )
501 _this.summary = this;
502 this.el = new Gtk.Entry();
506 // set gobject values
507 this.el.visible = true;
510 // user defined functions
513 public class Xcls_Label10 : Object
516 private Ticket _this;
522 public Xcls_Label10(Ticket _owner )
525 this.el = new Gtk.Label( "Milestone" );
529 // set gobject values
530 this.el.halign = Gtk.Align.START;
531 this.el.justify = Gtk.Justification.RIGHT;
532 this.el.xalign = 0.900000f;
535 // user defined functions
538 public class Xcls_milestone_id : Object
540 public Gtk.ComboBox el;
541 private Ticket _this;
548 public Xcls_milestone_id(Ticket _owner )
551 _this.milestone_id = this;
552 this.el = new Gtk.ComboBox.with_entry();
555 this.loading = false;
557 // set gobject values
558 var child_0 = new Xcls_msmodel( _this );
560 this.el.set_model ( child_0.el );
564 this.el.set_entry_text_column(1);
567 // user defined functions
568 public string selectedMilestoneId () {
573 this.el.get_active_iter (out iter);
574 _this.msmodel.el.get_value (iter, 0, out val1);
577 return (string) val1;
584 public class Xcls_msmodel : Object
586 public Gtk.ListStore el;
587 private Ticket _this;
593 public Xcls_msmodel(Ticket _owner )
596 _this.msmodel = this;
597 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
601 // set gobject values
604 // user defined functions
605 public void loadMilestones ( ) {
607 var rt = RooTicket.singleton();
608 // rt.loadProjects();
610 _this.milestone_id.loading = true;
619 el.set_value(iter, 0, "");
620 el.set_value(iter, 1, "-- select a milestone --");
621 _this.milestone_id.el.set_active_iter(iter);
623 var projects = rt.milestones;
624 foreach(var project in projects) {
628 el.set_value(iter, 0, project.id);
629 el.set_value(iter, 1, project.display_name );
630 // if (id == project.id) {
631 // _this.milestone.el.set_active_iter(iter);
637 _this.milestone_id.loading = false;
638 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
644 public class Xcls_Label13 : Object
647 private Ticket _this;
653 public Xcls_Label13(Ticket _owner )
656 this.el = new Gtk.Label( "Description" );
660 // set gobject values
661 this.el.halign = Gtk.Align.START;
664 // user defined functions
667 public class Xcls_description : Object
669 public Gtk.TextView el;
670 private Ticket _this;
676 public Xcls_description(Ticket _owner )
679 _this.description = this;
680 this.el = new Gtk.TextView();
684 // set gobject values
685 this.el.border_width = 1;
688 // user defined functions
691 public class Xcls_Label15 : Object
694 private Ticket _this;
700 public Xcls_Label15(Ticket _owner )
703 this.el = new Gtk.Label( "Priority" );
707 // set gobject values
708 this.el.halign = Gtk.Align.START;
709 this.el.xalign = 0.900000f;
712 // user defined functions
715 public class Xcls_priority_id : Object
717 public Gtk.ComboBox el;
718 private Ticket _this;
725 public Xcls_priority_id(Ticket _owner )
728 _this.priority_id = this;
729 this.el = new Gtk.ComboBox.with_entry();
732 this.loading = false;
734 // set gobject values
735 var child_0 = new Xcls_primodel( _this );
737 this.el.set_model ( child_0.el );
741 this.el.set_entry_text_column(1);
744 // user defined functions
745 public string selectedPriorityId () {
750 this.el.get_active_iter (out iter);
751 _this.primodel.el.get_value (iter, 0, out val1);
754 return (string) val1;
761 public class Xcls_primodel : Object
763 public Gtk.ListStore el;
764 private Ticket _this;
770 public Xcls_primodel(Ticket _owner )
773 _this.primodel = this;
774 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
778 // set gobject values
781 // user defined functions
782 public void loadPriorities ( ) {
784 var rt = RooTicket.singleton();
785 // rt.loadProjects();
787 _this.priority_id.loading = true;
794 var projects = rt.priorities;
795 foreach(var project in projects) {
799 el.set_value(iter, 0, project.id);
800 el.set_value(iter, 1, project.display_name );
801 if ("normal" == project.name) {
802 _this.priority_id.el.set_active_iter(iter);
807 _this.priority_id.loading = false;
814 public class Xcls_Label18 : Object
817 private Ticket _this;
823 public Xcls_Label18(Ticket _owner )
826 this.el = new Gtk.Label( "Severity" );
830 // set gobject values
831 this.el.halign = Gtk.Align.START;
834 // user defined functions
837 public class Xcls_severity_id : Object
839 public Gtk.ComboBox el;
840 private Ticket _this;
847 public Xcls_severity_id(Ticket _owner )
850 _this.severity_id = this;
851 this.el = new Gtk.ComboBox.with_entry();
854 this.loading = false;
856 // set gobject values
857 var child_0 = new Xcls_sevmodel( _this );
859 this.el.set_model ( child_0.el );
863 this.el.set_entry_text_column(1);
866 // user defined functions
867 public string selectedSeverityId () {
872 this.el.get_active_iter (out iter);
873 _this.sevmodel.el.get_value (iter, 0, out val1);
876 return (string) val1;
883 public class Xcls_sevmodel : Object
885 public Gtk.ListStore el;
886 private Ticket _this;
892 public Xcls_sevmodel(Ticket _owner )
895 _this.sevmodel = this;
896 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
900 // set gobject values
903 // user defined functions
904 public void loadSeverities () {
906 var rt = RooTicket.singleton();
909 _this.severity_id.loading = true;
915 var projects = rt.serverities;
916 foreach(var project in projects) {
920 el.set_value(iter, 0, project.id);
921 el.set_value(iter, 1, project.display_name );
922 if ("normal" == project.name) {
923 _this.severity_id.el.set_active_iter(iter);
928 _this.severity_id.loading = false;
929 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
935 public class Xcls_Label21 : Object
938 private Ticket _this;
944 public Xcls_Label21(Ticket _owner )
947 this.el = new Gtk.Label( "Classification" );
951 // set gobject values
952 this.el.halign = Gtk.Align.START;
955 // user defined functions
958 public class Xcls_classification_id : Object
960 public Gtk.ComboBox el;
961 private Ticket _this;
968 public Xcls_classification_id(Ticket _owner )
971 _this.classification_id = this;
972 this.el = new Gtk.ComboBox.with_entry();
975 this.loading = false;
977 // set gobject values
978 var child_0 = new Xcls_clmodel( _this );
980 this.el.set_model ( child_0.el );
984 this.el.set_entry_text_column(1);
987 // user defined functions
988 public string selectedClassificationId () {
993 this.el.get_active_iter (out iter);
994 _this.clmodel.el.get_value (iter, 0, out val1);
997 return (string) val1;
1004 public class Xcls_clmodel : Object
1006 public Gtk.ListStore el;
1007 private Ticket _this;
1013 public Xcls_clmodel(Ticket _owner )
1016 _this.clmodel = this;
1017 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
1021 // set gobject values
1024 // user defined functions
1025 public void loadClassifications ( ) {
1027 var rt = RooTicket.singleton();
1028 // rt.loadProjects();
1030 _this.classification_id.loading = true;
1036 el.append(out iter);
1039 var projects = rt.classifications;
1040 foreach(var project in projects) {
1042 el.append(out iter);
1044 el.set_value(iter, 0, project.id);
1045 el.set_value(iter, 1, project.display_name );
1046 if ("bug" == project.name) {
1047 _this.classification_id.el.set_active_iter(iter);
1052 _this.classification_id.loading = false;
1053 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
1059 public class Xcls_Label24 : Object
1061 public Gtk.Label el;
1062 private Ticket _this;
1068 public Xcls_Label24(Ticket _owner )
1071 this.el = new Gtk.Label( "Assign to" );
1075 // set gobject values
1076 this.el.halign = Gtk.Align.START;
1079 // user defined functions
1082 public class Xcls_developer_id : Object
1084 public Gtk.ComboBox el;
1085 private Ticket _this;
1089 public bool loading;
1092 public Xcls_developer_id(Ticket _owner )
1095 _this.developer_id = this;
1096 this.el = new Gtk.ComboBox.with_entry();
1099 this.loading = false;
1101 // set gobject values
1102 var child_0 = new Xcls_devmodel( _this );
1104 this.el.set_model ( child_0.el );
1108 this.el.set_entry_text_column(1);
1111 // user defined functions
1112 public string selectedDeveloperId () {
1117 this.el.get_active_iter (out iter);
1118 _this.devmodel.el.get_value (iter, 0, out val1);
1121 return (string) val1;
1128 public class Xcls_devmodel : Object
1130 public Gtk.ListStore el;
1131 private Ticket _this;
1137 public Xcls_devmodel(Ticket _owner )
1140 _this.devmodel = this;
1141 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
1145 // set gobject values
1148 // user defined functions
1149 public void loadDevelopers ( ) {
1151 var rt = RooTicket.singleton();
1152 //rt.loadProjects();
1154 _this.developer_id.loading = true;
1160 el.append(out iter);
1163 el.set_value(iter, 0, "");
1164 el.set_value(iter, 1, "-- select a developer --");
1166 _this.developer_id.el.set_active_iter(iter);
1169 var projects = rt.developers;
1170 foreach(var project in projects) {
1172 el.append(out iter);
1174 el.set_value(iter, 0, project.id);
1175 el.set_value(iter, 1, project.display_name );
1176 // if (id == project.id) {
1177 // _this.projectsel.el.set_active_iter(iter);
1182 _this.developer_id.loading = false;
1183 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
1189 public class Xcls_Button27 : Object
1191 public Gtk.Button el;
1192 private Ticket _this;
1198 public Xcls_Button27(Ticket _owner )
1201 this.el = new Gtk.Button();
1205 // set gobject values
1206 this.el.label = "Create Ticket";
1211 this.el.get_style_context().add_class("suggested-action");
1215 this.el.clicked.connect( () => {
1216 GLib.debug("fire response = 1");
1219 var invalid = false;
1221 // validate first...
1222 _this.project_id.el.get_child().get_style_context().remove_class("warning");
1223 if (_this.project_id.selectedProjectId() == "") {
1224 _this.project_id.el.get_child().get_style_context().add_class("warning");
1228 _this.milestone_id.el.get_child().get_style_context().remove_class("warning");
1229 if (_this.milestone_id.selectedMilestoneId() == "") {
1230 _this.milestone_id.el.get_child().get_style_context().add_class("warning");
1234 _this.priority_id.el.get_child().get_style_context().remove_class("warning");
1235 if (_this.priority_id.selectedPriorityId() == "") {
1236 _this.priority_id.el.get_child().get_style_context().add_class("warning");
1240 _this.classification_id.el.get_child().get_style_context().remove_class("warning");
1241 if (_this.classification_id.selectedClassificationId() == "") {
1242 _this.classification_id.el.get_child().get_style_context().add_class("warning");
1246 _this.developer_id.el.get_child().get_style_context().remove_class("warning");
1247 if (_this.developer_id.selectedDeveloperId() == "") {
1248 _this.developer_id.el.get_child().get_style_context().add_class("warning");
1252 _this.summary.el.get_style_context().remove_class("warning");
1253 if (_this.summary.el.get_text() == "") {
1254 _this.summary.el.get_style_context().add_class("warning");
1258 _this.description.el.get_style_context().remove_class("warning");
1259 if (_this.description.el.buffer.text == "") {
1260 _this.description.el.get_style_context().add_class("warning");
1268 GLib.debug("for is valid");
1270 _this.el.response(1);
1274 // user defined functions
1278 public class Xcls_spinner : Object
1280 public Gtk.Spinner el;
1281 private Ticket _this;
1287 public Xcls_spinner(Ticket _owner )
1290 _this.spinner = this;
1291 this.el = new Gtk.Spinner();
1295 // set gobject values
1296 this.el.hexpand = true;
1297 this.el.vexpand = true;
1300 // user defined functions