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;
46 public Xcls_commit_message commit_message;
47 public Xcls_createbtn createbtn;
52 public Gee.ArrayList<GitMonitorQueue> queue;
58 this.el = new Gtk.Dialog();
66 this.el.title = "Create a working branch ";
67 this.el.default_height = 500;
68 this.el.default_width = 500;
69 this.el.deletable = true;
71 var child_0 = new Xcls_Notebook2( _this );
73 this.el.get_content_area().add ( child_0.el );
76 this.el.delete_event.connect( (self, event) => {
81 this.el.response.connect( (self, response_id) => {
83 GLib.debug("got %d", (int) response_id);
88 // have they selected a ticket..
89 // make that the current active ticket?
90 // we really need to store locally what ticket is being worked on..
91 // in theory we could be working on multiple project and not merging..
92 // -- each repo would have their active ticket (only one per repo)
93 // -- so we could just store that in there
94 // -- initial load can check the contents of the ticket files on first scan.
97 if (response_id < 1) {
103 var ticket_id = _this.ticketsel.selectedTicketId();
105 if (this.repo != null) {
106 var bn = _this.name.el.get_text();
108 var res = this.repo.setActiveTicket(
109 RooTicket.singleton().getById(ticket_id != "" ? ticket_id : "-1"), bn
112 // start the monitoring..
113 GitMonitor.gitmonitor.start();
119 this.running = false;
129 // user defined functions
130 public void show ( GitRepo repo, Gee.ArrayList<GitMonitorQueue> queue, string tid = "" )
132 // this.el.set_gravity(Gdk.Gravity.NORTH);
133 if (this.running) { // should not happen!!
134 GLib.error("new branch show called, when already being displayed?");
139 GitMonitor.gitmonitor.stop();
145 this.el.move((Gdk.Screen.width() / 2)- 250 ,0);
146 this.el.set_default_size( 500,200); // not sure why it grows..
147 GLib.debug("Loading tickets");
151 this.el.set_keep_above(true);
154 var curproj = RooProject.getProjectByRepo(this.repo);
155 _this.prmodel.loadProjects(curproj == null ? "" : curproj.id);
157 _this.dbmodel.loadTickets(curproj == null ? "": curproj.id, tid);
158 _this.createbtn.updateState();
160 _this.ticketsel.el.get_child().get_style_context().remove_class("warning");
162 var name = RooTicket.singleton().usernameLocal();
163 var ticket = RooTicket.singleton().getById(tid);
164 _this.name.el.set_text("wip_%s_T%s_%s".printf(name,ticket.id, ticket.summaryToBranchName()));
166 _this.ticketsel.el.get_child().get_style_context().add_class("warning");
168 _this.view.loadTicket(tid);
172 public class Xcls_Notebook2 : Object
174 public Gtk.Notebook el;
175 private NewBranch _this;
181 public Xcls_Notebook2(NewBranch _owner )
184 this.el = new Gtk.Notebook();
188 // set gobject values
189 this.el.vexpand = true;
190 var child_0 = new Xcls_label_select_ticket( _this );
192 var child_1 = new Xcls_label_create_ticket( _this );
194 var child_2 = new Xcls_label_quick_commit( _this );
196 var child_3 = new Xcls_Box6( _this );
198 this.el.append_page ( child_3.el , _this.label_select_ticket.el );
199 var child_4 = new Xcls_Box25( _this );
201 this.el.append_page ( child_4.el , _this.label_create_ticket.el );
202 var child_5 = new Xcls_Box51( _this );
204 this.el.append_page ( child_5.el , _this.label_quick_commit.el );
207 // user defined functions
209 public class Xcls_label_select_ticket : Object
212 private NewBranch _this;
218 public Xcls_label_select_ticket(NewBranch _owner )
221 _this.label_select_ticket = this;
222 this.el = new Gtk.Label( "Select Existing Ticket to work on" );
226 // set gobject values
229 // user defined functions
232 public class Xcls_label_create_ticket : Object
235 private NewBranch _this;
241 public Xcls_label_create_ticket(NewBranch _owner )
244 _this.label_create_ticket = this;
245 this.el = new Gtk.Label( "Create a New Ticket" );
249 // set gobject values
252 // user defined functions
255 public class Xcls_label_quick_commit : Object
258 private NewBranch _this;
264 public Xcls_label_quick_commit(NewBranch _owner )
267 _this.label_quick_commit = this;
268 this.el = new Gtk.Label( "Quick Commit" );
272 // set gobject values
275 // user defined functions
278 public class Xcls_Box6 : Object
281 private NewBranch _this;
287 public Xcls_Box6(NewBranch _owner )
290 this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
294 // set gobject values
295 this.el.homogeneous = false;
296 var child_0 = new Xcls_Table7( _this );
298 this.el.pack_start ( child_0.el , false,false,0 );
299 var child_1 = new Xcls_scrolled_window( _this );
301 this.el.add ( child_1.el );
304 // user defined functions
306 public class Xcls_Table7 : Object
309 private NewBranch _this;
315 public Xcls_Table7(NewBranch _owner )
318 this.el = new Gtk.Table( 5, 5, true );
322 // set gobject values
323 this.el.expand = false;
325 this.el.column_spacing = 4;
326 this.el.vexpand = false;
327 var child_0 = new Xcls_Label8( _this );
329 this.el.attach_defaults ( child_0.el , 0,1,0,1 );
330 var child_1 = new Xcls_Label9( _this );
332 this.el.attach_defaults ( child_1.el , 1,2,0,1 );
333 var child_2 = new Xcls_projectsel( _this );
335 this.el.attach_defaults ( child_2.el , 0,1,1,2 );
336 var child_3 = new Xcls_ticketsel( _this );
338 this.el.attach_defaults ( child_3.el , 1,5,1,2 );
339 var child_4 = new Xcls_Label16( _this );
341 this.el.attach_defaults ( child_4.el , 0,1,3,4 );
342 var child_5 = new Xcls_name( _this );
344 this.el.attach_defaults ( child_5.el , 0,4,4,5 );
345 var child_6 = new Xcls_createbtn( _this );
347 this.el.attach_defaults ( child_6.el , 4,5,4,5 );
348 var child_7 = new Xcls_Box19( _this );
350 this.el.attach_defaults ( child_7.el , 0,5,2,3 );
353 // user defined functions
355 public class Xcls_Label8 : Object
358 private NewBranch _this;
364 public Xcls_Label8(NewBranch _owner )
367 this.el = new Gtk.Label( "Project" );
371 // set gobject values
372 this.el.halign = Gtk.Align.START;
373 this.el.justify = Gtk.Justification.RIGHT;
374 this.el.visible = true;
377 // user defined functions
380 public class Xcls_Label9 : Object
383 private NewBranch _this;
389 public Xcls_Label9(NewBranch _owner )
392 this.el = new Gtk.Label( "Ticket" );
396 // set gobject values
397 this.el.halign = Gtk.Align.START;
398 this.el.visible = true;
401 // user defined functions
404 public class Xcls_projectsel : Object
406 public Gtk.ComboBox el;
407 private NewBranch _this;
414 public Xcls_projectsel(NewBranch _owner )
417 _this.projectsel = this;
418 this.el = new Gtk.ComboBox.with_entry();
421 this.loading = false;
423 // set gobject values
424 var child_0 = new Xcls_prcellrenderer( _this );
426 this.el.pack_start ( child_0.el , true );
427 var child_1 = new Xcls_prmodel( _this );
429 this.el.set_model ( child_1.el );
433 this.el.set_entry_text_column(1);
436 this.el.changed.connect( () => {
440 var project_id = this.selectedProjectId();
441 _this.dbmodel.loadTickets(project_id);
444 /*if (this.loading) {
447 var ticket_id = this.selectedTicketId();
449 var name = RooTicket.singleton().usernameLocal();
451 if (ticket_id == "" || ticket_id == null) {
453 var dt = new DateTime.now_local();
454 _this.name.el.set_text("wip_%s_%s".printf(name,dt.format("%Y_%b_%d")));
459 var ticket = RooTicket.singleton().getById(ticket_id);
461 _this.name.el.set_text("wip_%s_T%s_%s".printf(name,ticket.id, ticket.summaryToBranchName()));
463 //GLib.debug (//"Selection: %s, %s\n", (string) val1, (string) val2);
468 // user defined functions
469 public string selectedProjectId () {
474 this.el.get_active_iter (out iter);
475 _this.prmodel.el.get_value (iter, 0, out val1);
478 return (string) val1;
485 public class Xcls_prcellrenderer : Object
487 public Gtk.CellRendererText el;
488 private NewBranch _this;
494 public Xcls_prcellrenderer(NewBranch _owner )
497 _this.prcellrenderer = this;
498 this.el = new Gtk.CellRendererText();
502 // set gobject values
505 // user defined functions
508 public class Xcls_prmodel : Object
510 public Gtk.ListStore el;
511 private NewBranch _this;
517 public Xcls_prmodel(NewBranch _owner )
520 _this.prmodel = this;
521 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
525 // set gobject values
528 // user defined functions
529 public void loadProjects (string id) {
533 _this.projectsel.loading = true;
542 el.set_value(iter, 0, "");
543 el.set_value(iter, 1, "-- select a project --");
545 _this.projectsel.el.set_active_iter(iter);
548 foreach(var project in RooProject.projects()) {
552 el.set_value(iter, 0, project.id);
553 el.set_value(iter, 1, project.name );
554 if (id == project.id) {
555 _this.projectsel.el.set_active_iter(iter);
560 _this.projectsel.loading = false;
561 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
567 public class Xcls_ticketsel : Object
569 public Gtk.ComboBox el;
570 private NewBranch _this;
577 public Xcls_ticketsel(NewBranch _owner )
580 _this.ticketsel = this;
581 this.el = new Gtk.ComboBox.with_entry();
584 this.loading = false;
586 // set gobject values
587 var child_0 = new Xcls_dbcellrenderer( _this );
589 this.el.pack_start ( child_0.el , true );
590 var child_1 = new Xcls_dbmodel( _this );
592 this.el.set_model ( child_1.el );
596 //this.el.add_attribute(_this.dbcellrenderer.el , "markup", 1 );
597 this.el.set_entry_text_column(1);
598 this.el.get_child().set_sensitive(false);
601 this.el.changed.connect( () => {
605 var ticket_id = this.selectedTicketId();
607 var name = RooTicket.singleton().usernameLocal();
609 this.el.get_child().get_style_context().remove_class("warning");
610 if (ticket_id == "" || ticket_id == null) {
612 var dt = new DateTime.now_local();
613 _this.name.el.set_text("wip_%s_%s".printf(name,dt.format("%Y_%b_%d")));
614 _this.view.loadTicket("");
616 this.el.get_child().get_style_context().add_class("warning");
617 _this.createbtn.updateState();
622 var ticket = RooTicket.singleton().getById(ticket_id);
624 _this.name.el.set_text("wip_%s_T%s_%s".printf(name,ticket.id, ticket.summaryToBranchName()));
625 _this.scrolled_window.el.show();
627 _this.view.loadTicket(ticket.id);
628 _this.createbtn.updateState();
630 //GLib.debug (//"Selection: %s, %s\n", (string) val1, (string) val2);
634 // user defined functions
635 public string selectedTicketId () {
640 this.el.get_active_iter (out iter);
641 _this.dbmodel.el.get_value (iter, 0, out val1);
644 return (string) val1;
651 public class Xcls_dbcellrenderer : Object
653 public Gtk.CellRendererText el;
654 private NewBranch _this;
660 public Xcls_dbcellrenderer(NewBranch _owner )
663 _this.dbcellrenderer = this;
664 this.el = new Gtk.CellRendererText();
668 // set gobject values
671 // user defined functions
674 public class Xcls_dbmodel : Object
676 public Gtk.ListStore el;
677 private NewBranch _this;
683 public Xcls_dbmodel(NewBranch _owner )
686 _this.dbmodel = this;
687 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
691 // set gobject values
694 // user defined functions
695 public void loadTickets (string project_id , string tid = "") {
699 // fixme .. get project id from selection..
701 RooTicket.singleton().loadTickets(
703 _this.btn_not_me.el.active ? RooTicket.Who.ANYBODY : RooTicket.Who.ME,
704 _this.btn_closed.el.active ? RooTicket.Status.ALL : RooTicket.Status.ACTIVE
707 _this.ticketsel.loading = true;
716 el.set_value(iter, 0, "");
717 el.set_value(iter, 1, "-- select a ticket --");
719 _this.ticketsel.el.set_active_iter(iter);
720 var tickets = RooTicket.singleton().tickets;
721 foreach(var ticket in tickets) {
725 el.set_value(iter, 0, ticket.id);
726 el.set_value(iter, 1, "#%s %s".printf( ticket.id, ticket.summary));
728 if (ticket.id == tid) {
729 _this.ticketsel.el.set_active_iter(iter);
734 _this.ticketsel.loading = false;
735 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
741 public class Xcls_Label16 : Object
744 private NewBranch _this;
750 public Xcls_Label16(NewBranch _owner )
753 this.el = new Gtk.Label( "Use this as branch name" );
757 // set gobject values
758 this.el.halign = Gtk.Align.START;
759 this.el.justify = Gtk.Justification.RIGHT;
760 this.el.xalign = 0.900000f;
763 // user defined functions
766 public class Xcls_name : Object
769 private NewBranch _this;
775 public Xcls_name(NewBranch _owner )
779 this.el = new Gtk.Entry();
783 // set gobject values
784 this.el.visible = true;
787 // user defined functions
790 public class Xcls_createbtn : Object
792 public Gtk.Button el;
793 private NewBranch _this;
799 public Xcls_createbtn(NewBranch _owner )
802 _this.createbtn = this;
803 this.el = new Gtk.Button();
807 // set gobject values
808 this.el.label = "Create Branch";
813 this.el.get_style_context().add_class("suggested-action");
817 this.el.clicked.connect( () => {
819 GLib.debug("fire response = 1");
821 var ticket_id = _this.ticketsel.selectedTicketId();
823 if (ticket_id == "") {
824 _this.ticketsel.el.get_child().get_style_context().add_class("warning");
828 _this.el.response(1);
832 // user defined functions
833 public void updateState () {
835 var ticket_id = _this.ticketsel.selectedTicketId();
837 if (ticket_id == "") {
838 this.el.set_sensitive(false);
842 this.el.set_sensitive(true);
847 public class Xcls_Box19 : Object
850 private NewBranch _this;
856 public Xcls_Box19(NewBranch _owner )
859 this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
863 // set gobject values
864 var child_0 = new Xcls_btn_not_me( _this );
866 this.el.add ( child_0.el );
867 var child_1 = new Xcls_btn_closed( _this );
869 this.el.add ( child_1.el );
870 var child_2 = new Xcls_Label22( _this );
872 this.el.add ( child_2.el );
875 // user defined functions
877 public class Xcls_btn_not_me : Object
879 public Gtk.CheckButton el;
880 private NewBranch _this;
886 public Xcls_btn_not_me(NewBranch _owner )
889 _this.btn_not_me = this;
890 this.el = new Gtk.CheckButton();
894 // set gobject values
895 this.el.label = "Show tickets not assigned to me";
898 this.el.toggled.connect( () => {
899 var project_id = _this.projectsel.selectedProjectId();
900 _this.dbmodel.loadTickets(project_id);
904 // user defined functions
907 public class Xcls_btn_closed : Object
909 public Gtk.CheckButton el;
910 private NewBranch _this;
916 public Xcls_btn_closed(NewBranch _owner )
919 _this.btn_closed = this;
920 this.el = new Gtk.CheckButton();
924 // set gobject values
925 this.el.label = "Show closed Tickets";
928 this.el.toggled.connect( () => {
929 var project_id = _this.projectsel.selectedProjectId();
930 _this.dbmodel.loadTickets(project_id);
935 // user defined functions
938 public class Xcls_Label22 : Object
941 private NewBranch _this;
947 public Xcls_Label22(NewBranch _owner )
950 this.el = new Gtk.Label( "<a href=\"refresh\">Refresh Ticket list</a>" );
954 // set gobject values
955 this.el.halign = Gtk.Align.END;
956 this.el.hexpand = true;
957 this.el.use_markup = true;
960 this.el.activate_link.connect( (uri) => {
961 if (uri == "refresh") {
963 var curproj = RooProject.getProjectByRepo(_this.repo);
964 _this.prmodel.loadProjects(curproj == null ? "": curproj.id);
966 _this.dbmodel.loadTickets(curproj == null ? "": curproj.id);
972 // user defined functions
977 public class Xcls_scrolled_window : Object
979 public Gtk.ScrolledWindow el;
980 private NewBranch _this;
986 public Xcls_scrolled_window(NewBranch _owner )
989 _this.scrolled_window = this;
990 this.el = new Gtk.ScrolledWindow( null, null );
994 // set gobject values
995 this.el.height_request = 500;
996 this.el.vexpand = true;
997 var child_0 = new Xcls_view( _this );
999 this.el.add ( child_0.el );
1004 this.el.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);
1008 // user defined functions
1010 public class Xcls_view : Object
1012 public WebKit.WebView el;
1013 private NewBranch _this;
1019 public Xcls_view(NewBranch _owner )
1023 this.el = new WebKit.WebView();
1027 // set gobject values
1030 // user defined functions
1031 public void loadTicket (string tid) {
1033 _this.el.get_size(out w, out h);
1036 _this.scrolled_window.el.hide();
1037 _this.el.resize(w, 150);
1039 _this.scrolled_window.el.show();
1040 _this.el.resize(w, 800);
1043 var rs = RooTicket.singleton();
1044 var uri = new WebKit.URIRequest("https://roojs.com/admin.php/MTrack/View/" + tid);
1045 var hd = uri.get_http_headers();
1046 var authCode = Base64.encode ("%s:%s".printf(rs.username, rs.password).data);
1047 hd.append("Authorization", "Basic %s".printf(authCode));
1049 this.el.load_request(uri);
1055 public class Xcls_Box25 : Object
1058 private NewBranch _this;
1064 public Xcls_Box25(NewBranch _owner )
1067 this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
1071 // set gobject values
1072 this.el.homogeneous = false;
1073 var child_0 = new Xcls_table( _this );
1075 this.el.pack_start ( child_0.el , false,false,0 );
1078 // user defined functions
1080 public class Xcls_table : Object
1082 public Gtk.Table el;
1083 private NewBranch _this;
1089 public Xcls_table(NewBranch _owner )
1093 this.el = new Gtk.Table( 14, 4, true );
1097 // set gobject values
1098 this.el.expand = false;
1100 this.el.column_spacing = 4;
1101 this.el.vexpand = false;
1102 var child_0 = new Xcls_Label27( _this );
1104 this.el.attach_defaults ( child_0.el , 0,1,0,1 );
1105 var child_1 = new Xcls_Label28( _this );
1107 this.el.attach_defaults ( child_1.el , 1,2,0,1 );
1108 var child_2 = new Xcls_project_id( _this );
1110 this.el.attach_defaults ( child_2.el , 0,1,1,2 );
1111 var child_3 = new Xcls_summary( _this );
1113 this.el.attach_defaults ( child_3.el , 1,4,1,2 );
1114 var child_4 = new Xcls_Label33( _this );
1116 this.el.attach_defaults ( child_4.el , 0,1,2,3 );
1117 var child_5 = new Xcls_milestone_id( _this );
1119 this.el.attach_defaults ( child_5.el , 0,1,3,4 );
1120 var child_6 = new Xcls_Label36( _this );
1122 this.el.attach_defaults ( child_6.el , 1,4,2,3 );
1123 var child_7 = new Xcls_description( _this );
1125 this.el.attach_defaults ( child_7.el , 1,4,3,12 );
1126 var child_8 = new Xcls_Label38( _this );
1128 this.el.attach_defaults ( child_8.el , 0,1,4,5 );
1129 var child_9 = new Xcls_priority_id( _this );
1131 this.el.attach_defaults ( child_9.el , 0,1,5,6 );
1132 var child_10 = new Xcls_Label41( _this );
1134 this.el.attach_defaults ( child_10.el , 0,1,6,7 );
1135 var child_11 = new Xcls_severity_id( _this );
1137 this.el.attach_defaults ( child_11.el , 0,1,7,8 );
1138 var child_12 = new Xcls_Label44( _this );
1140 this.el.attach_defaults ( child_12.el , 0,1,8,9 );
1141 var child_13 = new Xcls_classification_id( _this );
1143 this.el.attach_defaults ( child_13.el , 0,1,9,10 );
1144 var child_14 = new Xcls_Label47( _this );
1146 this.el.attach_defaults ( child_14.el , 0,1,10,11 );
1147 var child_15 = new Xcls_developer_id( _this );
1149 this.el.attach_defaults ( child_15.el , 0,1,11,12 );
1150 var child_16 = new Xcls_Button50( _this );
1152 this.el.attach_defaults ( child_16.el , 0,4,13,14 );
1155 // user defined functions
1157 public class Xcls_Label27 : Object
1159 public Gtk.Label el;
1160 private NewBranch _this;
1166 public Xcls_Label27(NewBranch _owner )
1169 this.el = new Gtk.Label( "Project" );
1173 // set gobject values
1174 this.el.halign = Gtk.Align.START;
1175 this.el.visible = true;
1178 // user defined functions
1181 public class Xcls_Label28 : Object
1183 public Gtk.Label el;
1184 private NewBranch _this;
1190 public Xcls_Label28(NewBranch _owner )
1193 this.el = new Gtk.Label( "Summary" );
1197 // set gobject values
1198 this.el.halign = Gtk.Align.START;
1199 this.el.visible = true;
1202 // user defined functions
1205 public class Xcls_project_id : Object
1207 public Gtk.ComboBox el;
1208 private NewBranch _this;
1212 public bool loading;
1215 public Xcls_project_id(NewBranch _owner )
1218 _this.project_id = this;
1219 this.el = new Gtk.ComboBox.with_entry();
1222 this.loading = false;
1224 // set gobject values
1225 var child_0 = new Xcls_prcellrenderer( _this );
1227 this.el.pack_start ( child_0.el , true );
1228 var child_1 = new Xcls_prmodel( _this );
1230 this.el.set_model ( child_1.el );
1234 this.el.set_entry_text_column(1);
1237 this.el.changed.connect( () => {
1241 var project_id = this.selectedProjectId();
1243 var rt = RooTicket.singleton();
1244 rt.loadProjectOptions(project_id);
1246 _this.msmodel.loadMilestones();
1247 _this.primodel.loadPriorities();
1248 _this.sevmodel.loadSeverities();
1249 _this.clmodel.loadClassifications();
1250 _this.devmodel.loadDevelopers();
1252 // affects projects and milestones..
1255 /*if (this.loading) {
1258 var ticket_id = this.selectedTicketId();
1260 var name = RooTicket.singleton().usernameLocal();
1262 if (ticket_id == "" || ticket_id == null) {
1264 var dt = new DateTime.now_local();
1265 _this.name.el.set_text("wip_%s_%s".printf(name,dt.format("%Y_%b_%d")));
1270 var ticket = RooTicket.singleton().getById(ticket_id);
1272 _this.name.el.set_text("wip_%s_T%s_%s".printf(name,ticket.id, ticket.summaryToBranchName()));
1274 //GLib.debug (//"Selection: %s, %s\n", (string) val1, (string) val2);
1279 // user defined functions
1280 public string selectedProjectId () {
1285 this.el.get_active_iter (out iter);
1286 _this.prmodel.el.get_value (iter, 0, out val1);
1289 return (string) val1;
1296 public class Xcls_prcellrenderer : Object
1298 public Gtk.CellRendererText el;
1299 private NewBranch _this;
1305 public Xcls_prcellrenderer(NewBranch _owner )
1308 _this.prcellrenderer = this;
1309 this.el = new Gtk.CellRendererText();
1313 // set gobject values
1316 // user defined functions
1319 public class Xcls_prmodel : Object
1321 public Gtk.ListStore el;
1322 private NewBranch _this;
1328 public Xcls_prmodel(NewBranch _owner )
1331 _this.prmodel = this;
1332 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
1336 // set gobject values
1339 // user defined functions
1340 public void loadProjects (string id) {
1343 _this.project_id.loading = true;
1349 el.append(out iter);
1352 el.set_value(iter, 0, "");
1353 el.set_value(iter, 1, "-- select a project --");
1355 _this.project_id.el.set_active_iter(iter);
1358 foreach(var project in RooProject.projects()) {
1360 el.append(out iter);
1362 el.set_value(iter, 0, project.id);
1363 el.set_value(iter, 1, project.name );
1364 if (id == project.id) {
1365 _this.project_id.el.set_active_iter(iter);
1370 _this.project_id.loading = false;
1371 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
1377 public class Xcls_summary : Object
1379 public Gtk.Entry el;
1380 private NewBranch _this;
1386 public Xcls_summary(NewBranch _owner )
1389 _this.summary = this;
1390 this.el = new Gtk.Entry();
1394 // set gobject values
1395 this.el.visible = true;
1398 // user defined functions
1401 public class Xcls_Label33 : Object
1403 public Gtk.Label el;
1404 private NewBranch _this;
1410 public Xcls_Label33(NewBranch _owner )
1413 this.el = new Gtk.Label( "Milestone" );
1417 // set gobject values
1418 this.el.halign = Gtk.Align.START;
1419 this.el.justify = Gtk.Justification.RIGHT;
1420 this.el.xalign = 0.900000f;
1423 // user defined functions
1426 public class Xcls_milestone_id : Object
1428 public Gtk.ComboBox el;
1429 private NewBranch _this;
1433 public bool loading;
1436 public Xcls_milestone_id(NewBranch _owner )
1439 _this.milestone_id = this;
1440 this.el = new Gtk.ComboBox.with_entry();
1443 this.loading = false;
1445 // set gobject values
1446 var child_0 = new Xcls_msmodel( _this );
1448 this.el.set_model ( child_0.el );
1452 this.el.set_entry_text_column(1);
1455 // user defined functions
1456 public string selectedMilestoneId () {
1461 this.el.get_active_iter (out iter);
1462 _this.msmodel.el.get_value (iter, 0, out val1);
1465 return (string) val1;
1472 public class Xcls_msmodel : Object
1474 public Gtk.ListStore el;
1475 private NewBranch _this;
1481 public Xcls_msmodel(NewBranch _owner )
1484 _this.msmodel = this;
1485 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
1489 // set gobject values
1492 // user defined functions
1493 public void loadMilestones ( ) {
1495 var rt = RooTicket.singleton();
1496 // rt.loadProjects();
1498 _this.milestone_id.loading = true;
1504 el.append(out iter);
1507 el.set_value(iter, 0, "");
1508 el.set_value(iter, 1, "-- select a milestone --");
1509 _this.milestone_id.el.set_active_iter(iter);
1511 var projects = rt.milestones;
1512 foreach(var project in projects) {
1514 el.append(out iter);
1516 el.set_value(iter, 0, project.id);
1517 el.set_value(iter, 1, project.display_name );
1518 // if (id == project.id) {
1519 // _this.milestone.el.set_active_iter(iter);
1525 _this.milestone_id.loading = false;
1526 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
1532 public class Xcls_Label36 : Object
1534 public Gtk.Label el;
1535 private NewBranch _this;
1541 public Xcls_Label36(NewBranch _owner )
1544 this.el = new Gtk.Label( "Description" );
1548 // set gobject values
1549 this.el.halign = Gtk.Align.START;
1552 // user defined functions
1555 public class Xcls_description : Object
1557 public Gtk.TextView el;
1558 private NewBranch _this;
1564 public Xcls_description(NewBranch _owner )
1567 _this.description = this;
1568 this.el = new Gtk.TextView();
1572 // set gobject values
1573 this.el.border_width = 1;
1576 // user defined functions
1579 public class Xcls_Label38 : Object
1581 public Gtk.Label el;
1582 private NewBranch _this;
1588 public Xcls_Label38(NewBranch _owner )
1591 this.el = new Gtk.Label( "Priority" );
1595 // set gobject values
1596 this.el.halign = Gtk.Align.START;
1597 this.el.xalign = 0.900000f;
1600 // user defined functions
1603 public class Xcls_priority_id : Object
1605 public Gtk.ComboBox el;
1606 private NewBranch _this;
1610 public bool loading;
1613 public Xcls_priority_id(NewBranch _owner )
1616 _this.priority_id = this;
1617 this.el = new Gtk.ComboBox.with_entry();
1620 this.loading = false;
1622 // set gobject values
1623 var child_0 = new Xcls_primodel( _this );
1625 this.el.set_model ( child_0.el );
1629 this.el.set_entry_text_column(1);
1632 // user defined functions
1633 public string selectedPriorityId () {
1638 this.el.get_active_iter (out iter);
1639 _this.primodel.el.get_value (iter, 0, out val1);
1642 return (string) val1;
1649 public class Xcls_primodel : Object
1651 public Gtk.ListStore el;
1652 private NewBranch _this;
1658 public Xcls_primodel(NewBranch _owner )
1661 _this.primodel = this;
1662 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
1666 // set gobject values
1669 // user defined functions
1670 public void loadPriorities ( ) {
1672 var rt = RooTicket.singleton();
1673 // rt.loadProjects();
1675 _this.priority_id.loading = true;
1682 var projects = rt.priorities;
1683 foreach(var project in projects) {
1685 el.append(out iter);
1687 el.set_value(iter, 0, project.id);
1688 el.set_value(iter, 1, project.display_name );
1689 if ("normal" == project.name) {
1690 _this.priority_id.el.set_active_iter(iter);
1695 _this.priority_id.loading = false;
1702 public class Xcls_Label41 : Object
1704 public Gtk.Label el;
1705 private NewBranch _this;
1711 public Xcls_Label41(NewBranch _owner )
1714 this.el = new Gtk.Label( "Severity" );
1718 // set gobject values
1719 this.el.halign = Gtk.Align.START;
1722 // user defined functions
1725 public class Xcls_severity_id : Object
1727 public Gtk.ComboBox el;
1728 private NewBranch _this;
1732 public bool loading;
1735 public Xcls_severity_id(NewBranch _owner )
1738 _this.severity_id = this;
1739 this.el = new Gtk.ComboBox.with_entry();
1742 this.loading = false;
1744 // set gobject values
1745 var child_0 = new Xcls_sevmodel( _this );
1747 this.el.set_model ( child_0.el );
1751 this.el.set_entry_text_column(1);
1754 // user defined functions
1755 public string selectedSeverityId () {
1760 this.el.get_active_iter (out iter);
1761 _this.sevmodel.el.get_value (iter, 0, out val1);
1764 return (string) val1;
1771 public class Xcls_sevmodel : Object
1773 public Gtk.ListStore el;
1774 private NewBranch _this;
1780 public Xcls_sevmodel(NewBranch _owner )
1783 _this.sevmodel = this;
1784 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
1788 // set gobject values
1791 // user defined functions
1792 public void loadSeverities () {
1794 var rt = RooTicket.singleton();
1795 //rt.loadProjects();
1797 _this.severity_id.loading = true;
1803 var projects = rt.serverities;
1804 foreach(var project in projects) {
1806 el.append(out iter);
1808 el.set_value(iter, 0, project.id);
1809 el.set_value(iter, 1, project.display_name );
1810 if ("normal" == project.name) {
1811 _this.severity_id.el.set_active_iter(iter);
1816 _this.severity_id.loading = false;
1817 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
1823 public class Xcls_Label44 : Object
1825 public Gtk.Label el;
1826 private NewBranch _this;
1832 public Xcls_Label44(NewBranch _owner )
1835 this.el = new Gtk.Label( "Classification" );
1839 // set gobject values
1840 this.el.halign = Gtk.Align.START;
1843 // user defined functions
1846 public class Xcls_classification_id : Object
1848 public Gtk.ComboBox el;
1849 private NewBranch _this;
1853 public bool loading;
1856 public Xcls_classification_id(NewBranch _owner )
1859 _this.classification_id = this;
1860 this.el = new Gtk.ComboBox.with_entry();
1863 this.loading = false;
1865 // set gobject values
1866 var child_0 = new Xcls_clmodel( _this );
1868 this.el.set_model ( child_0.el );
1872 this.el.set_entry_text_column(1);
1875 // user defined functions
1876 public string selectedClassificationId () {
1881 this.el.get_active_iter (out iter);
1882 _this.clmodel.el.get_value (iter, 0, out val1);
1885 return (string) val1;
1892 public class Xcls_clmodel : Object
1894 public Gtk.ListStore el;
1895 private NewBranch _this;
1901 public Xcls_clmodel(NewBranch _owner )
1904 _this.clmodel = this;
1905 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
1909 // set gobject values
1912 // user defined functions
1913 public void loadClassifications ( ) {
1915 var rt = RooTicket.singleton();
1916 // rt.loadProjects();
1918 _this.classification_id.loading = true;
1924 el.append(out iter);
1927 var projects = rt.classifications;
1928 foreach(var project in projects) {
1930 el.append(out iter);
1932 el.set_value(iter, 0, project.id);
1933 el.set_value(iter, 1, project.display_name );
1934 if ("bug" == project.name) {
1935 _this.classification_id.el.set_active_iter(iter);
1940 _this.classification_id.loading = false;
1941 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
1947 public class Xcls_Label47 : Object
1949 public Gtk.Label el;
1950 private NewBranch _this;
1956 public Xcls_Label47(NewBranch _owner )
1959 this.el = new Gtk.Label( "Assign to" );
1963 // set gobject values
1964 this.el.halign = Gtk.Align.START;
1967 // user defined functions
1970 public class Xcls_developer_id : Object
1972 public Gtk.ComboBox el;
1973 private NewBranch _this;
1977 public bool loading;
1980 public Xcls_developer_id(NewBranch _owner )
1983 _this.developer_id = this;
1984 this.el = new Gtk.ComboBox.with_entry();
1987 this.loading = false;
1989 // set gobject values
1990 var child_0 = new Xcls_devmodel( _this );
1992 this.el.set_model ( child_0.el );
1996 this.el.set_entry_text_column(1);
1999 // user defined functions
2000 public string selectedDeveloperId () {
2005 this.el.get_active_iter (out iter);
2006 _this.devmodel.el.get_value (iter, 0, out val1);
2009 return (string) val1;
2016 public class Xcls_devmodel : Object
2018 public Gtk.ListStore el;
2019 private NewBranch _this;
2025 public Xcls_devmodel(NewBranch _owner )
2028 _this.devmodel = this;
2029 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
2033 // set gobject values
2036 // user defined functions
2037 public void loadDevelopers ( ) {
2039 var rt = RooTicket.singleton();
2040 //rt.loadProjects();
2042 _this.developer_id.loading = true;
2048 el.append(out iter);
2051 el.set_value(iter, 0, "");
2052 el.set_value(iter, 1, "-- select a developer --");
2054 _this.developer_id.el.set_active_iter(iter);
2057 var peps = rt.developers;
2058 foreach(var p in peps) {
2060 el.append(out iter);
2062 el.set_value(iter, 0, p.id);
2063 el.set_value(iter, 1, p.display_name );
2064 if (rt.authuser_id == p.id) {
2065 _this.developer_id.el.set_active_iter(iter);
2069 _this.developer_id.loading = false;
2070 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
2076 public class Xcls_Button50 : Object
2078 public Gtk.Button el;
2079 private NewBranch _this;
2085 public Xcls_Button50(NewBranch _owner )
2088 this.el = new Gtk.Button();
2092 // set gobject values
2093 this.el.label = "Create Ticket & Branch";
2098 this.el.get_style_context().add_class("suggested-action");
2102 this.el.clicked.connect( () => {
2103 GLib.debug("fire response = 1");
2106 var invalid = false;
2108 // validate first...
2109 _this.project_id.el.get_child().get_style_context().remove_class("warning");
2110 if (_this.project_id.selectedProjectId() == "") {
2111 _this.project_id.el.get_child().get_style_context().add_class("warning");
2115 _this.milestone_id.el.get_child().get_style_context().remove_class("warning");
2117 _this.priority_id.el.get_child().get_style_context().remove_class("warning");
2118 if (_this.priority_id.selectedPriorityId() == "") {
2119 _this.priority_id.el.get_child().get_style_context().add_class("warning");
2123 _this.classification_id.el.get_child().get_style_context().remove_class("warning");
2124 if (_this.classification_id.selectedClassificationId() == "") {
2125 _this.classification_id.el.get_child().get_style_context().add_class("warning");
2129 _this.developer_id.el.get_child().get_style_context().remove_class("warning");
2130 if (_this.developer_id.selectedDeveloperId() == "") {
2131 _this.developer_id.el.get_child().get_style_context().add_class("warning");
2135 _this.summary.el.get_style_context().remove_class("warning");
2136 if (_this.summary.el.get_text() == "") {
2137 _this.summary.el.get_style_context().add_class("warning");
2141 _this.description.el.get_style_context().remove_class("warning");
2146 GLib.debug("for is valid");
2148 _this.el.response(1);
2152 // user defined functions
2157 public class Xcls_Box51 : Object
2160 private NewBranch _this;
2166 public Xcls_Box51(NewBranch _owner )
2169 this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
2173 // set gobject values
2174 this.el.homogeneous = false;
2175 var child_0 = new Xcls_Table52( _this );
2177 this.el.pack_start ( child_0.el , false,false,0 );
2180 // user defined functions
2182 public class Xcls_Table52 : Object
2184 public Gtk.Table el;
2185 private NewBranch _this;
2191 public Xcls_Table52(NewBranch _owner )
2194 this.el = new Gtk.Table( 5, 5, true );
2198 // set gobject values
2199 this.el.expand = false;
2201 this.el.column_spacing = 4;
2202 this.el.vexpand = false;
2203 var child_0 = new Xcls_Label53( _this );
2205 this.el.attach_defaults ( child_0.el , 0,1,0,1 );
2206 var child_1 = new Xcls_commit_message( _this );
2208 this.el.attach_defaults ( child_1.el , 0,4,1,2 );
2209 var child_2 = new Xcls_createbtn( _this );
2211 this.el.attach_defaults ( child_2.el , 4,5,1,2 );
2214 // user defined functions
2216 public class Xcls_Label53 : Object
2218 public Gtk.Label el;
2219 private NewBranch _this;
2225 public Xcls_Label53(NewBranch _owner )
2228 this.el = new Gtk.Label( "Commit Message" );
2232 // set gobject values
2233 this.el.halign = Gtk.Align.START;
2234 this.el.justify = Gtk.Justification.RIGHT;
2235 this.el.xalign = 0.900000f;
2238 // user defined functions
2241 public class Xcls_commit_message : Object
2243 public Gtk.Entry el;
2244 private NewBranch _this;
2250 public Xcls_commit_message(NewBranch _owner )
2253 _this.commit_message = this;
2254 this.el = new Gtk.Entry();
2258 // set gobject values
2259 this.el.visible = true;
2262 // user defined functions
2265 public class Xcls_createbtn : Object
2267 public Gtk.Button el;
2268 private NewBranch _this;
2274 public Xcls_createbtn(NewBranch _owner )
2277 _this.createbtn = this;
2278 this.el = new Gtk.Button();
2282 // set gobject values
2283 this.el.label = "Commit Changes";
2288 this.el.get_style_context().add_class("suggested-action");
2292 this.el.clicked.connect( () => {
2294 GLib.debug("fire response = 1");
2296 var ticket_id = _this.ticketsel.selectedTicketId();
2298 if (ticket_id == "") {
2299 _this.ticketsel.el.get_child().get_style_context().add_class("warning");
2303 _this.el.response(1);
2307 // user defined functions
2308 public void updateState () {
2310 var ticket_id = _this.ticketsel.selectedTicketId();
2312 if (ticket_id == "") {
2313 this.el.set_sensitive(false);
2317 this.el.set_sensitive(true);