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.notebook.el.set_current_page(0);
161 _this.select_ticket_tab.load_data(tid);
162 _this.create_ticket_tab.load_data();
163 _this.quick_commit_tab.load_data();
174 public class Xcls_Notebook2 : Object
176 public Gtk.Notebook el;
177 private NewBranch _this;
183 public Xcls_Notebook2(NewBranch _owner )
186 this.el = new Gtk.Notebook();
190 // set gobject values
191 this.el.vexpand = true;
192 var child_0 = new Xcls_label_select_ticket( _this );
194 var child_1 = new Xcls_label_create_ticket( _this );
196 var child_2 = new Xcls_label_quick_commit( _this );
198 var child_3 = new Xcls_select_ticket_tab( _this );
200 this.el.append_page ( child_3.el , _this.label_select_ticket.el );
201 var child_4 = new Xcls_create_ticket_tab( _this );
203 this.el.append_page ( child_4.el , _this.label_create_ticket.el );
204 var child_5 = new Xcls_quick_commit_tab( _this );
206 this.el.append_page ( child_5.el , _this.label_quick_commit.el );
209 this.el.switch_page.connect( (page, page_num) => {
210 GLib.debug("Switch to page: %d", (int)page_num);
213 break; // do nothing.. it's already loaded at start.
215 _this.create_ticket_tab.load_data();
218 _this.quick_commit_tab.load_data();
226 // user defined functions
228 public class Xcls_label_select_ticket : Object
231 private NewBranch _this;
237 public Xcls_label_select_ticket(NewBranch _owner )
240 _this.label_select_ticket = this;
241 this.el = new Gtk.Label( "Select Existing Ticket to work on" );
245 // set gobject values
248 // user defined functions
251 public class Xcls_label_create_ticket : Object
254 private NewBranch _this;
260 public Xcls_label_create_ticket(NewBranch _owner )
263 _this.label_create_ticket = this;
264 this.el = new Gtk.Label( "Create a New Ticket" );
268 // set gobject values
271 // user defined functions
274 public class Xcls_label_quick_commit : Object
277 private NewBranch _this;
283 public Xcls_label_quick_commit(NewBranch _owner )
286 _this.label_quick_commit = this;
287 this.el = new Gtk.Label( "Quick Commit" );
291 // set gobject values
294 // user defined functions
297 public class Xcls_select_ticket_tab : Object
300 private NewBranch _this;
306 public Xcls_select_ticket_tab(NewBranch _owner )
309 _this.select_ticket_tab = this;
310 this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
314 // set gobject values
315 this.el.homogeneous = false;
316 var child_0 = new Xcls_Table7( _this );
318 this.el.pack_start ( child_0.el , false,false,0 );
319 var child_1 = new Xcls_scrolled_window( _this );
321 this.el.add ( child_1.el );
324 // user defined functions
325 public void load_data (string tid = "") {
327 GLib.debug("Loading tickets");
329 var curproj = RooProject.getProjectByRepo(_this.repo);
330 _this.prmodel.loadProjects(curproj == null ? "" : curproj.id);
332 _this.dbmodel.loadTickets(curproj == null ? "": curproj.id, tid);
333 _this.branchbtn.updateState();
335 _this.ticketsel.el.get_child().get_style_context().remove_class("warning");
337 var name = RooTicket.singleton().usernameLocal();
338 var ticket = RooTicket.singleton().getById(tid);
339 _this.name.el.set_text("wip_%s_T%s_%s".printf(name,ticket.id, ticket.summaryToBranchName()));
341 _this.ticketsel.el.get_child().get_style_context().add_class("warning");
343 _this.view.loadTicket(tid);
348 public class Xcls_Table7 : Object
351 private NewBranch _this;
357 public Xcls_Table7(NewBranch _owner )
360 this.el = new Gtk.Table( 5, 5, true );
364 // set gobject values
365 this.el.expand = false;
367 this.el.column_spacing = 4;
368 this.el.vexpand = false;
369 var child_0 = new Xcls_Label8( _this );
371 this.el.attach_defaults ( child_0.el , 0,1,0,1 );
372 var child_1 = new Xcls_Label9( _this );
374 this.el.attach_defaults ( child_1.el , 1,2,0,1 );
375 var child_2 = new Xcls_projectsel( _this );
377 this.el.attach_defaults ( child_2.el , 0,1,1,2 );
378 var child_3 = new Xcls_ticketsel( _this );
380 this.el.attach_defaults ( child_3.el , 1,5,1,2 );
381 var child_4 = new Xcls_Label16( _this );
383 this.el.attach_defaults ( child_4.el , 0,1,3,4 );
384 var child_5 = new Xcls_name( _this );
386 this.el.attach_defaults ( child_5.el , 0,4,4,5 );
387 var child_6 = new Xcls_branchbtn( _this );
389 this.el.attach_defaults ( child_6.el , 4,5,4,5 );
390 var child_7 = new Xcls_Box19( _this );
392 this.el.attach_defaults ( child_7.el , 0,5,2,3 );
395 // user defined functions
397 public class Xcls_Label8 : Object
400 private NewBranch _this;
406 public Xcls_Label8(NewBranch _owner )
409 this.el = new Gtk.Label( "Project" );
413 // set gobject values
414 this.el.halign = Gtk.Align.START;
415 this.el.justify = Gtk.Justification.RIGHT;
416 this.el.visible = true;
419 // user defined functions
422 public class Xcls_Label9 : Object
425 private NewBranch _this;
431 public Xcls_Label9(NewBranch _owner )
434 this.el = new Gtk.Label( "Ticket" );
438 // set gobject values
439 this.el.halign = Gtk.Align.START;
440 this.el.visible = true;
443 // user defined functions
446 public class Xcls_projectsel : Object
448 public Gtk.ComboBox el;
449 private NewBranch _this;
456 public Xcls_projectsel(NewBranch _owner )
459 _this.projectsel = this;
460 this.el = new Gtk.ComboBox.with_entry();
463 this.loading = false;
465 // set gobject values
466 var child_0 = new Xcls_prcellrenderer( _this );
468 this.el.pack_start ( child_0.el , true );
469 var child_1 = new Xcls_prmodel( _this );
471 this.el.set_model ( child_1.el );
475 this.el.set_entry_text_column(1);
478 this.el.changed.connect( () => {
482 var project_id = this.selectedProjectId();
483 _this.dbmodel.loadTickets(project_id);
486 /*if (this.loading) {
489 var ticket_id = this.selectedTicketId();
491 var name = RooTicket.singleton().usernameLocal();
493 if (ticket_id == "" || ticket_id == null) {
495 var dt = new DateTime.now_local();
496 _this.name.el.set_text("wip_%s_%s".printf(name,dt.format("%Y_%b_%d")));
501 var ticket = RooTicket.singleton().getById(ticket_id);
503 _this.name.el.set_text("wip_%s_T%s_%s".printf(name,ticket.id, ticket.summaryToBranchName()));
505 //GLib.debug (//"Selection: %s, %s\n", (string) val1, (string) val2);
510 // user defined functions
511 public string selectedProjectId () {
516 this.el.get_active_iter (out iter);
517 _this.prmodel.el.get_value (iter, 0, out val1);
520 return (string) val1;
527 public class Xcls_prcellrenderer : Object
529 public Gtk.CellRendererText el;
530 private NewBranch _this;
536 public Xcls_prcellrenderer(NewBranch _owner )
539 _this.prcellrenderer = this;
540 this.el = new Gtk.CellRendererText();
544 // set gobject values
547 // user defined functions
550 public class Xcls_prmodel : Object
552 public Gtk.ListStore el;
553 private NewBranch _this;
559 public Xcls_prmodel(NewBranch _owner )
562 _this.prmodel = this;
563 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
567 // set gobject values
570 // user defined functions
571 public void loadProjects (string id) {
575 _this.projectsel.loading = true;
584 el.set_value(iter, 0, "");
585 el.set_value(iter, 1, "-- select a project --");
587 _this.projectsel.el.set_active_iter(iter);
590 foreach(var project in RooProject.projects()) {
594 el.set_value(iter, 0, project.id);
595 el.set_value(iter, 1, project.name );
596 if (id == project.id) {
597 _this.projectsel.el.set_active_iter(iter);
602 _this.projectsel.loading = false;
603 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
609 public class Xcls_ticketsel : Object
611 public Gtk.ComboBox el;
612 private NewBranch _this;
619 public Xcls_ticketsel(NewBranch _owner )
622 _this.ticketsel = this;
623 this.el = new Gtk.ComboBox.with_entry();
626 this.loading = false;
628 // set gobject values
629 var child_0 = new Xcls_dbcellrenderer( _this );
631 this.el.pack_start ( child_0.el , true );
632 var child_1 = new Xcls_dbmodel( _this );
634 this.el.set_model ( child_1.el );
638 //this.el.add_attribute(_this.dbcellrenderer.el , "markup", 1 );
639 this.el.set_entry_text_column(1);
640 this.el.get_child().set_sensitive(false);
643 this.el.changed.connect( () => {
647 var ticket_id = this.selectedTicketId();
649 var name = RooTicket.singleton().usernameLocal();
651 this.el.get_child().get_style_context().remove_class("warning");
652 if (ticket_id == "" || ticket_id == null) {
654 var dt = new DateTime.now_local();
655 _this.name.el.set_text("wip_%s_%s".printf(name,dt.format("%Y_%b_%d")));
656 _this.view.loadTicket("");
658 this.el.get_child().get_style_context().add_class("warning");
659 _this.createbtn.updateState();
664 var ticket = RooTicket.singleton().getById(ticket_id);
666 _this.name.el.set_text("wip_%s_T%s_%s".printf(name,ticket.id, ticket.summaryToBranchName()));
667 _this.scrolled_window.el.show();
669 _this.view.loadTicket(ticket.id);
670 _this.branchbtn.updateState();
672 //GLib.debug (//"Selection: %s, %s\n", (string) val1, (string) val2);
676 // user defined functions
677 public string selectedTicketId () {
682 this.el.get_active_iter (out iter);
683 _this.dbmodel.el.get_value (iter, 0, out val1);
686 return (string) val1;
693 public class Xcls_dbcellrenderer : Object
695 public Gtk.CellRendererText el;
696 private NewBranch _this;
702 public Xcls_dbcellrenderer(NewBranch _owner )
705 _this.dbcellrenderer = this;
706 this.el = new Gtk.CellRendererText();
710 // set gobject values
713 // user defined functions
716 public class Xcls_dbmodel : Object
718 public Gtk.ListStore el;
719 private NewBranch _this;
725 public Xcls_dbmodel(NewBranch _owner )
728 _this.dbmodel = this;
729 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
733 // set gobject values
736 // user defined functions
737 public void loadTickets (string project_id , string tid = "") {
741 // fixme .. get project id from selection..
743 RooTicket.singleton().loadTickets(
745 _this.btn_not_me.el.active ? RooTicket.Who.ANYBODY : RooTicket.Who.ME,
746 _this.btn_closed.el.active ? RooTicket.Status.ALL : RooTicket.Status.ACTIVE
749 _this.ticketsel.loading = true;
758 el.set_value(iter, 0, "");
759 el.set_value(iter, 1, "-- select a ticket --");
761 _this.ticketsel.el.set_active_iter(iter);
762 var tickets = RooTicket.singleton().tickets;
763 foreach(var ticket in tickets) {
767 el.set_value(iter, 0, ticket.id);
768 el.set_value(iter, 1, "#%s %s".printf( ticket.id, ticket.summary));
770 if (ticket.id == tid) {
771 _this.ticketsel.el.set_active_iter(iter);
776 _this.ticketsel.loading = false;
777 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
783 public class Xcls_Label16 : Object
786 private NewBranch _this;
792 public Xcls_Label16(NewBranch _owner )
795 this.el = new Gtk.Label( "Use this as branch name" );
799 // set gobject values
800 this.el.halign = Gtk.Align.START;
801 this.el.justify = Gtk.Justification.RIGHT;
802 this.el.xalign = 0.900000f;
805 // user defined functions
808 public class Xcls_name : Object
811 private NewBranch _this;
817 public Xcls_name(NewBranch _owner )
821 this.el = new Gtk.Entry();
825 // set gobject values
826 this.el.visible = true;
829 // user defined functions
832 public class Xcls_branchbtn : Object
834 public Gtk.Button el;
835 private NewBranch _this;
841 public Xcls_branchbtn(NewBranch _owner )
844 _this.branchbtn = this;
845 this.el = new Gtk.Button();
849 // set gobject values
850 this.el.label = "Create Branch";
855 this.el.get_style_context().add_class("suggested-action");
859 this.el.clicked.connect( () => {
861 GLib.debug("fire response = 1");
863 var ticket_id = _this.ticketsel.selectedTicketId();
865 if (ticket_id == "") {
866 _this.ticketsel.el.get_child().get_style_context().add_class("warning");
870 _this.el.response(1);
874 // user defined functions
875 public void updateState () {
877 var ticket_id = _this.ticketsel.selectedTicketId();
879 if (ticket_id == "") {
880 this.el.set_sensitive(false);
884 this.el.set_sensitive(true);
889 public class Xcls_Box19 : Object
892 private NewBranch _this;
898 public Xcls_Box19(NewBranch _owner )
901 this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
905 // set gobject values
906 var child_0 = new Xcls_btn_not_me( _this );
908 this.el.add ( child_0.el );
909 var child_1 = new Xcls_btn_closed( _this );
911 this.el.add ( child_1.el );
912 var child_2 = new Xcls_Label22( _this );
914 this.el.add ( child_2.el );
917 // user defined functions
919 public class Xcls_btn_not_me : Object
921 public Gtk.CheckButton el;
922 private NewBranch _this;
928 public Xcls_btn_not_me(NewBranch _owner )
931 _this.btn_not_me = this;
932 this.el = new Gtk.CheckButton();
936 // set gobject values
937 this.el.label = "Show tickets not assigned to me";
940 this.el.toggled.connect( () => {
941 var project_id = _this.projectsel.selectedProjectId();
942 _this.dbmodel.loadTickets(project_id);
946 // user defined functions
949 public class Xcls_btn_closed : Object
951 public Gtk.CheckButton el;
952 private NewBranch _this;
958 public Xcls_btn_closed(NewBranch _owner )
961 _this.btn_closed = this;
962 this.el = new Gtk.CheckButton();
966 // set gobject values
967 this.el.label = "Show closed Tickets";
970 this.el.toggled.connect( () => {
971 var project_id = _this.projectsel.selectedProjectId();
972 _this.dbmodel.loadTickets(project_id);
977 // user defined functions
980 public class Xcls_Label22 : Object
983 private NewBranch _this;
989 public Xcls_Label22(NewBranch _owner )
992 this.el = new Gtk.Label( "<a href=\"refresh\">Refresh Ticket list</a>" );
996 // set gobject values
997 this.el.halign = Gtk.Align.END;
998 this.el.hexpand = true;
999 this.el.use_markup = true;
1002 this.el.activate_link.connect( (uri) => {
1003 if (uri == "refresh") {
1004 RooProject.reload();
1005 var curproj = RooProject.getProjectByRepo(_this.repo);
1006 _this.prmodel.loadProjects(curproj == null ? "": curproj.id);
1008 _this.dbmodel.loadTickets(curproj == null ? "": curproj.id);
1014 // user defined functions
1019 public class Xcls_scrolled_window : Object
1021 public Gtk.ScrolledWindow el;
1022 private NewBranch _this;
1028 public Xcls_scrolled_window(NewBranch _owner )
1031 _this.scrolled_window = this;
1032 this.el = new Gtk.ScrolledWindow( null, null );
1036 // set gobject values
1037 this.el.height_request = 500;
1038 this.el.vexpand = true;
1039 var child_0 = new Xcls_view( _this );
1041 this.el.add ( child_0.el );
1046 this.el.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);
1050 // user defined functions
1052 public class Xcls_view : Object
1054 public WebKit.WebView el;
1055 private NewBranch _this;
1061 public Xcls_view(NewBranch _owner )
1065 this.el = new WebKit.WebView();
1069 // set gobject values
1072 // user defined functions
1073 public void loadTicket (string tid) {
1075 _this.el.get_size(out w, out h);
1078 _this.scrolled_window.el.hide();
1079 _this.el.resize(w, 150);
1081 _this.scrolled_window.el.show();
1082 _this.el.resize(w, 800);
1085 var rs = RooTicket.singleton();
1086 var uri = new WebKit.URIRequest("https://roojs.com/admin.php/MTrack/View/" + tid);
1087 var hd = uri.get_http_headers();
1088 var authCode = Base64.encode ("%s:%s".printf(rs.username, rs.password).data);
1089 hd.append("Authorization", "Basic %s".printf(authCode));
1091 this.el.load_request(uri);
1097 public class Xcls_create_ticket_tab : Object
1100 private NewBranch _this;
1106 public Xcls_create_ticket_tab(NewBranch _owner )
1109 _this.create_ticket_tab = this;
1110 this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
1114 // set gobject values
1115 this.el.homogeneous = false;
1116 var child_0 = new Xcls_table( _this );
1118 this.el.pack_start ( child_0.el , false,false,0 );
1121 // user defined functions
1122 public void load_data () {
1126 Timeout.add_seconds(1, () => {
1128 RooProject? curproj = null;
1129 if (_this.repo != null) {
1130 curproj = RooProject.getProjectByRepo(_this.repo);
1132 _this.prmodel.loadProjects(curproj == null ? "" : curproj.id);
1133 if (curproj != null) {
1136 var rt = RooTicket.singleton();
1137 rt.loadProjectOptions(curproj.id);
1139 _this.msmodel.loadMilestones();
1140 _this.primodel.loadPriorities();
1141 _this.sevmodel.loadSeverities();
1142 _this.clmodel.loadClassifications();
1143 _this.devmodel.loadDevelopers();
1146 _this.summary.el.set_text("");
1147 _this.description.el.buffer.text = "";
1148 //_this.spinner.el.stop();
1149 //_this.spinner.el.hide();
1151 _this.table.el.show();
1152 //_this.summary.el.grab_focus();
1158 public class Xcls_table : Object
1160 public Gtk.Table el;
1161 private NewBranch _this;
1167 public Xcls_table(NewBranch _owner )
1171 this.el = new Gtk.Table( 14, 4, true );
1175 // set gobject values
1176 this.el.expand = false;
1178 this.el.column_spacing = 4;
1179 this.el.vexpand = false;
1180 var child_0 = new Xcls_Label27( _this );
1182 this.el.attach_defaults ( child_0.el , 0,1,0,1 );
1183 var child_1 = new Xcls_Label28( _this );
1185 this.el.attach_defaults ( child_1.el , 1,2,0,1 );
1186 var child_2 = new Xcls_project_id( _this );
1188 this.el.attach_defaults ( child_2.el , 0,1,1,2 );
1189 var child_3 = new Xcls_summary( _this );
1191 this.el.attach_defaults ( child_3.el , 1,4,1,2 );
1192 var child_4 = new Xcls_Label33( _this );
1194 this.el.attach_defaults ( child_4.el , 0,1,2,3 );
1195 var child_5 = new Xcls_milestone_id( _this );
1197 this.el.attach_defaults ( child_5.el , 0,1,3,4 );
1198 var child_6 = new Xcls_Label36( _this );
1200 this.el.attach_defaults ( child_6.el , 1,4,2,3 );
1201 var child_7 = new Xcls_description( _this );
1203 this.el.attach_defaults ( child_7.el , 1,4,3,12 );
1204 var child_8 = new Xcls_Label38( _this );
1206 this.el.attach_defaults ( child_8.el , 0,1,4,5 );
1207 var child_9 = new Xcls_priority_id( _this );
1209 this.el.attach_defaults ( child_9.el , 0,1,5,6 );
1210 var child_10 = new Xcls_Label41( _this );
1212 this.el.attach_defaults ( child_10.el , 0,1,6,7 );
1213 var child_11 = new Xcls_severity_id( _this );
1215 this.el.attach_defaults ( child_11.el , 0,1,7,8 );
1216 var child_12 = new Xcls_Label44( _this );
1218 this.el.attach_defaults ( child_12.el , 0,1,8,9 );
1219 var child_13 = new Xcls_classification_id( _this );
1221 this.el.attach_defaults ( child_13.el , 0,1,9,10 );
1222 var child_14 = new Xcls_Label47( _this );
1224 this.el.attach_defaults ( child_14.el , 0,1,10,11 );
1225 var child_15 = new Xcls_developer_id( _this );
1227 this.el.attach_defaults ( child_15.el , 0,1,11,12 );
1228 var child_16 = new Xcls_Button50( _this );
1230 this.el.attach_defaults ( child_16.el , 0,4,13,14 );
1233 // user defined functions
1235 public class Xcls_Label27 : Object
1237 public Gtk.Label el;
1238 private NewBranch _this;
1244 public Xcls_Label27(NewBranch _owner )
1247 this.el = new Gtk.Label( "Project" );
1251 // set gobject values
1252 this.el.halign = Gtk.Align.START;
1253 this.el.visible = true;
1256 // user defined functions
1259 public class Xcls_Label28 : Object
1261 public Gtk.Label el;
1262 private NewBranch _this;
1268 public Xcls_Label28(NewBranch _owner )
1271 this.el = new Gtk.Label( "Summary" );
1275 // set gobject values
1276 this.el.halign = Gtk.Align.START;
1277 this.el.visible = true;
1280 // user defined functions
1283 public class Xcls_project_id : Object
1285 public Gtk.ComboBox el;
1286 private NewBranch _this;
1290 public bool loading;
1293 public Xcls_project_id(NewBranch _owner )
1296 _this.project_id = this;
1297 this.el = new Gtk.ComboBox.with_entry();
1300 this.loading = false;
1302 // set gobject values
1303 var child_0 = new Xcls_tprcellrenderer( _this );
1305 this.el.pack_start ( child_0.el , true );
1306 var child_1 = new Xcls_tprmodel( _this );
1308 this.el.set_model ( child_1.el );
1312 this.el.set_entry_text_column(1);
1315 this.el.changed.connect( () => {
1319 var project_id = this.selectedProjectId();
1321 var rt = RooTicket.singleton();
1322 rt.loadProjectOptions(project_id);
1324 _this.msmodel.loadMilestones();
1325 _this.primodel.loadPriorities();
1326 _this.sevmodel.loadSeverities();
1327 _this.clmodel.loadClassifications();
1328 _this.devmodel.loadDevelopers();
1330 // affects projects and milestones..
1333 /*if (this.loading) {
1336 var ticket_id = this.selectedTicketId();
1338 var name = RooTicket.singleton().usernameLocal();
1340 if (ticket_id == "" || ticket_id == null) {
1342 var dt = new DateTime.now_local();
1343 _this.name.el.set_text("wip_%s_%s".printf(name,dt.format("%Y_%b_%d")));
1348 var ticket = RooTicket.singleton().getById(ticket_id);
1350 _this.name.el.set_text("wip_%s_T%s_%s".printf(name,ticket.id, ticket.summaryToBranchName()));
1352 //GLib.debug (//"Selection: %s, %s\n", (string) val1, (string) val2);
1357 // user defined functions
1358 public string selectedProjectId () {
1363 this.el.get_active_iter (out iter);
1364 _this.tprmodel.el.get_value (iter, 0, out val1);
1367 return (string) val1;
1374 public class Xcls_tprcellrenderer : Object
1376 public Gtk.CellRendererText el;
1377 private NewBranch _this;
1383 public Xcls_tprcellrenderer(NewBranch _owner )
1386 _this.tprcellrenderer = this;
1387 this.el = new Gtk.CellRendererText();
1391 // set gobject values
1394 // user defined functions
1397 public class Xcls_tprmodel : Object
1399 public Gtk.ListStore el;
1400 private NewBranch _this;
1406 public Xcls_tprmodel(NewBranch _owner )
1409 _this.tprmodel = this;
1410 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
1414 // set gobject values
1417 // user defined functions
1418 public void loadProjects (string id) {
1421 _this.project_id.loading = true;
1427 el.append(out iter);
1430 el.set_value(iter, 0, "");
1431 el.set_value(iter, 1, "-- select a project --");
1433 _this.project_id.el.set_active_iter(iter);
1436 foreach(var project in RooProject.projects()) {
1438 el.append(out iter);
1440 el.set_value(iter, 0, project.id);
1441 el.set_value(iter, 1, project.name );
1442 if (id == project.id) {
1443 _this.project_id.el.set_active_iter(iter);
1448 _this.project_id.loading = false;
1449 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
1455 public class Xcls_summary : Object
1457 public Gtk.Entry el;
1458 private NewBranch _this;
1464 public Xcls_summary(NewBranch _owner )
1467 _this.summary = this;
1468 this.el = new Gtk.Entry();
1472 // set gobject values
1473 this.el.visible = true;
1476 // user defined functions
1479 public class Xcls_Label33 : Object
1481 public Gtk.Label el;
1482 private NewBranch _this;
1488 public Xcls_Label33(NewBranch _owner )
1491 this.el = new Gtk.Label( "Milestone" );
1495 // set gobject values
1496 this.el.halign = Gtk.Align.START;
1497 this.el.justify = Gtk.Justification.RIGHT;
1498 this.el.xalign = 0.900000f;
1501 // user defined functions
1504 public class Xcls_milestone_id : Object
1506 public Gtk.ComboBox el;
1507 private NewBranch _this;
1511 public bool loading;
1514 public Xcls_milestone_id(NewBranch _owner )
1517 _this.milestone_id = this;
1518 this.el = new Gtk.ComboBox.with_entry();
1521 this.loading = false;
1523 // set gobject values
1524 var child_0 = new Xcls_msmodel( _this );
1526 this.el.set_model ( child_0.el );
1530 this.el.set_entry_text_column(1);
1533 // user defined functions
1534 public string selectedMilestoneId () {
1539 this.el.get_active_iter (out iter);
1540 _this.msmodel.el.get_value (iter, 0, out val1);
1543 return (string) val1;
1550 public class Xcls_msmodel : Object
1552 public Gtk.ListStore el;
1553 private NewBranch _this;
1559 public Xcls_msmodel(NewBranch _owner )
1562 _this.msmodel = this;
1563 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
1567 // set gobject values
1570 // user defined functions
1571 public void loadMilestones ( ) {
1573 var rt = RooTicket.singleton();
1574 // rt.loadProjects();
1576 _this.milestone_id.loading = true;
1582 el.append(out iter);
1585 el.set_value(iter, 0, "");
1586 el.set_value(iter, 1, "-- select a milestone --");
1587 _this.milestone_id.el.set_active_iter(iter);
1589 var projects = rt.milestones;
1590 foreach(var project in projects) {
1592 el.append(out iter);
1594 el.set_value(iter, 0, project.id);
1595 el.set_value(iter, 1, project.display_name );
1596 // if (id == project.id) {
1597 // _this.milestone.el.set_active_iter(iter);
1603 _this.milestone_id.loading = false;
1604 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
1610 public class Xcls_Label36 : Object
1612 public Gtk.Label el;
1613 private NewBranch _this;
1619 public Xcls_Label36(NewBranch _owner )
1622 this.el = new Gtk.Label( "Description" );
1626 // set gobject values
1627 this.el.halign = Gtk.Align.START;
1630 // user defined functions
1633 public class Xcls_description : Object
1635 public Gtk.TextView el;
1636 private NewBranch _this;
1642 public Xcls_description(NewBranch _owner )
1645 _this.description = this;
1646 this.el = new Gtk.TextView();
1650 // set gobject values
1651 this.el.border_width = 1;
1654 // user defined functions
1657 public class Xcls_Label38 : Object
1659 public Gtk.Label el;
1660 private NewBranch _this;
1666 public Xcls_Label38(NewBranch _owner )
1669 this.el = new Gtk.Label( "Priority" );
1673 // set gobject values
1674 this.el.halign = Gtk.Align.START;
1675 this.el.xalign = 0.900000f;
1678 // user defined functions
1681 public class Xcls_priority_id : Object
1683 public Gtk.ComboBox el;
1684 private NewBranch _this;
1688 public bool loading;
1691 public Xcls_priority_id(NewBranch _owner )
1694 _this.priority_id = this;
1695 this.el = new Gtk.ComboBox.with_entry();
1698 this.loading = false;
1700 // set gobject values
1701 var child_0 = new Xcls_primodel( _this );
1703 this.el.set_model ( child_0.el );
1707 this.el.set_entry_text_column(1);
1710 // user defined functions
1711 public string selectedPriorityId () {
1716 this.el.get_active_iter (out iter);
1717 _this.primodel.el.get_value (iter, 0, out val1);
1720 return (string) val1;
1727 public class Xcls_primodel : Object
1729 public Gtk.ListStore el;
1730 private NewBranch _this;
1736 public Xcls_primodel(NewBranch _owner )
1739 _this.primodel = this;
1740 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
1744 // set gobject values
1747 // user defined functions
1748 public void loadPriorities ( ) {
1750 var rt = RooTicket.singleton();
1751 // rt.loadProjects();
1753 _this.priority_id.loading = true;
1760 var projects = rt.priorities;
1761 foreach(var project in projects) {
1763 el.append(out iter);
1765 el.set_value(iter, 0, project.id);
1766 el.set_value(iter, 1, project.display_name );
1767 if ("normal" == project.name) {
1768 _this.priority_id.el.set_active_iter(iter);
1773 _this.priority_id.loading = false;
1780 public class Xcls_Label41 : Object
1782 public Gtk.Label el;
1783 private NewBranch _this;
1789 public Xcls_Label41(NewBranch _owner )
1792 this.el = new Gtk.Label( "Severity" );
1796 // set gobject values
1797 this.el.halign = Gtk.Align.START;
1800 // user defined functions
1803 public class Xcls_severity_id : Object
1805 public Gtk.ComboBox el;
1806 private NewBranch _this;
1810 public bool loading;
1813 public Xcls_severity_id(NewBranch _owner )
1816 _this.severity_id = this;
1817 this.el = new Gtk.ComboBox.with_entry();
1820 this.loading = false;
1822 // set gobject values
1823 var child_0 = new Xcls_sevmodel( _this );
1825 this.el.set_model ( child_0.el );
1829 this.el.set_entry_text_column(1);
1832 // user defined functions
1833 public string selectedSeverityId () {
1838 this.el.get_active_iter (out iter);
1839 _this.sevmodel.el.get_value (iter, 0, out val1);
1842 return (string) val1;
1849 public class Xcls_sevmodel : Object
1851 public Gtk.ListStore el;
1852 private NewBranch _this;
1858 public Xcls_sevmodel(NewBranch _owner )
1861 _this.sevmodel = this;
1862 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
1866 // set gobject values
1869 // user defined functions
1870 public void loadSeverities () {
1872 var rt = RooTicket.singleton();
1873 //rt.loadProjects();
1875 _this.severity_id.loading = true;
1881 var projects = rt.serverities;
1882 foreach(var project in projects) {
1884 el.append(out iter);
1886 el.set_value(iter, 0, project.id);
1887 el.set_value(iter, 1, project.display_name );
1888 if ("normal" == project.name) {
1889 _this.severity_id.el.set_active_iter(iter);
1894 _this.severity_id.loading = false;
1895 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
1901 public class Xcls_Label44 : Object
1903 public Gtk.Label el;
1904 private NewBranch _this;
1910 public Xcls_Label44(NewBranch _owner )
1913 this.el = new Gtk.Label( "Classification" );
1917 // set gobject values
1918 this.el.halign = Gtk.Align.START;
1921 // user defined functions
1924 public class Xcls_classification_id : Object
1926 public Gtk.ComboBox el;
1927 private NewBranch _this;
1931 public bool loading;
1934 public Xcls_classification_id(NewBranch _owner )
1937 _this.classification_id = this;
1938 this.el = new Gtk.ComboBox.with_entry();
1941 this.loading = false;
1943 // set gobject values
1944 var child_0 = new Xcls_clmodel( _this );
1946 this.el.set_model ( child_0.el );
1950 this.el.set_entry_text_column(1);
1953 // user defined functions
1954 public string selectedClassificationId () {
1959 this.el.get_active_iter (out iter);
1960 _this.clmodel.el.get_value (iter, 0, out val1);
1963 return (string) val1;
1970 public class Xcls_clmodel : Object
1972 public Gtk.ListStore el;
1973 private NewBranch _this;
1979 public Xcls_clmodel(NewBranch _owner )
1982 _this.clmodel = this;
1983 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
1987 // set gobject values
1990 // user defined functions
1991 public void loadClassifications ( ) {
1993 var rt = RooTicket.singleton();
1994 // rt.loadProjects();
1996 _this.classification_id.loading = true;
2002 el.append(out iter);
2005 var projects = rt.classifications;
2006 foreach(var project in projects) {
2008 el.append(out iter);
2010 el.set_value(iter, 0, project.id);
2011 el.set_value(iter, 1, project.display_name );
2012 if ("bug" == project.name) {
2013 _this.classification_id.el.set_active_iter(iter);
2018 _this.classification_id.loading = false;
2019 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
2025 public class Xcls_Label47 : Object
2027 public Gtk.Label el;
2028 private NewBranch _this;
2034 public Xcls_Label47(NewBranch _owner )
2037 this.el = new Gtk.Label( "Assign to" );
2041 // set gobject values
2042 this.el.halign = Gtk.Align.START;
2045 // user defined functions
2048 public class Xcls_developer_id : Object
2050 public Gtk.ComboBox el;
2051 private NewBranch _this;
2055 public bool loading;
2058 public Xcls_developer_id(NewBranch _owner )
2061 _this.developer_id = this;
2062 this.el = new Gtk.ComboBox.with_entry();
2065 this.loading = false;
2067 // set gobject values
2068 var child_0 = new Xcls_devmodel( _this );
2070 this.el.set_model ( child_0.el );
2074 this.el.set_entry_text_column(1);
2077 // user defined functions
2078 public string selectedDeveloperId () {
2083 this.el.get_active_iter (out iter);
2084 _this.devmodel.el.get_value (iter, 0, out val1);
2087 return (string) val1;
2094 public class Xcls_devmodel : Object
2096 public Gtk.ListStore el;
2097 private NewBranch _this;
2103 public Xcls_devmodel(NewBranch _owner )
2106 _this.devmodel = this;
2107 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
2111 // set gobject values
2114 // user defined functions
2115 public void loadDevelopers ( ) {
2117 var rt = RooTicket.singleton();
2118 //rt.loadProjects();
2120 _this.developer_id.loading = true;
2126 el.append(out iter);
2129 el.set_value(iter, 0, "");
2130 el.set_value(iter, 1, "-- select a developer --");
2132 _this.developer_id.el.set_active_iter(iter);
2135 var peps = rt.developers;
2136 foreach(var p in peps) {
2138 el.append(out iter);
2140 el.set_value(iter, 0, p.id);
2141 el.set_value(iter, 1, p.display_name );
2142 if (rt.authuser_id == p.id) {
2143 _this.developer_id.el.set_active_iter(iter);
2147 _this.developer_id.loading = false;
2148 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
2154 public class Xcls_Button50 : Object
2156 public Gtk.Button el;
2157 private NewBranch _this;
2163 public Xcls_Button50(NewBranch _owner )
2166 this.el = new Gtk.Button();
2170 // set gobject values
2171 this.el.label = "Create Ticket & Branch";
2176 this.el.get_style_context().add_class("suggested-action");
2180 this.el.clicked.connect( () => {
2181 GLib.debug("fire response = 1");
2184 var invalid = false;
2186 // validate first...
2187 _this.project_id.el.get_child().get_style_context().remove_class("warning");
2188 if (_this.project_id.selectedProjectId() == "") {
2189 _this.project_id.el.get_child().get_style_context().add_class("warning");
2193 _this.milestone_id.el.get_child().get_style_context().remove_class("warning");
2195 _this.priority_id.el.get_child().get_style_context().remove_class("warning");
2196 if (_this.priority_id.selectedPriorityId() == "") {
2197 _this.priority_id.el.get_child().get_style_context().add_class("warning");
2201 _this.classification_id.el.get_child().get_style_context().remove_class("warning");
2202 if (_this.classification_id.selectedClassificationId() == "") {
2203 _this.classification_id.el.get_child().get_style_context().add_class("warning");
2207 _this.developer_id.el.get_child().get_style_context().remove_class("warning");
2208 if (_this.developer_id.selectedDeveloperId() == "") {
2209 _this.developer_id.el.get_child().get_style_context().add_class("warning");
2213 _this.summary.el.get_style_context().remove_class("warning");
2214 if (_this.summary.el.get_text() == "") {
2215 _this.summary.el.get_style_context().add_class("warning");
2219 _this.description.el.get_style_context().remove_class("warning");
2224 GLib.debug("for is valid");
2226 _this.el.response(1);
2230 // user defined functions
2235 public class Xcls_quick_commit_tab : Object
2238 private NewBranch _this;
2244 public Xcls_quick_commit_tab(NewBranch _owner )
2247 _this.quick_commit_tab = this;
2248 this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
2252 // set gobject values
2253 this.el.homogeneous = false;
2254 var child_0 = new Xcls_Table52( _this );
2256 this.el.pack_start ( child_0.el , false,false,0 );
2257 var child_1 = new Xcls_ScrolledWindow56( _this );
2259 this.el.add ( child_1.el );
2262 // user defined functions
2263 public void load_data () {
2264 _this.commit_message.el.set_text("");
2268 public class Xcls_Table52 : Object
2270 public Gtk.Table el;
2271 private NewBranch _this;
2277 public Xcls_Table52(NewBranch _owner )
2280 this.el = new Gtk.Table( 2, 5, true );
2284 // set gobject values
2285 this.el.expand = false;
2287 this.el.column_spacing = 4;
2288 this.el.vexpand = false;
2289 var child_0 = new Xcls_Label53( _this );
2291 this.el.attach_defaults ( child_0.el , 0,1,0,1 );
2292 var child_1 = new Xcls_commit_message( _this );
2294 this.el.attach_defaults ( child_1.el , 0,4,1,2 );
2295 var child_2 = new Xcls_createbtn( _this );
2297 this.el.attach_defaults ( child_2.el , 4,5,1,2 );
2300 // user defined functions
2302 public class Xcls_Label53 : Object
2304 public Gtk.Label el;
2305 private NewBranch _this;
2311 public Xcls_Label53(NewBranch _owner )
2314 this.el = new Gtk.Label( "Just commit with this comment" );
2318 // set gobject values
2319 this.el.halign = Gtk.Align.START;
2320 this.el.justify = Gtk.Justification.RIGHT;
2321 this.el.xalign = 0.900000f;
2324 // user defined functions
2327 public class Xcls_commit_message : Object
2329 public Gtk.Entry el;
2330 private NewBranch _this;
2336 public Xcls_commit_message(NewBranch _owner )
2339 _this.commit_message = this;
2340 this.el = new Gtk.Entry();
2344 // set gobject values
2345 this.el.visible = true;
2348 // user defined functions
2351 public class Xcls_createbtn : Object
2353 public Gtk.Button el;
2354 private NewBranch _this;
2360 public Xcls_createbtn(NewBranch _owner )
2363 _this.createbtn = this;
2364 this.el = new Gtk.Button();
2368 // set gobject values
2369 this.el.label = "Commit Changes";
2374 this.el.get_style_context().add_class("suggested-action");
2378 this.el.clicked.connect( () => {
2380 GLib.debug("fire response = 1");
2382 var ticket_id = _this.ticketsel.selectedTicketId();
2384 if (ticket_id == "") {
2385 _this.ticketsel.el.get_child().get_style_context().add_class("warning");
2389 _this.el.response(1);
2393 // user defined functions
2394 public void updateState () {
2396 var ticket_id = _this.ticketsel.selectedTicketId();
2398 if (ticket_id == "") {
2399 this.el.set_sensitive(false);
2403 this.el.set_sensitive(true);
2409 public class Xcls_ScrolledWindow56 : Object
2411 public Gtk.ScrolledWindow el;
2412 private NewBranch _this;
2418 public Xcls_ScrolledWindow56(NewBranch _owner )
2421 this.el = new Gtk.ScrolledWindow( null, null );
2425 // set gobject values
2426 this.el.height_request = 400;
2427 this.el.vexpand = true;
2428 var child_0 = new Xcls_diff_view( _this );
2430 this.el.add ( child_0.el );
2433 // user defined functions
2435 public class Xcls_diff_view : Object
2437 public Gtk.SourceView el;
2438 private NewBranch _this;
2444 public Xcls_diff_view(NewBranch _owner )
2447 _this.diff_view = this;
2448 this.el = new Gtk.SourceView();
2454 var description = Pango.FontDescription.from_string("monospace");
2455 description.set_size(9000);
2456 this.el.override_font(description);
2457 var lm = Gtk.SourceLanguageManager.get_default();
2459 ((Gtk.SourceBuffer)(this.el.get_buffer())).set_language(
2460 lm.get_language("diff")
2464 // user defined functions