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.msmodel.loadMilestones();
304 _this.primodel.loadPriorities();
305 _this.sevmodel.loadSeverities();
306 _this.clmodel.loadClassifications();
307 _this.devmodel.loadDevelopers();
309 // affects projects and milestones..
312 /*if (this.loading) {
315 var ticket_id = this.selectedTicketId();
317 var name = RooTicket.singleton().usernameLocal();
319 if (ticket_id == "" || ticket_id == null) {
321 var dt = new DateTime.now_local();
322 _this.name.el.set_text("wip_%s_%s".printf(name,dt.format("%Y_%b_%d")));
327 var ticket = RooTicket.singleton().getById(ticket_id);
329 _this.name.el.set_text("wip_%s_T%s_%s".printf(name,ticket.id, ticket.summaryToBranchName()));
331 //GLib.debug (//"Selection: %s, %s\n", (string) val1, (string) val2);
336 // user defined functions
337 public string selectedProjectId () {
342 this.el.get_active_iter (out iter);
343 _this.prmodel.el.get_value (iter, 0, out val1);
346 return (string) val1;
353 public class Xcls_prcellrenderer : Object
355 public Gtk.CellRendererText el;
356 private Ticket _this;
362 public Xcls_prcellrenderer(Ticket _owner )
365 _this.prcellrenderer = this;
366 this.el = new Gtk.CellRendererText();
370 // set gobject values
373 // user defined functions
376 public class Xcls_prmodel : Object
378 public Gtk.ListStore el;
379 private Ticket _this;
385 public Xcls_prmodel(Ticket _owner )
388 _this.prmodel = this;
389 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
393 // set gobject values
396 // user defined functions
397 public void loadProjects (string id) {
399 var rt = RooTicket.singleton();
402 _this.project_id.loading = true;
411 el.set_value(iter, 0, "");
412 el.set_value(iter, 1, "-- select a project --");
414 _this.project_id.el.set_active_iter(iter);
416 var projects = rt.projects;
417 foreach(var project in projects) {
421 el.set_value(iter, 0, project.id);
422 el.set_value(iter, 1, project.name );
423 if (id == project.id) {
424 _this.project_id.el.set_active_iter(iter);
429 _this.project_id.loading = false;
430 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
436 public class Xcls_summary : Object
439 private Ticket _this;
445 public Xcls_summary(Ticket _owner )
448 _this.summary = this;
449 this.el = new Gtk.Entry();
453 // set gobject values
454 this.el.visible = true;
457 // user defined functions
460 public class Xcls_Label10 : Object
463 private Ticket _this;
469 public Xcls_Label10(Ticket _owner )
472 this.el = new Gtk.Label( "Milestone" );
476 // set gobject values
477 this.el.halign = Gtk.Align.START;
478 this.el.justify = Gtk.Justification.RIGHT;
479 this.el.xalign = 0.900000f;
482 // user defined functions
485 public class Xcls_milestone_id : Object
487 public Gtk.ComboBox el;
488 private Ticket _this;
495 public Xcls_milestone_id(Ticket _owner )
498 _this.milestone_id = this;
499 this.el = new Gtk.ComboBox.with_entry();
502 this.loading = false;
504 // set gobject values
505 var child_0 = new Xcls_msmodel( _this );
507 this.el.set_model ( child_0.el );
511 this.el.set_entry_text_column(1);
514 // user defined functions
515 public string selectedMilestoneId () {
520 this.el.get_active_iter (out iter);
521 _this.msmodel.el.get_value (iter, 0, out val1);
524 return (string) val1;
531 public class Xcls_msmodel : Object
533 public Gtk.ListStore el;
534 private Ticket _this;
540 public Xcls_msmodel(Ticket _owner )
543 _this.msmodel = this;
544 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
548 // set gobject values
551 // user defined functions
552 public void loadMilestones (string id) {
554 var rt = RooTicket.singleton();
555 // rt.loadProjects();
557 _this.milestone_id.loading = true;
566 el.set_value(iter, 0, "");
567 el.set_value(iter, 1, "-- select a milestone --");
568 _this.milestone_id.el.set_active_iter(iter);
573 var projects = rt.projects;
574 foreach(var project in projects) {
578 el.set_value(iter, 0, project.id);
579 el.set_value(iter, 1, project.name );
580 if (id == project.id) {
581 _this.milestone.el.set_active_iter(iter);
587 _this.milestone_id.loading = false;
588 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
594 public class Xcls_Label13 : Object
597 private Ticket _this;
603 public Xcls_Label13(Ticket _owner )
606 this.el = new Gtk.Label( "Description" );
610 // set gobject values
611 this.el.halign = Gtk.Align.START;
614 // user defined functions
617 public class Xcls_description : Object
619 public Gtk.TextView el;
620 private Ticket _this;
626 public Xcls_description(Ticket _owner )
629 _this.description = this;
630 this.el = new Gtk.TextView();
634 // set gobject values
635 this.el.border_width = 1;
638 // user defined functions
641 public class Xcls_Label15 : Object
644 private Ticket _this;
650 public Xcls_Label15(Ticket _owner )
653 this.el = new Gtk.Label( "Priority" );
657 // set gobject values
658 this.el.halign = Gtk.Align.START;
659 this.el.xalign = 0.900000f;
662 // user defined functions
665 public class Xcls_priority_id : Object
667 public Gtk.ComboBox el;
668 private Ticket _this;
675 public Xcls_priority_id(Ticket _owner )
678 _this.priority_id = this;
679 this.el = new Gtk.ComboBox.with_entry();
682 this.loading = false;
684 // set gobject values
685 var child_0 = new Xcls_primodel( _this );
687 this.el.set_model ( child_0.el );
691 this.el.set_entry_text_column(1);
694 // user defined functions
695 public string selectedPriorityId () {
700 this.el.get_active_iter (out iter);
701 _this.primodel.el.get_value (iter, 0, out val1);
704 return (string) val1;
711 public class Xcls_primodel : Object
713 public Gtk.ListStore el;
714 private Ticket _this;
720 public Xcls_primodel(Ticket _owner )
723 _this.primodel = this;
724 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
728 // set gobject values
731 // user defined functions
732 public void loadPriority (string id) {
734 var rt = RooTicket.singleton();
735 // rt.loadProjects();
737 _this.priority_id.loading = true;
746 el.set_value(iter, 0, "");
747 el.set_value(iter, 1, "-- select priority --");
749 _this.priority_id.el.set_active_iter(iter);
751 /*var projects = rt.projects;
752 foreach(var project in projects) {
756 el.set_value(iter, 0, project.id);
757 el.set_value(iter, 1, project.name );
758 if (id == project.id) {
759 _this.priority_id.el.set_active_iter(iter);
764 _this.priority_id.loading = false;
771 public class Xcls_Label18 : Object
774 private Ticket _this;
780 public Xcls_Label18(Ticket _owner )
783 this.el = new Gtk.Label( "Severity" );
787 // set gobject values
788 this.el.halign = Gtk.Align.START;
791 // user defined functions
794 public class Xcls_severity_id : Object
796 public Gtk.ComboBox el;
797 private Ticket _this;
804 public Xcls_severity_id(Ticket _owner )
807 _this.severity_id = this;
808 this.el = new Gtk.ComboBox.with_entry();
811 this.loading = false;
813 // set gobject values
814 var child_0 = new Xcls_sevmodel( _this );
816 this.el.set_model ( child_0.el );
820 this.el.set_entry_text_column(1);
823 // user defined functions
824 public string selectedSeverityId () {
829 this.el.get_active_iter (out iter);
830 _this.sevmodel.el.get_value (iter, 0, out val1);
833 return (string) val1;
840 public class Xcls_sevmodel : Object
842 public Gtk.ListStore el;
843 private Ticket _this;
849 public Xcls_sevmodel(Ticket _owner )
852 _this.sevmodel = this;
853 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
857 // set gobject values
860 // user defined functions
861 public void loadSeverities (string id) {
863 var rt = RooTicket.singleton();
866 _this.severity_id.loading = true;
875 el.set_value(iter, 0, "");
876 el.set_value(iter, 1, "-- select severity --");
878 _this.severity_id.el.set_active_iter(iter);
881 var projects = rt.projects;
882 foreach(var project in projects) {
886 el.set_value(iter, 0, project.id);
887 el.set_value(iter, 1, project.name );
888 if (id == project.id) {
889 _this.projectsel.el.set_active_iter(iter);
894 _this.severity_id.loading = false;
895 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
901 public class Xcls_Label21 : Object
904 private Ticket _this;
910 public Xcls_Label21(Ticket _owner )
913 this.el = new Gtk.Label( "Classification" );
917 // set gobject values
918 this.el.halign = Gtk.Align.START;
921 // user defined functions
924 public class Xcls_classification_id : Object
926 public Gtk.ComboBox el;
927 private Ticket _this;
934 public Xcls_classification_id(Ticket _owner )
937 _this.classification_id = this;
938 this.el = new Gtk.ComboBox.with_entry();
941 this.loading = false;
943 // set gobject values
944 var child_0 = new Xcls_clmodel( _this );
946 this.el.set_model ( child_0.el );
950 this.el.set_entry_text_column(1);
953 // user defined functions
954 public string selectedProjectId () {
959 this.el.get_active_iter (out iter);
960 _this.prmodel.el.get_value (iter, 0, out val1);
963 return (string) val1;
970 public class Xcls_clmodel : Object
972 public Gtk.ListStore el;
973 private Ticket _this;
979 public Xcls_clmodel(Ticket _owner )
982 _this.clmodel = this;
983 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
987 // set gobject values
990 // user defined functions
991 public void loadClassifications (string id) {
993 var rt = RooTicket.singleton();
994 // rt.loadProjects();
996 _this.classification_id.loading = true;
1002 el.append(out iter);
1005 el.set_value(iter, 0, "");
1006 el.set_value(iter, 1, "-- select a project --");
1008 _this.classification_id.el.set_active_iter(iter);
1011 var projects = rt.projects;
1012 foreach(var project in projects) {
1014 el.append(out iter);
1016 el.set_value(iter, 0, project.id);
1017 el.set_value(iter, 1, project.name );
1018 if (id == project.id) {
1019 _this.classification_id.el.set_active_iter(iter);
1024 _this.classification_id.loading = false;
1025 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
1031 public class Xcls_Label24 : Object
1033 public Gtk.Label el;
1034 private Ticket _this;
1040 public Xcls_Label24(Ticket _owner )
1043 this.el = new Gtk.Label( "Assign to" );
1047 // set gobject values
1048 this.el.halign = Gtk.Align.START;
1051 // user defined functions
1054 public class Xcls_developer_id : Object
1056 public Gtk.ComboBox el;
1057 private Ticket _this;
1061 public bool loading;
1064 public Xcls_developer_id(Ticket _owner )
1067 _this.developer_id = this;
1068 this.el = new Gtk.ComboBox.with_entry();
1071 this.loading = false;
1073 // set gobject values
1074 var child_0 = new Xcls_devmodel( _this );
1076 this.el.set_model ( child_0.el );
1080 this.el.set_entry_text_column(1);
1083 // user defined functions
1084 public string selectedDeveloperId () {
1089 this.el.get_active_iter (out iter);
1090 _this.devmodel.el.get_value (iter, 0, out val1);
1093 return (string) val1;
1100 public class Xcls_devmodel : Object
1102 public Gtk.ListStore el;
1103 private Ticket _this;
1109 public Xcls_devmodel(Ticket _owner )
1112 _this.devmodel = this;
1113 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
1117 // set gobject values
1120 // user defined functions
1121 public void loadDevelopers (string id) {
1123 var rt = RooTicket.singleton();
1124 //rt.loadProjects();
1126 _this.developer_id.loading = true;
1132 el.append(out iter);
1135 el.set_value(iter, 0, "");
1136 el.set_value(iter, 1, "-- select a project --");
1138 _this.developer_id.el.set_active_iter(iter);
1141 var projects = rt.projects;
1142 foreach(var project in projects) {
1144 el.append(out iter);
1146 el.set_value(iter, 0, project.id);
1147 el.set_value(iter, 1, project.name );
1148 if (id == project.id) {
1149 _this.projectsel.el.set_active_iter(iter);
1154 _this.developer_id.loading = false;
1155 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
1161 public class Xcls_Button27 : Object
1163 public Gtk.Button el;
1164 private Ticket _this;
1170 public Xcls_Button27(Ticket _owner )
1173 this.el = new Gtk.Button();
1177 // set gobject values
1178 this.el.label = "Create Ticket";
1183 this.el.get_style_context().add_class("suggested-action");
1187 this.el.clicked.connect( () => {
1188 GLib.debug("fire response = 1");
1189 _this.el.response(1);
1193 // user defined functions