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_quick_commit_tab quick_commit_tab;
49 public Xcls_commit_message commit_message;
50 public Xcls_createbtn createbtn;
51 public Xcls_diff_view diff_view;
56 public Gee.ArrayList<GitMonitorQueue> queue;
62 this.el = new Gtk.Dialog();
70 this.el.title = "Create a working branch ";
71 this.el.default_height = 500;
72 this.el.default_width = 500;
73 this.el.deletable = true;
75 var child_0 = new Xcls_Notebook2( _this );
77 this.el.get_content_area().add ( child_0.el );
80 this.el.delete_event.connect( (self, event) => {
85 this.el.response.connect( (self, response_id) => {
87 GLib.debug("got %d", (int) response_id);
92 // have they selected a ticket..
93 // make that the current active ticket?
94 // we really need to store locally what ticket is being worked on..
95 // in theory we could be working on multiple project and not merging..
96 // -- each repo would have their active ticket (only one per repo)
97 // -- so we could just store that in there
98 // -- initial load can check the contents of the ticket files on first scan.
101 if (response_id < 1) {
103 this.running = false;
107 var ticket_id = _this.ticketsel.selectedTicketId();
109 if (this.repo != null) {
110 var bn = _this.name.el.get_text();
112 var res = this.repo.setActiveTicket(
113 RooTicket.singleton().getById(ticket_id != "" ? ticket_id : "-1"), bn
116 // start the monitoring..
117 GitMonitor.gitmonitor.start();
123 this.running = false;
133 // user defined functions
134 public void show ( GitRepo repo, Gee.ArrayList<GitMonitorQueue> queue, string tid = "" )
136 // this.el.set_gravity(Gdk.Gravity.NORTH);
137 if (this.running) { // should not happen!!
138 GLib.error("new branch show called, when already being displayed?");
144 GitMonitor.gitmonitor.stop();
148 this.el.move((Gdk.Screen.width() / 2)- 250 ,0);
149 this.el.set_default_size( 500,200); // not sure why it grows..
157 this.el.set_keep_above(true);
159 _this.select_ticket_tab.load_data(tid);
160 _this.create_ticket_tab.load_data();
161 _this.quick_commit_tab.load_data();
172 public class Xcls_Notebook2 : Object
174 public Gtk.Notebook el;
175 private NewBranch _this;
181 public Xcls_Notebook2(NewBranch _owner )
184 this.el = new Gtk.Notebook();
188 // set gobject values
189 this.el.vexpand = true;
190 var child_0 = new Xcls_label_select_ticket( _this );
192 var child_1 = new Xcls_label_create_ticket( _this );
194 var child_2 = new Xcls_label_quick_commit( _this );
196 var child_3 = new Xcls_select_ticket_tab( _this );
198 this.el.append_page ( child_3.el , _this.label_select_ticket.el );
199 var child_4 = new Xcls_create_ticket_tab( _this );
201 this.el.append_page ( child_4.el , _this.label_create_ticket.el );
202 var child_5 = new Xcls_quick_commit_tab( _this );
204 this.el.append_page ( child_5.el , _this.label_quick_commit.el );
207 // user defined functions
209 public class Xcls_label_select_ticket : Object
212 private NewBranch _this;
218 public Xcls_label_select_ticket(NewBranch _owner )
221 _this.label_select_ticket = this;
222 this.el = new Gtk.Label( "Select Existing Ticket to work on" );
226 // set gobject values
229 // user defined functions
232 public class Xcls_label_create_ticket : Object
235 private NewBranch _this;
241 public Xcls_label_create_ticket(NewBranch _owner )
244 _this.label_create_ticket = this;
245 this.el = new Gtk.Label( "Create a New Ticket" );
249 // set gobject values
252 // user defined functions
255 public class Xcls_label_quick_commit : Object
258 private NewBranch _this;
264 public Xcls_label_quick_commit(NewBranch _owner )
267 _this.label_quick_commit = this;
268 this.el = new Gtk.Label( "Quick Commit" );
272 // set gobject values
275 // user defined functions
278 public class Xcls_select_ticket_tab : Object
281 private NewBranch _this;
287 public Xcls_select_ticket_tab(NewBranch _owner )
290 _this.select_ticket_tab = this;
291 this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
295 // set gobject values
296 this.el.homogeneous = false;
297 var child_0 = new Xcls_Table7( _this );
299 this.el.pack_start ( child_0.el , false,false,0 );
300 var child_1 = new Xcls_scrolled_window( _this );
302 this.el.add ( child_1.el );
305 // user defined functions
306 public void load_data (string tid = "") {
308 GLib.debug("Loading tickets");
310 var curproj = RooProject.getProjectByRepo(_this.repo);
311 _this.prmodel.loadProjects(curproj == null ? "" : curproj.id);
313 _this.dbmodel.loadTickets(curproj == null ? "": curproj.id, tid);
314 _this.branchbtn.updateState();
316 _this.ticketsel.el.get_child().get_style_context().remove_class("warning");
318 var name = RooTicket.singleton().usernameLocal();
319 var ticket = RooTicket.singleton().getById(tid);
320 _this.name.el.set_text("wip_%s_T%s_%s".printf(name,ticket.id, ticket.summaryToBranchName()));
322 _this.ticketsel.el.get_child().get_style_context().add_class("warning");
324 _this.view.loadTicket(tid);
329 public class Xcls_Table7 : Object
332 private NewBranch _this;
338 public Xcls_Table7(NewBranch _owner )
341 this.el = new Gtk.Table( 5, 5, true );
345 // set gobject values
346 this.el.expand = false;
348 this.el.column_spacing = 4;
349 this.el.vexpand = false;
350 var child_0 = new Xcls_Label8( _this );
352 this.el.attach_defaults ( child_0.el , 0,1,0,1 );
353 var child_1 = new Xcls_Label9( _this );
355 this.el.attach_defaults ( child_1.el , 1,2,0,1 );
356 var child_2 = new Xcls_projectsel( _this );
358 this.el.attach_defaults ( child_2.el , 0,1,1,2 );
359 var child_3 = new Xcls_ticketsel( _this );
361 this.el.attach_defaults ( child_3.el , 1,5,1,2 );
362 var child_4 = new Xcls_Label16( _this );
364 this.el.attach_defaults ( child_4.el , 0,1,3,4 );
365 var child_5 = new Xcls_name( _this );
367 this.el.attach_defaults ( child_5.el , 0,4,4,5 );
368 var child_6 = new Xcls_branchbtn( _this );
370 this.el.attach_defaults ( child_6.el , 4,5,4,5 );
371 var child_7 = new Xcls_Box19( _this );
373 this.el.attach_defaults ( child_7.el , 0,5,2,3 );
376 // user defined functions
378 public class Xcls_Label8 : Object
381 private NewBranch _this;
387 public Xcls_Label8(NewBranch _owner )
390 this.el = new Gtk.Label( "Project" );
394 // set gobject values
395 this.el.halign = Gtk.Align.START;
396 this.el.justify = Gtk.Justification.RIGHT;
397 this.el.visible = true;
400 // user defined functions
403 public class Xcls_Label9 : Object
406 private NewBranch _this;
412 public Xcls_Label9(NewBranch _owner )
415 this.el = new Gtk.Label( "Ticket" );
419 // set gobject values
420 this.el.halign = Gtk.Align.START;
421 this.el.visible = true;
424 // user defined functions
427 public class Xcls_projectsel : Object
429 public Gtk.ComboBox el;
430 private NewBranch _this;
437 public Xcls_projectsel(NewBranch _owner )
440 _this.projectsel = this;
441 this.el = new Gtk.ComboBox.with_entry();
444 this.loading = false;
446 // set gobject values
447 var child_0 = new Xcls_prcellrenderer( _this );
449 this.el.pack_start ( child_0.el , true );
450 var child_1 = new Xcls_prmodel( _this );
452 this.el.set_model ( child_1.el );
456 this.el.set_entry_text_column(1);
459 this.el.changed.connect( () => {
463 var project_id = this.selectedProjectId();
464 _this.dbmodel.loadTickets(project_id);
467 /*if (this.loading) {
470 var ticket_id = this.selectedTicketId();
472 var name = RooTicket.singleton().usernameLocal();
474 if (ticket_id == "" || ticket_id == null) {
476 var dt = new DateTime.now_local();
477 _this.name.el.set_text("wip_%s_%s".printf(name,dt.format("%Y_%b_%d")));
482 var ticket = RooTicket.singleton().getById(ticket_id);
484 _this.name.el.set_text("wip_%s_T%s_%s".printf(name,ticket.id, ticket.summaryToBranchName()));
486 //GLib.debug (//"Selection: %s, %s\n", (string) val1, (string) val2);
491 // user defined functions
492 public string selectedProjectId () {
497 this.el.get_active_iter (out iter);
498 _this.prmodel.el.get_value (iter, 0, out val1);
501 return (string) val1;
508 public class Xcls_prcellrenderer : Object
510 public Gtk.CellRendererText el;
511 private NewBranch _this;
517 public Xcls_prcellrenderer(NewBranch _owner )
520 _this.prcellrenderer = this;
521 this.el = new Gtk.CellRendererText();
525 // set gobject values
528 // user defined functions
531 public class Xcls_prmodel : Object
533 public Gtk.ListStore el;
534 private NewBranch _this;
540 public Xcls_prmodel(NewBranch _owner )
543 _this.prmodel = this;
544 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
548 // set gobject values
551 // user defined functions
552 public void loadProjects (string id) {
556 _this.projectsel.loading = true;
565 el.set_value(iter, 0, "");
566 el.set_value(iter, 1, "-- select a project --");
568 _this.projectsel.el.set_active_iter(iter);
571 foreach(var project in RooProject.projects()) {
575 el.set_value(iter, 0, project.id);
576 el.set_value(iter, 1, project.name );
577 if (id == project.id) {
578 _this.projectsel.el.set_active_iter(iter);
583 _this.projectsel.loading = false;
584 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
590 public class Xcls_ticketsel : Object
592 public Gtk.ComboBox el;
593 private NewBranch _this;
600 public Xcls_ticketsel(NewBranch _owner )
603 _this.ticketsel = this;
604 this.el = new Gtk.ComboBox.with_entry();
607 this.loading = false;
609 // set gobject values
610 var child_0 = new Xcls_dbcellrenderer( _this );
612 this.el.pack_start ( child_0.el , true );
613 var child_1 = new Xcls_dbmodel( _this );
615 this.el.set_model ( child_1.el );
619 //this.el.add_attribute(_this.dbcellrenderer.el , "markup", 1 );
620 this.el.set_entry_text_column(1);
621 this.el.get_child().set_sensitive(false);
624 this.el.changed.connect( () => {
628 var ticket_id = this.selectedTicketId();
630 var name = RooTicket.singleton().usernameLocal();
632 this.el.get_child().get_style_context().remove_class("warning");
633 if (ticket_id == "" || ticket_id == null) {
635 var dt = new DateTime.now_local();
636 _this.name.el.set_text("wip_%s_%s".printf(name,dt.format("%Y_%b_%d")));
637 _this.view.loadTicket("");
639 this.el.get_child().get_style_context().add_class("warning");
640 _this.createbtn.updateState();
645 var ticket = RooTicket.singleton().getById(ticket_id);
647 _this.name.el.set_text("wip_%s_T%s_%s".printf(name,ticket.id, ticket.summaryToBranchName()));
648 _this.scrolled_window.el.show();
650 _this.view.loadTicket(ticket.id);
651 _this.branchbtn.updateState();
653 //GLib.debug (//"Selection: %s, %s\n", (string) val1, (string) val2);
657 // user defined functions
658 public string selectedTicketId () {
663 this.el.get_active_iter (out iter);
664 _this.dbmodel.el.get_value (iter, 0, out val1);
667 return (string) val1;
674 public class Xcls_dbcellrenderer : Object
676 public Gtk.CellRendererText el;
677 private NewBranch _this;
683 public Xcls_dbcellrenderer(NewBranch _owner )
686 _this.dbcellrenderer = this;
687 this.el = new Gtk.CellRendererText();
691 // set gobject values
694 // user defined functions
697 public class Xcls_dbmodel : Object
699 public Gtk.ListStore el;
700 private NewBranch _this;
706 public Xcls_dbmodel(NewBranch _owner )
709 _this.dbmodel = this;
710 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
714 // set gobject values
717 // user defined functions
718 public void loadTickets (string project_id , string tid = "") {
722 // fixme .. get project id from selection..
724 RooTicket.singleton().loadTickets(
726 _this.btn_not_me.el.active ? RooTicket.Who.ANYBODY : RooTicket.Who.ME,
727 _this.btn_closed.el.active ? RooTicket.Status.ALL : RooTicket.Status.ACTIVE
730 _this.ticketsel.loading = true;
739 el.set_value(iter, 0, "");
740 el.set_value(iter, 1, "-- select a ticket --");
742 _this.ticketsel.el.set_active_iter(iter);
743 var tickets = RooTicket.singleton().tickets;
744 foreach(var ticket in tickets) {
748 el.set_value(iter, 0, ticket.id);
749 el.set_value(iter, 1, "#%s %s".printf( ticket.id, ticket.summary));
751 if (ticket.id == tid) {
752 _this.ticketsel.el.set_active_iter(iter);
757 _this.ticketsel.loading = false;
758 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
764 public class Xcls_Label16 : Object
767 private NewBranch _this;
773 public Xcls_Label16(NewBranch _owner )
776 this.el = new Gtk.Label( "Use this as branch name" );
780 // set gobject values
781 this.el.halign = Gtk.Align.START;
782 this.el.justify = Gtk.Justification.RIGHT;
783 this.el.xalign = 0.900000f;
786 // user defined functions
789 public class Xcls_name : Object
792 private NewBranch _this;
798 public Xcls_name(NewBranch _owner )
802 this.el = new Gtk.Entry();
806 // set gobject values
807 this.el.visible = true;
810 // user defined functions
813 public class Xcls_branchbtn : Object
815 public Gtk.Button el;
816 private NewBranch _this;
822 public Xcls_branchbtn(NewBranch _owner )
825 _this.branchbtn = this;
826 this.el = new Gtk.Button();
830 // set gobject values
831 this.el.label = "Create Branch";
836 this.el.get_style_context().add_class("suggested-action");
840 this.el.clicked.connect( () => {
842 GLib.debug("fire response = 1");
844 var ticket_id = _this.ticketsel.selectedTicketId();
846 if (ticket_id == "") {
847 _this.ticketsel.el.get_child().get_style_context().add_class("warning");
851 _this.el.response(1);
855 // user defined functions
856 public void updateState () {
858 var ticket_id = _this.ticketsel.selectedTicketId();
860 if (ticket_id == "") {
861 this.el.set_sensitive(false);
865 this.el.set_sensitive(true);
870 public class Xcls_Box19 : Object
873 private NewBranch _this;
879 public Xcls_Box19(NewBranch _owner )
882 this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
886 // set gobject values
887 var child_0 = new Xcls_btn_not_me( _this );
889 this.el.add ( child_0.el );
890 var child_1 = new Xcls_btn_closed( _this );
892 this.el.add ( child_1.el );
893 var child_2 = new Xcls_Label22( _this );
895 this.el.add ( child_2.el );
898 // user defined functions
900 public class Xcls_btn_not_me : Object
902 public Gtk.CheckButton el;
903 private NewBranch _this;
909 public Xcls_btn_not_me(NewBranch _owner )
912 _this.btn_not_me = this;
913 this.el = new Gtk.CheckButton();
917 // set gobject values
918 this.el.label = "Show tickets not assigned to me";
921 this.el.toggled.connect( () => {
922 var project_id = _this.projectsel.selectedProjectId();
923 _this.dbmodel.loadTickets(project_id);
927 // user defined functions
930 public class Xcls_btn_closed : Object
932 public Gtk.CheckButton el;
933 private NewBranch _this;
939 public Xcls_btn_closed(NewBranch _owner )
942 _this.btn_closed = this;
943 this.el = new Gtk.CheckButton();
947 // set gobject values
948 this.el.label = "Show closed Tickets";
951 this.el.toggled.connect( () => {
952 var project_id = _this.projectsel.selectedProjectId();
953 _this.dbmodel.loadTickets(project_id);
958 // user defined functions
961 public class Xcls_Label22 : Object
964 private NewBranch _this;
970 public Xcls_Label22(NewBranch _owner )
973 this.el = new Gtk.Label( "<a href=\"refresh\">Refresh Ticket list</a>" );
977 // set gobject values
978 this.el.halign = Gtk.Align.END;
979 this.el.hexpand = true;
980 this.el.use_markup = true;
983 this.el.activate_link.connect( (uri) => {
984 if (uri == "refresh") {
986 var curproj = RooProject.getProjectByRepo(_this.repo);
987 _this.prmodel.loadProjects(curproj == null ? "": curproj.id);
989 _this.dbmodel.loadTickets(curproj == null ? "": curproj.id);
995 // user defined functions
1000 public class Xcls_scrolled_window : Object
1002 public Gtk.ScrolledWindow el;
1003 private NewBranch _this;
1009 public Xcls_scrolled_window(NewBranch _owner )
1012 _this.scrolled_window = this;
1013 this.el = new Gtk.ScrolledWindow( null, null );
1017 // set gobject values
1018 this.el.height_request = 500;
1019 this.el.vexpand = true;
1020 var child_0 = new Xcls_view( _this );
1022 this.el.add ( child_0.el );
1027 this.el.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);
1031 // user defined functions
1033 public class Xcls_view : Object
1035 public WebKit.WebView el;
1036 private NewBranch _this;
1042 public Xcls_view(NewBranch _owner )
1046 this.el = new WebKit.WebView();
1050 // set gobject values
1053 // user defined functions
1054 public void loadTicket (string tid) {
1056 _this.el.get_size(out w, out h);
1059 _this.scrolled_window.el.hide();
1060 _this.el.resize(w, 150);
1062 _this.scrolled_window.el.show();
1063 _this.el.resize(w, 800);
1066 var rs = RooTicket.singleton();
1067 var uri = new WebKit.URIRequest("https://roojs.com/admin.php/MTrack/View/" + tid);
1068 var hd = uri.get_http_headers();
1069 var authCode = Base64.encode ("%s:%s".printf(rs.username, rs.password).data);
1070 hd.append("Authorization", "Basic %s".printf(authCode));
1072 this.el.load_request(uri);
1078 public class Xcls_create_ticket_tab : Object
1081 private NewBranch _this;
1087 public Xcls_create_ticket_tab(NewBranch _owner )
1090 _this.create_ticket_tab = this;
1091 this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
1095 // set gobject values
1096 this.el.homogeneous = false;
1097 var child_0 = new Xcls_table( _this );
1099 this.el.pack_start ( child_0.el , false,false,0 );
1102 // user defined functions
1103 public void load_data () {
1107 Timeout.add_seconds(1, () => {
1109 RooProject? curproj = null;
1110 if (_this.repo != null) {
1111 curproj = RooProject.getProjectByRepo(_this.repo);
1113 _this.prmodel.loadProjects(curproj == null ? "" : curproj.id);
1114 if (curproj != null) {
1117 var rt = RooTicket.singleton();
1118 rt.loadProjectOptions(curproj.id);
1120 _this.msmodel.loadMilestones();
1121 _this.primodel.loadPriorities();
1122 _this.sevmodel.loadSeverities();
1123 _this.clmodel.loadClassifications();
1124 _this.devmodel.loadDevelopers();
1127 _this.summary.el.set_text("");
1128 _this.description.el.buffer.text = "";
1129 //_this.spinner.el.stop();
1130 //_this.spinner.el.hide();
1132 _this.table.el.show();
1133 //_this.summary.el.grab_focus();
1139 public class Xcls_table : Object
1141 public Gtk.Table el;
1142 private NewBranch _this;
1148 public Xcls_table(NewBranch _owner )
1152 this.el = new Gtk.Table( 14, 4, true );
1156 // set gobject values
1157 this.el.expand = false;
1159 this.el.column_spacing = 4;
1160 this.el.vexpand = false;
1161 var child_0 = new Xcls_Label27( _this );
1163 this.el.attach_defaults ( child_0.el , 0,1,0,1 );
1164 var child_1 = new Xcls_Label28( _this );
1166 this.el.attach_defaults ( child_1.el , 1,2,0,1 );
1167 var child_2 = new Xcls_project_id( _this );
1169 this.el.attach_defaults ( child_2.el , 0,1,1,2 );
1170 var child_3 = new Xcls_summary( _this );
1172 this.el.attach_defaults ( child_3.el , 1,4,1,2 );
1173 var child_4 = new Xcls_Label33( _this );
1175 this.el.attach_defaults ( child_4.el , 0,1,2,3 );
1176 var child_5 = new Xcls_milestone_id( _this );
1178 this.el.attach_defaults ( child_5.el , 0,1,3,4 );
1179 var child_6 = new Xcls_Label36( _this );
1181 this.el.attach_defaults ( child_6.el , 1,4,2,3 );
1182 var child_7 = new Xcls_description( _this );
1184 this.el.attach_defaults ( child_7.el , 1,4,3,12 );
1185 var child_8 = new Xcls_Label38( _this );
1187 this.el.attach_defaults ( child_8.el , 0,1,4,5 );
1188 var child_9 = new Xcls_priority_id( _this );
1190 this.el.attach_defaults ( child_9.el , 0,1,5,6 );
1191 var child_10 = new Xcls_Label41( _this );
1193 this.el.attach_defaults ( child_10.el , 0,1,6,7 );
1194 var child_11 = new Xcls_severity_id( _this );
1196 this.el.attach_defaults ( child_11.el , 0,1,7,8 );
1197 var child_12 = new Xcls_Label44( _this );
1199 this.el.attach_defaults ( child_12.el , 0,1,8,9 );
1200 var child_13 = new Xcls_classification_id( _this );
1202 this.el.attach_defaults ( child_13.el , 0,1,9,10 );
1203 var child_14 = new Xcls_Label47( _this );
1205 this.el.attach_defaults ( child_14.el , 0,1,10,11 );
1206 var child_15 = new Xcls_developer_id( _this );
1208 this.el.attach_defaults ( child_15.el , 0,1,11,12 );
1209 var child_16 = new Xcls_Button50( _this );
1211 this.el.attach_defaults ( child_16.el , 0,4,13,14 );
1214 // user defined functions
1216 public class Xcls_Label27 : Object
1218 public Gtk.Label el;
1219 private NewBranch _this;
1225 public Xcls_Label27(NewBranch _owner )
1228 this.el = new Gtk.Label( "Project" );
1232 // set gobject values
1233 this.el.halign = Gtk.Align.START;
1234 this.el.visible = true;
1237 // user defined functions
1240 public class Xcls_Label28 : Object
1242 public Gtk.Label el;
1243 private NewBranch _this;
1249 public Xcls_Label28(NewBranch _owner )
1252 this.el = new Gtk.Label( "Summary" );
1256 // set gobject values
1257 this.el.halign = Gtk.Align.START;
1258 this.el.visible = true;
1261 // user defined functions
1264 public class Xcls_project_id : Object
1266 public Gtk.ComboBox el;
1267 private NewBranch _this;
1271 public bool loading;
1274 public Xcls_project_id(NewBranch _owner )
1277 _this.project_id = this;
1278 this.el = new Gtk.ComboBox.with_entry();
1281 this.loading = false;
1283 // set gobject values
1284 var child_0 = new Xcls_tprcellrenderer( _this );
1286 this.el.pack_start ( child_0.el , true );
1287 var child_1 = new Xcls_tprmodel( _this );
1289 this.el.set_model ( child_1.el );
1293 this.el.set_entry_text_column(1);
1296 this.el.changed.connect( () => {
1300 var project_id = this.selectedProjectId();
1302 var rt = RooTicket.singleton();
1303 rt.loadProjectOptions(project_id);
1305 _this.msmodel.loadMilestones();
1306 _this.primodel.loadPriorities();
1307 _this.sevmodel.loadSeverities();
1308 _this.clmodel.loadClassifications();
1309 _this.devmodel.loadDevelopers();
1311 // affects projects and milestones..
1314 /*if (this.loading) {
1317 var ticket_id = this.selectedTicketId();
1319 var name = RooTicket.singleton().usernameLocal();
1321 if (ticket_id == "" || ticket_id == null) {
1323 var dt = new DateTime.now_local();
1324 _this.name.el.set_text("wip_%s_%s".printf(name,dt.format("%Y_%b_%d")));
1329 var ticket = RooTicket.singleton().getById(ticket_id);
1331 _this.name.el.set_text("wip_%s_T%s_%s".printf(name,ticket.id, ticket.summaryToBranchName()));
1333 //GLib.debug (//"Selection: %s, %s\n", (string) val1, (string) val2);
1338 // user defined functions
1339 public string selectedProjectId () {
1344 this.el.get_active_iter (out iter);
1345 _this.tprmodel.el.get_value (iter, 0, out val1);
1348 return (string) val1;
1355 public class Xcls_tprcellrenderer : Object
1357 public Gtk.CellRendererText el;
1358 private NewBranch _this;
1364 public Xcls_tprcellrenderer(NewBranch _owner )
1367 _this.tprcellrenderer = this;
1368 this.el = new Gtk.CellRendererText();
1372 // set gobject values
1375 // user defined functions
1378 public class Xcls_tprmodel : Object
1380 public Gtk.ListStore el;
1381 private NewBranch _this;
1387 public Xcls_tprmodel(NewBranch _owner )
1390 _this.tprmodel = this;
1391 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
1395 // set gobject values
1398 // user defined functions
1399 public void loadProjects (string id) {
1402 _this.project_id.loading = true;
1408 el.append(out iter);
1411 el.set_value(iter, 0, "");
1412 el.set_value(iter, 1, "-- select a project --");
1414 _this.project_id.el.set_active_iter(iter);
1417 foreach(var project in RooProject.projects()) {
1419 el.append(out iter);
1421 el.set_value(iter, 0, project.id);
1422 el.set_value(iter, 1, project.name );
1423 if (id == project.id) {
1424 _this.project_id.el.set_active_iter(iter);
1429 _this.project_id.loading = false;
1430 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
1436 public class Xcls_summary : Object
1438 public Gtk.Entry el;
1439 private NewBranch _this;
1445 public Xcls_summary(NewBranch _owner )
1448 _this.summary = this;
1449 this.el = new Gtk.Entry();
1453 // set gobject values
1454 this.el.visible = true;
1457 // user defined functions
1460 public class Xcls_Label33 : Object
1462 public Gtk.Label el;
1463 private NewBranch _this;
1469 public Xcls_Label33(NewBranch _owner )
1472 this.el = new Gtk.Label( "Milestone" );
1476 // set gobject values
1477 this.el.halign = Gtk.Align.START;
1478 this.el.justify = Gtk.Justification.RIGHT;
1479 this.el.xalign = 0.900000f;
1482 // user defined functions
1485 public class Xcls_milestone_id : Object
1487 public Gtk.ComboBox el;
1488 private NewBranch _this;
1492 public bool loading;
1495 public Xcls_milestone_id(NewBranch _owner )
1498 _this.milestone_id = this;
1499 this.el = new Gtk.ComboBox.with_entry();
1502 this.loading = false;
1504 // set gobject values
1505 var child_0 = new Xcls_msmodel( _this );
1507 this.el.set_model ( child_0.el );
1511 this.el.set_entry_text_column(1);
1514 // user defined functions
1515 public string selectedMilestoneId () {
1520 this.el.get_active_iter (out iter);
1521 _this.msmodel.el.get_value (iter, 0, out val1);
1524 return (string) val1;
1531 public class Xcls_msmodel : Object
1533 public Gtk.ListStore el;
1534 private NewBranch _this;
1540 public Xcls_msmodel(NewBranch _owner )
1543 _this.msmodel = this;
1544 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
1548 // set gobject values
1551 // user defined functions
1552 public void loadMilestones ( ) {
1554 var rt = RooTicket.singleton();
1555 // rt.loadProjects();
1557 _this.milestone_id.loading = true;
1563 el.append(out iter);
1566 el.set_value(iter, 0, "");
1567 el.set_value(iter, 1, "-- select a milestone --");
1568 _this.milestone_id.el.set_active_iter(iter);
1570 var projects = rt.milestones;
1571 foreach(var project in projects) {
1573 el.append(out iter);
1575 el.set_value(iter, 0, project.id);
1576 el.set_value(iter, 1, project.display_name );
1577 // if (id == project.id) {
1578 // _this.milestone.el.set_active_iter(iter);
1584 _this.milestone_id.loading = false;
1585 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
1591 public class Xcls_Label36 : Object
1593 public Gtk.Label el;
1594 private NewBranch _this;
1600 public Xcls_Label36(NewBranch _owner )
1603 this.el = new Gtk.Label( "Description" );
1607 // set gobject values
1608 this.el.halign = Gtk.Align.START;
1611 // user defined functions
1614 public class Xcls_description : Object
1616 public Gtk.TextView el;
1617 private NewBranch _this;
1623 public Xcls_description(NewBranch _owner )
1626 _this.description = this;
1627 this.el = new Gtk.TextView();
1631 // set gobject values
1632 this.el.border_width = 1;
1635 // user defined functions
1638 public class Xcls_Label38 : Object
1640 public Gtk.Label el;
1641 private NewBranch _this;
1647 public Xcls_Label38(NewBranch _owner )
1650 this.el = new Gtk.Label( "Priority" );
1654 // set gobject values
1655 this.el.halign = Gtk.Align.START;
1656 this.el.xalign = 0.900000f;
1659 // user defined functions
1662 public class Xcls_priority_id : Object
1664 public Gtk.ComboBox el;
1665 private NewBranch _this;
1669 public bool loading;
1672 public Xcls_priority_id(NewBranch _owner )
1675 _this.priority_id = this;
1676 this.el = new Gtk.ComboBox.with_entry();
1679 this.loading = false;
1681 // set gobject values
1682 var child_0 = new Xcls_primodel( _this );
1684 this.el.set_model ( child_0.el );
1688 this.el.set_entry_text_column(1);
1691 // user defined functions
1692 public string selectedPriorityId () {
1697 this.el.get_active_iter (out iter);
1698 _this.primodel.el.get_value (iter, 0, out val1);
1701 return (string) val1;
1708 public class Xcls_primodel : Object
1710 public Gtk.ListStore el;
1711 private NewBranch _this;
1717 public Xcls_primodel(NewBranch _owner )
1720 _this.primodel = this;
1721 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
1725 // set gobject values
1728 // user defined functions
1729 public void loadPriorities ( ) {
1731 var rt = RooTicket.singleton();
1732 // rt.loadProjects();
1734 _this.priority_id.loading = true;
1741 var projects = rt.priorities;
1742 foreach(var project in projects) {
1744 el.append(out iter);
1746 el.set_value(iter, 0, project.id);
1747 el.set_value(iter, 1, project.display_name );
1748 if ("normal" == project.name) {
1749 _this.priority_id.el.set_active_iter(iter);
1754 _this.priority_id.loading = false;
1761 public class Xcls_Label41 : Object
1763 public Gtk.Label el;
1764 private NewBranch _this;
1770 public Xcls_Label41(NewBranch _owner )
1773 this.el = new Gtk.Label( "Severity" );
1777 // set gobject values
1778 this.el.halign = Gtk.Align.START;
1781 // user defined functions
1784 public class Xcls_severity_id : Object
1786 public Gtk.ComboBox el;
1787 private NewBranch _this;
1791 public bool loading;
1794 public Xcls_severity_id(NewBranch _owner )
1797 _this.severity_id = this;
1798 this.el = new Gtk.ComboBox.with_entry();
1801 this.loading = false;
1803 // set gobject values
1804 var child_0 = new Xcls_sevmodel( _this );
1806 this.el.set_model ( child_0.el );
1810 this.el.set_entry_text_column(1);
1813 // user defined functions
1814 public string selectedSeverityId () {
1819 this.el.get_active_iter (out iter);
1820 _this.sevmodel.el.get_value (iter, 0, out val1);
1823 return (string) val1;
1830 public class Xcls_sevmodel : Object
1832 public Gtk.ListStore el;
1833 private NewBranch _this;
1839 public Xcls_sevmodel(NewBranch _owner )
1842 _this.sevmodel = this;
1843 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
1847 // set gobject values
1850 // user defined functions
1851 public void loadSeverities () {
1853 var rt = RooTicket.singleton();
1854 //rt.loadProjects();
1856 _this.severity_id.loading = true;
1862 var projects = rt.serverities;
1863 foreach(var project in projects) {
1865 el.append(out iter);
1867 el.set_value(iter, 0, project.id);
1868 el.set_value(iter, 1, project.display_name );
1869 if ("normal" == project.name) {
1870 _this.severity_id.el.set_active_iter(iter);
1875 _this.severity_id.loading = false;
1876 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
1882 public class Xcls_Label44 : Object
1884 public Gtk.Label el;
1885 private NewBranch _this;
1891 public Xcls_Label44(NewBranch _owner )
1894 this.el = new Gtk.Label( "Classification" );
1898 // set gobject values
1899 this.el.halign = Gtk.Align.START;
1902 // user defined functions
1905 public class Xcls_classification_id : Object
1907 public Gtk.ComboBox el;
1908 private NewBranch _this;
1912 public bool loading;
1915 public Xcls_classification_id(NewBranch _owner )
1918 _this.classification_id = this;
1919 this.el = new Gtk.ComboBox.with_entry();
1922 this.loading = false;
1924 // set gobject values
1925 var child_0 = new Xcls_clmodel( _this );
1927 this.el.set_model ( child_0.el );
1931 this.el.set_entry_text_column(1);
1934 // user defined functions
1935 public string selectedClassificationId () {
1940 this.el.get_active_iter (out iter);
1941 _this.clmodel.el.get_value (iter, 0, out val1);
1944 return (string) val1;
1951 public class Xcls_clmodel : Object
1953 public Gtk.ListStore el;
1954 private NewBranch _this;
1960 public Xcls_clmodel(NewBranch _owner )
1963 _this.clmodel = this;
1964 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
1968 // set gobject values
1971 // user defined functions
1972 public void loadClassifications ( ) {
1974 var rt = RooTicket.singleton();
1975 // rt.loadProjects();
1977 _this.classification_id.loading = true;
1983 el.append(out iter);
1986 var projects = rt.classifications;
1987 foreach(var project in projects) {
1989 el.append(out iter);
1991 el.set_value(iter, 0, project.id);
1992 el.set_value(iter, 1, project.display_name );
1993 if ("bug" == project.name) {
1994 _this.classification_id.el.set_active_iter(iter);
1999 _this.classification_id.loading = false;
2000 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
2006 public class Xcls_Label47 : Object
2008 public Gtk.Label el;
2009 private NewBranch _this;
2015 public Xcls_Label47(NewBranch _owner )
2018 this.el = new Gtk.Label( "Assign to" );
2022 // set gobject values
2023 this.el.halign = Gtk.Align.START;
2026 // user defined functions
2029 public class Xcls_developer_id : Object
2031 public Gtk.ComboBox el;
2032 private NewBranch _this;
2036 public bool loading;
2039 public Xcls_developer_id(NewBranch _owner )
2042 _this.developer_id = this;
2043 this.el = new Gtk.ComboBox.with_entry();
2046 this.loading = false;
2048 // set gobject values
2049 var child_0 = new Xcls_devmodel( _this );
2051 this.el.set_model ( child_0.el );
2055 this.el.set_entry_text_column(1);
2058 // user defined functions
2059 public string selectedDeveloperId () {
2064 this.el.get_active_iter (out iter);
2065 _this.devmodel.el.get_value (iter, 0, out val1);
2068 return (string) val1;
2075 public class Xcls_devmodel : Object
2077 public Gtk.ListStore el;
2078 private NewBranch _this;
2084 public Xcls_devmodel(NewBranch _owner )
2087 _this.devmodel = this;
2088 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
2092 // set gobject values
2095 // user defined functions
2096 public void loadDevelopers ( ) {
2098 var rt = RooTicket.singleton();
2099 //rt.loadProjects();
2101 _this.developer_id.loading = true;
2107 el.append(out iter);
2110 el.set_value(iter, 0, "");
2111 el.set_value(iter, 1, "-- select a developer --");
2113 _this.developer_id.el.set_active_iter(iter);
2116 var peps = rt.developers;
2117 foreach(var p in peps) {
2119 el.append(out iter);
2121 el.set_value(iter, 0, p.id);
2122 el.set_value(iter, 1, p.display_name );
2123 if (rt.authuser_id == p.id) {
2124 _this.developer_id.el.set_active_iter(iter);
2128 _this.developer_id.loading = false;
2129 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
2135 public class Xcls_Button50 : Object
2137 public Gtk.Button el;
2138 private NewBranch _this;
2144 public Xcls_Button50(NewBranch _owner )
2147 this.el = new Gtk.Button();
2151 // set gobject values
2152 this.el.label = "Create Ticket & Branch";
2157 this.el.get_style_context().add_class("suggested-action");
2161 this.el.clicked.connect( () => {
2162 GLib.debug("fire response = 1");
2165 var invalid = false;
2167 // validate first...
2168 _this.project_id.el.get_child().get_style_context().remove_class("warning");
2169 if (_this.project_id.selectedProjectId() == "") {
2170 _this.project_id.el.get_child().get_style_context().add_class("warning");
2174 _this.milestone_id.el.get_child().get_style_context().remove_class("warning");
2176 _this.priority_id.el.get_child().get_style_context().remove_class("warning");
2177 if (_this.priority_id.selectedPriorityId() == "") {
2178 _this.priority_id.el.get_child().get_style_context().add_class("warning");
2182 _this.classification_id.el.get_child().get_style_context().remove_class("warning");
2183 if (_this.classification_id.selectedClassificationId() == "") {
2184 _this.classification_id.el.get_child().get_style_context().add_class("warning");
2188 _this.developer_id.el.get_child().get_style_context().remove_class("warning");
2189 if (_this.developer_id.selectedDeveloperId() == "") {
2190 _this.developer_id.el.get_child().get_style_context().add_class("warning");
2194 _this.summary.el.get_style_context().remove_class("warning");
2195 if (_this.summary.el.get_text() == "") {
2196 _this.summary.el.get_style_context().add_class("warning");
2200 _this.description.el.get_style_context().remove_class("warning");
2205 GLib.debug("for is valid");
2207 _this.el.response(1);
2211 // user defined functions
2216 public class Xcls_quick_commit_tab : Object
2219 private NewBranch _this;
2225 public Xcls_quick_commit_tab(NewBranch _owner )
2228 _this.quick_commit_tab = this;
2229 this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
2233 // set gobject values
2234 this.el.homogeneous = false;
2235 var child_0 = new Xcls_Table52( _this );
2237 this.el.pack_start ( child_0.el , false,false,0 );
2238 var child_1 = new Xcls_ScrolledWindow56( _this );
2240 this.el.add ( child_1.el );
2243 // user defined functions
2244 public void load_data () {
2245 _this.commit_message.el.set_text("");
2249 public class Xcls_Table52 : Object
2251 public Gtk.Table el;
2252 private NewBranch _this;
2258 public Xcls_Table52(NewBranch _owner )
2261 this.el = new Gtk.Table( 2, 5, true );
2265 // set gobject values
2266 this.el.expand = false;
2268 this.el.column_spacing = 4;
2269 this.el.vexpand = false;
2270 var child_0 = new Xcls_Label53( _this );
2272 this.el.attach_defaults ( child_0.el , 0,1,0,1 );
2273 var child_1 = new Xcls_commit_message( _this );
2275 this.el.attach_defaults ( child_1.el , 0,4,1,2 );
2276 var child_2 = new Xcls_createbtn( _this );
2278 this.el.attach_defaults ( child_2.el , 4,5,1,2 );
2281 // user defined functions
2283 public class Xcls_Label53 : Object
2285 public Gtk.Label el;
2286 private NewBranch _this;
2292 public Xcls_Label53(NewBranch _owner )
2295 this.el = new Gtk.Label( "Just commit with this comment" );
2299 // set gobject values
2300 this.el.halign = Gtk.Align.START;
2301 this.el.justify = Gtk.Justification.RIGHT;
2302 this.el.xalign = 0.900000f;
2305 // user defined functions
2308 public class Xcls_commit_message : Object
2310 public Gtk.Entry el;
2311 private NewBranch _this;
2317 public Xcls_commit_message(NewBranch _owner )
2320 _this.commit_message = this;
2321 this.el = new Gtk.Entry();
2325 // set gobject values
2326 this.el.visible = true;
2329 // user defined functions
2332 public class Xcls_createbtn : Object
2334 public Gtk.Button el;
2335 private NewBranch _this;
2341 public Xcls_createbtn(NewBranch _owner )
2344 _this.createbtn = this;
2345 this.el = new Gtk.Button();
2349 // set gobject values
2350 this.el.label = "Commit Changes";
2355 this.el.get_style_context().add_class("suggested-action");
2359 this.el.clicked.connect( () => {
2361 GLib.debug("fire response = 1");
2363 var ticket_id = _this.ticketsel.selectedTicketId();
2365 if (ticket_id == "") {
2366 _this.ticketsel.el.get_child().get_style_context().add_class("warning");
2370 _this.el.response(1);
2374 // user defined functions
2375 public void updateState () {
2377 var ticket_id = _this.ticketsel.selectedTicketId();
2379 if (ticket_id == "") {
2380 this.el.set_sensitive(false);
2384 this.el.set_sensitive(true);
2390 public class Xcls_ScrolledWindow56 : Object
2392 public Gtk.ScrolledWindow el;
2393 private NewBranch _this;
2399 public Xcls_ScrolledWindow56(NewBranch _owner )
2402 this.el = new Gtk.ScrolledWindow( null, null );
2406 // set gobject values
2407 this.el.height_request = 400;
2408 this.el.vexpand = true;
2409 var child_0 = new Xcls_diff_view( _this );
2411 this.el.add ( child_0.el );
2414 // user defined functions
2416 public class Xcls_diff_view : Object
2418 public Gtk.SourceView el;
2419 private NewBranch _this;
2425 public Xcls_diff_view(NewBranch _owner )
2428 _this.diff_view = this;
2429 this.el = new Gtk.SourceView();
2435 var description = Pango.FontDescription.from_string("monospace");
2436 description.set_size(9000);
2437 this.el.override_font(description);
2438 var lm = Gtk.SourceLanguageManager.get_default();
2440 ((Gtk.SourceBuffer)(this.el.get_buffer())).set_language(
2441 lm.get_language("diff")
2445 // user defined functions