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_notebook notebook;
16 public Xcls_label_select_ticket label_select_ticket;
17 public Xcls_label_create_ticket label_create_ticket;
18 public Xcls_label_quick_commit label_quick_commit;
19 public Xcls_select_ticket_tab select_ticket_tab;
20 public Xcls_projectsel projectsel;
21 public Xcls_prcellrenderer prcellrenderer;
22 public Xcls_prmodel prmodel;
23 public Xcls_ticketsel ticketsel;
24 public Xcls_dbcellrenderer dbcellrenderer;
25 public Xcls_dbmodel dbmodel;
26 public Xcls_name name;
27 public Xcls_branchbtn branchbtn;
28 public Xcls_btn_not_me btn_not_me;
29 public Xcls_btn_closed btn_closed;
30 public Xcls_scrolled_window scrolled_window;
31 public Xcls_view view;
32 public Xcls_create_ticket_tab create_ticket_tab;
33 public Xcls_table table;
34 public Xcls_project_id project_id;
35 public Xcls_tprcellrenderer tprcellrenderer;
36 public Xcls_tprmodel tprmodel;
37 public Xcls_summary summary;
38 public Xcls_milestone_id milestone_id;
39 public Xcls_msmodel msmodel;
40 public Xcls_description description;
41 public Xcls_priority_id priority_id;
42 public Xcls_primodel primodel;
43 public Xcls_severity_id severity_id;
44 public Xcls_sevmodel sevmodel;
45 public Xcls_classification_id classification_id;
46 public Xcls_clmodel clmodel;
47 public Xcls_developer_id developer_id;
48 public Xcls_devmodel devmodel;
49 public Xcls_spinner spinner;
50 public Xcls_quick_commit_tab quick_commit_tab;
51 public Xcls_commit_message commit_message;
52 public Xcls_createbtn createbtn;
53 public Xcls_diff_view diff_view;
58 public Gee.ArrayList<GitMonitorQueue> queue;
64 this.el = new Gtk.Dialog();
72 this.el.title = "Create a working branch ";
73 this.el.default_height = 500;
74 this.el.default_width = 500;
75 this.el.deletable = true;
77 var child_0 = new Xcls_notebook( _this );
79 this.el.get_content_area().add ( child_0.el );
82 this.el.delete_event.connect( (self, event) => {
87 this.el.response.connect( (self, response_id) => {
89 GLib.debug("got %d", (int) response_id);
94 // have they selected a ticket..
95 // make that the current active ticket?
96 // we really need to store locally what ticket is being worked on..
97 // in theory we could be working on multiple project and not merging..
98 // -- each repo would have their active ticket (only one per repo)
99 // -- so we could just store that in there
100 // -- initial load can check the contents of the ticket files on first scan.
103 if (response_id < 1) {
105 this.running = false;
109 var ticket_id = _this.ticketsel.selectedTicketId();
111 if (this.repo != null) {
112 var bn = _this.name.el.get_text();
114 var res = this.repo.setActiveTicket(
115 RooTicket.singleton().getById(ticket_id != "" ? ticket_id : "-1"), bn
118 // start the monitoring..
119 GitMonitor.gitmonitor.start();
125 this.running = false;
135 // user defined functions
136 public void show ( GitRepo repo, Gee.ArrayList<GitMonitorQueue> queue, string tid = "" )
138 // this.el.set_gravity(Gdk.Gravity.NORTH);
139 if (this.running) { // should not happen!!
140 GLib.error("new branch show called, when already being displayed?");
146 GitMonitor.gitmonitor.stop();
150 this.el.move((Gdk.Screen.width() / 2)- 250 ,0);
151 this.el.set_default_size( 500,200); // not sure why it grows..
159 this.el.set_keep_above(true);
161 _this.notebook.el.set_current_page(0);
163 _this.select_ticket_tab.load_data(tid);
164 //_this.create_ticket_tab.load_data();
165 //_this.quick_commit_tab.load_data();
176 public class Xcls_notebook : Object
178 public Gtk.Notebook el;
179 private NewBranch _this;
185 public Xcls_notebook(NewBranch _owner )
188 _this.notebook = this;
189 this.el = new Gtk.Notebook();
193 // set gobject values
194 this.el.vexpand = true;
195 var child_0 = new Xcls_label_select_ticket( _this );
197 var child_1 = new Xcls_label_create_ticket( _this );
199 var child_2 = new Xcls_label_quick_commit( _this );
201 var child_3 = new Xcls_select_ticket_tab( _this );
203 this.el.append_page ( child_3.el , _this.label_select_ticket.el );
204 var child_4 = new Xcls_create_ticket_tab( _this );
206 this.el.append_page ( child_4.el , _this.label_create_ticket.el );
207 var child_5 = new Xcls_quick_commit_tab( _this );
209 this.el.append_page ( child_5.el , _this.label_quick_commit.el );
212 this.el.switch_page.connect( (page, page_num) => {
213 GLib.debug("Switch to page: %d", (int)page_num);
216 break; // do nothing.. it's already loaded at start.
218 _this.create_ticket_tab.load_data();
221 _this.quick_commit_tab.load_data();
229 // user defined functions
231 public class Xcls_label_select_ticket : Object
234 private NewBranch _this;
240 public Xcls_label_select_ticket(NewBranch _owner )
243 _this.label_select_ticket = this;
244 this.el = new Gtk.Label( "Select Existing Ticket to work on" );
248 // set gobject values
251 // user defined functions
254 public class Xcls_label_create_ticket : Object
257 private NewBranch _this;
263 public Xcls_label_create_ticket(NewBranch _owner )
266 _this.label_create_ticket = this;
267 this.el = new Gtk.Label( "Create a New Ticket" );
271 // set gobject values
274 // user defined functions
277 public class Xcls_label_quick_commit : Object
280 private NewBranch _this;
286 public Xcls_label_quick_commit(NewBranch _owner )
289 _this.label_quick_commit = this;
290 this.el = new Gtk.Label( "Quick Commit" );
294 // set gobject values
297 // user defined functions
300 public class Xcls_select_ticket_tab : Object
303 private NewBranch _this;
309 public Xcls_select_ticket_tab(NewBranch _owner )
312 _this.select_ticket_tab = this;
313 this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
317 // set gobject values
318 this.el.homogeneous = false;
319 var child_0 = new Xcls_Table7( _this );
321 this.el.pack_start ( child_0.el , false,false,0 );
322 var child_1 = new Xcls_scrolled_window( _this );
324 this.el.add ( child_1.el );
327 // user defined functions
328 public void load_data (string tid = "") {
330 GLib.debug("Loading tickets");
332 var curproj = RooProject.getProjectByRepo(_this.repo);
333 _this.prmodel.loadProjects(curproj == null ? "" : curproj.id);
335 _this.dbmodel.loadTickets(curproj == null ? "": curproj.id, tid);
336 _this.branchbtn.updateState();
338 _this.ticketsel.el.get_child().get_style_context().remove_class("warning");
340 var name = RooTicket.singleton().usernameLocal();
341 var ticket = RooTicket.singleton().getById(tid);
342 _this.name.el.set_text("wip_%s_T%s_%s".printf(name,ticket.id, ticket.summaryToBranchName()));
344 _this.ticketsel.el.get_child().get_style_context().add_class("warning");
346 _this.view.loadTicket(tid);
351 public class Xcls_Table7 : Object
354 private NewBranch _this;
360 public Xcls_Table7(NewBranch _owner )
363 this.el = new Gtk.Table( 5, 5, true );
367 // set gobject values
368 this.el.expand = false;
370 this.el.column_spacing = 4;
371 this.el.vexpand = false;
372 var child_0 = new Xcls_Label8( _this );
374 this.el.attach_defaults ( child_0.el , 0,1,0,1 );
375 var child_1 = new Xcls_Label9( _this );
377 this.el.attach_defaults ( child_1.el , 1,2,0,1 );
378 var child_2 = new Xcls_projectsel( _this );
380 this.el.attach_defaults ( child_2.el , 0,1,1,2 );
381 var child_3 = new Xcls_ticketsel( _this );
383 this.el.attach_defaults ( child_3.el , 1,5,1,2 );
384 var child_4 = new Xcls_Label16( _this );
386 this.el.attach_defaults ( child_4.el , 0,1,3,4 );
387 var child_5 = new Xcls_name( _this );
389 this.el.attach_defaults ( child_5.el , 0,4,4,5 );
390 var child_6 = new Xcls_branchbtn( _this );
392 this.el.attach_defaults ( child_6.el , 4,5,4,5 );
393 var child_7 = new Xcls_Box19( _this );
395 this.el.attach_defaults ( child_7.el , 0,5,2,3 );
398 // user defined functions
400 public class Xcls_Label8 : Object
403 private NewBranch _this;
409 public Xcls_Label8(NewBranch _owner )
412 this.el = new Gtk.Label( "Project" );
416 // set gobject values
417 this.el.halign = Gtk.Align.START;
418 this.el.justify = Gtk.Justification.RIGHT;
419 this.el.visible = true;
422 // user defined functions
425 public class Xcls_Label9 : Object
428 private NewBranch _this;
434 public Xcls_Label9(NewBranch _owner )
437 this.el = new Gtk.Label( "Ticket" );
441 // set gobject values
442 this.el.halign = Gtk.Align.START;
443 this.el.visible = true;
446 // user defined functions
449 public class Xcls_projectsel : Object
451 public Gtk.ComboBox el;
452 private NewBranch _this;
459 public Xcls_projectsel(NewBranch _owner )
462 _this.projectsel = this;
463 this.el = new Gtk.ComboBox.with_entry();
466 this.loading = false;
468 // set gobject values
469 var child_0 = new Xcls_prcellrenderer( _this );
471 this.el.pack_start ( child_0.el , true );
472 var child_1 = new Xcls_prmodel( _this );
474 this.el.set_model ( child_1.el );
478 this.el.set_entry_text_column(1);
481 this.el.changed.connect( () => {
485 var project_id = this.selectedProjectId();
486 _this.dbmodel.loadTickets(project_id);
489 /*if (this.loading) {
492 var ticket_id = this.selectedTicketId();
494 var name = RooTicket.singleton().usernameLocal();
496 if (ticket_id == "" || ticket_id == null) {
498 var dt = new DateTime.now_local();
499 _this.name.el.set_text("wip_%s_%s".printf(name,dt.format("%Y_%b_%d")));
504 var ticket = RooTicket.singleton().getById(ticket_id);
506 _this.name.el.set_text("wip_%s_T%s_%s".printf(name,ticket.id, ticket.summaryToBranchName()));
508 //GLib.debug (//"Selection: %s, %s\n", (string) val1, (string) val2);
513 // user defined functions
514 public string selectedProjectId () {
519 this.el.get_active_iter (out iter);
520 _this.prmodel.el.get_value (iter, 0, out val1);
523 return (string) val1;
530 public class Xcls_prcellrenderer : Object
532 public Gtk.CellRendererText el;
533 private NewBranch _this;
539 public Xcls_prcellrenderer(NewBranch _owner )
542 _this.prcellrenderer = this;
543 this.el = new Gtk.CellRendererText();
547 // set gobject values
550 // user defined functions
553 public class Xcls_prmodel : Object
555 public Gtk.ListStore el;
556 private NewBranch _this;
562 public Xcls_prmodel(NewBranch _owner )
565 _this.prmodel = this;
566 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
570 // set gobject values
573 // user defined functions
574 public void loadProjects (string id) {
578 _this.projectsel.loading = true;
587 el.set_value(iter, 0, "");
588 el.set_value(iter, 1, "-- select a project --");
590 _this.projectsel.el.set_active_iter(iter);
593 foreach(var project in RooProject.projects()) {
597 el.set_value(iter, 0, project.id);
598 el.set_value(iter, 1, project.name );
599 if (id == project.id) {
600 _this.projectsel.el.set_active_iter(iter);
605 _this.projectsel.loading = false;
606 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
612 public class Xcls_ticketsel : Object
614 public Gtk.ComboBox el;
615 private NewBranch _this;
622 public Xcls_ticketsel(NewBranch _owner )
625 _this.ticketsel = this;
626 this.el = new Gtk.ComboBox.with_entry();
629 this.loading = false;
631 // set gobject values
632 var child_0 = new Xcls_dbcellrenderer( _this );
634 this.el.pack_start ( child_0.el , true );
635 var child_1 = new Xcls_dbmodel( _this );
637 this.el.set_model ( child_1.el );
641 //this.el.add_attribute(_this.dbcellrenderer.el , "markup", 1 );
642 this.el.set_entry_text_column(1);
643 this.el.get_child().set_sensitive(false);
646 this.el.changed.connect( () => {
650 var ticket_id = this.selectedTicketId();
652 var name = RooTicket.singleton().usernameLocal();
654 this.el.get_child().get_style_context().remove_class("warning");
655 if (ticket_id == "" || ticket_id == null) {
657 var dt = new DateTime.now_local();
658 _this.name.el.set_text("wip_%s_%s".printf(name,dt.format("%Y_%b_%d")));
659 _this.view.loadTicket("");
661 this.el.get_child().get_style_context().add_class("warning");
662 _this.createbtn.updateState();
667 var ticket = RooTicket.singleton().getById(ticket_id);
669 _this.name.el.set_text("wip_%s_T%s_%s".printf(name,ticket.id, ticket.summaryToBranchName()));
670 _this.scrolled_window.el.show();
672 _this.view.loadTicket(ticket.id);
673 _this.branchbtn.updateState();
675 //GLib.debug (//"Selection: %s, %s\n", (string) val1, (string) val2);
679 // user defined functions
680 public string selectedTicketId () {
685 this.el.get_active_iter (out iter);
686 _this.dbmodel.el.get_value (iter, 0, out val1);
689 return (string) val1;
696 public class Xcls_dbcellrenderer : Object
698 public Gtk.CellRendererText el;
699 private NewBranch _this;
705 public Xcls_dbcellrenderer(NewBranch _owner )
708 _this.dbcellrenderer = this;
709 this.el = new Gtk.CellRendererText();
713 // set gobject values
716 // user defined functions
719 public class Xcls_dbmodel : Object
721 public Gtk.ListStore el;
722 private NewBranch _this;
728 public Xcls_dbmodel(NewBranch _owner )
731 _this.dbmodel = this;
732 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
736 // set gobject values
739 // user defined functions
740 public void loadTickets (string project_id , string tid = "") {
744 // fixme .. get project id from selection..
746 RooTicket.singleton().loadTickets(
748 _this.btn_not_me.el.active ? RooTicket.Who.ANYBODY : RooTicket.Who.ME,
749 _this.btn_closed.el.active ? RooTicket.Status.ALL : RooTicket.Status.ACTIVE
752 _this.ticketsel.loading = true;
761 el.set_value(iter, 0, "");
762 el.set_value(iter, 1, "-- select a ticket --");
764 _this.ticketsel.el.set_active_iter(iter);
765 var tickets = RooTicket.singleton().tickets;
766 foreach(var ticket in tickets) {
770 el.set_value(iter, 0, ticket.id);
771 el.set_value(iter, 1, "#%s %s".printf( ticket.id, ticket.summary));
773 if (ticket.id == tid) {
774 _this.ticketsel.el.set_active_iter(iter);
779 _this.ticketsel.loading = false;
780 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
786 public class Xcls_Label16 : Object
789 private NewBranch _this;
795 public Xcls_Label16(NewBranch _owner )
798 this.el = new Gtk.Label( "Use this as branch name" );
802 // set gobject values
803 this.el.halign = Gtk.Align.START;
804 this.el.justify = Gtk.Justification.RIGHT;
805 this.el.xalign = 0.900000f;
808 // user defined functions
811 public class Xcls_name : Object
814 private NewBranch _this;
820 public Xcls_name(NewBranch _owner )
824 this.el = new Gtk.Entry();
828 // set gobject values
829 this.el.visible = true;
832 // user defined functions
835 public class Xcls_branchbtn : Object
837 public Gtk.Button el;
838 private NewBranch _this;
844 public Xcls_branchbtn(NewBranch _owner )
847 _this.branchbtn = this;
848 this.el = new Gtk.Button();
852 // set gobject values
853 this.el.label = "Create Branch";
858 this.el.get_style_context().add_class("suggested-action");
862 this.el.clicked.connect( () => {
864 GLib.debug("fire response = 1");
866 var ticket_id = _this.ticketsel.selectedTicketId();
868 if (ticket_id == "") {
869 _this.ticketsel.el.get_child().get_style_context().add_class("warning");
873 _this.el.response(1);
877 // user defined functions
878 public void updateState () {
880 var ticket_id = _this.ticketsel.selectedTicketId();
882 if (ticket_id == "") {
883 this.el.set_sensitive(false);
887 this.el.set_sensitive(true);
892 public class Xcls_Box19 : Object
895 private NewBranch _this;
901 public Xcls_Box19(NewBranch _owner )
904 this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
908 // set gobject values
909 var child_0 = new Xcls_btn_not_me( _this );
911 this.el.add ( child_0.el );
912 var child_1 = new Xcls_btn_closed( _this );
914 this.el.add ( child_1.el );
915 var child_2 = new Xcls_Label22( _this );
917 this.el.add ( child_2.el );
920 // user defined functions
922 public class Xcls_btn_not_me : Object
924 public Gtk.CheckButton el;
925 private NewBranch _this;
931 public Xcls_btn_not_me(NewBranch _owner )
934 _this.btn_not_me = this;
935 this.el = new Gtk.CheckButton();
939 // set gobject values
940 this.el.label = "Show tickets not assigned to me";
943 this.el.toggled.connect( () => {
944 var project_id = _this.projectsel.selectedProjectId();
945 _this.dbmodel.loadTickets(project_id);
949 // user defined functions
952 public class Xcls_btn_closed : Object
954 public Gtk.CheckButton el;
955 private NewBranch _this;
961 public Xcls_btn_closed(NewBranch _owner )
964 _this.btn_closed = this;
965 this.el = new Gtk.CheckButton();
969 // set gobject values
970 this.el.label = "Show closed Tickets";
973 this.el.toggled.connect( () => {
974 var project_id = _this.projectsel.selectedProjectId();
975 _this.dbmodel.loadTickets(project_id);
980 // user defined functions
983 public class Xcls_Label22 : Object
986 private NewBranch _this;
992 public Xcls_Label22(NewBranch _owner )
995 this.el = new Gtk.Label( "<a href=\"refresh\">Refresh Ticket list</a>" );
999 // set gobject values
1000 this.el.halign = Gtk.Align.END;
1001 this.el.hexpand = true;
1002 this.el.use_markup = true;
1005 this.el.activate_link.connect( (uri) => {
1006 if (uri == "refresh") {
1007 RooProject.reload();
1008 var curproj = RooProject.getProjectByRepo(_this.repo);
1009 _this.prmodel.loadProjects(curproj == null ? "": curproj.id);
1011 _this.dbmodel.loadTickets(curproj == null ? "": curproj.id);
1017 // user defined functions
1022 public class Xcls_scrolled_window : Object
1024 public Gtk.ScrolledWindow el;
1025 private NewBranch _this;
1031 public Xcls_scrolled_window(NewBranch _owner )
1034 _this.scrolled_window = this;
1035 this.el = new Gtk.ScrolledWindow( null, null );
1039 // set gobject values
1040 this.el.height_request = 500;
1041 this.el.vexpand = true;
1042 var child_0 = new Xcls_view( _this );
1044 this.el.add ( child_0.el );
1049 this.el.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);
1053 // user defined functions
1055 public class Xcls_view : Object
1057 public WebKit.WebView el;
1058 private NewBranch _this;
1064 public Xcls_view(NewBranch _owner )
1068 this.el = new WebKit.WebView();
1072 // set gobject values
1075 // user defined functions
1076 public void loadTicket (string tid) {
1078 _this.el.get_size(out w, out h);
1081 _this.scrolled_window.el.hide();
1082 _this.el.resize(w, 150);
1084 _this.scrolled_window.el.show();
1085 _this.el.resize(w, 800);
1088 var rs = RooTicket.singleton();
1089 var uri = new WebKit.URIRequest("https://roojs.com/admin.php/MTrack/View/" + tid);
1090 var hd = uri.get_http_headers();
1091 var authCode = Base64.encode ("%s:%s".printf(rs.username, rs.password).data);
1092 hd.append("Authorization", "Basic %s".printf(authCode));
1094 this.el.load_request(uri);
1100 public class Xcls_create_ticket_tab : Object
1103 private NewBranch _this;
1109 public Xcls_create_ticket_tab(NewBranch _owner )
1112 _this.create_ticket_tab = this;
1113 this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
1117 // set gobject values
1118 this.el.homogeneous = false;
1119 var child_0 = new Xcls_table( _this );
1121 this.el.pack_start ( child_0.el , false,false,0 );
1122 var child_1 = new Xcls_spinner( _this );
1124 this.el.add ( child_1.el );
1127 // user defined functions
1128 public void load_data () {
1130 _this.table.el.hide();
1131 _this.spinner.el.show();
1132 _this.spinner.el.start();
1134 Timeout.add_seconds(1, () => {
1136 RooProject? curproj = null;
1137 if (_this.repo != null) {
1138 curproj = RooProject.getProjectByRepo(_this.repo);
1140 _this.tprmodel.loadProjects(curproj == null ? "" : curproj.id);
1141 if (curproj != null) {
1144 var rt = RooTicket.singleton();
1145 rt.loadProjectOptions(curproj.id);
1147 _this.msmodel.loadMilestones();
1148 _this.primodel.loadPriorities();
1149 _this.sevmodel.loadSeverities();
1150 _this.clmodel.loadClassifications();
1151 _this.devmodel.loadDevelopers();
1154 _this.summary.el.set_text("");
1155 _this.description.el.buffer.text = "";
1156 _this.spinner.el.stop();
1157 _this.spinner.el.hide();
1159 _this.table.el.show();
1160 //_this.summary.el.grab_focus();
1166 public class Xcls_table : Object
1168 public Gtk.Table el;
1169 private NewBranch _this;
1175 public Xcls_table(NewBranch _owner )
1179 this.el = new Gtk.Table( 14, 4, true );
1183 // set gobject values
1184 this.el.expand = false;
1186 this.el.column_spacing = 4;
1187 this.el.vexpand = false;
1188 var child_0 = new Xcls_Label27( _this );
1190 this.el.attach_defaults ( child_0.el , 0,1,0,1 );
1191 var child_1 = new Xcls_Label28( _this );
1193 this.el.attach_defaults ( child_1.el , 1,2,0,1 );
1194 var child_2 = new Xcls_project_id( _this );
1196 this.el.attach_defaults ( child_2.el , 0,1,1,2 );
1197 var child_3 = new Xcls_summary( _this );
1199 this.el.attach_defaults ( child_3.el , 1,4,1,2 );
1200 var child_4 = new Xcls_Label33( _this );
1202 this.el.attach_defaults ( child_4.el , 0,1,2,3 );
1203 var child_5 = new Xcls_milestone_id( _this );
1205 this.el.attach_defaults ( child_5.el , 0,1,3,4 );
1206 var child_6 = new Xcls_Label36( _this );
1208 this.el.attach_defaults ( child_6.el , 1,4,2,3 );
1209 var child_7 = new Xcls_description( _this );
1211 this.el.attach_defaults ( child_7.el , 1,4,3,12 );
1212 var child_8 = new Xcls_Label38( _this );
1214 this.el.attach_defaults ( child_8.el , 0,1,4,5 );
1215 var child_9 = new Xcls_priority_id( _this );
1217 this.el.attach_defaults ( child_9.el , 0,1,5,6 );
1218 var child_10 = new Xcls_Label41( _this );
1220 this.el.attach_defaults ( child_10.el , 0,1,6,7 );
1221 var child_11 = new Xcls_severity_id( _this );
1223 this.el.attach_defaults ( child_11.el , 0,1,7,8 );
1224 var child_12 = new Xcls_Label44( _this );
1226 this.el.attach_defaults ( child_12.el , 0,1,8,9 );
1227 var child_13 = new Xcls_classification_id( _this );
1229 this.el.attach_defaults ( child_13.el , 0,1,9,10 );
1230 var child_14 = new Xcls_Label47( _this );
1232 this.el.attach_defaults ( child_14.el , 0,1,10,11 );
1233 var child_15 = new Xcls_developer_id( _this );
1235 this.el.attach_defaults ( child_15.el , 0,1,11,12 );
1236 var child_16 = new Xcls_Button50( _this );
1238 this.el.attach_defaults ( child_16.el , 0,4,13,14 );
1241 // user defined functions
1243 public class Xcls_Label27 : Object
1245 public Gtk.Label el;
1246 private NewBranch _this;
1252 public Xcls_Label27(NewBranch _owner )
1255 this.el = new Gtk.Label( "Project" );
1259 // set gobject values
1260 this.el.halign = Gtk.Align.START;
1261 this.el.visible = true;
1264 // user defined functions
1267 public class Xcls_Label28 : Object
1269 public Gtk.Label el;
1270 private NewBranch _this;
1276 public Xcls_Label28(NewBranch _owner )
1279 this.el = new Gtk.Label( "Summary" );
1283 // set gobject values
1284 this.el.halign = Gtk.Align.START;
1285 this.el.visible = true;
1288 // user defined functions
1291 public class Xcls_project_id : Object
1293 public Gtk.ComboBox el;
1294 private NewBranch _this;
1298 public bool loading;
1301 public Xcls_project_id(NewBranch _owner )
1304 _this.project_id = this;
1305 this.el = new Gtk.ComboBox.with_entry();
1308 this.loading = false;
1310 // set gobject values
1311 var child_0 = new Xcls_tprcellrenderer( _this );
1313 this.el.pack_start ( child_0.el , true );
1314 var child_1 = new Xcls_tprmodel( _this );
1316 this.el.set_model ( child_1.el );
1320 this.el.set_entry_text_column(1);
1323 this.el.changed.connect( () => {
1327 var project_id = this.selectedProjectId();
1329 var rt = RooTicket.singleton();
1330 rt.loadProjectOptions(project_id);
1332 _this.msmodel.loadMilestones();
1333 _this.primodel.loadPriorities();
1334 _this.sevmodel.loadSeverities();
1335 _this.clmodel.loadClassifications();
1336 _this.devmodel.loadDevelopers();
1338 // affects projects and milestones..
1341 /*if (this.loading) {
1344 var ticket_id = this.selectedTicketId();
1346 var name = RooTicket.singleton().usernameLocal();
1348 if (ticket_id == "" || ticket_id == null) {
1350 var dt = new DateTime.now_local();
1351 _this.name.el.set_text("wip_%s_%s".printf(name,dt.format("%Y_%b_%d")));
1356 var ticket = RooTicket.singleton().getById(ticket_id);
1358 _this.name.el.set_text("wip_%s_T%s_%s".printf(name,ticket.id, ticket.summaryToBranchName()));
1360 //GLib.debug (//"Selection: %s, %s\n", (string) val1, (string) val2);
1365 // user defined functions
1366 public string selectedProjectId () {
1371 this.el.get_active_iter (out iter);
1372 _this.tprmodel.el.get_value (iter, 0, out val1);
1375 return (string) val1;
1382 public class Xcls_tprcellrenderer : Object
1384 public Gtk.CellRendererText el;
1385 private NewBranch _this;
1391 public Xcls_tprcellrenderer(NewBranch _owner )
1394 _this.tprcellrenderer = this;
1395 this.el = new Gtk.CellRendererText();
1399 // set gobject values
1402 // user defined functions
1405 public class Xcls_tprmodel : Object
1407 public Gtk.ListStore el;
1408 private NewBranch _this;
1414 public Xcls_tprmodel(NewBranch _owner )
1417 _this.tprmodel = this;
1418 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
1422 // set gobject values
1425 // user defined functions
1426 public void loadProjects (string id) {
1429 _this.project_id.loading = true;
1435 el.append(out iter);
1438 el.set_value(iter, 0, "");
1439 el.set_value(iter, 1, "-- select a project --");
1441 _this.project_id.el.set_active_iter(iter);
1444 foreach(var project in RooProject.projects()) {
1446 el.append(out iter);
1448 el.set_value(iter, 0, project.id);
1449 el.set_value(iter, 1, project.name );
1450 if (id == project.id) {
1451 _this.project_id.el.set_active_iter(iter);
1456 _this.project_id.loading = false;
1457 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
1463 public class Xcls_summary : Object
1465 public Gtk.Entry el;
1466 private NewBranch _this;
1472 public Xcls_summary(NewBranch _owner )
1475 _this.summary = this;
1476 this.el = new Gtk.Entry();
1480 // set gobject values
1481 this.el.visible = true;
1484 // user defined functions
1487 public class Xcls_Label33 : Object
1489 public Gtk.Label el;
1490 private NewBranch _this;
1496 public Xcls_Label33(NewBranch _owner )
1499 this.el = new Gtk.Label( "Milestone" );
1503 // set gobject values
1504 this.el.halign = Gtk.Align.START;
1505 this.el.justify = Gtk.Justification.RIGHT;
1506 this.el.xalign = 0.900000f;
1509 // user defined functions
1512 public class Xcls_milestone_id : Object
1514 public Gtk.ComboBox el;
1515 private NewBranch _this;
1519 public bool loading;
1522 public Xcls_milestone_id(NewBranch _owner )
1525 _this.milestone_id = this;
1526 this.el = new Gtk.ComboBox.with_entry();
1529 this.loading = false;
1531 // set gobject values
1532 var child_0 = new Xcls_msmodel( _this );
1534 this.el.set_model ( child_0.el );
1538 this.el.set_entry_text_column(1);
1541 // user defined functions
1542 public string selectedMilestoneId () {
1547 this.el.get_active_iter (out iter);
1548 _this.msmodel.el.get_value (iter, 0, out val1);
1551 return (string) val1;
1558 public class Xcls_msmodel : Object
1560 public Gtk.ListStore el;
1561 private NewBranch _this;
1567 public Xcls_msmodel(NewBranch _owner )
1570 _this.msmodel = this;
1571 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
1575 // set gobject values
1578 // user defined functions
1579 public void loadMilestones ( ) {
1581 var rt = RooTicket.singleton();
1582 // rt.loadProjects();
1584 _this.milestone_id.loading = true;
1590 el.append(out iter);
1593 el.set_value(iter, 0, "");
1594 el.set_value(iter, 1, "-- select a milestone --");
1595 _this.milestone_id.el.set_active_iter(iter);
1597 var projects = rt.milestones;
1598 foreach(var project in projects) {
1600 el.append(out iter);
1602 el.set_value(iter, 0, project.id);
1603 el.set_value(iter, 1, project.display_name );
1604 // if (id == project.id) {
1605 // _this.milestone.el.set_active_iter(iter);
1611 _this.milestone_id.loading = false;
1612 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
1618 public class Xcls_Label36 : Object
1620 public Gtk.Label el;
1621 private NewBranch _this;
1627 public Xcls_Label36(NewBranch _owner )
1630 this.el = new Gtk.Label( "Description" );
1634 // set gobject values
1635 this.el.halign = Gtk.Align.START;
1638 // user defined functions
1641 public class Xcls_description : Object
1643 public Gtk.TextView el;
1644 private NewBranch _this;
1650 public Xcls_description(NewBranch _owner )
1653 _this.description = this;
1654 this.el = new Gtk.TextView();
1658 // set gobject values
1659 this.el.border_width = 1;
1662 // user defined functions
1665 public class Xcls_Label38 : Object
1667 public Gtk.Label el;
1668 private NewBranch _this;
1674 public Xcls_Label38(NewBranch _owner )
1677 this.el = new Gtk.Label( "Priority" );
1681 // set gobject values
1682 this.el.halign = Gtk.Align.START;
1683 this.el.xalign = 0.900000f;
1686 // user defined functions
1689 public class Xcls_priority_id : Object
1691 public Gtk.ComboBox el;
1692 private NewBranch _this;
1696 public bool loading;
1699 public Xcls_priority_id(NewBranch _owner )
1702 _this.priority_id = this;
1703 this.el = new Gtk.ComboBox.with_entry();
1706 this.loading = false;
1708 // set gobject values
1709 var child_0 = new Xcls_primodel( _this );
1711 this.el.set_model ( child_0.el );
1715 this.el.set_entry_text_column(1);
1718 // user defined functions
1719 public string selectedPriorityId () {
1724 this.el.get_active_iter (out iter);
1725 _this.primodel.el.get_value (iter, 0, out val1);
1728 return (string) val1;
1735 public class Xcls_primodel : Object
1737 public Gtk.ListStore el;
1738 private NewBranch _this;
1744 public Xcls_primodel(NewBranch _owner )
1747 _this.primodel = this;
1748 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
1752 // set gobject values
1755 // user defined functions
1756 public void loadPriorities ( ) {
1758 var rt = RooTicket.singleton();
1759 // rt.loadProjects();
1761 _this.priority_id.loading = true;
1768 var projects = rt.priorities;
1769 foreach(var project in projects) {
1771 el.append(out iter);
1773 el.set_value(iter, 0, project.id);
1774 el.set_value(iter, 1, project.display_name );
1775 if ("normal" == project.name) {
1776 _this.priority_id.el.set_active_iter(iter);
1781 _this.priority_id.loading = false;
1788 public class Xcls_Label41 : Object
1790 public Gtk.Label el;
1791 private NewBranch _this;
1797 public Xcls_Label41(NewBranch _owner )
1800 this.el = new Gtk.Label( "Severity" );
1804 // set gobject values
1805 this.el.halign = Gtk.Align.START;
1808 // user defined functions
1811 public class Xcls_severity_id : Object
1813 public Gtk.ComboBox el;
1814 private NewBranch _this;
1818 public bool loading;
1821 public Xcls_severity_id(NewBranch _owner )
1824 _this.severity_id = this;
1825 this.el = new Gtk.ComboBox.with_entry();
1828 this.loading = false;
1830 // set gobject values
1831 var child_0 = new Xcls_sevmodel( _this );
1833 this.el.set_model ( child_0.el );
1837 this.el.set_entry_text_column(1);
1840 // user defined functions
1841 public string selectedSeverityId () {
1846 this.el.get_active_iter (out iter);
1847 _this.sevmodel.el.get_value (iter, 0, out val1);
1850 return (string) val1;
1857 public class Xcls_sevmodel : Object
1859 public Gtk.ListStore el;
1860 private NewBranch _this;
1866 public Xcls_sevmodel(NewBranch _owner )
1869 _this.sevmodel = this;
1870 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
1874 // set gobject values
1877 // user defined functions
1878 public void loadSeverities () {
1880 var rt = RooTicket.singleton();
1881 //rt.loadProjects();
1883 _this.severity_id.loading = true;
1889 var projects = rt.serverities;
1890 foreach(var project in projects) {
1892 el.append(out iter);
1894 el.set_value(iter, 0, project.id);
1895 el.set_value(iter, 1, project.display_name );
1896 if ("normal" == project.name) {
1897 _this.severity_id.el.set_active_iter(iter);
1902 _this.severity_id.loading = false;
1903 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
1909 public class Xcls_Label44 : Object
1911 public Gtk.Label el;
1912 private NewBranch _this;
1918 public Xcls_Label44(NewBranch _owner )
1921 this.el = new Gtk.Label( "Classification" );
1925 // set gobject values
1926 this.el.halign = Gtk.Align.START;
1929 // user defined functions
1932 public class Xcls_classification_id : Object
1934 public Gtk.ComboBox el;
1935 private NewBranch _this;
1939 public bool loading;
1942 public Xcls_classification_id(NewBranch _owner )
1945 _this.classification_id = this;
1946 this.el = new Gtk.ComboBox.with_entry();
1949 this.loading = false;
1951 // set gobject values
1952 var child_0 = new Xcls_clmodel( _this );
1954 this.el.set_model ( child_0.el );
1958 this.el.set_entry_text_column(1);
1961 // user defined functions
1962 public string selectedClassificationId () {
1967 this.el.get_active_iter (out iter);
1968 _this.clmodel.el.get_value (iter, 0, out val1);
1971 return (string) val1;
1978 public class Xcls_clmodel : Object
1980 public Gtk.ListStore el;
1981 private NewBranch _this;
1987 public Xcls_clmodel(NewBranch _owner )
1990 _this.clmodel = this;
1991 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
1995 // set gobject values
1998 // user defined functions
1999 public void loadClassifications ( ) {
2001 var rt = RooTicket.singleton();
2002 // rt.loadProjects();
2004 _this.classification_id.loading = true;
2010 el.append(out iter);
2013 var projects = rt.classifications;
2014 foreach(var project in projects) {
2016 el.append(out iter);
2018 el.set_value(iter, 0, project.id);
2019 el.set_value(iter, 1, project.display_name );
2020 if ("bug" == project.name) {
2021 _this.classification_id.el.set_active_iter(iter);
2026 _this.classification_id.loading = false;
2027 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
2033 public class Xcls_Label47 : Object
2035 public Gtk.Label el;
2036 private NewBranch _this;
2042 public Xcls_Label47(NewBranch _owner )
2045 this.el = new Gtk.Label( "Assign to" );
2049 // set gobject values
2050 this.el.halign = Gtk.Align.START;
2053 // user defined functions
2056 public class Xcls_developer_id : Object
2058 public Gtk.ComboBox el;
2059 private NewBranch _this;
2063 public bool loading;
2066 public Xcls_developer_id(NewBranch _owner )
2069 _this.developer_id = this;
2070 this.el = new Gtk.ComboBox.with_entry();
2073 this.loading = false;
2075 // set gobject values
2076 var child_0 = new Xcls_devmodel( _this );
2078 this.el.set_model ( child_0.el );
2082 this.el.set_entry_text_column(1);
2085 // user defined functions
2086 public string selectedDeveloperId () {
2091 this.el.get_active_iter (out iter);
2092 _this.devmodel.el.get_value (iter, 0, out val1);
2095 return (string) val1;
2102 public class Xcls_devmodel : Object
2104 public Gtk.ListStore el;
2105 private NewBranch _this;
2111 public Xcls_devmodel(NewBranch _owner )
2114 _this.devmodel = this;
2115 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
2119 // set gobject values
2122 // user defined functions
2123 public void loadDevelopers ( ) {
2125 var rt = RooTicket.singleton();
2126 //rt.loadProjects();
2128 _this.developer_id.loading = true;
2134 el.append(out iter);
2137 el.set_value(iter, 0, "");
2138 el.set_value(iter, 1, "-- select a developer --");
2140 _this.developer_id.el.set_active_iter(iter);
2143 var peps = rt.developers;
2144 foreach(var p in peps) {
2146 el.append(out iter);
2148 el.set_value(iter, 0, p.id);
2149 el.set_value(iter, 1, p.display_name );
2150 if (rt.authuser_id == p.id) {
2151 _this.developer_id.el.set_active_iter(iter);
2155 _this.developer_id.loading = false;
2156 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
2162 public class Xcls_Button50 : Object
2164 public Gtk.Button el;
2165 private NewBranch _this;
2171 public Xcls_Button50(NewBranch _owner )
2174 this.el = new Gtk.Button();
2178 // set gobject values
2179 this.el.label = "Create Ticket & Branch";
2184 this.el.get_style_context().add_class("suggested-action");
2188 this.el.clicked.connect( () => {
2189 GLib.debug("fire response = 1");
2192 var invalid = false;
2194 // validate first...
2195 _this.project_id.el.get_child().get_style_context().remove_class("warning");
2196 if (_this.project_id.selectedProjectId() == "") {
2197 _this.project_id.el.get_child().get_style_context().add_class("warning");
2201 _this.milestone_id.el.get_child().get_style_context().remove_class("warning");
2203 _this.priority_id.el.get_child().get_style_context().remove_class("warning");
2204 if (_this.priority_id.selectedPriorityId() == "") {
2205 _this.priority_id.el.get_child().get_style_context().add_class("warning");
2209 _this.classification_id.el.get_child().get_style_context().remove_class("warning");
2210 if (_this.classification_id.selectedClassificationId() == "") {
2211 _this.classification_id.el.get_child().get_style_context().add_class("warning");
2215 _this.developer_id.el.get_child().get_style_context().remove_class("warning");
2216 if (_this.developer_id.selectedDeveloperId() == "") {
2217 _this.developer_id.el.get_child().get_style_context().add_class("warning");
2221 _this.summary.el.get_style_context().remove_class("warning");
2222 if (_this.summary.el.get_text() == "") {
2223 _this.summary.el.get_style_context().add_class("warning");
2227 _this.description.el.get_style_context().remove_class("warning");
2232 GLib.debug("for is valid");
2234 _this.el.response(1);
2238 // user defined functions
2242 public class Xcls_spinner : Object
2244 public Gtk.Spinner el;
2245 private NewBranch _this;
2251 public Xcls_spinner(NewBranch _owner )
2254 _this.spinner = this;
2255 this.el = new Gtk.Spinner();
2259 // set gobject values
2260 this.el.hexpand = true;
2261 this.el.vexpand = true;
2264 // user defined functions
2268 public class Xcls_quick_commit_tab : Object
2271 private NewBranch _this;
2277 public Xcls_quick_commit_tab(NewBranch _owner )
2280 _this.quick_commit_tab = this;
2281 this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
2285 // set gobject values
2286 this.el.homogeneous = false;
2287 var child_0 = new Xcls_Table53( _this );
2289 this.el.pack_start ( child_0.el , false,false,0 );
2290 var child_1 = new Xcls_ScrolledWindow57( _this );
2292 this.el.add ( child_1.el );
2295 // user defined functions
2296 public void load_data () {
2297 _this.commit_message.el.set_text("");
2298 _this.createbtn.updateState();
2301 public class Xcls_Table53 : Object
2303 public Gtk.Table el;
2304 private NewBranch _this;
2310 public Xcls_Table53(NewBranch _owner )
2313 this.el = new Gtk.Table( 3, 5, true );
2317 // set gobject values
2318 this.el.expand = false;
2320 this.el.column_spacing = 4;
2321 this.el.vexpand = false;
2322 var child_0 = new Xcls_Label54( _this );
2324 this.el.attach_defaults ( child_0.el , 0,1,0,1 );
2325 var child_1 = new Xcls_commit_message( _this );
2327 this.el.attach_defaults ( child_1.el , 0,5,1,2 );
2328 var child_2 = new Xcls_createbtn( _this );
2330 this.el.attach_defaults ( child_2.el , 0,5,2,3 );
2333 // user defined functions
2335 public class Xcls_Label54 : Object
2337 public Gtk.Label el;
2338 private NewBranch _this;
2344 public Xcls_Label54(NewBranch _owner )
2347 this.el = new Gtk.Label( "Just commit with this comment" );
2351 // set gobject values
2352 this.el.halign = Gtk.Align.START;
2353 this.el.justify = Gtk.Justification.RIGHT;
2354 this.el.xalign = 0.900000f;
2357 // user defined functions
2360 public class Xcls_commit_message : Object
2362 public Gtk.Entry el;
2363 private NewBranch _this;
2369 public Xcls_commit_message(NewBranch _owner )
2372 _this.commit_message = this;
2373 this.el = new Gtk.Entry();
2377 // set gobject values
2378 this.el.visible = true;
2381 this.el.key_release_event.connect( () => {
2383 _this.createbtn.updateState();
2388 // user defined functions
2391 public class Xcls_createbtn : Object
2393 public Gtk.Button el;
2394 private NewBranch _this;
2400 public Xcls_createbtn(NewBranch _owner )
2403 _this.createbtn = this;
2404 this.el = new Gtk.Button();
2408 // set gobject values
2409 this.el.label = "Commit Changes";
2414 this.el.get_style_context().add_class("suggested-action");
2418 this.el.clicked.connect( () => {
2420 GLib.debug("fire response = 1");
2424 _this.el.response(3);
2428 // user defined functions
2429 public void updateState () {
2431 var msg = _this.commit_message.el.get_text();
2434 this.el.set_sensitive(false);
2438 this.el.set_sensitive(true);
2444 public class Xcls_ScrolledWindow57 : Object
2446 public Gtk.ScrolledWindow el;
2447 private NewBranch _this;
2453 public Xcls_ScrolledWindow57(NewBranch _owner )
2456 this.el = new Gtk.ScrolledWindow( null, null );
2460 // set gobject values
2461 this.el.height_request = 400;
2462 this.el.vexpand = true;
2463 var child_0 = new Xcls_diff_view( _this );
2465 this.el.add ( child_0.el );
2468 // user defined functions
2470 public class Xcls_diff_view : Object
2472 public Gtk.SourceView el;
2473 private NewBranch _this;
2479 public Xcls_diff_view(NewBranch _owner )
2482 _this.diff_view = this;
2483 this.el = new Gtk.SourceView();
2489 var description = Pango.FontDescription.from_string("monospace");
2490 description.set_size(9000);
2491 this.el.override_font(description);
2492 var lm = Gtk.SourceLanguageManager.get_default();
2494 ((Gtk.SourceBuffer)(this.el.get_buffer())).set_language(
2495 lm.get_language("diff")
2499 // user defined functions