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) {
71 var tid = RooTicket.singleton().createTicket(
73 _this.project_id.selectProjectId(),
75 _this.milestone_id.selectedMilestoneId(),
76 _this.priority_id.selectedPriorityId() ,
77 _this.classification_id.selectedClassificationId() ,
78 _this.developer_id.selectedDeveloperId(),
79 _this.summary.el.get_text() ,
80 _this.description.el.buffer.text
83 if (this.repo != null) {
84 NewBranch.singleton().show(this.repo, new Gee.ArrayList<GitMonitorQueue>(), tid);
92 // user defined functions
93 public void show ( GitRepo? repo )
95 // this.el.set_gravity(Gdk.Gravity.NORTH);
96 if (this.running) { // should not happen!!
97 GLib.error("new branch show called, when already being displayed?");
102 //GitMonitor.gitmonitor.stop();
109 this.el.move((Gdk.Screen.width() / 2)- 250 ,0);
110 this.el.set_default_size( 500,200); // not sure why it grows..
111 GLib.debug("Loading tickets");
115 this.el.set_keep_above(true);
118 RooProject? curproj = null;
119 if (this.repo != null) {
120 curproj = RooTicket.singleton().getProjectByRepo(this.repo);
122 _this.prmodel.loadProjects(curproj == null ? "" : curproj.id);
128 public class Xcls_VBox2 : Object
131 private Ticket _this;
137 public Xcls_VBox2(Ticket _owner )
140 this.el = new Gtk.VBox( true, 0 );
144 // set gobject values
145 var child_0 = new Xcls_Table3( _this );
147 this.el.pack_start ( child_0.el , false,false,0 );
150 // user defined functions
152 public class Xcls_Table3 : Object
155 private Ticket _this;
161 public Xcls_Table3(Ticket _owner )
164 this.el = new Gtk.Table( 14, 4, true );
168 // set gobject values
169 this.el.expand = false;
171 this.el.column_spacing = 4;
172 this.el.vexpand = false;
173 var child_0 = new Xcls_Label4( _this );
175 this.el.attach_defaults ( child_0.el , 0,1,0,1 );
176 var child_1 = new Xcls_Label5( _this );
178 this.el.attach_defaults ( child_1.el , 1,2,0,1 );
179 var child_2 = new Xcls_project_id( _this );
181 this.el.attach_defaults ( child_2.el , 0,1,1,2 );
182 var child_3 = new Xcls_summary( _this );
184 this.el.attach_defaults ( child_3.el , 1,4,1,2 );
185 var child_4 = new Xcls_Label10( _this );
187 this.el.attach_defaults ( child_4.el , 0,1,2,3 );
188 var child_5 = new Xcls_milestone_id( _this );
190 this.el.attach_defaults ( child_5.el , 0,1,3,4 );
191 var child_6 = new Xcls_Label13( _this );
193 this.el.attach_defaults ( child_6.el , 1,4,2,3 );
194 var child_7 = new Xcls_description( _this );
196 this.el.attach_defaults ( child_7.el , 1,4,3,12 );
197 var child_8 = new Xcls_Label15( _this );
199 this.el.attach_defaults ( child_8.el , 0,1,4,5 );
200 var child_9 = new Xcls_priority_id( _this );
202 this.el.attach_defaults ( child_9.el , 0,1,5,6 );
203 var child_10 = new Xcls_Label18( _this );
205 this.el.attach_defaults ( child_10.el , 0,1,6,7 );
206 var child_11 = new Xcls_severity_id( _this );
208 this.el.attach_defaults ( child_11.el , 0,1,7,8 );
209 var child_12 = new Xcls_Label21( _this );
211 this.el.attach_defaults ( child_12.el , 0,1,8,9 );
212 var child_13 = new Xcls_classification_id( _this );
214 this.el.attach_defaults ( child_13.el , 0,1,9,10 );
215 var child_14 = new Xcls_Label24( _this );
217 this.el.attach_defaults ( child_14.el , 0,1,10,11 );
218 var child_15 = new Xcls_developer_id( _this );
220 this.el.attach_defaults ( child_15.el , 0,1,11,12 );
221 var child_16 = new Xcls_Button27( _this );
223 this.el.attach_defaults ( child_16.el , 0,4,13,14 );
226 // user defined functions
228 public class Xcls_Label4 : Object
231 private Ticket _this;
237 public Xcls_Label4(Ticket _owner )
240 this.el = new Gtk.Label( "Project" );
244 // set gobject values
245 this.el.halign = Gtk.Align.START;
246 this.el.visible = true;
249 // user defined functions
252 public class Xcls_Label5 : Object
255 private Ticket _this;
261 public Xcls_Label5(Ticket _owner )
264 this.el = new Gtk.Label( "Summary" );
268 // set gobject values
269 this.el.halign = Gtk.Align.START;
270 this.el.visible = true;
273 // user defined functions
276 public class Xcls_project_id : Object
278 public Gtk.ComboBox el;
279 private Ticket _this;
286 public Xcls_project_id(Ticket _owner )
289 _this.project_id = this;
290 this.el = new Gtk.ComboBox.with_entry();
293 this.loading = false;
295 // set gobject values
296 var child_0 = new Xcls_prcellrenderer( _this );
298 this.el.pack_start ( child_0.el , true );
299 var child_1 = new Xcls_prmodel( _this );
301 this.el.set_model ( child_1.el );
305 this.el.set_entry_text_column(1);
308 this.el.changed.connect( () => {
312 var project_id = this.selectedProjectId();
314 var rt = RooTicket.singleton();
315 rt.loadProjectOptions(project_id);
317 _this.msmodel.loadMilestones();
318 _this.primodel.loadPriorities();
319 _this.sevmodel.loadSeverities();
320 _this.clmodel.loadClassifications();
321 _this.devmodel.loadDevelopers();
323 // affects projects and milestones..
326 /*if (this.loading) {
329 var ticket_id = this.selectedTicketId();
331 var name = RooTicket.singleton().usernameLocal();
333 if (ticket_id == "" || ticket_id == null) {
335 var dt = new DateTime.now_local();
336 _this.name.el.set_text("wip_%s_%s".printf(name,dt.format("%Y_%b_%d")));
341 var ticket = RooTicket.singleton().getById(ticket_id);
343 _this.name.el.set_text("wip_%s_T%s_%s".printf(name,ticket.id, ticket.summaryToBranchName()));
345 //GLib.debug (//"Selection: %s, %s\n", (string) val1, (string) val2);
350 // user defined functions
351 public string selectedProjectId () {
356 this.el.get_active_iter (out iter);
357 _this.prmodel.el.get_value (iter, 0, out val1);
360 return (string) val1;
367 public class Xcls_prcellrenderer : Object
369 public Gtk.CellRendererText el;
370 private Ticket _this;
376 public Xcls_prcellrenderer(Ticket _owner )
379 _this.prcellrenderer = this;
380 this.el = new Gtk.CellRendererText();
384 // set gobject values
387 // user defined functions
390 public class Xcls_prmodel : Object
392 public Gtk.ListStore el;
393 private Ticket _this;
399 public Xcls_prmodel(Ticket _owner )
402 _this.prmodel = this;
403 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
407 // set gobject values
410 // user defined functions
411 public void loadProjects (string id) {
413 var rt = RooTicket.singleton();
416 _this.project_id.loading = true;
425 el.set_value(iter, 0, "");
426 el.set_value(iter, 1, "-- select a project --");
428 _this.project_id.el.set_active_iter(iter);
430 var projects = rt.projects;
431 foreach(var project in projects) {
435 el.set_value(iter, 0, project.id);
436 el.set_value(iter, 1, project.name );
437 if (id == project.id) {
438 _this.project_id.el.set_active_iter(iter);
443 _this.project_id.loading = false;
444 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
450 public class Xcls_summary : Object
453 private Ticket _this;
459 public Xcls_summary(Ticket _owner )
462 _this.summary = this;
463 this.el = new Gtk.Entry();
467 // set gobject values
468 this.el.visible = true;
471 // user defined functions
474 public class Xcls_Label10 : Object
477 private Ticket _this;
483 public Xcls_Label10(Ticket _owner )
486 this.el = new Gtk.Label( "Milestone" );
490 // set gobject values
491 this.el.halign = Gtk.Align.START;
492 this.el.justify = Gtk.Justification.RIGHT;
493 this.el.xalign = 0.900000f;
496 // user defined functions
499 public class Xcls_milestone_id : Object
501 public Gtk.ComboBox el;
502 private Ticket _this;
509 public Xcls_milestone_id(Ticket _owner )
512 _this.milestone_id = this;
513 this.el = new Gtk.ComboBox.with_entry();
516 this.loading = false;
518 // set gobject values
519 var child_0 = new Xcls_msmodel( _this );
521 this.el.set_model ( child_0.el );
525 this.el.set_entry_text_column(1);
528 // user defined functions
529 public string selectedMilestoneId () {
534 this.el.get_active_iter (out iter);
535 _this.msmodel.el.get_value (iter, 0, out val1);
538 return (string) val1;
545 public class Xcls_msmodel : Object
547 public Gtk.ListStore el;
548 private Ticket _this;
554 public Xcls_msmodel(Ticket _owner )
557 _this.msmodel = this;
558 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
562 // set gobject values
565 // user defined functions
566 public void loadMilestones ( ) {
568 var rt = RooTicket.singleton();
569 // rt.loadProjects();
571 _this.milestone_id.loading = true;
580 el.set_value(iter, 0, "");
581 el.set_value(iter, 1, "-- select a milestone --");
582 _this.milestone_id.el.set_active_iter(iter);
584 var projects = rt.milestones;
585 foreach(var project in projects) {
589 el.set_value(iter, 0, project.id);
590 el.set_value(iter, 1, project.display_name );
591 // if (id == project.id) {
592 // _this.milestone.el.set_active_iter(iter);
598 _this.milestone_id.loading = false;
599 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
605 public class Xcls_Label13 : Object
608 private Ticket _this;
614 public Xcls_Label13(Ticket _owner )
617 this.el = new Gtk.Label( "Description" );
621 // set gobject values
622 this.el.halign = Gtk.Align.START;
625 // user defined functions
628 public class Xcls_description : Object
630 public Gtk.TextView el;
631 private Ticket _this;
637 public Xcls_description(Ticket _owner )
640 _this.description = this;
641 this.el = new Gtk.TextView();
645 // set gobject values
646 this.el.border_width = 1;
649 // user defined functions
652 public class Xcls_Label15 : Object
655 private Ticket _this;
661 public Xcls_Label15(Ticket _owner )
664 this.el = new Gtk.Label( "Priority" );
668 // set gobject values
669 this.el.halign = Gtk.Align.START;
670 this.el.xalign = 0.900000f;
673 // user defined functions
676 public class Xcls_priority_id : Object
678 public Gtk.ComboBox el;
679 private Ticket _this;
686 public Xcls_priority_id(Ticket _owner )
689 _this.priority_id = this;
690 this.el = new Gtk.ComboBox.with_entry();
693 this.loading = false;
695 // set gobject values
696 var child_0 = new Xcls_primodel( _this );
698 this.el.set_model ( child_0.el );
702 this.el.set_entry_text_column(1);
705 // user defined functions
706 public string selectedPriorityId () {
711 this.el.get_active_iter (out iter);
712 _this.primodel.el.get_value (iter, 0, out val1);
715 return (string) val1;
722 public class Xcls_primodel : Object
724 public Gtk.ListStore el;
725 private Ticket _this;
731 public Xcls_primodel(Ticket _owner )
734 _this.primodel = this;
735 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
739 // set gobject values
742 // user defined functions
743 public void loadPriorities ( ) {
745 var rt = RooTicket.singleton();
746 // rt.loadProjects();
748 _this.priority_id.loading = true;
755 var projects = rt.priorities;
756 foreach(var project in projects) {
760 el.set_value(iter, 0, project.id);
761 el.set_value(iter, 1, project.display_name );
762 if ("normal" == project.name) {
763 _this.priority_id.el.set_active_iter(iter);
768 _this.priority_id.loading = false;
775 public class Xcls_Label18 : Object
778 private Ticket _this;
784 public Xcls_Label18(Ticket _owner )
787 this.el = new Gtk.Label( "Severity" );
791 // set gobject values
792 this.el.halign = Gtk.Align.START;
795 // user defined functions
798 public class Xcls_severity_id : Object
800 public Gtk.ComboBox el;
801 private Ticket _this;
808 public Xcls_severity_id(Ticket _owner )
811 _this.severity_id = this;
812 this.el = new Gtk.ComboBox.with_entry();
815 this.loading = false;
817 // set gobject values
818 var child_0 = new Xcls_sevmodel( _this );
820 this.el.set_model ( child_0.el );
824 this.el.set_entry_text_column(1);
827 // user defined functions
828 public string selectedSeverityId () {
833 this.el.get_active_iter (out iter);
834 _this.sevmodel.el.get_value (iter, 0, out val1);
837 return (string) val1;
844 public class Xcls_sevmodel : Object
846 public Gtk.ListStore el;
847 private Ticket _this;
853 public Xcls_sevmodel(Ticket _owner )
856 _this.sevmodel = this;
857 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
861 // set gobject values
864 // user defined functions
865 public void loadSeverities () {
867 var rt = RooTicket.singleton();
870 _this.severity_id.loading = true;
876 var projects = rt.serverities;
877 foreach(var project in projects) {
881 el.set_value(iter, 0, project.id);
882 el.set_value(iter, 1, project.display_name );
883 if ("normal" == project.name) {
884 _this.severity_id.el.set_active_iter(iter);
889 _this.severity_id.loading = false;
890 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
896 public class Xcls_Label21 : Object
899 private Ticket _this;
905 public Xcls_Label21(Ticket _owner )
908 this.el = new Gtk.Label( "Classification" );
912 // set gobject values
913 this.el.halign = Gtk.Align.START;
916 // user defined functions
919 public class Xcls_classification_id : Object
921 public Gtk.ComboBox el;
922 private Ticket _this;
929 public Xcls_classification_id(Ticket _owner )
932 _this.classification_id = this;
933 this.el = new Gtk.ComboBox.with_entry();
936 this.loading = false;
938 // set gobject values
939 var child_0 = new Xcls_clmodel( _this );
941 this.el.set_model ( child_0.el );
945 this.el.set_entry_text_column(1);
948 // user defined functions
949 public string selectedClassificationId () {
954 this.el.get_active_iter (out iter);
955 _this.clmodel.el.get_value (iter, 0, out val1);
958 return (string) val1;
965 public class Xcls_clmodel : Object
967 public Gtk.ListStore el;
968 private Ticket _this;
974 public Xcls_clmodel(Ticket _owner )
977 _this.clmodel = this;
978 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
982 // set gobject values
985 // user defined functions
986 public void loadClassifications ( ) {
988 var rt = RooTicket.singleton();
989 // rt.loadProjects();
991 _this.classification_id.loading = true;
1000 var projects = rt.classifications;
1001 foreach(var project in projects) {
1003 el.append(out iter);
1005 el.set_value(iter, 0, project.id);
1006 el.set_value(iter, 1, project.display_name );
1007 if ("bug" == project.name) {
1008 _this.classification_id.el.set_active_iter(iter);
1013 _this.classification_id.loading = false;
1014 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
1020 public class Xcls_Label24 : Object
1022 public Gtk.Label el;
1023 private Ticket _this;
1029 public Xcls_Label24(Ticket _owner )
1032 this.el = new Gtk.Label( "Assign to" );
1036 // set gobject values
1037 this.el.halign = Gtk.Align.START;
1040 // user defined functions
1043 public class Xcls_developer_id : Object
1045 public Gtk.ComboBox el;
1046 private Ticket _this;
1050 public bool loading;
1053 public Xcls_developer_id(Ticket _owner )
1056 _this.developer_id = this;
1057 this.el = new Gtk.ComboBox.with_entry();
1060 this.loading = false;
1062 // set gobject values
1063 var child_0 = new Xcls_devmodel( _this );
1065 this.el.set_model ( child_0.el );
1069 this.el.set_entry_text_column(1);
1072 // user defined functions
1073 public string selectedDeveloperId () {
1078 this.el.get_active_iter (out iter);
1079 _this.devmodel.el.get_value (iter, 0, out val1);
1082 return (string) val1;
1089 public class Xcls_devmodel : Object
1091 public Gtk.ListStore el;
1092 private Ticket _this;
1098 public Xcls_devmodel(Ticket _owner )
1101 _this.devmodel = this;
1102 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
1106 // set gobject values
1109 // user defined functions
1110 public void loadDevelopers ( ) {
1112 var rt = RooTicket.singleton();
1113 //rt.loadProjects();
1115 _this.developer_id.loading = true;
1121 el.append(out iter);
1124 el.set_value(iter, 0, "");
1125 el.set_value(iter, 1, "-- select a developer --");
1127 _this.developer_id.el.set_active_iter(iter);
1130 var projects = rt.developers;
1131 foreach(var project in projects) {
1133 el.append(out iter);
1135 el.set_value(iter, 0, project.id);
1136 el.set_value(iter, 1, project.display_name );
1137 // if (id == project.id) {
1138 // _this.projectsel.el.set_active_iter(iter);
1143 _this.developer_id.loading = false;
1144 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
1150 public class Xcls_Button27 : Object
1152 public Gtk.Button el;
1153 private Ticket _this;
1159 public Xcls_Button27(Ticket _owner )
1162 this.el = new Gtk.Button();
1166 // set gobject values
1167 this.el.label = "Create Ticket";
1172 this.el.get_style_context().add_class("suggested-action");
1176 this.el.clicked.connect( () => {
1177 GLib.debug("fire response = 1");
1180 var invalid = false;
1182 // validate first...
1183 _this.project_id.el.get_child().get_style_context().remove_class("warning");
1184 if (_this.project_id.selectedProjectId() == "") {
1185 _this.project_id.el.get_child().get_style_context().add_class("warning");
1189 _this.milestone_id.el.get_child().get_style_context().remove_class("warning");
1190 if (_this.milestone_id.selectedMilestoneId() == "") {
1191 _this.milestone_id.el.get_child().get_style_context().add_class("warning");
1195 _this.priority_id.el.get_child().get_style_context().remove_class("warning");
1196 if (_this.priority_id.selectedPriorityId() == "") {
1197 _this.priority_id.el.get_child().get_style_context().add_class("warning");
1201 _this.classification_id.el.get_child().get_style_context().remove_class("warning");
1202 if (_this.classification_id.selectedClassificationId() == "") {
1203 _this.classification_id.el.get_child().get_style_context().add_class("warning");
1207 _this.developer_id.el.get_child().get_style_context().remove_class("warning");
1208 if (_this.developer_id.selectedDeveloperId() == "") {
1209 _this.developer_id.el.get_child().get_style_context().add_class("warning");
1213 _this.summary.el.get_style_context().remove_class("warning");
1214 if (_this.summary.el.get_text() == "") {
1215 _this.summary.el.get_style_context().add_class("warning");
1219 _this.description.el.get_style_context().remove_class("warning");
1220 if (_this.description.el.buffer.text == "") {
1221 _this.description.el.get_style_context().add_class("warning");
1229 GLib.debug("for is valid");
1231 _this.el.response(1);
1235 // user defined functions