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 ( ) {
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);
570 var projects = rt.milestones;
571 foreach(var project in projects) {
575 el.set_value(iter, 0, project.id);
576 el.set_value(iter, 1, project.display_name );
577 if (id == project.id) {
578 _this.milestone.el.set_active_iter(iter);
584 _this.milestone_id.loading = false;
585 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
591 public class Xcls_Label13 : Object
594 private Ticket _this;
600 public Xcls_Label13(Ticket _owner )
603 this.el = new Gtk.Label( "Description" );
607 // set gobject values
608 this.el.halign = Gtk.Align.START;
611 // user defined functions
614 public class Xcls_description : Object
616 public Gtk.TextView el;
617 private Ticket _this;
623 public Xcls_description(Ticket _owner )
626 _this.description = this;
627 this.el = new Gtk.TextView();
631 // set gobject values
632 this.el.border_width = 1;
635 // user defined functions
638 public class Xcls_Label15 : Object
641 private Ticket _this;
647 public Xcls_Label15(Ticket _owner )
650 this.el = new Gtk.Label( "Priority" );
654 // set gobject values
655 this.el.halign = Gtk.Align.START;
656 this.el.xalign = 0.900000f;
659 // user defined functions
662 public class Xcls_priority_id : Object
664 public Gtk.ComboBox el;
665 private Ticket _this;
672 public Xcls_priority_id(Ticket _owner )
675 _this.priority_id = this;
676 this.el = new Gtk.ComboBox.with_entry();
679 this.loading = false;
681 // set gobject values
682 var child_0 = new Xcls_primodel( _this );
684 this.el.set_model ( child_0.el );
688 this.el.set_entry_text_column(1);
691 // user defined functions
692 public string selectedPriorityId () {
697 this.el.get_active_iter (out iter);
698 _this.primodel.el.get_value (iter, 0, out val1);
701 return (string) val1;
708 public class Xcls_primodel : Object
710 public Gtk.ListStore el;
711 private Ticket _this;
717 public Xcls_primodel(Ticket _owner )
720 _this.primodel = this;
721 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
725 // set gobject values
728 // user defined functions
729 public void loadPriorities ( ) {
731 var rt = RooTicket.singleton();
732 // rt.loadProjects();
734 _this.priority_id.loading = true;
743 el.set_value(iter, 0, "");
744 el.set_value(iter, 1, "-- select priority --");
746 _this.priority_id.el.set_active_iter(iter);
748 var projects = rt.priorities;
749 foreach(var project in projects) {
753 el.set_value(iter, 0, project.id);
754 el.set_value(iter, 1, project.display_name );
755 //if (id == project.id) {
756 _this.priority_id.el.set_active_iter(iter);
761 _this.priority_id.loading = false;
768 public class Xcls_Label18 : Object
771 private Ticket _this;
777 public Xcls_Label18(Ticket _owner )
780 this.el = new Gtk.Label( "Severity" );
784 // set gobject values
785 this.el.halign = Gtk.Align.START;
788 // user defined functions
791 public class Xcls_severity_id : Object
793 public Gtk.ComboBox el;
794 private Ticket _this;
801 public Xcls_severity_id(Ticket _owner )
804 _this.severity_id = this;
805 this.el = new Gtk.ComboBox.with_entry();
808 this.loading = false;
810 // set gobject values
811 var child_0 = new Xcls_sevmodel( _this );
813 this.el.set_model ( child_0.el );
817 this.el.set_entry_text_column(1);
820 // user defined functions
821 public string selectedSeverityId () {
826 this.el.get_active_iter (out iter);
827 _this.sevmodel.el.get_value (iter, 0, out val1);
830 return (string) val1;
837 public class Xcls_sevmodel : Object
839 public Gtk.ListStore el;
840 private Ticket _this;
846 public Xcls_sevmodel(Ticket _owner )
849 _this.sevmodel = this;
850 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
854 // set gobject values
857 // user defined functions
858 public void loadSeverities () {
860 var rt = RooTicket.singleton();
863 _this.severity_id.loading = true;
872 el.set_value(iter, 0, "");
873 el.set_value(iter, 1, "-- select severity --");
875 _this.severity_id.el.set_active_iter(iter);
878 var projects = rt.serverities;
879 foreach(var project in projects) {
883 el.set_value(iter, 0, project.id);
884 el.set_value(iter, 1, project.display_name );
885 //if (id == project.id) {
886 // _this.severity_id.el.set_active_iter(iter);
891 _this.severity_id.loading = false;
892 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
898 public class Xcls_Label21 : Object
901 private Ticket _this;
907 public Xcls_Label21(Ticket _owner )
910 this.el = new Gtk.Label( "Classification" );
914 // set gobject values
915 this.el.halign = Gtk.Align.START;
918 // user defined functions
921 public class Xcls_classification_id : Object
923 public Gtk.ComboBox el;
924 private Ticket _this;
931 public Xcls_classification_id(Ticket _owner )
934 _this.classification_id = this;
935 this.el = new Gtk.ComboBox.with_entry();
938 this.loading = false;
940 // set gobject values
941 var child_0 = new Xcls_clmodel( _this );
943 this.el.set_model ( child_0.el );
947 this.el.set_entry_text_column(1);
950 // user defined functions
951 public string selectedProjectId () {
956 this.el.get_active_iter (out iter);
957 _this.prmodel.el.get_value (iter, 0, out val1);
960 return (string) val1;
967 public class Xcls_clmodel : Object
969 public Gtk.ListStore el;
970 private Ticket _this;
976 public Xcls_clmodel(Ticket _owner )
979 _this.clmodel = this;
980 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
984 // set gobject values
987 // user defined functions
988 public void loadClassifications ( ) {
990 var rt = RooTicket.singleton();
991 // rt.loadProjects();
993 _this.classification_id.loading = true;
1002 el.set_value(iter, 0, "");
1003 el.set_value(iter, 1, "-- select a project --");
1005 _this.classification_id.el.set_active_iter(iter);
1008 var projects = rt.classifications;
1009 foreach(var project in projects) {
1011 el.append(out iter);
1013 el.set_value(iter, 0, project.id);
1014 el.set_value(iter, 1, project.display_name );
1015 // if (id == project.id) {
1016 // _this.classification_id.el.set_active_iter(iter);
1021 _this.classification_id.loading = false;
1022 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
1028 public class Xcls_Label24 : Object
1030 public Gtk.Label el;
1031 private Ticket _this;
1037 public Xcls_Label24(Ticket _owner )
1040 this.el = new Gtk.Label( "Assign to" );
1044 // set gobject values
1045 this.el.halign = Gtk.Align.START;
1048 // user defined functions
1051 public class Xcls_developer_id : Object
1053 public Gtk.ComboBox el;
1054 private Ticket _this;
1058 public bool loading;
1061 public Xcls_developer_id(Ticket _owner )
1064 _this.developer_id = this;
1065 this.el = new Gtk.ComboBox.with_entry();
1068 this.loading = false;
1070 // set gobject values
1071 var child_0 = new Xcls_devmodel( _this );
1073 this.el.set_model ( child_0.el );
1077 this.el.set_entry_text_column(1);
1080 // user defined functions
1081 public string selectedDeveloperId () {
1086 this.el.get_active_iter (out iter);
1087 _this.devmodel.el.get_value (iter, 0, out val1);
1090 return (string) val1;
1097 public class Xcls_devmodel : Object
1099 public Gtk.ListStore el;
1100 private Ticket _this;
1106 public Xcls_devmodel(Ticket _owner )
1109 _this.devmodel = this;
1110 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
1114 // set gobject values
1117 // user defined functions
1118 public void loadDevelopers ( ) {
1120 var rt = RooTicket.singleton();
1121 //rt.loadProjects();
1123 _this.developer_id.loading = true;
1129 el.append(out iter);
1132 el.set_value(iter, 0, "");
1133 el.set_value(iter, 1, "-- select a project --");
1135 _this.developer_id.el.set_active_iter(iter);
1138 var projects = rt.projects;
1139 foreach(var project in projects) {
1141 el.append(out iter);
1143 el.set_value(iter, 0, project.id);
1144 el.set_value(iter, 1, project.name );
1145 if (id == project.id) {
1146 _this.projectsel.el.set_active_iter(iter);
1151 _this.developer_id.loading = false;
1152 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
1158 public class Xcls_Button27 : Object
1160 public Gtk.Button el;
1161 private Ticket _this;
1167 public Xcls_Button27(Ticket _owner )
1170 this.el = new Gtk.Button();
1174 // set gobject values
1175 this.el.label = "Create Ticket";
1180 this.el.get_style_context().add_class("suggested-action");
1184 this.el.clicked.connect( () => {
1185 GLib.debug("fire response = 1");
1186 _this.el.response(1);
1190 // user defined functions