1 static NewBranch _NewBranch;
3 public class NewBranch : Object
6 private NewBranch _this;
8 public static NewBranch singleton()
10 if (_NewBranch == null) {
11 _NewBranch= new NewBranch();
15 public Xcls_label_select_ticket label_select_ticket;
16 public Xcls_label_create_ticket label_create_ticket;
17 public Xcls_label_quick_commit label_quick_commit;
18 public Xcls_projectsel projectsel;
19 public Xcls_prcellrenderer prcellrenderer;
20 public Xcls_prmodel prmodel;
21 public Xcls_ticketsel ticketsel;
22 public Xcls_dbcellrenderer dbcellrenderer;
23 public Xcls_dbmodel dbmodel;
24 public Xcls_name name;
25 public Xcls_createbtn createbtn;
26 public Xcls_btn_not_me btn_not_me;
27 public Xcls_btn_closed btn_closed;
28 public Xcls_scrolled_window scrolled_window;
29 public Xcls_view view;
30 public Xcls_table table;
31 public Xcls_project_id project_id;
32 public Xcls_prcellrenderer prcellrenderer;
33 public Xcls_prmodel prmodel;
34 public Xcls_summary summary;
35 public Xcls_milestone_id milestone_id;
36 public Xcls_msmodel msmodel;
37 public Xcls_description description;
38 public Xcls_priority_id priority_id;
39 public Xcls_primodel primodel;
40 public Xcls_severity_id severity_id;
41 public Xcls_sevmodel sevmodel;
42 public Xcls_classification_id classification_id;
43 public Xcls_clmodel clmodel;
44 public Xcls_developer_id developer_id;
45 public Xcls_devmodel devmodel;
50 public Gee.ArrayList<GitMonitorQueue> queue;
56 this.el = new Gtk.Dialog();
64 this.el.title = "Create a working branch ";
65 this.el.default_height = 500;
66 this.el.default_width = 500;
67 this.el.deletable = true;
69 var child_0 = new Xcls_Notebook2( _this );
71 this.el.get_content_area().add ( child_0.el );
74 this.el.delete_event.connect( (self, event) => {
79 this.el.response.connect( (self, response_id) => {
81 GLib.debug("got %d", (int) response_id);
86 // have they selected a ticket..
87 // make that the current active ticket?
88 // we really need to store locally what ticket is being worked on..
89 // in theory we could be working on multiple project and not merging..
90 // -- each repo would have their active ticket (only one per repo)
91 // -- so we could just store that in there
92 // -- initial load can check the contents of the ticket files on first scan.
95 if (response_id < 1) {
101 var ticket_id = _this.ticketsel.selectedTicketId();
103 if (this.repo != null) {
104 var bn = _this.name.el.get_text();
106 var res = this.repo.setActiveTicket(
107 RooTicket.singleton().getById(ticket_id != "" ? ticket_id : "-1"), bn
110 // start the monitoring..
111 GitMonitor.gitmonitor.start();
117 this.running = false;
127 // user defined functions
128 public void show ( GitRepo repo, Gee.ArrayList<GitMonitorQueue> queue, string tid = "" )
130 // this.el.set_gravity(Gdk.Gravity.NORTH);
131 if (this.running) { // should not happen!!
132 GLib.error("new branch show called, when already being displayed?");
137 GitMonitor.gitmonitor.stop();
143 this.el.move((Gdk.Screen.width() / 2)- 250 ,0);
144 this.el.set_default_size( 500,200); // not sure why it grows..
145 GLib.debug("Loading tickets");
149 this.el.set_keep_above(true);
152 var curproj = RooProject.getProjectByRepo(this.repo);
153 _this.prmodel.loadProjects(curproj == null ? "" : curproj.id);
155 _this.dbmodel.loadTickets(curproj == null ? "": curproj.id, tid);
156 _this.createbtn.updateState();
158 _this.ticketsel.el.get_child().get_style_context().remove_class("warning");
160 var name = RooTicket.singleton().usernameLocal();
161 var ticket = RooTicket.singleton().getById(tid);
162 _this.name.el.set_text("wip_%s_T%s_%s".printf(name,ticket.id, ticket.summaryToBranchName()));
164 _this.ticketsel.el.get_child().get_style_context().add_class("warning");
166 _this.view.loadTicket(tid);
170 public class Xcls_Notebook2 : Object
172 public Gtk.Notebook el;
173 private NewBranch _this;
179 public Xcls_Notebook2(NewBranch _owner )
182 this.el = new Gtk.Notebook();
186 // set gobject values
187 this.el.vexpand = true;
188 var child_0 = new Xcls_label_select_ticket( _this );
190 var child_1 = new Xcls_label_create_ticket( _this );
192 var child_2 = new Xcls_label_quick_commit( _this );
194 var child_3 = new Xcls_Box6( _this );
196 this.el.append_page ( child_3.el , _this.label_select_ticket.el );
197 var child_4 = new Xcls_Box25( _this );
199 this.el.append_page ( child_4.el , _this.label_create_ticket.el );
200 var child_5 = new Xcls_Box51( _this );
202 this.el.append_page ( child_5.el , _this.label_quick_commit.el );
205 // user defined functions
207 public class Xcls_label_select_ticket : Object
210 private NewBranch _this;
216 public Xcls_label_select_ticket(NewBranch _owner )
219 _this.label_select_ticket = this;
220 this.el = new Gtk.Label( "Select Existing Ticket to work on" );
224 // set gobject values
227 // user defined functions
230 public class Xcls_label_create_ticket : Object
233 private NewBranch _this;
239 public Xcls_label_create_ticket(NewBranch _owner )
242 _this.label_create_ticket = this;
243 this.el = new Gtk.Label( "Create a New Ticket" );
247 // set gobject values
250 // user defined functions
253 public class Xcls_label_quick_commit : Object
256 private NewBranch _this;
262 public Xcls_label_quick_commit(NewBranch _owner )
265 _this.label_quick_commit = this;
266 this.el = new Gtk.Label( "Quick Commit" );
270 // set gobject values
273 // user defined functions
276 public class Xcls_Box6 : Object
279 private NewBranch _this;
285 public Xcls_Box6(NewBranch _owner )
288 this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
292 // set gobject values
293 this.el.homogeneous = false;
294 var child_0 = new Xcls_Table7( _this );
296 this.el.pack_start ( child_0.el , false,false,0 );
297 var child_1 = new Xcls_scrolled_window( _this );
299 this.el.add ( child_1.el );
302 // user defined functions
304 public class Xcls_Table7 : Object
307 private NewBranch _this;
313 public Xcls_Table7(NewBranch _owner )
316 this.el = new Gtk.Table( 5, 5, true );
320 // set gobject values
321 this.el.expand = false;
323 this.el.column_spacing = 4;
324 this.el.vexpand = false;
325 var child_0 = new Xcls_Label8( _this );
327 this.el.attach_defaults ( child_0.el , 0,1,0,1 );
328 var child_1 = new Xcls_Label9( _this );
330 this.el.attach_defaults ( child_1.el , 1,2,0,1 );
331 var child_2 = new Xcls_projectsel( _this );
333 this.el.attach_defaults ( child_2.el , 0,1,1,2 );
334 var child_3 = new Xcls_ticketsel( _this );
336 this.el.attach_defaults ( child_3.el , 1,4,1,2 );
337 var child_4 = new Xcls_Label16( _this );
339 this.el.attach_defaults ( child_4.el , 0,1,3,4 );
340 var child_5 = new Xcls_name( _this );
342 this.el.attach_defaults ( child_5.el , 0,4,4,5 );
343 var child_6 = new Xcls_createbtn( _this );
345 this.el.attach_defaults ( child_6.el , 4,5,4,5 );
346 var child_7 = new Xcls_Box19( _this );
348 this.el.attach_defaults ( child_7.el , 0,5,2,3 );
351 // user defined functions
353 public class Xcls_Label8 : Object
356 private NewBranch _this;
362 public Xcls_Label8(NewBranch _owner )
365 this.el = new Gtk.Label( "Project" );
369 // set gobject values
370 this.el.halign = Gtk.Align.START;
371 this.el.justify = Gtk.Justification.RIGHT;
372 this.el.visible = true;
375 // user defined functions
378 public class Xcls_Label9 : Object
381 private NewBranch _this;
387 public Xcls_Label9(NewBranch _owner )
390 this.el = new Gtk.Label( "Ticket" );
394 // set gobject values
395 this.el.halign = Gtk.Align.START;
396 this.el.visible = true;
399 // user defined functions
402 public class Xcls_projectsel : Object
404 public Gtk.ComboBox el;
405 private NewBranch _this;
412 public Xcls_projectsel(NewBranch _owner )
415 _this.projectsel = this;
416 this.el = new Gtk.ComboBox.with_entry();
419 this.loading = false;
421 // set gobject values
422 var child_0 = new Xcls_prcellrenderer( _this );
424 this.el.pack_start ( child_0.el , true );
425 var child_1 = new Xcls_prmodel( _this );
427 this.el.set_model ( child_1.el );
431 this.el.set_entry_text_column(1);
434 this.el.changed.connect( () => {
438 var project_id = this.selectedProjectId();
439 _this.dbmodel.loadTickets(project_id);
442 /*if (this.loading) {
445 var ticket_id = this.selectedTicketId();
447 var name = RooTicket.singleton().usernameLocal();
449 if (ticket_id == "" || ticket_id == null) {
451 var dt = new DateTime.now_local();
452 _this.name.el.set_text("wip_%s_%s".printf(name,dt.format("%Y_%b_%d")));
457 var ticket = RooTicket.singleton().getById(ticket_id);
459 _this.name.el.set_text("wip_%s_T%s_%s".printf(name,ticket.id, ticket.summaryToBranchName()));
461 //GLib.debug (//"Selection: %s, %s\n", (string) val1, (string) val2);
466 // user defined functions
467 public string selectedProjectId () {
472 this.el.get_active_iter (out iter);
473 _this.prmodel.el.get_value (iter, 0, out val1);
476 return (string) val1;
483 public class Xcls_prcellrenderer : Object
485 public Gtk.CellRendererText el;
486 private NewBranch _this;
492 public Xcls_prcellrenderer(NewBranch _owner )
495 _this.prcellrenderer = this;
496 this.el = new Gtk.CellRendererText();
500 // set gobject values
503 // user defined functions
506 public class Xcls_prmodel : Object
508 public Gtk.ListStore el;
509 private NewBranch _this;
515 public Xcls_prmodel(NewBranch _owner )
518 _this.prmodel = this;
519 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
523 // set gobject values
526 // user defined functions
527 public void loadProjects (string id) {
531 _this.projectsel.loading = true;
540 el.set_value(iter, 0, "");
541 el.set_value(iter, 1, "-- select a project --");
543 _this.projectsel.el.set_active_iter(iter);
546 foreach(var project in RooProject.projects()) {
550 el.set_value(iter, 0, project.id);
551 el.set_value(iter, 1, project.name );
552 if (id == project.id) {
553 _this.projectsel.el.set_active_iter(iter);
558 _this.projectsel.loading = false;
559 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
565 public class Xcls_ticketsel : Object
567 public Gtk.ComboBox el;
568 private NewBranch _this;
575 public Xcls_ticketsel(NewBranch _owner )
578 _this.ticketsel = this;
579 this.el = new Gtk.ComboBox.with_entry();
582 this.loading = false;
584 // set gobject values
585 var child_0 = new Xcls_dbcellrenderer( _this );
587 this.el.pack_start ( child_0.el , true );
588 var child_1 = new Xcls_dbmodel( _this );
590 this.el.set_model ( child_1.el );
594 //this.el.add_attribute(_this.dbcellrenderer.el , "markup", 1 );
595 this.el.set_entry_text_column(1);
596 this.el.get_child().set_sensitive(false);
599 this.el.changed.connect( () => {
603 var ticket_id = this.selectedTicketId();
605 var name = RooTicket.singleton().usernameLocal();
607 this.el.get_child().get_style_context().remove_class("warning");
608 if (ticket_id == "" || ticket_id == null) {
610 var dt = new DateTime.now_local();
611 _this.name.el.set_text("wip_%s_%s".printf(name,dt.format("%Y_%b_%d")));
612 _this.view.loadTicket("");
614 this.el.get_child().get_style_context().add_class("warning");
615 _this.createbtn.updateState();
620 var ticket = RooTicket.singleton().getById(ticket_id);
622 _this.name.el.set_text("wip_%s_T%s_%s".printf(name,ticket.id, ticket.summaryToBranchName()));
623 _this.scrolled_window.el.show();
625 _this.view.loadTicket(ticket.id);
626 _this.createbtn.updateState();
628 //GLib.debug (//"Selection: %s, %s\n", (string) val1, (string) val2);
632 // user defined functions
633 public string selectedTicketId () {
638 this.el.get_active_iter (out iter);
639 _this.dbmodel.el.get_value (iter, 0, out val1);
642 return (string) val1;
649 public class Xcls_dbcellrenderer : Object
651 public Gtk.CellRendererText el;
652 private NewBranch _this;
658 public Xcls_dbcellrenderer(NewBranch _owner )
661 _this.dbcellrenderer = this;
662 this.el = new Gtk.CellRendererText();
666 // set gobject values
669 // user defined functions
672 public class Xcls_dbmodel : Object
674 public Gtk.ListStore el;
675 private NewBranch _this;
681 public Xcls_dbmodel(NewBranch _owner )
684 _this.dbmodel = this;
685 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
689 // set gobject values
692 // user defined functions
693 public void loadTickets (string project_id , string tid = "") {
697 // fixme .. get project id from selection..
699 RooTicket.singleton().loadTickets(
701 _this.btn_not_me.el.active ? RooTicket.Who.ANYBODY : RooTicket.Who.ME,
702 _this.btn_closed.el.active ? RooTicket.Status.ALL : RooTicket.Status.ACTIVE
705 _this.ticketsel.loading = true;
714 el.set_value(iter, 0, "");
715 el.set_value(iter, 1, "-- select a ticket --");
717 _this.ticketsel.el.set_active_iter(iter);
718 var tickets = RooTicket.singleton().tickets;
719 foreach(var ticket in tickets) {
723 el.set_value(iter, 0, ticket.id);
724 el.set_value(iter, 1, "#%s %s".printf( ticket.id, ticket.summary));
726 if (ticket.id == tid) {
727 _this.ticketsel.el.set_active_iter(iter);
732 _this.ticketsel.loading = false;
733 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
739 public class Xcls_Label16 : Object
742 private NewBranch _this;
748 public Xcls_Label16(NewBranch _owner )
751 this.el = new Gtk.Label( "Use this as branch name" );
755 // set gobject values
756 this.el.halign = Gtk.Align.START;
757 this.el.justify = Gtk.Justification.RIGHT;
758 this.el.xalign = 0.900000f;
761 // user defined functions
764 public class Xcls_name : Object
767 private NewBranch _this;
773 public Xcls_name(NewBranch _owner )
777 this.el = new Gtk.Entry();
781 // set gobject values
782 this.el.visible = true;
785 // user defined functions
788 public class Xcls_createbtn : Object
790 public Gtk.Button el;
791 private NewBranch _this;
797 public Xcls_createbtn(NewBranch _owner )
800 _this.createbtn = this;
801 this.el = new Gtk.Button();
805 // set gobject values
806 this.el.label = "Create Branch";
811 this.el.get_style_context().add_class("suggested-action");
815 this.el.clicked.connect( () => {
817 GLib.debug("fire response = 1");
819 var ticket_id = _this.ticketsel.selectedTicketId();
821 if (ticket_id == "") {
822 _this.ticketsel.el.get_child().get_style_context().add_class("warning");
826 _this.el.response(1);
830 // user defined functions
831 public void updateState () {
833 var ticket_id = _this.ticketsel.selectedTicketId();
835 if (ticket_id == "") {
836 this.el.set_sensitive(false);
840 this.el.set_sensitive(true);
845 public class Xcls_Box19 : Object
848 private NewBranch _this;
854 public Xcls_Box19(NewBranch _owner )
857 this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
861 // set gobject values
862 var child_0 = new Xcls_btn_not_me( _this );
864 this.el.add ( child_0.el );
865 var child_1 = new Xcls_btn_closed( _this );
867 this.el.add ( child_1.el );
868 var child_2 = new Xcls_Label22( _this );
870 this.el.add ( child_2.el );
873 // user defined functions
875 public class Xcls_btn_not_me : Object
877 public Gtk.CheckButton el;
878 private NewBranch _this;
884 public Xcls_btn_not_me(NewBranch _owner )
887 _this.btn_not_me = this;
888 this.el = new Gtk.CheckButton();
892 // set gobject values
893 this.el.label = "Show tickets not assigned to me";
896 this.el.toggled.connect( () => {
897 var project_id = _this.projectsel.selectedProjectId();
898 _this.dbmodel.loadTickets(project_id);
902 // user defined functions
905 public class Xcls_btn_closed : Object
907 public Gtk.CheckButton el;
908 private NewBranch _this;
914 public Xcls_btn_closed(NewBranch _owner )
917 _this.btn_closed = this;
918 this.el = new Gtk.CheckButton();
922 // set gobject values
923 this.el.label = "Show closed Tickets";
926 this.el.toggled.connect( () => {
927 var project_id = _this.projectsel.selectedProjectId();
928 _this.dbmodel.loadTickets(project_id);
933 // user defined functions
936 public class Xcls_Label22 : Object
939 private NewBranch _this;
945 public Xcls_Label22(NewBranch _owner )
948 this.el = new Gtk.Label( "<a href=\"refresh\">Refresh Ticket list</a>" );
952 // set gobject values
953 this.el.halign = Gtk.Align.END;
954 this.el.hexpand = true;
955 this.el.use_markup = true;
958 this.el.activate_link.connect( (uri) => {
959 if (uri == "refresh") {
961 var curproj = RooProject.getProjectByRepo(_this.repo);
962 _this.prmodel.loadProjects(curproj == null ? "": curproj.id);
964 _this.dbmodel.loadTickets(curproj == null ? "": curproj.id);
970 // user defined functions
975 public class Xcls_scrolled_window : Object
977 public Gtk.ScrolledWindow el;
978 private NewBranch _this;
984 public Xcls_scrolled_window(NewBranch _owner )
987 _this.scrolled_window = this;
988 this.el = new Gtk.ScrolledWindow( null, null );
992 // set gobject values
993 this.el.height_request = 500;
994 this.el.vexpand = true;
995 var child_0 = new Xcls_view( _this );
997 this.el.add ( child_0.el );
1002 this.el.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);
1006 // user defined functions
1008 public class Xcls_view : Object
1010 public WebKit.WebView el;
1011 private NewBranch _this;
1017 public Xcls_view(NewBranch _owner )
1021 this.el = new WebKit.WebView();
1025 // set gobject values
1028 // user defined functions
1029 public void loadTicket (string tid) {
1031 _this.el.get_size(out w, out h);
1034 _this.scrolled_window.el.hide();
1035 _this.el.resize(w, 150);
1037 _this.scrolled_window.el.show();
1038 _this.el.resize(w, 800);
1041 var rs = RooTicket.singleton();
1042 var uri = new WebKit.URIRequest("https://roojs.com/admin.php/MTrack/View/" + tid);
1043 var hd = uri.get_http_headers();
1044 var authCode = Base64.encode ("%s:%s".printf(rs.username, rs.password).data);
1045 hd.append("Authorization", "Basic %s".printf(authCode));
1047 this.el.load_request(uri);
1053 public class Xcls_Box25 : Object
1056 private NewBranch _this;
1062 public Xcls_Box25(NewBranch _owner )
1065 this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
1069 // set gobject values
1070 this.el.homogeneous = false;
1071 var child_0 = new Xcls_table( _this );
1073 this.el.pack_start ( child_0.el , false,false,0 );
1076 // user defined functions
1078 public class Xcls_table : Object
1080 public Gtk.Table el;
1081 private NewBranch _this;
1087 public Xcls_table(NewBranch _owner )
1091 this.el = new Gtk.Table( 14, 4, true );
1095 // set gobject values
1096 this.el.expand = false;
1098 this.el.column_spacing = 4;
1099 this.el.vexpand = false;
1100 var child_0 = new Xcls_Label27( _this );
1102 this.el.attach_defaults ( child_0.el , 0,1,0,1 );
1103 var child_1 = new Xcls_Label28( _this );
1105 this.el.attach_defaults ( child_1.el , 1,2,0,1 );
1106 var child_2 = new Xcls_project_id( _this );
1108 this.el.attach_defaults ( child_2.el , 0,1,1,2 );
1109 var child_3 = new Xcls_summary( _this );
1111 this.el.attach_defaults ( child_3.el , 1,4,1,2 );
1112 var child_4 = new Xcls_Label33( _this );
1114 this.el.attach_defaults ( child_4.el , 0,1,2,3 );
1115 var child_5 = new Xcls_milestone_id( _this );
1117 this.el.attach_defaults ( child_5.el , 0,1,3,4 );
1118 var child_6 = new Xcls_Label36( _this );
1120 this.el.attach_defaults ( child_6.el , 1,4,2,3 );
1121 var child_7 = new Xcls_description( _this );
1123 this.el.attach_defaults ( child_7.el , 1,4,3,12 );
1124 var child_8 = new Xcls_Label38( _this );
1126 this.el.attach_defaults ( child_8.el , 0,1,4,5 );
1127 var child_9 = new Xcls_priority_id( _this );
1129 this.el.attach_defaults ( child_9.el , 0,1,5,6 );
1130 var child_10 = new Xcls_Label41( _this );
1132 this.el.attach_defaults ( child_10.el , 0,1,6,7 );
1133 var child_11 = new Xcls_severity_id( _this );
1135 this.el.attach_defaults ( child_11.el , 0,1,7,8 );
1136 var child_12 = new Xcls_Label44( _this );
1138 this.el.attach_defaults ( child_12.el , 0,1,8,9 );
1139 var child_13 = new Xcls_classification_id( _this );
1141 this.el.attach_defaults ( child_13.el , 0,1,9,10 );
1142 var child_14 = new Xcls_Label47( _this );
1144 this.el.attach_defaults ( child_14.el , 0,1,10,11 );
1145 var child_15 = new Xcls_developer_id( _this );
1147 this.el.attach_defaults ( child_15.el , 0,1,11,12 );
1148 var child_16 = new Xcls_Button50( _this );
1150 this.el.attach_defaults ( child_16.el , 0,4,13,14 );
1153 // user defined functions
1155 public class Xcls_Label27 : Object
1157 public Gtk.Label el;
1158 private NewBranch _this;
1164 public Xcls_Label27(NewBranch _owner )
1167 this.el = new Gtk.Label( "Project" );
1171 // set gobject values
1172 this.el.halign = Gtk.Align.START;
1173 this.el.visible = true;
1176 // user defined functions
1179 public class Xcls_Label28 : Object
1181 public Gtk.Label el;
1182 private NewBranch _this;
1188 public Xcls_Label28(NewBranch _owner )
1191 this.el = new Gtk.Label( "Summary" );
1195 // set gobject values
1196 this.el.halign = Gtk.Align.START;
1197 this.el.visible = true;
1200 // user defined functions
1203 public class Xcls_project_id : Object
1205 public Gtk.ComboBox el;
1206 private NewBranch _this;
1210 public bool loading;
1213 public Xcls_project_id(NewBranch _owner )
1216 _this.project_id = this;
1217 this.el = new Gtk.ComboBox.with_entry();
1220 this.loading = false;
1222 // set gobject values
1223 var child_0 = new Xcls_prcellrenderer( _this );
1225 this.el.pack_start ( child_0.el , true );
1226 var child_1 = new Xcls_prmodel( _this );
1228 this.el.set_model ( child_1.el );
1232 this.el.set_entry_text_column(1);
1235 this.el.changed.connect( () => {
1239 var project_id = this.selectedProjectId();
1241 var rt = RooTicket.singleton();
1242 rt.loadProjectOptions(project_id);
1244 _this.msmodel.loadMilestones();
1245 _this.primodel.loadPriorities();
1246 _this.sevmodel.loadSeverities();
1247 _this.clmodel.loadClassifications();
1248 _this.devmodel.loadDevelopers();
1250 // affects projects and milestones..
1253 /*if (this.loading) {
1256 var ticket_id = this.selectedTicketId();
1258 var name = RooTicket.singleton().usernameLocal();
1260 if (ticket_id == "" || ticket_id == null) {
1262 var dt = new DateTime.now_local();
1263 _this.name.el.set_text("wip_%s_%s".printf(name,dt.format("%Y_%b_%d")));
1268 var ticket = RooTicket.singleton().getById(ticket_id);
1270 _this.name.el.set_text("wip_%s_T%s_%s".printf(name,ticket.id, ticket.summaryToBranchName()));
1272 //GLib.debug (//"Selection: %s, %s\n", (string) val1, (string) val2);
1277 // user defined functions
1278 public string selectedProjectId () {
1283 this.el.get_active_iter (out iter);
1284 _this.prmodel.el.get_value (iter, 0, out val1);
1287 return (string) val1;
1294 public class Xcls_prcellrenderer : Object
1296 public Gtk.CellRendererText el;
1297 private NewBranch _this;
1303 public Xcls_prcellrenderer(NewBranch _owner )
1306 _this.prcellrenderer = this;
1307 this.el = new Gtk.CellRendererText();
1311 // set gobject values
1314 // user defined functions
1317 public class Xcls_prmodel : Object
1319 public Gtk.ListStore el;
1320 private NewBranch _this;
1326 public Xcls_prmodel(NewBranch _owner )
1329 _this.prmodel = this;
1330 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
1334 // set gobject values
1337 // user defined functions
1338 public void loadProjects (string id) {
1341 _this.project_id.loading = true;
1347 el.append(out iter);
1350 el.set_value(iter, 0, "");
1351 el.set_value(iter, 1, "-- select a project --");
1353 _this.project_id.el.set_active_iter(iter);
1356 foreach(var project in RooProject.projects()) {
1358 el.append(out iter);
1360 el.set_value(iter, 0, project.id);
1361 el.set_value(iter, 1, project.name );
1362 if (id == project.id) {
1363 _this.project_id.el.set_active_iter(iter);
1368 _this.project_id.loading = false;
1369 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
1375 public class Xcls_summary : Object
1377 public Gtk.Entry el;
1378 private NewBranch _this;
1384 public Xcls_summary(NewBranch _owner )
1387 _this.summary = this;
1388 this.el = new Gtk.Entry();
1392 // set gobject values
1393 this.el.visible = true;
1396 // user defined functions
1399 public class Xcls_Label33 : Object
1401 public Gtk.Label el;
1402 private NewBranch _this;
1408 public Xcls_Label33(NewBranch _owner )
1411 this.el = new Gtk.Label( "Milestone" );
1415 // set gobject values
1416 this.el.halign = Gtk.Align.START;
1417 this.el.justify = Gtk.Justification.RIGHT;
1418 this.el.xalign = 0.900000f;
1421 // user defined functions
1424 public class Xcls_milestone_id : Object
1426 public Gtk.ComboBox el;
1427 private NewBranch _this;
1431 public bool loading;
1434 public Xcls_milestone_id(NewBranch _owner )
1437 _this.milestone_id = this;
1438 this.el = new Gtk.ComboBox.with_entry();
1441 this.loading = false;
1443 // set gobject values
1444 var child_0 = new Xcls_msmodel( _this );
1446 this.el.set_model ( child_0.el );
1450 this.el.set_entry_text_column(1);
1453 // user defined functions
1454 public string selectedMilestoneId () {
1459 this.el.get_active_iter (out iter);
1460 _this.msmodel.el.get_value (iter, 0, out val1);
1463 return (string) val1;
1470 public class Xcls_msmodel : Object
1472 public Gtk.ListStore el;
1473 private NewBranch _this;
1479 public Xcls_msmodel(NewBranch _owner )
1482 _this.msmodel = this;
1483 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
1487 // set gobject values
1490 // user defined functions
1491 public void loadMilestones ( ) {
1493 var rt = RooTicket.singleton();
1494 // rt.loadProjects();
1496 _this.milestone_id.loading = true;
1502 el.append(out iter);
1505 el.set_value(iter, 0, "");
1506 el.set_value(iter, 1, "-- select a milestone --");
1507 _this.milestone_id.el.set_active_iter(iter);
1509 var projects = rt.milestones;
1510 foreach(var project in projects) {
1512 el.append(out iter);
1514 el.set_value(iter, 0, project.id);
1515 el.set_value(iter, 1, project.display_name );
1516 // if (id == project.id) {
1517 // _this.milestone.el.set_active_iter(iter);
1523 _this.milestone_id.loading = false;
1524 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
1530 public class Xcls_Label36 : Object
1532 public Gtk.Label el;
1533 private NewBranch _this;
1539 public Xcls_Label36(NewBranch _owner )
1542 this.el = new Gtk.Label( "Description" );
1546 // set gobject values
1547 this.el.halign = Gtk.Align.START;
1550 // user defined functions
1553 public class Xcls_description : Object
1555 public Gtk.TextView el;
1556 private NewBranch _this;
1562 public Xcls_description(NewBranch _owner )
1565 _this.description = this;
1566 this.el = new Gtk.TextView();
1570 // set gobject values
1571 this.el.border_width = 1;
1574 // user defined functions
1577 public class Xcls_Label38 : Object
1579 public Gtk.Label el;
1580 private NewBranch _this;
1586 public Xcls_Label38(NewBranch _owner )
1589 this.el = new Gtk.Label( "Priority" );
1593 // set gobject values
1594 this.el.halign = Gtk.Align.START;
1595 this.el.xalign = 0.900000f;
1598 // user defined functions
1601 public class Xcls_priority_id : Object
1603 public Gtk.ComboBox el;
1604 private NewBranch _this;
1608 public bool loading;
1611 public Xcls_priority_id(NewBranch _owner )
1614 _this.priority_id = this;
1615 this.el = new Gtk.ComboBox.with_entry();
1618 this.loading = false;
1620 // set gobject values
1621 var child_0 = new Xcls_primodel( _this );
1623 this.el.set_model ( child_0.el );
1627 this.el.set_entry_text_column(1);
1630 // user defined functions
1631 public string selectedPriorityId () {
1636 this.el.get_active_iter (out iter);
1637 _this.primodel.el.get_value (iter, 0, out val1);
1640 return (string) val1;
1647 public class Xcls_primodel : Object
1649 public Gtk.ListStore el;
1650 private NewBranch _this;
1656 public Xcls_primodel(NewBranch _owner )
1659 _this.primodel = this;
1660 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
1664 // set gobject values
1667 // user defined functions
1668 public void loadPriorities ( ) {
1670 var rt = RooTicket.singleton();
1671 // rt.loadProjects();
1673 _this.priority_id.loading = true;
1680 var projects = rt.priorities;
1681 foreach(var project in projects) {
1683 el.append(out iter);
1685 el.set_value(iter, 0, project.id);
1686 el.set_value(iter, 1, project.display_name );
1687 if ("normal" == project.name) {
1688 _this.priority_id.el.set_active_iter(iter);
1693 _this.priority_id.loading = false;
1700 public class Xcls_Label41 : Object
1702 public Gtk.Label el;
1703 private NewBranch _this;
1709 public Xcls_Label41(NewBranch _owner )
1712 this.el = new Gtk.Label( "Severity" );
1716 // set gobject values
1717 this.el.halign = Gtk.Align.START;
1720 // user defined functions
1723 public class Xcls_severity_id : Object
1725 public Gtk.ComboBox el;
1726 private NewBranch _this;
1730 public bool loading;
1733 public Xcls_severity_id(NewBranch _owner )
1736 _this.severity_id = this;
1737 this.el = new Gtk.ComboBox.with_entry();
1740 this.loading = false;
1742 // set gobject values
1743 var child_0 = new Xcls_sevmodel( _this );
1745 this.el.set_model ( child_0.el );
1749 this.el.set_entry_text_column(1);
1752 // user defined functions
1753 public string selectedSeverityId () {
1758 this.el.get_active_iter (out iter);
1759 _this.sevmodel.el.get_value (iter, 0, out val1);
1762 return (string) val1;
1769 public class Xcls_sevmodel : Object
1771 public Gtk.ListStore el;
1772 private NewBranch _this;
1778 public Xcls_sevmodel(NewBranch _owner )
1781 _this.sevmodel = this;
1782 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
1786 // set gobject values
1789 // user defined functions
1790 public void loadSeverities () {
1792 var rt = RooTicket.singleton();
1793 //rt.loadProjects();
1795 _this.severity_id.loading = true;
1801 var projects = rt.serverities;
1802 foreach(var project in projects) {
1804 el.append(out iter);
1806 el.set_value(iter, 0, project.id);
1807 el.set_value(iter, 1, project.display_name );
1808 if ("normal" == project.name) {
1809 _this.severity_id.el.set_active_iter(iter);
1814 _this.severity_id.loading = false;
1815 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
1821 public class Xcls_Label44 : Object
1823 public Gtk.Label el;
1824 private NewBranch _this;
1830 public Xcls_Label44(NewBranch _owner )
1833 this.el = new Gtk.Label( "Classification" );
1837 // set gobject values
1838 this.el.halign = Gtk.Align.START;
1841 // user defined functions
1844 public class Xcls_classification_id : Object
1846 public Gtk.ComboBox el;
1847 private NewBranch _this;
1851 public bool loading;
1854 public Xcls_classification_id(NewBranch _owner )
1857 _this.classification_id = this;
1858 this.el = new Gtk.ComboBox.with_entry();
1861 this.loading = false;
1863 // set gobject values
1864 var child_0 = new Xcls_clmodel( _this );
1866 this.el.set_model ( child_0.el );
1870 this.el.set_entry_text_column(1);
1873 // user defined functions
1874 public string selectedClassificationId () {
1879 this.el.get_active_iter (out iter);
1880 _this.clmodel.el.get_value (iter, 0, out val1);
1883 return (string) val1;
1890 public class Xcls_clmodel : Object
1892 public Gtk.ListStore el;
1893 private NewBranch _this;
1899 public Xcls_clmodel(NewBranch _owner )
1902 _this.clmodel = this;
1903 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
1907 // set gobject values
1910 // user defined functions
1911 public void loadClassifications ( ) {
1913 var rt = RooTicket.singleton();
1914 // rt.loadProjects();
1916 _this.classification_id.loading = true;
1922 el.append(out iter);
1925 var projects = rt.classifications;
1926 foreach(var project in projects) {
1928 el.append(out iter);
1930 el.set_value(iter, 0, project.id);
1931 el.set_value(iter, 1, project.display_name );
1932 if ("bug" == project.name) {
1933 _this.classification_id.el.set_active_iter(iter);
1938 _this.classification_id.loading = false;
1939 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
1945 public class Xcls_Label47 : Object
1947 public Gtk.Label el;
1948 private NewBranch _this;
1954 public Xcls_Label47(NewBranch _owner )
1957 this.el = new Gtk.Label( "Assign to" );
1961 // set gobject values
1962 this.el.halign = Gtk.Align.START;
1965 // user defined functions
1968 public class Xcls_developer_id : Object
1970 public Gtk.ComboBox el;
1971 private NewBranch _this;
1975 public bool loading;
1978 public Xcls_developer_id(NewBranch _owner )
1981 _this.developer_id = this;
1982 this.el = new Gtk.ComboBox.with_entry();
1985 this.loading = false;
1987 // set gobject values
1988 var child_0 = new Xcls_devmodel( _this );
1990 this.el.set_model ( child_0.el );
1994 this.el.set_entry_text_column(1);
1997 // user defined functions
1998 public string selectedDeveloperId () {
2003 this.el.get_active_iter (out iter);
2004 _this.devmodel.el.get_value (iter, 0, out val1);
2007 return (string) val1;
2014 public class Xcls_devmodel : Object
2016 public Gtk.ListStore el;
2017 private NewBranch _this;
2023 public Xcls_devmodel(NewBranch _owner )
2026 _this.devmodel = this;
2027 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
2031 // set gobject values
2034 // user defined functions
2035 public void loadDevelopers ( ) {
2037 var rt = RooTicket.singleton();
2038 //rt.loadProjects();
2040 _this.developer_id.loading = true;
2046 el.append(out iter);
2049 el.set_value(iter, 0, "");
2050 el.set_value(iter, 1, "-- select a developer --");
2052 _this.developer_id.el.set_active_iter(iter);
2055 var peps = rt.developers;
2056 foreach(var p in peps) {
2058 el.append(out iter);
2060 el.set_value(iter, 0, p.id);
2061 el.set_value(iter, 1, p.display_name );
2062 if (rt.authuser_id == p.id) {
2063 _this.developer_id.el.set_active_iter(iter);
2067 _this.developer_id.loading = false;
2068 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
2074 public class Xcls_Button50 : Object
2076 public Gtk.Button el;
2077 private NewBranch _this;
2083 public Xcls_Button50(NewBranch _owner )
2086 this.el = new Gtk.Button();
2090 // set gobject values
2091 this.el.label = "Create Ticket & Branch";
2096 this.el.get_style_context().add_class("suggested-action");
2100 this.el.clicked.connect( () => {
2101 GLib.debug("fire response = 1");
2104 var invalid = false;
2106 // validate first...
2107 _this.project_id.el.get_child().get_style_context().remove_class("warning");
2108 if (_this.project_id.selectedProjectId() == "") {
2109 _this.project_id.el.get_child().get_style_context().add_class("warning");
2113 _this.milestone_id.el.get_child().get_style_context().remove_class("warning");
2115 _this.priority_id.el.get_child().get_style_context().remove_class("warning");
2116 if (_this.priority_id.selectedPriorityId() == "") {
2117 _this.priority_id.el.get_child().get_style_context().add_class("warning");
2121 _this.classification_id.el.get_child().get_style_context().remove_class("warning");
2122 if (_this.classification_id.selectedClassificationId() == "") {
2123 _this.classification_id.el.get_child().get_style_context().add_class("warning");
2127 _this.developer_id.el.get_child().get_style_context().remove_class("warning");
2128 if (_this.developer_id.selectedDeveloperId() == "") {
2129 _this.developer_id.el.get_child().get_style_context().add_class("warning");
2133 _this.summary.el.get_style_context().remove_class("warning");
2134 if (_this.summary.el.get_text() == "") {
2135 _this.summary.el.get_style_context().add_class("warning");
2139 _this.description.el.get_style_context().remove_class("warning");
2144 GLib.debug("for is valid");
2146 _this.el.response(1);
2150 // user defined functions
2155 public class Xcls_Box51 : Object
2158 private NewBranch _this;
2164 public Xcls_Box51(NewBranch _owner )
2167 this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
2171 // set gobject values
2172 this.el.homogeneous = false;
2175 // user defined functions