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_select_ticket_tab select_ticket_tab;
19 public Xcls_projectsel projectsel;
20 public Xcls_prcellrenderer prcellrenderer;
21 public Xcls_prmodel prmodel;
22 public Xcls_ticketsel ticketsel;
23 public Xcls_dbcellrenderer dbcellrenderer;
24 public Xcls_dbmodel dbmodel;
25 public Xcls_name name;
26 public Xcls_branchbtn branchbtn;
27 public Xcls_btn_not_me btn_not_me;
28 public Xcls_btn_closed btn_closed;
29 public Xcls_scrolled_window scrolled_window;
30 public Xcls_view view;
31 public Xcls_create_ticket_tab create_ticket_tab;
32 public Xcls_table table;
33 public Xcls_project_id project_id;
34 public Xcls_tprcellrenderer tprcellrenderer;
35 public Xcls_tprmodel tprmodel;
36 public Xcls_summary summary;
37 public Xcls_milestone_id milestone_id;
38 public Xcls_msmodel msmodel;
39 public Xcls_description description;
40 public Xcls_priority_id priority_id;
41 public Xcls_primodel primodel;
42 public Xcls_severity_id severity_id;
43 public Xcls_sevmodel sevmodel;
44 public Xcls_classification_id classification_id;
45 public Xcls_clmodel clmodel;
46 public Xcls_developer_id developer_id;
47 public Xcls_devmodel devmodel;
48 public Xcls_commit_message commit_message;
49 public Xcls_createbtn createbtn;
50 public Xcls_diff_view diff_view;
55 public Gee.ArrayList<GitMonitorQueue> queue;
61 this.el = new Gtk.Dialog();
69 this.el.title = "Create a working branch ";
70 this.el.default_height = 500;
71 this.el.default_width = 500;
72 this.el.deletable = true;
74 var child_0 = new Xcls_Notebook2( _this );
76 this.el.get_content_area().add ( child_0.el );
79 this.el.delete_event.connect( (self, event) => {
84 this.el.response.connect( (self, response_id) => {
86 GLib.debug("got %d", (int) response_id);
91 // have they selected a ticket..
92 // make that the current active ticket?
93 // we really need to store locally what ticket is being worked on..
94 // in theory we could be working on multiple project and not merging..
95 // -- each repo would have their active ticket (only one per repo)
96 // -- so we could just store that in there
97 // -- initial load can check the contents of the ticket files on first scan.
100 if (response_id < 1) {
102 this.running = false;
106 var ticket_id = _this.ticketsel.selectedTicketId();
108 if (this.repo != null) {
109 var bn = _this.name.el.get_text();
111 var res = this.repo.setActiveTicket(
112 RooTicket.singleton().getById(ticket_id != "" ? ticket_id : "-1"), bn
115 // start the monitoring..
116 GitMonitor.gitmonitor.start();
122 this.running = false;
132 // user defined functions
133 public void show ( GitRepo repo, Gee.ArrayList<GitMonitorQueue> queue, string tid = "" )
135 // this.el.set_gravity(Gdk.Gravity.NORTH);
136 if (this.running) { // should not happen!!
137 GLib.error("new branch show called, when already being displayed?");
143 GitMonitor.gitmonitor.stop();
147 this.el.move((Gdk.Screen.width() / 2)- 250 ,0);
148 this.el.set_default_size( 500,200); // not sure why it grows..
156 this.el.set_keep_above(true);
158 _this.select_ticket_tab.load_data(tid);
159 _this.create_ticket_tab.load_data();
160 _this.quick_commit_tab.load_data();
171 public class Xcls_Notebook2 : Object
173 public Gtk.Notebook el;
174 private NewBranch _this;
180 public Xcls_Notebook2(NewBranch _owner )
183 this.el = new Gtk.Notebook();
187 // set gobject values
188 this.el.vexpand = true;
189 var child_0 = new Xcls_label_select_ticket( _this );
191 var child_1 = new Xcls_label_create_ticket( _this );
193 var child_2 = new Xcls_label_quick_commit( _this );
195 var child_3 = new Xcls_select_ticket_tab( _this );
197 this.el.append_page ( child_3.el , _this.label_select_ticket.el );
198 var child_4 = new Xcls_create_ticket_tab( _this );
200 this.el.append_page ( child_4.el , _this.label_create_ticket.el );
201 var child_5 = new Xcls_Box51( _this );
203 this.el.append_page ( child_5.el , _this.label_quick_commit.el );
206 // user defined functions
208 public class Xcls_label_select_ticket : Object
211 private NewBranch _this;
217 public Xcls_label_select_ticket(NewBranch _owner )
220 _this.label_select_ticket = this;
221 this.el = new Gtk.Label( "Select Existing Ticket to work on" );
225 // set gobject values
228 // user defined functions
231 public class Xcls_label_create_ticket : Object
234 private NewBranch _this;
240 public Xcls_label_create_ticket(NewBranch _owner )
243 _this.label_create_ticket = this;
244 this.el = new Gtk.Label( "Create a New Ticket" );
248 // set gobject values
251 // user defined functions
254 public class Xcls_label_quick_commit : Object
257 private NewBranch _this;
263 public Xcls_label_quick_commit(NewBranch _owner )
266 _this.label_quick_commit = this;
267 this.el = new Gtk.Label( "Quick Commit" );
271 // set gobject values
274 // user defined functions
277 public class Xcls_select_ticket_tab : Object
280 private NewBranch _this;
286 public Xcls_select_ticket_tab(NewBranch _owner )
289 _this.select_ticket_tab = this;
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
305 public void load_data (string tid = "") {
307 GLib.debug("Loading tickets");
309 var curproj = RooProject.getProjectByRepo(_this.repo);
310 _this.prmodel.loadProjects(curproj == null ? "" : curproj.id);
312 _this.dbmodel.loadTickets(curproj == null ? "": curproj.id, tid);
313 _this.branchbtn.updateState();
315 _this.ticketsel.el.get_child().get_style_context().remove_class("warning");
317 var name = RooTicket.singleton().usernameLocal();
318 var ticket = RooTicket.singleton().getById(tid);
319 _this.name.el.set_text("wip_%s_T%s_%s".printf(name,ticket.id, ticket.summaryToBranchName()));
321 _this.ticketsel.el.get_child().get_style_context().add_class("warning");
323 _this.view.loadTicket(tid);
328 public class Xcls_Table7 : Object
331 private NewBranch _this;
337 public Xcls_Table7(NewBranch _owner )
340 this.el = new Gtk.Table( 5, 5, true );
344 // set gobject values
345 this.el.expand = false;
347 this.el.column_spacing = 4;
348 this.el.vexpand = false;
349 var child_0 = new Xcls_Label8( _this );
351 this.el.attach_defaults ( child_0.el , 0,1,0,1 );
352 var child_1 = new Xcls_Label9( _this );
354 this.el.attach_defaults ( child_1.el , 1,2,0,1 );
355 var child_2 = new Xcls_projectsel( _this );
357 this.el.attach_defaults ( child_2.el , 0,1,1,2 );
358 var child_3 = new Xcls_ticketsel( _this );
360 this.el.attach_defaults ( child_3.el , 1,5,1,2 );
361 var child_4 = new Xcls_Label16( _this );
363 this.el.attach_defaults ( child_4.el , 0,1,3,4 );
364 var child_5 = new Xcls_name( _this );
366 this.el.attach_defaults ( child_5.el , 0,4,4,5 );
367 var child_6 = new Xcls_branchbtn( _this );
369 this.el.attach_defaults ( child_6.el , 4,5,4,5 );
370 var child_7 = new Xcls_Box19( _this );
372 this.el.attach_defaults ( child_7.el , 0,5,2,3 );
375 // user defined functions
377 public class Xcls_Label8 : Object
380 private NewBranch _this;
386 public Xcls_Label8(NewBranch _owner )
389 this.el = new Gtk.Label( "Project" );
393 // set gobject values
394 this.el.halign = Gtk.Align.START;
395 this.el.justify = Gtk.Justification.RIGHT;
396 this.el.visible = true;
399 // user defined functions
402 public class Xcls_Label9 : Object
405 private NewBranch _this;
411 public Xcls_Label9(NewBranch _owner )
414 this.el = new Gtk.Label( "Ticket" );
418 // set gobject values
419 this.el.halign = Gtk.Align.START;
420 this.el.visible = true;
423 // user defined functions
426 public class Xcls_projectsel : Object
428 public Gtk.ComboBox el;
429 private NewBranch _this;
436 public Xcls_projectsel(NewBranch _owner )
439 _this.projectsel = this;
440 this.el = new Gtk.ComboBox.with_entry();
443 this.loading = false;
445 // set gobject values
446 var child_0 = new Xcls_prcellrenderer( _this );
448 this.el.pack_start ( child_0.el , true );
449 var child_1 = new Xcls_prmodel( _this );
451 this.el.set_model ( child_1.el );
455 this.el.set_entry_text_column(1);
458 this.el.changed.connect( () => {
462 var project_id = this.selectedProjectId();
463 _this.dbmodel.loadTickets(project_id);
466 /*if (this.loading) {
469 var ticket_id = this.selectedTicketId();
471 var name = RooTicket.singleton().usernameLocal();
473 if (ticket_id == "" || ticket_id == null) {
475 var dt = new DateTime.now_local();
476 _this.name.el.set_text("wip_%s_%s".printf(name,dt.format("%Y_%b_%d")));
481 var ticket = RooTicket.singleton().getById(ticket_id);
483 _this.name.el.set_text("wip_%s_T%s_%s".printf(name,ticket.id, ticket.summaryToBranchName()));
485 //GLib.debug (//"Selection: %s, %s\n", (string) val1, (string) val2);
490 // user defined functions
491 public string selectedProjectId () {
496 this.el.get_active_iter (out iter);
497 _this.prmodel.el.get_value (iter, 0, out val1);
500 return (string) val1;
507 public class Xcls_prcellrenderer : Object
509 public Gtk.CellRendererText el;
510 private NewBranch _this;
516 public Xcls_prcellrenderer(NewBranch _owner )
519 _this.prcellrenderer = this;
520 this.el = new Gtk.CellRendererText();
524 // set gobject values
527 // user defined functions
530 public class Xcls_prmodel : Object
532 public Gtk.ListStore el;
533 private NewBranch _this;
539 public Xcls_prmodel(NewBranch _owner )
542 _this.prmodel = this;
543 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
547 // set gobject values
550 // user defined functions
551 public void loadProjects (string id) {
555 _this.projectsel.loading = true;
564 el.set_value(iter, 0, "");
565 el.set_value(iter, 1, "-- select a project --");
567 _this.projectsel.el.set_active_iter(iter);
570 foreach(var project in RooProject.projects()) {
574 el.set_value(iter, 0, project.id);
575 el.set_value(iter, 1, project.name );
576 if (id == project.id) {
577 _this.projectsel.el.set_active_iter(iter);
582 _this.projectsel.loading = false;
583 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
589 public class Xcls_ticketsel : Object
591 public Gtk.ComboBox el;
592 private NewBranch _this;
599 public Xcls_ticketsel(NewBranch _owner )
602 _this.ticketsel = this;
603 this.el = new Gtk.ComboBox.with_entry();
606 this.loading = false;
608 // set gobject values
609 var child_0 = new Xcls_dbcellrenderer( _this );
611 this.el.pack_start ( child_0.el , true );
612 var child_1 = new Xcls_dbmodel( _this );
614 this.el.set_model ( child_1.el );
618 //this.el.add_attribute(_this.dbcellrenderer.el , "markup", 1 );
619 this.el.set_entry_text_column(1);
620 this.el.get_child().set_sensitive(false);
623 this.el.changed.connect( () => {
627 var ticket_id = this.selectedTicketId();
629 var name = RooTicket.singleton().usernameLocal();
631 this.el.get_child().get_style_context().remove_class("warning");
632 if (ticket_id == "" || ticket_id == null) {
634 var dt = new DateTime.now_local();
635 _this.name.el.set_text("wip_%s_%s".printf(name,dt.format("%Y_%b_%d")));
636 _this.view.loadTicket("");
638 this.el.get_child().get_style_context().add_class("warning");
639 _this.createbtn.updateState();
644 var ticket = RooTicket.singleton().getById(ticket_id);
646 _this.name.el.set_text("wip_%s_T%s_%s".printf(name,ticket.id, ticket.summaryToBranchName()));
647 _this.scrolled_window.el.show();
649 _this.view.loadTicket(ticket.id);
650 _this.branchbtn.updateState();
652 //GLib.debug (//"Selection: %s, %s\n", (string) val1, (string) val2);
656 // user defined functions
657 public string selectedTicketId () {
662 this.el.get_active_iter (out iter);
663 _this.dbmodel.el.get_value (iter, 0, out val1);
666 return (string) val1;
673 public class Xcls_dbcellrenderer : Object
675 public Gtk.CellRendererText el;
676 private NewBranch _this;
682 public Xcls_dbcellrenderer(NewBranch _owner )
685 _this.dbcellrenderer = this;
686 this.el = new Gtk.CellRendererText();
690 // set gobject values
693 // user defined functions
696 public class Xcls_dbmodel : Object
698 public Gtk.ListStore el;
699 private NewBranch _this;
705 public Xcls_dbmodel(NewBranch _owner )
708 _this.dbmodel = this;
709 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
713 // set gobject values
716 // user defined functions
717 public void loadTickets (string project_id , string tid = "") {
721 // fixme .. get project id from selection..
723 RooTicket.singleton().loadTickets(
725 _this.btn_not_me.el.active ? RooTicket.Who.ANYBODY : RooTicket.Who.ME,
726 _this.btn_closed.el.active ? RooTicket.Status.ALL : RooTicket.Status.ACTIVE
729 _this.ticketsel.loading = true;
738 el.set_value(iter, 0, "");
739 el.set_value(iter, 1, "-- select a ticket --");
741 _this.ticketsel.el.set_active_iter(iter);
742 var tickets = RooTicket.singleton().tickets;
743 foreach(var ticket in tickets) {
747 el.set_value(iter, 0, ticket.id);
748 el.set_value(iter, 1, "#%s %s".printf( ticket.id, ticket.summary));
750 if (ticket.id == tid) {
751 _this.ticketsel.el.set_active_iter(iter);
756 _this.ticketsel.loading = false;
757 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
763 public class Xcls_Label16 : Object
766 private NewBranch _this;
772 public Xcls_Label16(NewBranch _owner )
775 this.el = new Gtk.Label( "Use this as branch name" );
779 // set gobject values
780 this.el.halign = Gtk.Align.START;
781 this.el.justify = Gtk.Justification.RIGHT;
782 this.el.xalign = 0.900000f;
785 // user defined functions
788 public class Xcls_name : Object
791 private NewBranch _this;
797 public Xcls_name(NewBranch _owner )
801 this.el = new Gtk.Entry();
805 // set gobject values
806 this.el.visible = true;
809 // user defined functions
812 public class Xcls_branchbtn : Object
814 public Gtk.Button el;
815 private NewBranch _this;
821 public Xcls_branchbtn(NewBranch _owner )
824 _this.branchbtn = this;
825 this.el = new Gtk.Button();
829 // set gobject values
830 this.el.label = "Create Branch";
835 this.el.get_style_context().add_class("suggested-action");
839 this.el.clicked.connect( () => {
841 GLib.debug("fire response = 1");
843 var ticket_id = _this.ticketsel.selectedTicketId();
845 if (ticket_id == "") {
846 _this.ticketsel.el.get_child().get_style_context().add_class("warning");
850 _this.el.response(1);
854 // user defined functions
855 public void updateState () {
857 var ticket_id = _this.ticketsel.selectedTicketId();
859 if (ticket_id == "") {
860 this.el.set_sensitive(false);
864 this.el.set_sensitive(true);
869 public class Xcls_Box19 : Object
872 private NewBranch _this;
878 public Xcls_Box19(NewBranch _owner )
881 this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
885 // set gobject values
886 var child_0 = new Xcls_btn_not_me( _this );
888 this.el.add ( child_0.el );
889 var child_1 = new Xcls_btn_closed( _this );
891 this.el.add ( child_1.el );
892 var child_2 = new Xcls_Label22( _this );
894 this.el.add ( child_2.el );
897 // user defined functions
899 public class Xcls_btn_not_me : Object
901 public Gtk.CheckButton el;
902 private NewBranch _this;
908 public Xcls_btn_not_me(NewBranch _owner )
911 _this.btn_not_me = this;
912 this.el = new Gtk.CheckButton();
916 // set gobject values
917 this.el.label = "Show tickets not assigned to me";
920 this.el.toggled.connect( () => {
921 var project_id = _this.projectsel.selectedProjectId();
922 _this.dbmodel.loadTickets(project_id);
926 // user defined functions
929 public class Xcls_btn_closed : Object
931 public Gtk.CheckButton el;
932 private NewBranch _this;
938 public Xcls_btn_closed(NewBranch _owner )
941 _this.btn_closed = this;
942 this.el = new Gtk.CheckButton();
946 // set gobject values
947 this.el.label = "Show closed Tickets";
950 this.el.toggled.connect( () => {
951 var project_id = _this.projectsel.selectedProjectId();
952 _this.dbmodel.loadTickets(project_id);
957 // user defined functions
960 public class Xcls_Label22 : Object
963 private NewBranch _this;
969 public Xcls_Label22(NewBranch _owner )
972 this.el = new Gtk.Label( "<a href=\"refresh\">Refresh Ticket list</a>" );
976 // set gobject values
977 this.el.halign = Gtk.Align.END;
978 this.el.hexpand = true;
979 this.el.use_markup = true;
982 this.el.activate_link.connect( (uri) => {
983 if (uri == "refresh") {
985 var curproj = RooProject.getProjectByRepo(_this.repo);
986 _this.prmodel.loadProjects(curproj == null ? "": curproj.id);
988 _this.dbmodel.loadTickets(curproj == null ? "": curproj.id);
994 // user defined functions
999 public class Xcls_scrolled_window : Object
1001 public Gtk.ScrolledWindow el;
1002 private NewBranch _this;
1008 public Xcls_scrolled_window(NewBranch _owner )
1011 _this.scrolled_window = this;
1012 this.el = new Gtk.ScrolledWindow( null, null );
1016 // set gobject values
1017 this.el.height_request = 500;
1018 this.el.vexpand = true;
1019 var child_0 = new Xcls_view( _this );
1021 this.el.add ( child_0.el );
1026 this.el.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);
1030 // user defined functions
1032 public class Xcls_view : Object
1034 public WebKit.WebView el;
1035 private NewBranch _this;
1041 public Xcls_view(NewBranch _owner )
1045 this.el = new WebKit.WebView();
1049 // set gobject values
1052 // user defined functions
1053 public void loadTicket (string tid) {
1055 _this.el.get_size(out w, out h);
1058 _this.scrolled_window.el.hide();
1059 _this.el.resize(w, 150);
1061 _this.scrolled_window.el.show();
1062 _this.el.resize(w, 800);
1065 var rs = RooTicket.singleton();
1066 var uri = new WebKit.URIRequest("https://roojs.com/admin.php/MTrack/View/" + tid);
1067 var hd = uri.get_http_headers();
1068 var authCode = Base64.encode ("%s:%s".printf(rs.username, rs.password).data);
1069 hd.append("Authorization", "Basic %s".printf(authCode));
1071 this.el.load_request(uri);
1077 public class Xcls_create_ticket_tab : Object
1080 private NewBranch _this;
1086 public Xcls_create_ticket_tab(NewBranch _owner )
1089 _this.create_ticket_tab = this;
1090 this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
1094 // set gobject values
1095 this.el.homogeneous = false;
1096 var child_0 = new Xcls_table( _this );
1098 this.el.pack_start ( child_0.el , false,false,0 );
1101 // user defined functions
1103 public class Xcls_table : Object
1105 public Gtk.Table el;
1106 private NewBranch _this;
1112 public Xcls_table(NewBranch _owner )
1116 this.el = new Gtk.Table( 14, 4, true );
1120 // set gobject values
1121 this.el.expand = false;
1123 this.el.column_spacing = 4;
1124 this.el.vexpand = false;
1125 var child_0 = new Xcls_Label27( _this );
1127 this.el.attach_defaults ( child_0.el , 0,1,0,1 );
1128 var child_1 = new Xcls_Label28( _this );
1130 this.el.attach_defaults ( child_1.el , 1,2,0,1 );
1131 var child_2 = new Xcls_project_id( _this );
1133 this.el.attach_defaults ( child_2.el , 0,1,1,2 );
1134 var child_3 = new Xcls_summary( _this );
1136 this.el.attach_defaults ( child_3.el , 1,4,1,2 );
1137 var child_4 = new Xcls_Label33( _this );
1139 this.el.attach_defaults ( child_4.el , 0,1,2,3 );
1140 var child_5 = new Xcls_milestone_id( _this );
1142 this.el.attach_defaults ( child_5.el , 0,1,3,4 );
1143 var child_6 = new Xcls_Label36( _this );
1145 this.el.attach_defaults ( child_6.el , 1,4,2,3 );
1146 var child_7 = new Xcls_description( _this );
1148 this.el.attach_defaults ( child_7.el , 1,4,3,12 );
1149 var child_8 = new Xcls_Label38( _this );
1151 this.el.attach_defaults ( child_8.el , 0,1,4,5 );
1152 var child_9 = new Xcls_priority_id( _this );
1154 this.el.attach_defaults ( child_9.el , 0,1,5,6 );
1155 var child_10 = new Xcls_Label41( _this );
1157 this.el.attach_defaults ( child_10.el , 0,1,6,7 );
1158 var child_11 = new Xcls_severity_id( _this );
1160 this.el.attach_defaults ( child_11.el , 0,1,7,8 );
1161 var child_12 = new Xcls_Label44( _this );
1163 this.el.attach_defaults ( child_12.el , 0,1,8,9 );
1164 var child_13 = new Xcls_classification_id( _this );
1166 this.el.attach_defaults ( child_13.el , 0,1,9,10 );
1167 var child_14 = new Xcls_Label47( _this );
1169 this.el.attach_defaults ( child_14.el , 0,1,10,11 );
1170 var child_15 = new Xcls_developer_id( _this );
1172 this.el.attach_defaults ( child_15.el , 0,1,11,12 );
1173 var child_16 = new Xcls_Button50( _this );
1175 this.el.attach_defaults ( child_16.el , 0,4,13,14 );
1178 // user defined functions
1180 public class Xcls_Label27 : Object
1182 public Gtk.Label el;
1183 private NewBranch _this;
1189 public Xcls_Label27(NewBranch _owner )
1192 this.el = new Gtk.Label( "Project" );
1196 // set gobject values
1197 this.el.halign = Gtk.Align.START;
1198 this.el.visible = true;
1201 // user defined functions
1204 public class Xcls_Label28 : Object
1206 public Gtk.Label el;
1207 private NewBranch _this;
1213 public Xcls_Label28(NewBranch _owner )
1216 this.el = new Gtk.Label( "Summary" );
1220 // set gobject values
1221 this.el.halign = Gtk.Align.START;
1222 this.el.visible = true;
1225 // user defined functions
1228 public class Xcls_project_id : Object
1230 public Gtk.ComboBox el;
1231 private NewBranch _this;
1235 public bool loading;
1238 public Xcls_project_id(NewBranch _owner )
1241 _this.project_id = this;
1242 this.el = new Gtk.ComboBox.with_entry();
1245 this.loading = false;
1247 // set gobject values
1248 var child_0 = new Xcls_tprcellrenderer( _this );
1250 this.el.pack_start ( child_0.el , true );
1251 var child_1 = new Xcls_tprmodel( _this );
1253 this.el.set_model ( child_1.el );
1257 this.el.set_entry_text_column(1);
1260 this.el.changed.connect( () => {
1264 var project_id = this.selectedProjectId();
1266 var rt = RooTicket.singleton();
1267 rt.loadProjectOptions(project_id);
1269 _this.msmodel.loadMilestones();
1270 _this.primodel.loadPriorities();
1271 _this.sevmodel.loadSeverities();
1272 _this.clmodel.loadClassifications();
1273 _this.devmodel.loadDevelopers();
1275 // affects projects and milestones..
1278 /*if (this.loading) {
1281 var ticket_id = this.selectedTicketId();
1283 var name = RooTicket.singleton().usernameLocal();
1285 if (ticket_id == "" || ticket_id == null) {
1287 var dt = new DateTime.now_local();
1288 _this.name.el.set_text("wip_%s_%s".printf(name,dt.format("%Y_%b_%d")));
1293 var ticket = RooTicket.singleton().getById(ticket_id);
1295 _this.name.el.set_text("wip_%s_T%s_%s".printf(name,ticket.id, ticket.summaryToBranchName()));
1297 //GLib.debug (//"Selection: %s, %s\n", (string) val1, (string) val2);
1302 // user defined functions
1303 public string selectedProjectId () {
1308 this.el.get_active_iter (out iter);
1309 _this.tprmodel.el.get_value (iter, 0, out val1);
1312 return (string) val1;
1319 public class Xcls_tprcellrenderer : Object
1321 public Gtk.CellRendererText el;
1322 private NewBranch _this;
1328 public Xcls_tprcellrenderer(NewBranch _owner )
1331 _this.tprcellrenderer = this;
1332 this.el = new Gtk.CellRendererText();
1336 // set gobject values
1339 // user defined functions
1342 public class Xcls_tprmodel : Object
1344 public Gtk.ListStore el;
1345 private NewBranch _this;
1351 public Xcls_tprmodel(NewBranch _owner )
1354 _this.tprmodel = this;
1355 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
1359 // set gobject values
1362 // user defined functions
1363 public void loadProjects (string id) {
1366 _this.project_id.loading = true;
1372 el.append(out iter);
1375 el.set_value(iter, 0, "");
1376 el.set_value(iter, 1, "-- select a project --");
1378 _this.project_id.el.set_active_iter(iter);
1381 foreach(var project in RooProject.projects()) {
1383 el.append(out iter);
1385 el.set_value(iter, 0, project.id);
1386 el.set_value(iter, 1, project.name );
1387 if (id == project.id) {
1388 _this.project_id.el.set_active_iter(iter);
1393 _this.project_id.loading = false;
1394 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
1400 public class Xcls_summary : Object
1402 public Gtk.Entry el;
1403 private NewBranch _this;
1409 public Xcls_summary(NewBranch _owner )
1412 _this.summary = this;
1413 this.el = new Gtk.Entry();
1417 // set gobject values
1418 this.el.visible = true;
1421 // user defined functions
1424 public class Xcls_Label33 : Object
1426 public Gtk.Label el;
1427 private NewBranch _this;
1433 public Xcls_Label33(NewBranch _owner )
1436 this.el = new Gtk.Label( "Milestone" );
1440 // set gobject values
1441 this.el.halign = Gtk.Align.START;
1442 this.el.justify = Gtk.Justification.RIGHT;
1443 this.el.xalign = 0.900000f;
1446 // user defined functions
1449 public class Xcls_milestone_id : Object
1451 public Gtk.ComboBox el;
1452 private NewBranch _this;
1456 public bool loading;
1459 public Xcls_milestone_id(NewBranch _owner )
1462 _this.milestone_id = this;
1463 this.el = new Gtk.ComboBox.with_entry();
1466 this.loading = false;
1468 // set gobject values
1469 var child_0 = new Xcls_msmodel( _this );
1471 this.el.set_model ( child_0.el );
1475 this.el.set_entry_text_column(1);
1478 // user defined functions
1479 public string selectedMilestoneId () {
1484 this.el.get_active_iter (out iter);
1485 _this.msmodel.el.get_value (iter, 0, out val1);
1488 return (string) val1;
1495 public class Xcls_msmodel : Object
1497 public Gtk.ListStore el;
1498 private NewBranch _this;
1504 public Xcls_msmodel(NewBranch _owner )
1507 _this.msmodel = this;
1508 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
1512 // set gobject values
1515 // user defined functions
1516 public void loadMilestones ( ) {
1518 var rt = RooTicket.singleton();
1519 // rt.loadProjects();
1521 _this.milestone_id.loading = true;
1527 el.append(out iter);
1530 el.set_value(iter, 0, "");
1531 el.set_value(iter, 1, "-- select a milestone --");
1532 _this.milestone_id.el.set_active_iter(iter);
1534 var projects = rt.milestones;
1535 foreach(var project in projects) {
1537 el.append(out iter);
1539 el.set_value(iter, 0, project.id);
1540 el.set_value(iter, 1, project.display_name );
1541 // if (id == project.id) {
1542 // _this.milestone.el.set_active_iter(iter);
1548 _this.milestone_id.loading = false;
1549 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
1555 public class Xcls_Label36 : Object
1557 public Gtk.Label el;
1558 private NewBranch _this;
1564 public Xcls_Label36(NewBranch _owner )
1567 this.el = new Gtk.Label( "Description" );
1571 // set gobject values
1572 this.el.halign = Gtk.Align.START;
1575 // user defined functions
1578 public class Xcls_description : Object
1580 public Gtk.TextView el;
1581 private NewBranch _this;
1587 public Xcls_description(NewBranch _owner )
1590 _this.description = this;
1591 this.el = new Gtk.TextView();
1595 // set gobject values
1596 this.el.border_width = 1;
1599 // user defined functions
1602 public class Xcls_Label38 : Object
1604 public Gtk.Label el;
1605 private NewBranch _this;
1611 public Xcls_Label38(NewBranch _owner )
1614 this.el = new Gtk.Label( "Priority" );
1618 // set gobject values
1619 this.el.halign = Gtk.Align.START;
1620 this.el.xalign = 0.900000f;
1623 // user defined functions
1626 public class Xcls_priority_id : Object
1628 public Gtk.ComboBox el;
1629 private NewBranch _this;
1633 public bool loading;
1636 public Xcls_priority_id(NewBranch _owner )
1639 _this.priority_id = this;
1640 this.el = new Gtk.ComboBox.with_entry();
1643 this.loading = false;
1645 // set gobject values
1646 var child_0 = new Xcls_primodel( _this );
1648 this.el.set_model ( child_0.el );
1652 this.el.set_entry_text_column(1);
1655 // user defined functions
1656 public string selectedPriorityId () {
1661 this.el.get_active_iter (out iter);
1662 _this.primodel.el.get_value (iter, 0, out val1);
1665 return (string) val1;
1672 public class Xcls_primodel : Object
1674 public Gtk.ListStore el;
1675 private NewBranch _this;
1681 public Xcls_primodel(NewBranch _owner )
1684 _this.primodel = this;
1685 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
1689 // set gobject values
1692 // user defined functions
1693 public void loadPriorities ( ) {
1695 var rt = RooTicket.singleton();
1696 // rt.loadProjects();
1698 _this.priority_id.loading = true;
1705 var projects = rt.priorities;
1706 foreach(var project in projects) {
1708 el.append(out iter);
1710 el.set_value(iter, 0, project.id);
1711 el.set_value(iter, 1, project.display_name );
1712 if ("normal" == project.name) {
1713 _this.priority_id.el.set_active_iter(iter);
1718 _this.priority_id.loading = false;
1725 public class Xcls_Label41 : Object
1727 public Gtk.Label el;
1728 private NewBranch _this;
1734 public Xcls_Label41(NewBranch _owner )
1737 this.el = new Gtk.Label( "Severity" );
1741 // set gobject values
1742 this.el.halign = Gtk.Align.START;
1745 // user defined functions
1748 public class Xcls_severity_id : Object
1750 public Gtk.ComboBox el;
1751 private NewBranch _this;
1755 public bool loading;
1758 public Xcls_severity_id(NewBranch _owner )
1761 _this.severity_id = this;
1762 this.el = new Gtk.ComboBox.with_entry();
1765 this.loading = false;
1767 // set gobject values
1768 var child_0 = new Xcls_sevmodel( _this );
1770 this.el.set_model ( child_0.el );
1774 this.el.set_entry_text_column(1);
1777 // user defined functions
1778 public string selectedSeverityId () {
1783 this.el.get_active_iter (out iter);
1784 _this.sevmodel.el.get_value (iter, 0, out val1);
1787 return (string) val1;
1794 public class Xcls_sevmodel : Object
1796 public Gtk.ListStore el;
1797 private NewBranch _this;
1803 public Xcls_sevmodel(NewBranch _owner )
1806 _this.sevmodel = this;
1807 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
1811 // set gobject values
1814 // user defined functions
1815 public void loadSeverities () {
1817 var rt = RooTicket.singleton();
1818 //rt.loadProjects();
1820 _this.severity_id.loading = true;
1826 var projects = rt.serverities;
1827 foreach(var project in projects) {
1829 el.append(out iter);
1831 el.set_value(iter, 0, project.id);
1832 el.set_value(iter, 1, project.display_name );
1833 if ("normal" == project.name) {
1834 _this.severity_id.el.set_active_iter(iter);
1839 _this.severity_id.loading = false;
1840 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
1846 public class Xcls_Label44 : Object
1848 public Gtk.Label el;
1849 private NewBranch _this;
1855 public Xcls_Label44(NewBranch _owner )
1858 this.el = new Gtk.Label( "Classification" );
1862 // set gobject values
1863 this.el.halign = Gtk.Align.START;
1866 // user defined functions
1869 public class Xcls_classification_id : Object
1871 public Gtk.ComboBox el;
1872 private NewBranch _this;
1876 public bool loading;
1879 public Xcls_classification_id(NewBranch _owner )
1882 _this.classification_id = this;
1883 this.el = new Gtk.ComboBox.with_entry();
1886 this.loading = false;
1888 // set gobject values
1889 var child_0 = new Xcls_clmodel( _this );
1891 this.el.set_model ( child_0.el );
1895 this.el.set_entry_text_column(1);
1898 // user defined functions
1899 public string selectedClassificationId () {
1904 this.el.get_active_iter (out iter);
1905 _this.clmodel.el.get_value (iter, 0, out val1);
1908 return (string) val1;
1915 public class Xcls_clmodel : Object
1917 public Gtk.ListStore el;
1918 private NewBranch _this;
1924 public Xcls_clmodel(NewBranch _owner )
1927 _this.clmodel = this;
1928 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
1932 // set gobject values
1935 // user defined functions
1936 public void loadClassifications ( ) {
1938 var rt = RooTicket.singleton();
1939 // rt.loadProjects();
1941 _this.classification_id.loading = true;
1947 el.append(out iter);
1950 var projects = rt.classifications;
1951 foreach(var project in projects) {
1953 el.append(out iter);
1955 el.set_value(iter, 0, project.id);
1956 el.set_value(iter, 1, project.display_name );
1957 if ("bug" == project.name) {
1958 _this.classification_id.el.set_active_iter(iter);
1963 _this.classification_id.loading = false;
1964 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
1970 public class Xcls_Label47 : Object
1972 public Gtk.Label el;
1973 private NewBranch _this;
1979 public Xcls_Label47(NewBranch _owner )
1982 this.el = new Gtk.Label( "Assign to" );
1986 // set gobject values
1987 this.el.halign = Gtk.Align.START;
1990 // user defined functions
1993 public class Xcls_developer_id : Object
1995 public Gtk.ComboBox el;
1996 private NewBranch _this;
2000 public bool loading;
2003 public Xcls_developer_id(NewBranch _owner )
2006 _this.developer_id = this;
2007 this.el = new Gtk.ComboBox.with_entry();
2010 this.loading = false;
2012 // set gobject values
2013 var child_0 = new Xcls_devmodel( _this );
2015 this.el.set_model ( child_0.el );
2019 this.el.set_entry_text_column(1);
2022 // user defined functions
2023 public string selectedDeveloperId () {
2028 this.el.get_active_iter (out iter);
2029 _this.devmodel.el.get_value (iter, 0, out val1);
2032 return (string) val1;
2039 public class Xcls_devmodel : Object
2041 public Gtk.ListStore el;
2042 private NewBranch _this;
2048 public Xcls_devmodel(NewBranch _owner )
2051 _this.devmodel = this;
2052 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
2056 // set gobject values
2059 // user defined functions
2060 public void loadDevelopers ( ) {
2062 var rt = RooTicket.singleton();
2063 //rt.loadProjects();
2065 _this.developer_id.loading = true;
2071 el.append(out iter);
2074 el.set_value(iter, 0, "");
2075 el.set_value(iter, 1, "-- select a developer --");
2077 _this.developer_id.el.set_active_iter(iter);
2080 var peps = rt.developers;
2081 foreach(var p in peps) {
2083 el.append(out iter);
2085 el.set_value(iter, 0, p.id);
2086 el.set_value(iter, 1, p.display_name );
2087 if (rt.authuser_id == p.id) {
2088 _this.developer_id.el.set_active_iter(iter);
2092 _this.developer_id.loading = false;
2093 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
2099 public class Xcls_Button50 : Object
2101 public Gtk.Button el;
2102 private NewBranch _this;
2108 public Xcls_Button50(NewBranch _owner )
2111 this.el = new Gtk.Button();
2115 // set gobject values
2116 this.el.label = "Create Ticket & Branch";
2121 this.el.get_style_context().add_class("suggested-action");
2125 this.el.clicked.connect( () => {
2126 GLib.debug("fire response = 1");
2129 var invalid = false;
2131 // validate first...
2132 _this.project_id.el.get_child().get_style_context().remove_class("warning");
2133 if (_this.project_id.selectedProjectId() == "") {
2134 _this.project_id.el.get_child().get_style_context().add_class("warning");
2138 _this.milestone_id.el.get_child().get_style_context().remove_class("warning");
2140 _this.priority_id.el.get_child().get_style_context().remove_class("warning");
2141 if (_this.priority_id.selectedPriorityId() == "") {
2142 _this.priority_id.el.get_child().get_style_context().add_class("warning");
2146 _this.classification_id.el.get_child().get_style_context().remove_class("warning");
2147 if (_this.classification_id.selectedClassificationId() == "") {
2148 _this.classification_id.el.get_child().get_style_context().add_class("warning");
2152 _this.developer_id.el.get_child().get_style_context().remove_class("warning");
2153 if (_this.developer_id.selectedDeveloperId() == "") {
2154 _this.developer_id.el.get_child().get_style_context().add_class("warning");
2158 _this.summary.el.get_style_context().remove_class("warning");
2159 if (_this.summary.el.get_text() == "") {
2160 _this.summary.el.get_style_context().add_class("warning");
2164 _this.description.el.get_style_context().remove_class("warning");
2169 GLib.debug("for is valid");
2171 _this.el.response(1);
2175 // user defined functions
2180 public class Xcls_Box51 : Object
2183 private NewBranch _this;
2189 public Xcls_Box51(NewBranch _owner )
2192 this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
2196 // set gobject values
2197 this.el.homogeneous = false;
2198 var child_0 = new Xcls_Table52( _this );
2200 this.el.pack_start ( child_0.el , false,false,0 );
2201 var child_1 = new Xcls_ScrolledWindow56( _this );
2203 this.el.add ( child_1.el );
2206 // user defined functions
2208 public class Xcls_Table52 : Object
2210 public Gtk.Table el;
2211 private NewBranch _this;
2217 public Xcls_Table52(NewBranch _owner )
2220 this.el = new Gtk.Table( 2, 5, true );
2224 // set gobject values
2225 this.el.expand = false;
2227 this.el.column_spacing = 4;
2228 this.el.vexpand = false;
2229 var child_0 = new Xcls_Label53( _this );
2231 this.el.attach_defaults ( child_0.el , 0,1,0,1 );
2232 var child_1 = new Xcls_commit_message( _this );
2234 this.el.attach_defaults ( child_1.el , 0,4,1,2 );
2235 var child_2 = new Xcls_createbtn( _this );
2237 this.el.attach_defaults ( child_2.el , 4,5,1,2 );
2240 // user defined functions
2242 public class Xcls_Label53 : Object
2244 public Gtk.Label el;
2245 private NewBranch _this;
2251 public Xcls_Label53(NewBranch _owner )
2254 this.el = new Gtk.Label( "Just commit with this comment" );
2258 // set gobject values
2259 this.el.halign = Gtk.Align.START;
2260 this.el.justify = Gtk.Justification.RIGHT;
2261 this.el.xalign = 0.900000f;
2264 // user defined functions
2267 public class Xcls_commit_message : Object
2269 public Gtk.Entry el;
2270 private NewBranch _this;
2276 public Xcls_commit_message(NewBranch _owner )
2279 _this.commit_message = this;
2280 this.el = new Gtk.Entry();
2284 // set gobject values
2285 this.el.visible = true;
2288 // user defined functions
2291 public class Xcls_createbtn : Object
2293 public Gtk.Button el;
2294 private NewBranch _this;
2300 public Xcls_createbtn(NewBranch _owner )
2303 _this.createbtn = this;
2304 this.el = new Gtk.Button();
2308 // set gobject values
2309 this.el.label = "Commit Changes";
2314 this.el.get_style_context().add_class("suggested-action");
2318 this.el.clicked.connect( () => {
2320 GLib.debug("fire response = 1");
2322 var ticket_id = _this.ticketsel.selectedTicketId();
2324 if (ticket_id == "") {
2325 _this.ticketsel.el.get_child().get_style_context().add_class("warning");
2329 _this.el.response(1);
2333 // user defined functions
2334 public void updateState () {
2336 var ticket_id = _this.ticketsel.selectedTicketId();
2338 if (ticket_id == "") {
2339 this.el.set_sensitive(false);
2343 this.el.set_sensitive(true);
2349 public class Xcls_ScrolledWindow56 : Object
2351 public Gtk.ScrolledWindow el;
2352 private NewBranch _this;
2358 public Xcls_ScrolledWindow56(NewBranch _owner )
2361 this.el = new Gtk.ScrolledWindow( null, null );
2365 // set gobject values
2366 this.el.height_request = 400;
2367 this.el.vexpand = true;
2368 var child_0 = new Xcls_diff_view( _this );
2370 this.el.add ( child_0.el );
2373 // user defined functions
2375 public class Xcls_diff_view : Object
2377 public Gtk.SourceView el;
2378 private NewBranch _this;
2384 public Xcls_diff_view(NewBranch _owner )
2387 _this.diff_view = this;
2388 this.el = new Gtk.SourceView();
2394 var description = Pango.FontDescription.from_string("monospace");
2395 description.set_size(9000);
2396 this.el.override_font(description);
2397 var lm = Gtk.SourceLanguageManager.get_default();
2399 ((Gtk.SourceBuffer)(this.el.get_buffer())).set_language(
2400 lm.get_language("diff")
2404 // user defined functions