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;
48 public Xcls_diff_view diff_view;
53 public Gee.ArrayList<GitMonitorQueue> queue;
59 this.el = new Gtk.Dialog();
67 this.el.title = "Create a working branch ";
68 this.el.default_height = 500;
69 this.el.default_width = 500;
70 this.el.deletable = true;
72 var child_0 = new Xcls_Notebook2( _this );
74 this.el.get_content_area().add ( child_0.el );
77 this.el.delete_event.connect( (self, event) => {
82 this.el.response.connect( (self, response_id) => {
84 GLib.debug("got %d", (int) response_id);
89 // have they selected a ticket..
90 // make that the current active ticket?
91 // we really need to store locally what ticket is being worked on..
92 // in theory we could be working on multiple project and not merging..
93 // -- each repo would have their active ticket (only one per repo)
94 // -- so we could just store that in there
95 // -- initial load can check the contents of the ticket files on first scan.
98 if (response_id < 1) {
100 this.running = false;
104 var ticket_id = _this.ticketsel.selectedTicketId();
106 if (this.repo != null) {
107 var bn = _this.name.el.get_text();
109 var res = this.repo.setActiveTicket(
110 RooTicket.singleton().getById(ticket_id != "" ? ticket_id : "-1"), bn
113 // start the monitoring..
114 GitMonitor.gitmonitor.start();
120 this.running = false;
130 // user defined functions
131 public void show ( GitRepo repo, Gee.ArrayList<GitMonitorQueue> queue, string tid = "" )
133 // this.el.set_gravity(Gdk.Gravity.NORTH);
134 if (this.running) { // should not happen!!
135 GLib.error("new branch show called, when already being displayed?");
140 GitMonitor.gitmonitor.stop();
146 this.el.move((Gdk.Screen.width() / 2)- 250 ,0);
147 this.el.set_default_size( 500,200); // not sure why it grows..
148 GLib.debug("Loading tickets");
152 this.el.set_keep_above(true);
155 var curproj = RooProject.getProjectByRepo(this.repo);
156 _this.prmodel.loadProjects(curproj == null ? "" : curproj.id);
158 _this.dbmodel.loadTickets(curproj == null ? "": curproj.id, tid);
159 _this.createbtn.updateState();
161 _this.ticketsel.el.get_child().get_style_context().remove_class("warning");
163 var name = RooTicket.singleton().usernameLocal();
164 var ticket = RooTicket.singleton().getById(tid);
165 _this.name.el.set_text("wip_%s_T%s_%s".printf(name,ticket.id, ticket.summaryToBranchName()));
167 _this.ticketsel.el.get_child().get_style_context().add_class("warning");
169 _this.view.loadTicket(tid);
180 public class Xcls_Notebook2 : Object
182 public Gtk.Notebook el;
183 private NewBranch _this;
189 public Xcls_Notebook2(NewBranch _owner )
192 this.el = new Gtk.Notebook();
196 // set gobject values
197 this.el.vexpand = true;
198 var child_0 = new Xcls_label_select_ticket( _this );
200 var child_1 = new Xcls_label_create_ticket( _this );
202 var child_2 = new Xcls_label_quick_commit( _this );
204 var child_3 = new Xcls_Box6( _this );
206 this.el.append_page ( child_3.el , _this.label_select_ticket.el );
207 var child_4 = new Xcls_Box25( _this );
209 this.el.append_page ( child_4.el , _this.label_create_ticket.el );
210 var child_5 = new Xcls_Box51( _this );
212 this.el.append_page ( child_5.el , _this.label_quick_commit.el );
215 // user defined functions
217 public class Xcls_label_select_ticket : Object
220 private NewBranch _this;
226 public Xcls_label_select_ticket(NewBranch _owner )
229 _this.label_select_ticket = this;
230 this.el = new Gtk.Label( "Select Existing Ticket to work on" );
234 // set gobject values
237 // user defined functions
240 public class Xcls_label_create_ticket : Object
243 private NewBranch _this;
249 public Xcls_label_create_ticket(NewBranch _owner )
252 _this.label_create_ticket = this;
253 this.el = new Gtk.Label( "Create a New Ticket" );
257 // set gobject values
260 // user defined functions
263 public class Xcls_label_quick_commit : Object
266 private NewBranch _this;
272 public Xcls_label_quick_commit(NewBranch _owner )
275 _this.label_quick_commit = this;
276 this.el = new Gtk.Label( "Quick Commit" );
280 // set gobject values
283 // user defined functions
286 public class Xcls_Box6 : Object
289 private NewBranch _this;
295 public Xcls_Box6(NewBranch _owner )
298 this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
302 // set gobject values
303 this.el.homogeneous = false;
304 var child_0 = new Xcls_Table7( _this );
306 this.el.pack_start ( child_0.el , false,false,0 );
307 var child_1 = new Xcls_scrolled_window( _this );
309 this.el.add ( child_1.el );
312 // user defined functions
314 public class Xcls_Table7 : Object
317 private NewBranch _this;
323 public Xcls_Table7(NewBranch _owner )
326 this.el = new Gtk.Table( 5, 5, true );
330 // set gobject values
331 this.el.expand = false;
333 this.el.column_spacing = 4;
334 this.el.vexpand = false;
335 var child_0 = new Xcls_Label8( _this );
337 this.el.attach_defaults ( child_0.el , 0,1,0,1 );
338 var child_1 = new Xcls_Label9( _this );
340 this.el.attach_defaults ( child_1.el , 1,2,0,1 );
341 var child_2 = new Xcls_projectsel( _this );
343 this.el.attach_defaults ( child_2.el , 0,1,1,2 );
344 var child_3 = new Xcls_ticketsel( _this );
346 this.el.attach_defaults ( child_3.el , 1,5,1,2 );
347 var child_4 = new Xcls_Label16( _this );
349 this.el.attach_defaults ( child_4.el , 0,1,3,4 );
350 var child_5 = new Xcls_name( _this );
352 this.el.attach_defaults ( child_5.el , 0,4,4,5 );
353 var child_6 = new Xcls_createbtn( _this );
355 this.el.attach_defaults ( child_6.el , 4,5,4,5 );
356 var child_7 = new Xcls_Box19( _this );
358 this.el.attach_defaults ( child_7.el , 0,5,2,3 );
361 // user defined functions
363 public class Xcls_Label8 : Object
366 private NewBranch _this;
372 public Xcls_Label8(NewBranch _owner )
375 this.el = new Gtk.Label( "Project" );
379 // set gobject values
380 this.el.halign = Gtk.Align.START;
381 this.el.justify = Gtk.Justification.RIGHT;
382 this.el.visible = true;
385 // user defined functions
388 public class Xcls_Label9 : Object
391 private NewBranch _this;
397 public Xcls_Label9(NewBranch _owner )
400 this.el = new Gtk.Label( "Ticket" );
404 // set gobject values
405 this.el.halign = Gtk.Align.START;
406 this.el.visible = true;
409 // user defined functions
412 public class Xcls_projectsel : Object
414 public Gtk.ComboBox el;
415 private NewBranch _this;
422 public Xcls_projectsel(NewBranch _owner )
425 _this.projectsel = this;
426 this.el = new Gtk.ComboBox.with_entry();
429 this.loading = false;
431 // set gobject values
432 var child_0 = new Xcls_prcellrenderer( _this );
434 this.el.pack_start ( child_0.el , true );
435 var child_1 = new Xcls_prmodel( _this );
437 this.el.set_model ( child_1.el );
441 this.el.set_entry_text_column(1);
444 this.el.changed.connect( () => {
448 var project_id = this.selectedProjectId();
449 _this.dbmodel.loadTickets(project_id);
452 /*if (this.loading) {
455 var ticket_id = this.selectedTicketId();
457 var name = RooTicket.singleton().usernameLocal();
459 if (ticket_id == "" || ticket_id == null) {
461 var dt = new DateTime.now_local();
462 _this.name.el.set_text("wip_%s_%s".printf(name,dt.format("%Y_%b_%d")));
467 var ticket = RooTicket.singleton().getById(ticket_id);
469 _this.name.el.set_text("wip_%s_T%s_%s".printf(name,ticket.id, ticket.summaryToBranchName()));
471 //GLib.debug (//"Selection: %s, %s\n", (string) val1, (string) val2);
476 // user defined functions
477 public string selectedProjectId () {
482 this.el.get_active_iter (out iter);
483 _this.prmodel.el.get_value (iter, 0, out val1);
486 return (string) val1;
493 public class Xcls_prcellrenderer : Object
495 public Gtk.CellRendererText el;
496 private NewBranch _this;
502 public Xcls_prcellrenderer(NewBranch _owner )
505 _this.prcellrenderer = this;
506 this.el = new Gtk.CellRendererText();
510 // set gobject values
513 // user defined functions
516 public class Xcls_prmodel : Object
518 public Gtk.ListStore el;
519 private NewBranch _this;
525 public Xcls_prmodel(NewBranch _owner )
528 _this.prmodel = this;
529 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
533 // set gobject values
536 // user defined functions
537 public void loadProjects (string id) {
541 _this.projectsel.loading = true;
550 el.set_value(iter, 0, "");
551 el.set_value(iter, 1, "-- select a project --");
553 _this.projectsel.el.set_active_iter(iter);
556 foreach(var project in RooProject.projects()) {
560 el.set_value(iter, 0, project.id);
561 el.set_value(iter, 1, project.name );
562 if (id == project.id) {
563 _this.projectsel.el.set_active_iter(iter);
568 _this.projectsel.loading = false;
569 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
575 public class Xcls_ticketsel : Object
577 public Gtk.ComboBox el;
578 private NewBranch _this;
585 public Xcls_ticketsel(NewBranch _owner )
588 _this.ticketsel = this;
589 this.el = new Gtk.ComboBox.with_entry();
592 this.loading = false;
594 // set gobject values
595 var child_0 = new Xcls_dbcellrenderer( _this );
597 this.el.pack_start ( child_0.el , true );
598 var child_1 = new Xcls_dbmodel( _this );
600 this.el.set_model ( child_1.el );
604 //this.el.add_attribute(_this.dbcellrenderer.el , "markup", 1 );
605 this.el.set_entry_text_column(1);
606 this.el.get_child().set_sensitive(false);
609 this.el.changed.connect( () => {
613 var ticket_id = this.selectedTicketId();
615 var name = RooTicket.singleton().usernameLocal();
617 this.el.get_child().get_style_context().remove_class("warning");
618 if (ticket_id == "" || ticket_id == null) {
620 var dt = new DateTime.now_local();
621 _this.name.el.set_text("wip_%s_%s".printf(name,dt.format("%Y_%b_%d")));
622 _this.view.loadTicket("");
624 this.el.get_child().get_style_context().add_class("warning");
625 _this.createbtn.updateState();
630 var ticket = RooTicket.singleton().getById(ticket_id);
632 _this.name.el.set_text("wip_%s_T%s_%s".printf(name,ticket.id, ticket.summaryToBranchName()));
633 _this.scrolled_window.el.show();
635 _this.view.loadTicket(ticket.id);
636 _this.createbtn.updateState();
638 //GLib.debug (//"Selection: %s, %s\n", (string) val1, (string) val2);
642 // user defined functions
643 public string selectedTicketId () {
648 this.el.get_active_iter (out iter);
649 _this.dbmodel.el.get_value (iter, 0, out val1);
652 return (string) val1;
659 public class Xcls_dbcellrenderer : Object
661 public Gtk.CellRendererText el;
662 private NewBranch _this;
668 public Xcls_dbcellrenderer(NewBranch _owner )
671 _this.dbcellrenderer = this;
672 this.el = new Gtk.CellRendererText();
676 // set gobject values
679 // user defined functions
682 public class Xcls_dbmodel : Object
684 public Gtk.ListStore el;
685 private NewBranch _this;
691 public Xcls_dbmodel(NewBranch _owner )
694 _this.dbmodel = this;
695 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
699 // set gobject values
702 // user defined functions
703 public void loadTickets (string project_id , string tid = "") {
707 // fixme .. get project id from selection..
709 RooTicket.singleton().loadTickets(
711 _this.btn_not_me.el.active ? RooTicket.Who.ANYBODY : RooTicket.Who.ME,
712 _this.btn_closed.el.active ? RooTicket.Status.ALL : RooTicket.Status.ACTIVE
715 _this.ticketsel.loading = true;
724 el.set_value(iter, 0, "");
725 el.set_value(iter, 1, "-- select a ticket --");
727 _this.ticketsel.el.set_active_iter(iter);
728 var tickets = RooTicket.singleton().tickets;
729 foreach(var ticket in tickets) {
733 el.set_value(iter, 0, ticket.id);
734 el.set_value(iter, 1, "#%s %s".printf( ticket.id, ticket.summary));
736 if (ticket.id == tid) {
737 _this.ticketsel.el.set_active_iter(iter);
742 _this.ticketsel.loading = false;
743 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
749 public class Xcls_Label16 : Object
752 private NewBranch _this;
758 public Xcls_Label16(NewBranch _owner )
761 this.el = new Gtk.Label( "Use this as branch name" );
765 // set gobject values
766 this.el.halign = Gtk.Align.START;
767 this.el.justify = Gtk.Justification.RIGHT;
768 this.el.xalign = 0.900000f;
771 // user defined functions
774 public class Xcls_name : Object
777 private NewBranch _this;
783 public Xcls_name(NewBranch _owner )
787 this.el = new Gtk.Entry();
791 // set gobject values
792 this.el.visible = true;
795 // user defined functions
798 public class Xcls_createbtn : Object
800 public Gtk.Button el;
801 private NewBranch _this;
807 public Xcls_createbtn(NewBranch _owner )
810 _this.createbtn = this;
811 this.el = new Gtk.Button();
815 // set gobject values
816 this.el.label = "Create Branch";
821 this.el.get_style_context().add_class("suggested-action");
825 this.el.clicked.connect( () => {
827 GLib.debug("fire response = 1");
829 var ticket_id = _this.ticketsel.selectedTicketId();
831 if (ticket_id == "") {
832 _this.ticketsel.el.get_child().get_style_context().add_class("warning");
836 _this.el.response(1);
840 // user defined functions
841 public void updateState () {
843 var ticket_id = _this.ticketsel.selectedTicketId();
845 if (ticket_id == "") {
846 this.el.set_sensitive(false);
850 this.el.set_sensitive(true);
855 public class Xcls_Box19 : Object
858 private NewBranch _this;
864 public Xcls_Box19(NewBranch _owner )
867 this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
871 // set gobject values
872 var child_0 = new Xcls_btn_not_me( _this );
874 this.el.add ( child_0.el );
875 var child_1 = new Xcls_btn_closed( _this );
877 this.el.add ( child_1.el );
878 var child_2 = new Xcls_Label22( _this );
880 this.el.add ( child_2.el );
883 // user defined functions
885 public class Xcls_btn_not_me : Object
887 public Gtk.CheckButton el;
888 private NewBranch _this;
894 public Xcls_btn_not_me(NewBranch _owner )
897 _this.btn_not_me = this;
898 this.el = new Gtk.CheckButton();
902 // set gobject values
903 this.el.label = "Show tickets not assigned to me";
906 this.el.toggled.connect( () => {
907 var project_id = _this.projectsel.selectedProjectId();
908 _this.dbmodel.loadTickets(project_id);
912 // user defined functions
915 public class Xcls_btn_closed : Object
917 public Gtk.CheckButton el;
918 private NewBranch _this;
924 public Xcls_btn_closed(NewBranch _owner )
927 _this.btn_closed = this;
928 this.el = new Gtk.CheckButton();
932 // set gobject values
933 this.el.label = "Show closed Tickets";
936 this.el.toggled.connect( () => {
937 var project_id = _this.projectsel.selectedProjectId();
938 _this.dbmodel.loadTickets(project_id);
943 // user defined functions
946 public class Xcls_Label22 : Object
949 private NewBranch _this;
955 public Xcls_Label22(NewBranch _owner )
958 this.el = new Gtk.Label( "<a href=\"refresh\">Refresh Ticket list</a>" );
962 // set gobject values
963 this.el.halign = Gtk.Align.END;
964 this.el.hexpand = true;
965 this.el.use_markup = true;
968 this.el.activate_link.connect( (uri) => {
969 if (uri == "refresh") {
971 var curproj = RooProject.getProjectByRepo(_this.repo);
972 _this.prmodel.loadProjects(curproj == null ? "": curproj.id);
974 _this.dbmodel.loadTickets(curproj == null ? "": curproj.id);
980 // user defined functions
985 public class Xcls_scrolled_window : Object
987 public Gtk.ScrolledWindow el;
988 private NewBranch _this;
994 public Xcls_scrolled_window(NewBranch _owner )
997 _this.scrolled_window = this;
998 this.el = new Gtk.ScrolledWindow( null, null );
1002 // set gobject values
1003 this.el.height_request = 500;
1004 this.el.vexpand = true;
1005 var child_0 = new Xcls_view( _this );
1007 this.el.add ( child_0.el );
1012 this.el.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);
1016 // user defined functions
1018 public class Xcls_view : Object
1020 public WebKit.WebView el;
1021 private NewBranch _this;
1027 public Xcls_view(NewBranch _owner )
1031 this.el = new WebKit.WebView();
1035 // set gobject values
1038 // user defined functions
1039 public void loadTicket (string tid) {
1041 _this.el.get_size(out w, out h);
1044 _this.scrolled_window.el.hide();
1045 _this.el.resize(w, 150);
1047 _this.scrolled_window.el.show();
1048 _this.el.resize(w, 800);
1051 var rs = RooTicket.singleton();
1052 var uri = new WebKit.URIRequest("https://roojs.com/admin.php/MTrack/View/" + tid);
1053 var hd = uri.get_http_headers();
1054 var authCode = Base64.encode ("%s:%s".printf(rs.username, rs.password).data);
1055 hd.append("Authorization", "Basic %s".printf(authCode));
1057 this.el.load_request(uri);
1063 public class Xcls_Box25 : Object
1066 private NewBranch _this;
1072 public Xcls_Box25(NewBranch _owner )
1075 this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
1079 // set gobject values
1080 this.el.homogeneous = false;
1081 var child_0 = new Xcls_table( _this );
1083 this.el.pack_start ( child_0.el , false,false,0 );
1086 // user defined functions
1088 public class Xcls_table : Object
1090 public Gtk.Table el;
1091 private NewBranch _this;
1097 public Xcls_table(NewBranch _owner )
1101 this.el = new Gtk.Table( 14, 4, true );
1105 // set gobject values
1106 this.el.expand = false;
1108 this.el.column_spacing = 4;
1109 this.el.vexpand = false;
1110 var child_0 = new Xcls_Label27( _this );
1112 this.el.attach_defaults ( child_0.el , 0,1,0,1 );
1113 var child_1 = new Xcls_Label28( _this );
1115 this.el.attach_defaults ( child_1.el , 1,2,0,1 );
1116 var child_2 = new Xcls_project_id( _this );
1118 this.el.attach_defaults ( child_2.el , 0,1,1,2 );
1119 var child_3 = new Xcls_summary( _this );
1121 this.el.attach_defaults ( child_3.el , 1,4,1,2 );
1122 var child_4 = new Xcls_Label33( _this );
1124 this.el.attach_defaults ( child_4.el , 0,1,2,3 );
1125 var child_5 = new Xcls_milestone_id( _this );
1127 this.el.attach_defaults ( child_5.el , 0,1,3,4 );
1128 var child_6 = new Xcls_Label36( _this );
1130 this.el.attach_defaults ( child_6.el , 1,4,2,3 );
1131 var child_7 = new Xcls_description( _this );
1133 this.el.attach_defaults ( child_7.el , 1,4,3,12 );
1134 var child_8 = new Xcls_Label38( _this );
1136 this.el.attach_defaults ( child_8.el , 0,1,4,5 );
1137 var child_9 = new Xcls_priority_id( _this );
1139 this.el.attach_defaults ( child_9.el , 0,1,5,6 );
1140 var child_10 = new Xcls_Label41( _this );
1142 this.el.attach_defaults ( child_10.el , 0,1,6,7 );
1143 var child_11 = new Xcls_severity_id( _this );
1145 this.el.attach_defaults ( child_11.el , 0,1,7,8 );
1146 var child_12 = new Xcls_Label44( _this );
1148 this.el.attach_defaults ( child_12.el , 0,1,8,9 );
1149 var child_13 = new Xcls_classification_id( _this );
1151 this.el.attach_defaults ( child_13.el , 0,1,9,10 );
1152 var child_14 = new Xcls_Label47( _this );
1154 this.el.attach_defaults ( child_14.el , 0,1,10,11 );
1155 var child_15 = new Xcls_developer_id( _this );
1157 this.el.attach_defaults ( child_15.el , 0,1,11,12 );
1158 var child_16 = new Xcls_Button50( _this );
1160 this.el.attach_defaults ( child_16.el , 0,4,13,14 );
1163 // user defined functions
1165 public class Xcls_Label27 : Object
1167 public Gtk.Label el;
1168 private NewBranch _this;
1174 public Xcls_Label27(NewBranch _owner )
1177 this.el = new Gtk.Label( "Project" );
1181 // set gobject values
1182 this.el.halign = Gtk.Align.START;
1183 this.el.visible = true;
1186 // user defined functions
1189 public class Xcls_Label28 : Object
1191 public Gtk.Label el;
1192 private NewBranch _this;
1198 public Xcls_Label28(NewBranch _owner )
1201 this.el = new Gtk.Label( "Summary" );
1205 // set gobject values
1206 this.el.halign = Gtk.Align.START;
1207 this.el.visible = true;
1210 // user defined functions
1213 public class Xcls_project_id : Object
1215 public Gtk.ComboBox el;
1216 private NewBranch _this;
1220 public bool loading;
1223 public Xcls_project_id(NewBranch _owner )
1226 _this.project_id = this;
1227 this.el = new Gtk.ComboBox.with_entry();
1230 this.loading = false;
1232 // set gobject values
1233 var child_0 = new Xcls_prcellrenderer( _this );
1235 this.el.pack_start ( child_0.el , true );
1236 var child_1 = new Xcls_prmodel( _this );
1238 this.el.set_model ( child_1.el );
1242 this.el.set_entry_text_column(1);
1245 this.el.changed.connect( () => {
1249 var project_id = this.selectedProjectId();
1251 var rt = RooTicket.singleton();
1252 rt.loadProjectOptions(project_id);
1254 _this.msmodel.loadMilestones();
1255 _this.primodel.loadPriorities();
1256 _this.sevmodel.loadSeverities();
1257 _this.clmodel.loadClassifications();
1258 _this.devmodel.loadDevelopers();
1260 // affects projects and milestones..
1263 /*if (this.loading) {
1266 var ticket_id = this.selectedTicketId();
1268 var name = RooTicket.singleton().usernameLocal();
1270 if (ticket_id == "" || ticket_id == null) {
1272 var dt = new DateTime.now_local();
1273 _this.name.el.set_text("wip_%s_%s".printf(name,dt.format("%Y_%b_%d")));
1278 var ticket = RooTicket.singleton().getById(ticket_id);
1280 _this.name.el.set_text("wip_%s_T%s_%s".printf(name,ticket.id, ticket.summaryToBranchName()));
1282 //GLib.debug (//"Selection: %s, %s\n", (string) val1, (string) val2);
1287 // user defined functions
1288 public string selectedProjectId () {
1293 this.el.get_active_iter (out iter);
1294 _this.prmodel.el.get_value (iter, 0, out val1);
1297 return (string) val1;
1304 public class Xcls_prcellrenderer : Object
1306 public Gtk.CellRendererText el;
1307 private NewBranch _this;
1313 public Xcls_prcellrenderer(NewBranch _owner )
1316 _this.prcellrenderer = this;
1317 this.el = new Gtk.CellRendererText();
1321 // set gobject values
1324 // user defined functions
1327 public class Xcls_prmodel : Object
1329 public Gtk.ListStore el;
1330 private NewBranch _this;
1336 public Xcls_prmodel(NewBranch _owner )
1339 _this.prmodel = this;
1340 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
1344 // set gobject values
1347 // user defined functions
1348 public void loadProjects (string id) {
1351 _this.project_id.loading = true;
1357 el.append(out iter);
1360 el.set_value(iter, 0, "");
1361 el.set_value(iter, 1, "-- select a project --");
1363 _this.project_id.el.set_active_iter(iter);
1366 foreach(var project in RooProject.projects()) {
1368 el.append(out iter);
1370 el.set_value(iter, 0, project.id);
1371 el.set_value(iter, 1, project.name );
1372 if (id == project.id) {
1373 _this.project_id.el.set_active_iter(iter);
1378 _this.project_id.loading = false;
1379 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
1385 public class Xcls_summary : Object
1387 public Gtk.Entry el;
1388 private NewBranch _this;
1394 public Xcls_summary(NewBranch _owner )
1397 _this.summary = this;
1398 this.el = new Gtk.Entry();
1402 // set gobject values
1403 this.el.visible = true;
1406 // user defined functions
1409 public class Xcls_Label33 : Object
1411 public Gtk.Label el;
1412 private NewBranch _this;
1418 public Xcls_Label33(NewBranch _owner )
1421 this.el = new Gtk.Label( "Milestone" );
1425 // set gobject values
1426 this.el.halign = Gtk.Align.START;
1427 this.el.justify = Gtk.Justification.RIGHT;
1428 this.el.xalign = 0.900000f;
1431 // user defined functions
1434 public class Xcls_milestone_id : Object
1436 public Gtk.ComboBox el;
1437 private NewBranch _this;
1441 public bool loading;
1444 public Xcls_milestone_id(NewBranch _owner )
1447 _this.milestone_id = this;
1448 this.el = new Gtk.ComboBox.with_entry();
1451 this.loading = false;
1453 // set gobject values
1454 var child_0 = new Xcls_msmodel( _this );
1456 this.el.set_model ( child_0.el );
1460 this.el.set_entry_text_column(1);
1463 // user defined functions
1464 public string selectedMilestoneId () {
1469 this.el.get_active_iter (out iter);
1470 _this.msmodel.el.get_value (iter, 0, out val1);
1473 return (string) val1;
1480 public class Xcls_msmodel : Object
1482 public Gtk.ListStore el;
1483 private NewBranch _this;
1489 public Xcls_msmodel(NewBranch _owner )
1492 _this.msmodel = this;
1493 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
1497 // set gobject values
1500 // user defined functions
1501 public void loadMilestones ( ) {
1503 var rt = RooTicket.singleton();
1504 // rt.loadProjects();
1506 _this.milestone_id.loading = true;
1512 el.append(out iter);
1515 el.set_value(iter, 0, "");
1516 el.set_value(iter, 1, "-- select a milestone --");
1517 _this.milestone_id.el.set_active_iter(iter);
1519 var projects = rt.milestones;
1520 foreach(var project in projects) {
1522 el.append(out iter);
1524 el.set_value(iter, 0, project.id);
1525 el.set_value(iter, 1, project.display_name );
1526 // if (id == project.id) {
1527 // _this.milestone.el.set_active_iter(iter);
1533 _this.milestone_id.loading = false;
1534 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
1540 public class Xcls_Label36 : Object
1542 public Gtk.Label el;
1543 private NewBranch _this;
1549 public Xcls_Label36(NewBranch _owner )
1552 this.el = new Gtk.Label( "Description" );
1556 // set gobject values
1557 this.el.halign = Gtk.Align.START;
1560 // user defined functions
1563 public class Xcls_description : Object
1565 public Gtk.TextView el;
1566 private NewBranch _this;
1572 public Xcls_description(NewBranch _owner )
1575 _this.description = this;
1576 this.el = new Gtk.TextView();
1580 // set gobject values
1581 this.el.border_width = 1;
1584 // user defined functions
1587 public class Xcls_Label38 : Object
1589 public Gtk.Label el;
1590 private NewBranch _this;
1596 public Xcls_Label38(NewBranch _owner )
1599 this.el = new Gtk.Label( "Priority" );
1603 // set gobject values
1604 this.el.halign = Gtk.Align.START;
1605 this.el.xalign = 0.900000f;
1608 // user defined functions
1611 public class Xcls_priority_id : Object
1613 public Gtk.ComboBox el;
1614 private NewBranch _this;
1618 public bool loading;
1621 public Xcls_priority_id(NewBranch _owner )
1624 _this.priority_id = this;
1625 this.el = new Gtk.ComboBox.with_entry();
1628 this.loading = false;
1630 // set gobject values
1631 var child_0 = new Xcls_primodel( _this );
1633 this.el.set_model ( child_0.el );
1637 this.el.set_entry_text_column(1);
1640 // user defined functions
1641 public string selectedPriorityId () {
1646 this.el.get_active_iter (out iter);
1647 _this.primodel.el.get_value (iter, 0, out val1);
1650 return (string) val1;
1657 public class Xcls_primodel : Object
1659 public Gtk.ListStore el;
1660 private NewBranch _this;
1666 public Xcls_primodel(NewBranch _owner )
1669 _this.primodel = this;
1670 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
1674 // set gobject values
1677 // user defined functions
1678 public void loadPriorities ( ) {
1680 var rt = RooTicket.singleton();
1681 // rt.loadProjects();
1683 _this.priority_id.loading = true;
1690 var projects = rt.priorities;
1691 foreach(var project in projects) {
1693 el.append(out iter);
1695 el.set_value(iter, 0, project.id);
1696 el.set_value(iter, 1, project.display_name );
1697 if ("normal" == project.name) {
1698 _this.priority_id.el.set_active_iter(iter);
1703 _this.priority_id.loading = false;
1710 public class Xcls_Label41 : Object
1712 public Gtk.Label el;
1713 private NewBranch _this;
1719 public Xcls_Label41(NewBranch _owner )
1722 this.el = new Gtk.Label( "Severity" );
1726 // set gobject values
1727 this.el.halign = Gtk.Align.START;
1730 // user defined functions
1733 public class Xcls_severity_id : Object
1735 public Gtk.ComboBox el;
1736 private NewBranch _this;
1740 public bool loading;
1743 public Xcls_severity_id(NewBranch _owner )
1746 _this.severity_id = this;
1747 this.el = new Gtk.ComboBox.with_entry();
1750 this.loading = false;
1752 // set gobject values
1753 var child_0 = new Xcls_sevmodel( _this );
1755 this.el.set_model ( child_0.el );
1759 this.el.set_entry_text_column(1);
1762 // user defined functions
1763 public string selectedSeverityId () {
1768 this.el.get_active_iter (out iter);
1769 _this.sevmodel.el.get_value (iter, 0, out val1);
1772 return (string) val1;
1779 public class Xcls_sevmodel : Object
1781 public Gtk.ListStore el;
1782 private NewBranch _this;
1788 public Xcls_sevmodel(NewBranch _owner )
1791 _this.sevmodel = this;
1792 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
1796 // set gobject values
1799 // user defined functions
1800 public void loadSeverities () {
1802 var rt = RooTicket.singleton();
1803 //rt.loadProjects();
1805 _this.severity_id.loading = true;
1811 var projects = rt.serverities;
1812 foreach(var project in projects) {
1814 el.append(out iter);
1816 el.set_value(iter, 0, project.id);
1817 el.set_value(iter, 1, project.display_name );
1818 if ("normal" == project.name) {
1819 _this.severity_id.el.set_active_iter(iter);
1824 _this.severity_id.loading = false;
1825 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
1831 public class Xcls_Label44 : Object
1833 public Gtk.Label el;
1834 private NewBranch _this;
1840 public Xcls_Label44(NewBranch _owner )
1843 this.el = new Gtk.Label( "Classification" );
1847 // set gobject values
1848 this.el.halign = Gtk.Align.START;
1851 // user defined functions
1854 public class Xcls_classification_id : Object
1856 public Gtk.ComboBox el;
1857 private NewBranch _this;
1861 public bool loading;
1864 public Xcls_classification_id(NewBranch _owner )
1867 _this.classification_id = this;
1868 this.el = new Gtk.ComboBox.with_entry();
1871 this.loading = false;
1873 // set gobject values
1874 var child_0 = new Xcls_clmodel( _this );
1876 this.el.set_model ( child_0.el );
1880 this.el.set_entry_text_column(1);
1883 // user defined functions
1884 public string selectedClassificationId () {
1889 this.el.get_active_iter (out iter);
1890 _this.clmodel.el.get_value (iter, 0, out val1);
1893 return (string) val1;
1900 public class Xcls_clmodel : Object
1902 public Gtk.ListStore el;
1903 private NewBranch _this;
1909 public Xcls_clmodel(NewBranch _owner )
1912 _this.clmodel = this;
1913 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
1917 // set gobject values
1920 // user defined functions
1921 public void loadClassifications ( ) {
1923 var rt = RooTicket.singleton();
1924 // rt.loadProjects();
1926 _this.classification_id.loading = true;
1932 el.append(out iter);
1935 var projects = rt.classifications;
1936 foreach(var project in projects) {
1938 el.append(out iter);
1940 el.set_value(iter, 0, project.id);
1941 el.set_value(iter, 1, project.display_name );
1942 if ("bug" == project.name) {
1943 _this.classification_id.el.set_active_iter(iter);
1948 _this.classification_id.loading = false;
1949 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
1955 public class Xcls_Label47 : Object
1957 public Gtk.Label el;
1958 private NewBranch _this;
1964 public Xcls_Label47(NewBranch _owner )
1967 this.el = new Gtk.Label( "Assign to" );
1971 // set gobject values
1972 this.el.halign = Gtk.Align.START;
1975 // user defined functions
1978 public class Xcls_developer_id : Object
1980 public Gtk.ComboBox el;
1981 private NewBranch _this;
1985 public bool loading;
1988 public Xcls_developer_id(NewBranch _owner )
1991 _this.developer_id = this;
1992 this.el = new Gtk.ComboBox.with_entry();
1995 this.loading = false;
1997 // set gobject values
1998 var child_0 = new Xcls_devmodel( _this );
2000 this.el.set_model ( child_0.el );
2004 this.el.set_entry_text_column(1);
2007 // user defined functions
2008 public string selectedDeveloperId () {
2013 this.el.get_active_iter (out iter);
2014 _this.devmodel.el.get_value (iter, 0, out val1);
2017 return (string) val1;
2024 public class Xcls_devmodel : Object
2026 public Gtk.ListStore el;
2027 private NewBranch _this;
2033 public Xcls_devmodel(NewBranch _owner )
2036 _this.devmodel = this;
2037 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
2041 // set gobject values
2044 // user defined functions
2045 public void loadDevelopers ( ) {
2047 var rt = RooTicket.singleton();
2048 //rt.loadProjects();
2050 _this.developer_id.loading = true;
2056 el.append(out iter);
2059 el.set_value(iter, 0, "");
2060 el.set_value(iter, 1, "-- select a developer --");
2062 _this.developer_id.el.set_active_iter(iter);
2065 var peps = rt.developers;
2066 foreach(var p in peps) {
2068 el.append(out iter);
2070 el.set_value(iter, 0, p.id);
2071 el.set_value(iter, 1, p.display_name );
2072 if (rt.authuser_id == p.id) {
2073 _this.developer_id.el.set_active_iter(iter);
2077 _this.developer_id.loading = false;
2078 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
2084 public class Xcls_Button50 : Object
2086 public Gtk.Button el;
2087 private NewBranch _this;
2093 public Xcls_Button50(NewBranch _owner )
2096 this.el = new Gtk.Button();
2100 // set gobject values
2101 this.el.label = "Create Ticket & Branch";
2106 this.el.get_style_context().add_class("suggested-action");
2110 this.el.clicked.connect( () => {
2111 GLib.debug("fire response = 1");
2114 var invalid = false;
2116 // validate first...
2117 _this.project_id.el.get_child().get_style_context().remove_class("warning");
2118 if (_this.project_id.selectedProjectId() == "") {
2119 _this.project_id.el.get_child().get_style_context().add_class("warning");
2123 _this.milestone_id.el.get_child().get_style_context().remove_class("warning");
2125 _this.priority_id.el.get_child().get_style_context().remove_class("warning");
2126 if (_this.priority_id.selectedPriorityId() == "") {
2127 _this.priority_id.el.get_child().get_style_context().add_class("warning");
2131 _this.classification_id.el.get_child().get_style_context().remove_class("warning");
2132 if (_this.classification_id.selectedClassificationId() == "") {
2133 _this.classification_id.el.get_child().get_style_context().add_class("warning");
2137 _this.developer_id.el.get_child().get_style_context().remove_class("warning");
2138 if (_this.developer_id.selectedDeveloperId() == "") {
2139 _this.developer_id.el.get_child().get_style_context().add_class("warning");
2143 _this.summary.el.get_style_context().remove_class("warning");
2144 if (_this.summary.el.get_text() == "") {
2145 _this.summary.el.get_style_context().add_class("warning");
2149 _this.description.el.get_style_context().remove_class("warning");
2154 GLib.debug("for is valid");
2156 _this.el.response(1);
2160 // user defined functions
2165 public class Xcls_Box51 : Object
2168 private NewBranch _this;
2174 public Xcls_Box51(NewBranch _owner )
2177 this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
2181 // set gobject values
2182 this.el.homogeneous = false;
2183 var child_0 = new Xcls_Table52( _this );
2185 this.el.pack_start ( child_0.el , false,false,0 );
2186 var child_1 = new Xcls_ScrolledWindow56( _this );
2188 this.el.add ( child_1.el );
2191 // user defined functions
2193 public class Xcls_Table52 : Object
2195 public Gtk.Table el;
2196 private NewBranch _this;
2202 public Xcls_Table52(NewBranch _owner )
2205 this.el = new Gtk.Table( 2, 5, true );
2209 // set gobject values
2210 this.el.expand = false;
2212 this.el.column_spacing = 4;
2213 this.el.vexpand = false;
2214 var child_0 = new Xcls_Label53( _this );
2216 this.el.attach_defaults ( child_0.el , 0,1,0,1 );
2217 var child_1 = new Xcls_commit_message( _this );
2219 this.el.attach_defaults ( child_1.el , 0,4,1,2 );
2220 var child_2 = new Xcls_createbtn( _this );
2222 this.el.attach_defaults ( child_2.el , 4,5,1,2 );
2225 // user defined functions
2227 public class Xcls_Label53 : Object
2229 public Gtk.Label el;
2230 private NewBranch _this;
2236 public Xcls_Label53(NewBranch _owner )
2239 this.el = new Gtk.Label( "Just commit with this comment" );
2243 // set gobject values
2244 this.el.halign = Gtk.Align.START;
2245 this.el.justify = Gtk.Justification.RIGHT;
2246 this.el.xalign = 0.900000f;
2249 // user defined functions
2252 public class Xcls_commit_message : Object
2254 public Gtk.Entry el;
2255 private NewBranch _this;
2261 public Xcls_commit_message(NewBranch _owner )
2264 _this.commit_message = this;
2265 this.el = new Gtk.Entry();
2269 // set gobject values
2270 this.el.visible = true;
2273 // user defined functions
2276 public class Xcls_createbtn : Object
2278 public Gtk.Button el;
2279 private NewBranch _this;
2285 public Xcls_createbtn(NewBranch _owner )
2288 _this.createbtn = this;
2289 this.el = new Gtk.Button();
2293 // set gobject values
2294 this.el.label = "Commit Changes";
2299 this.el.get_style_context().add_class("suggested-action");
2303 this.el.clicked.connect( () => {
2305 GLib.debug("fire response = 1");
2307 var ticket_id = _this.ticketsel.selectedTicketId();
2309 if (ticket_id == "") {
2310 _this.ticketsel.el.get_child().get_style_context().add_class("warning");
2314 _this.el.response(1);
2318 // user defined functions
2319 public void updateState () {
2321 var ticket_id = _this.ticketsel.selectedTicketId();
2323 if (ticket_id == "") {
2324 this.el.set_sensitive(false);
2328 this.el.set_sensitive(true);
2334 public class Xcls_ScrolledWindow56 : Object
2336 public Gtk.ScrolledWindow el;
2337 private NewBranch _this;
2343 public Xcls_ScrolledWindow56(NewBranch _owner )
2346 this.el = new Gtk.ScrolledWindow( null, null );
2350 // set gobject values
2351 this.el.height_request = 400;
2352 this.el.vexpand = true;
2353 var child_0 = new Xcls_diff_view( _this );
2355 this.el.add ( child_0.el );
2358 // user defined functions
2360 public class Xcls_diff_view : Object
2362 public Gtk.SourceView el;
2363 private NewBranch _this;
2369 public Xcls_diff_view(NewBranch _owner )
2372 _this.diff_view = this;
2373 this.el = new Gtk.SourceView();
2379 var description = Pango.FontDescription.from_string("monospace");
2380 description.set_size(9000);
2381 this.el.override_font(description);
2382 var lm = Gtk.SourceLanguageManager.get_default();
2384 ((Gtk.SourceBuffer)(this.el.get_buffer())).set_language(
2385 lm.get_language("diff")
2389 // user defined functions