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,12,13 );
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 // affects projects and milestones..
303 /*if (this.loading) {
306 var ticket_id = this.selectedTicketId();
308 var name = RooTicket.singleton().usernameLocal();
310 if (ticket_id == "" || ticket_id == null) {
312 var dt = new DateTime.now_local();
313 _this.name.el.set_text("wip_%s_%s".printf(name,dt.format("%Y_%b_%d")));
318 var ticket = RooTicket.singleton().getById(ticket_id);
320 _this.name.el.set_text("wip_%s_T%s_%s".printf(name,ticket.id, ticket.summaryToBranchName()));
322 //GLib.debug (//"Selection: %s, %s\n", (string) val1, (string) val2);
327 // user defined functions
328 public string selectedProjectId () {
333 this.el.get_active_iter (out iter);
334 _this.prmodel.el.get_value (iter, 0, out val1);
337 return (string) val1;
344 public class Xcls_prcellrenderer : Object
346 public Gtk.CellRendererText el;
347 private Ticket _this;
353 public Xcls_prcellrenderer(Ticket _owner )
356 _this.prcellrenderer = this;
357 this.el = new Gtk.CellRendererText();
361 // set gobject values
364 // user defined functions
367 public class Xcls_prmodel : Object
369 public Gtk.ListStore el;
370 private Ticket _this;
376 public Xcls_prmodel(Ticket _owner )
379 _this.prmodel = this;
380 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
384 // set gobject values
387 // user defined functions
388 public void loadProjects (string id) {
390 var rt = RooTicket.singleton();
393 _this.project_id.loading = true;
402 el.set_value(iter, 0, "");
403 el.set_value(iter, 1, "-- select a project --");
405 _this.project_id.el.set_active_iter(iter);
407 var projects = rt.projects;
408 foreach(var project in projects) {
412 el.set_value(iter, 0, project.id);
413 el.set_value(iter, 1, project.name );
414 if (id == project.id) {
415 _this.project_id.el.set_active_iter(iter);
420 _this.project_id.loading = false;
421 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
427 public class Xcls_summary : Object
430 private Ticket _this;
436 public Xcls_summary(Ticket _owner )
439 _this.summary = this;
440 this.el = new Gtk.Entry();
444 // set gobject values
445 this.el.visible = true;
448 // user defined functions
451 public class Xcls_Label10 : Object
454 private Ticket _this;
460 public Xcls_Label10(Ticket _owner )
463 this.el = new Gtk.Label( "Milestone" );
467 // set gobject values
468 this.el.halign = Gtk.Align.START;
469 this.el.justify = Gtk.Justification.RIGHT;
470 this.el.xalign = 0.900000f;
473 // user defined functions
476 public class Xcls_milestone_id : Object
478 public Gtk.ComboBox el;
479 private Ticket _this;
486 public Xcls_milestone_id(Ticket _owner )
489 _this.milestone_id = this;
490 this.el = new Gtk.ComboBox.with_entry();
493 this.loading = false;
495 // set gobject values
496 var child_0 = new Xcls_msmodel( _this );
498 this.el.set_model ( child_0.el );
502 this.el.set_entry_text_column(1);
505 // user defined functions
506 public string selectedMilestoneId () {
511 this.el.get_active_iter (out iter);
512 _this.msmodel.el.get_value (iter, 0, out val1);
515 return (string) val1;
522 public class Xcls_msmodel : Object
524 public Gtk.ListStore el;
525 private Ticket _this;
531 public Xcls_msmodel(Ticket _owner )
534 _this.msmodel = this;
535 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
539 // set gobject values
542 // user defined functions
543 public void loadMilestones (string id) {
545 var rt = RooTicket.singleton();
546 // rt.loadProjects();
548 _this.milestone_id.loading = true;
557 el.set_value(iter, 0, "");
558 el.set_value(iter, 1, "-- select a milestone --");
559 _this.milestone_id.el.set_active_iter(iter);
564 var projects = rt.projects;
565 foreach(var project in projects) {
569 el.set_value(iter, 0, project.id);
570 el.set_value(iter, 1, project.name );
571 if (id == project.id) {
572 _this.milestone.el.set_active_iter(iter);
578 _this.milestone_id.loading = false;
579 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
585 public class Xcls_Label13 : Object
588 private Ticket _this;
594 public Xcls_Label13(Ticket _owner )
597 this.el = new Gtk.Label( "Description" );
601 // set gobject values
602 this.el.halign = Gtk.Align.START;
605 // user defined functions
608 public class Xcls_description : Object
610 public Gtk.TextView el;
611 private Ticket _this;
617 public Xcls_description(Ticket _owner )
620 _this.description = this;
621 this.el = new Gtk.TextView();
625 // set gobject values
626 this.el.border_width = 1;
629 // user defined functions
632 public class Xcls_Label15 : Object
635 private Ticket _this;
641 public Xcls_Label15(Ticket _owner )
644 this.el = new Gtk.Label( "Priority" );
648 // set gobject values
649 this.el.halign = Gtk.Align.START;
650 this.el.xalign = 0.900000f;
653 // user defined functions
656 public class Xcls_priority_id : Object
658 public Gtk.ComboBox el;
659 private Ticket _this;
666 public Xcls_priority_id(Ticket _owner )
669 _this.priority_id = this;
670 this.el = new Gtk.ComboBox.with_entry();
673 this.loading = false;
675 // set gobject values
676 var child_0 = new Xcls_primodel( _this );
678 this.el.set_model ( child_0.el );
682 this.el.set_entry_text_column(1);
685 // user defined functions
686 public string selectedPriorityId () {
691 this.el.get_active_iter (out iter);
692 _this.primodel.el.get_value (iter, 0, out val1);
695 return (string) val1;
702 public class Xcls_primodel : Object
704 public Gtk.ListStore el;
705 private Ticket _this;
711 public Xcls_primodel(Ticket _owner )
714 _this.primodel = this;
715 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
719 // set gobject values
722 // user defined functions
723 public void loadPriority (string id) {
725 var rt = RooTicket.singleton();
726 // rt.loadProjects();
728 _this.priority_id.loading = true;
737 el.set_value(iter, 0, "");
738 el.set_value(iter, 1, "-- select priority --");
740 _this.priority_id.el.set_active_iter(iter);
742 /*var projects = rt.projects;
743 foreach(var project in projects) {
747 el.set_value(iter, 0, project.id);
748 el.set_value(iter, 1, project.name );
749 if (id == project.id) {
750 _this.priority_id.el.set_active_iter(iter);
755 _this.priority_id.loading = false;
762 public class Xcls_Label18 : Object
765 private Ticket _this;
771 public Xcls_Label18(Ticket _owner )
774 this.el = new Gtk.Label( "Severity" );
778 // set gobject values
779 this.el.halign = Gtk.Align.START;
782 // user defined functions
785 public class Xcls_severity_id : Object
787 public Gtk.ComboBox el;
788 private Ticket _this;
795 public Xcls_severity_id(Ticket _owner )
798 _this.severity_id = this;
799 this.el = new Gtk.ComboBox.with_entry();
802 this.loading = false;
804 // set gobject values
805 var child_0 = new Xcls_sevmodel( _this );
807 this.el.set_model ( child_0.el );
811 this.el.set_entry_text_column(1);
814 // user defined functions
815 public string selectedSeverityId () {
820 this.el.get_active_iter (out iter);
821 _this.sevmodel.el.get_value (iter, 0, out val1);
824 return (string) val1;
831 public class Xcls_sevmodel : Object
833 public Gtk.ListStore el;
834 private Ticket _this;
840 public Xcls_sevmodel(Ticket _owner )
843 _this.sevmodel = this;
844 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
848 // set gobject values
851 // user defined functions
852 public void loadProjects (string id) {
854 var rt = RooTicket.singleton();
857 _this.severity_id.loading = true;
866 el.set_value(iter, 0, "");
867 el.set_value(iter, 1, "-- select severity --");
869 _this.severity_id.el.set_active_iter(iter);
872 var projects = rt.projects;
873 foreach(var project in projects) {
877 el.set_value(iter, 0, project.id);
878 el.set_value(iter, 1, project.name );
879 if (id == project.id) {
880 _this.projectsel.el.set_active_iter(iter);
885 _this.severity_id.loading = false;
886 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
892 public class Xcls_Label21 : Object
895 private Ticket _this;
901 public Xcls_Label21(Ticket _owner )
904 this.el = new Gtk.Label( "Classification" );
908 // set gobject values
909 this.el.halign = Gtk.Align.START;
912 // user defined functions
915 public class Xcls_classification_id : Object
917 public Gtk.ComboBox el;
918 private Ticket _this;
925 public Xcls_classification_id(Ticket _owner )
928 _this.classification_id = this;
929 this.el = new Gtk.ComboBox.with_entry();
932 this.loading = false;
934 // set gobject values
935 var child_0 = new Xcls_clmodel( _this );
937 this.el.set_model ( child_0.el );
941 this.el.set_entry_text_column(1);
944 // user defined functions
945 public string selectedProjectId () {
950 this.el.get_active_iter (out iter);
951 _this.prmodel.el.get_value (iter, 0, out val1);
954 return (string) val1;
961 public class Xcls_clmodel : Object
963 public Gtk.ListStore el;
964 private Ticket _this;
970 public Xcls_clmodel(Ticket _owner )
973 _this.clmodel = this;
974 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
978 // set gobject values
981 // user defined functions
982 public void loadClassifications (string id) {
984 var rt = RooTicket.singleton();
985 // rt.loadProjects();
987 _this.classification_id.loading = true;
996 el.set_value(iter, 0, "");
997 el.set_value(iter, 1, "-- select a project --");
999 _this.classification_id.el.set_active_iter(iter);
1002 var projects = rt.projects;
1003 foreach(var project in projects) {
1005 el.append(out iter);
1007 el.set_value(iter, 0, project.id);
1008 el.set_value(iter, 1, project.name );
1009 if (id == project.id) {
1010 _this.classification_id.el.set_active_iter(iter);
1015 _this.classification_id.loading = false;
1016 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
1022 public class Xcls_Label24 : Object
1024 public Gtk.Label el;
1025 private Ticket _this;
1031 public Xcls_Label24(Ticket _owner )
1034 this.el = new Gtk.Label( "Assign to" );
1038 // set gobject values
1039 this.el.halign = Gtk.Align.START;
1042 // user defined functions
1045 public class Xcls_developer_id : Object
1047 public Gtk.ComboBox el;
1048 private Ticket _this;
1052 public bool loading;
1055 public Xcls_developer_id(Ticket _owner )
1058 _this.developer_id = this;
1059 this.el = new Gtk.ComboBox.with_entry();
1062 this.loading = false;
1064 // set gobject values
1065 var child_0 = new Xcls_devmodel( _this );
1067 this.el.set_model ( child_0.el );
1071 this.el.set_entry_text_column(1);
1074 // user defined functions
1075 public string selectedDeveloperId () {
1080 this.el.get_active_iter (out iter);
1081 _this.devmodel.el.get_value (iter, 0, out val1);
1084 return (string) val1;
1091 public class Xcls_devmodel : Object
1093 public Gtk.ListStore el;
1094 private Ticket _this;
1100 public Xcls_devmodel(Ticket _owner )
1103 _this.devmodel = this;
1104 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
1108 // set gobject values
1111 // user defined functions
1112 public void loadDevelopers (string id) {
1114 var rt = RooTicket.singleton();
1115 //rt.loadProjects();
1117 _this.developer_id.loading = true;
1123 el.append(out iter);
1126 el.set_value(iter, 0, "");
1127 el.set_value(iter, 1, "-- select a project --");
1129 _this.developer_id.el.set_active_iter(iter);
1132 var projects = rt.projects;
1133 foreach(var project in projects) {
1135 el.append(out iter);
1137 el.set_value(iter, 0, project.id);
1138 el.set_value(iter, 1, project.name );
1139 if (id == project.id) {
1140 _this.projectsel.el.set_active_iter(iter);
1145 _this.developer_id.loading = false;
1146 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
1152 public class Xcls_Button27 : Object
1154 public Gtk.Button el;
1155 private Ticket _this;
1161 public Xcls_Button27(Ticket _owner )
1164 this.el = new Gtk.Button();
1168 // set gobject values
1169 this.el.label = "Create Branch";
1174 this.el.get_style_context().add_class("suggested-action");
1178 this.el.clicked.connect( () => {
1179 GLib.debug("fire response = 1");
1180 _this.el.response(1);
1184 // user defined functions