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 this.el.switch_page.connect( );
210 // user defined functions
212 public class Xcls_label_select_ticket : Object
215 private NewBranch _this;
221 public Xcls_label_select_ticket(NewBranch _owner )
224 _this.label_select_ticket = this;
225 this.el = new Gtk.Label( "Select Existing Ticket to work on" );
229 // set gobject values
232 // user defined functions
235 public class Xcls_label_create_ticket : Object
238 private NewBranch _this;
244 public Xcls_label_create_ticket(NewBranch _owner )
247 _this.label_create_ticket = this;
248 this.el = new Gtk.Label( "Create a New Ticket" );
252 // set gobject values
255 // user defined functions
258 public class Xcls_label_quick_commit : Object
261 private NewBranch _this;
267 public Xcls_label_quick_commit(NewBranch _owner )
270 _this.label_quick_commit = this;
271 this.el = new Gtk.Label( "Quick Commit" );
275 // set gobject values
278 // user defined functions
281 public class Xcls_select_ticket_tab : Object
284 private NewBranch _this;
290 public Xcls_select_ticket_tab(NewBranch _owner )
293 _this.select_ticket_tab = this;
294 this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
298 // set gobject values
299 this.el.homogeneous = false;
300 var child_0 = new Xcls_Table7( _this );
302 this.el.pack_start ( child_0.el , false,false,0 );
303 var child_1 = new Xcls_scrolled_window( _this );
305 this.el.add ( child_1.el );
308 // user defined functions
309 public void load_data (string tid = "") {
311 GLib.debug("Loading tickets");
313 var curproj = RooProject.getProjectByRepo(_this.repo);
314 _this.prmodel.loadProjects(curproj == null ? "" : curproj.id);
316 _this.dbmodel.loadTickets(curproj == null ? "": curproj.id, tid);
317 _this.branchbtn.updateState();
319 _this.ticketsel.el.get_child().get_style_context().remove_class("warning");
321 var name = RooTicket.singleton().usernameLocal();
322 var ticket = RooTicket.singleton().getById(tid);
323 _this.name.el.set_text("wip_%s_T%s_%s".printf(name,ticket.id, ticket.summaryToBranchName()));
325 _this.ticketsel.el.get_child().get_style_context().add_class("warning");
327 _this.view.loadTicket(tid);
332 public class Xcls_Table7 : Object
335 private NewBranch _this;
341 public Xcls_Table7(NewBranch _owner )
344 this.el = new Gtk.Table( 5, 5, true );
348 // set gobject values
349 this.el.expand = false;
351 this.el.column_spacing = 4;
352 this.el.vexpand = false;
353 var child_0 = new Xcls_Label8( _this );
355 this.el.attach_defaults ( child_0.el , 0,1,0,1 );
356 var child_1 = new Xcls_Label9( _this );
358 this.el.attach_defaults ( child_1.el , 1,2,0,1 );
359 var child_2 = new Xcls_projectsel( _this );
361 this.el.attach_defaults ( child_2.el , 0,1,1,2 );
362 var child_3 = new Xcls_ticketsel( _this );
364 this.el.attach_defaults ( child_3.el , 1,5,1,2 );
365 var child_4 = new Xcls_Label16( _this );
367 this.el.attach_defaults ( child_4.el , 0,1,3,4 );
368 var child_5 = new Xcls_name( _this );
370 this.el.attach_defaults ( child_5.el , 0,4,4,5 );
371 var child_6 = new Xcls_branchbtn( _this );
373 this.el.attach_defaults ( child_6.el , 4,5,4,5 );
374 var child_7 = new Xcls_Box19( _this );
376 this.el.attach_defaults ( child_7.el , 0,5,2,3 );
379 // user defined functions
381 public class Xcls_Label8 : Object
384 private NewBranch _this;
390 public Xcls_Label8(NewBranch _owner )
393 this.el = new Gtk.Label( "Project" );
397 // set gobject values
398 this.el.halign = Gtk.Align.START;
399 this.el.justify = Gtk.Justification.RIGHT;
400 this.el.visible = true;
403 // user defined functions
406 public class Xcls_Label9 : Object
409 private NewBranch _this;
415 public Xcls_Label9(NewBranch _owner )
418 this.el = new Gtk.Label( "Ticket" );
422 // set gobject values
423 this.el.halign = Gtk.Align.START;
424 this.el.visible = true;
427 // user defined functions
430 public class Xcls_projectsel : Object
432 public Gtk.ComboBox el;
433 private NewBranch _this;
440 public Xcls_projectsel(NewBranch _owner )
443 _this.projectsel = this;
444 this.el = new Gtk.ComboBox.with_entry();
447 this.loading = false;
449 // set gobject values
450 var child_0 = new Xcls_prcellrenderer( _this );
452 this.el.pack_start ( child_0.el , true );
453 var child_1 = new Xcls_prmodel( _this );
455 this.el.set_model ( child_1.el );
459 this.el.set_entry_text_column(1);
462 this.el.changed.connect( () => {
466 var project_id = this.selectedProjectId();
467 _this.dbmodel.loadTickets(project_id);
470 /*if (this.loading) {
473 var ticket_id = this.selectedTicketId();
475 var name = RooTicket.singleton().usernameLocal();
477 if (ticket_id == "" || ticket_id == null) {
479 var dt = new DateTime.now_local();
480 _this.name.el.set_text("wip_%s_%s".printf(name,dt.format("%Y_%b_%d")));
485 var ticket = RooTicket.singleton().getById(ticket_id);
487 _this.name.el.set_text("wip_%s_T%s_%s".printf(name,ticket.id, ticket.summaryToBranchName()));
489 //GLib.debug (//"Selection: %s, %s\n", (string) val1, (string) val2);
494 // user defined functions
495 public string selectedProjectId () {
500 this.el.get_active_iter (out iter);
501 _this.prmodel.el.get_value (iter, 0, out val1);
504 return (string) val1;
511 public class Xcls_prcellrenderer : Object
513 public Gtk.CellRendererText el;
514 private NewBranch _this;
520 public Xcls_prcellrenderer(NewBranch _owner )
523 _this.prcellrenderer = this;
524 this.el = new Gtk.CellRendererText();
528 // set gobject values
531 // user defined functions
534 public class Xcls_prmodel : Object
536 public Gtk.ListStore el;
537 private NewBranch _this;
543 public Xcls_prmodel(NewBranch _owner )
546 _this.prmodel = this;
547 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
551 // set gobject values
554 // user defined functions
555 public void loadProjects (string id) {
559 _this.projectsel.loading = true;
568 el.set_value(iter, 0, "");
569 el.set_value(iter, 1, "-- select a project --");
571 _this.projectsel.el.set_active_iter(iter);
574 foreach(var project in RooProject.projects()) {
578 el.set_value(iter, 0, project.id);
579 el.set_value(iter, 1, project.name );
580 if (id == project.id) {
581 _this.projectsel.el.set_active_iter(iter);
586 _this.projectsel.loading = false;
587 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
593 public class Xcls_ticketsel : Object
595 public Gtk.ComboBox el;
596 private NewBranch _this;
603 public Xcls_ticketsel(NewBranch _owner )
606 _this.ticketsel = this;
607 this.el = new Gtk.ComboBox.with_entry();
610 this.loading = false;
612 // set gobject values
613 var child_0 = new Xcls_dbcellrenderer( _this );
615 this.el.pack_start ( child_0.el , true );
616 var child_1 = new Xcls_dbmodel( _this );
618 this.el.set_model ( child_1.el );
622 //this.el.add_attribute(_this.dbcellrenderer.el , "markup", 1 );
623 this.el.set_entry_text_column(1);
624 this.el.get_child().set_sensitive(false);
627 this.el.changed.connect( () => {
631 var ticket_id = this.selectedTicketId();
633 var name = RooTicket.singleton().usernameLocal();
635 this.el.get_child().get_style_context().remove_class("warning");
636 if (ticket_id == "" || ticket_id == null) {
638 var dt = new DateTime.now_local();
639 _this.name.el.set_text("wip_%s_%s".printf(name,dt.format("%Y_%b_%d")));
640 _this.view.loadTicket("");
642 this.el.get_child().get_style_context().add_class("warning");
643 _this.createbtn.updateState();
648 var ticket = RooTicket.singleton().getById(ticket_id);
650 _this.name.el.set_text("wip_%s_T%s_%s".printf(name,ticket.id, ticket.summaryToBranchName()));
651 _this.scrolled_window.el.show();
653 _this.view.loadTicket(ticket.id);
654 _this.branchbtn.updateState();
656 //GLib.debug (//"Selection: %s, %s\n", (string) val1, (string) val2);
660 // user defined functions
661 public string selectedTicketId () {
666 this.el.get_active_iter (out iter);
667 _this.dbmodel.el.get_value (iter, 0, out val1);
670 return (string) val1;
677 public class Xcls_dbcellrenderer : Object
679 public Gtk.CellRendererText el;
680 private NewBranch _this;
686 public Xcls_dbcellrenderer(NewBranch _owner )
689 _this.dbcellrenderer = this;
690 this.el = new Gtk.CellRendererText();
694 // set gobject values
697 // user defined functions
700 public class Xcls_dbmodel : Object
702 public Gtk.ListStore el;
703 private NewBranch _this;
709 public Xcls_dbmodel(NewBranch _owner )
712 _this.dbmodel = this;
713 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
717 // set gobject values
720 // user defined functions
721 public void loadTickets (string project_id , string tid = "") {
725 // fixme .. get project id from selection..
727 RooTicket.singleton().loadTickets(
729 _this.btn_not_me.el.active ? RooTicket.Who.ANYBODY : RooTicket.Who.ME,
730 _this.btn_closed.el.active ? RooTicket.Status.ALL : RooTicket.Status.ACTIVE
733 _this.ticketsel.loading = true;
742 el.set_value(iter, 0, "");
743 el.set_value(iter, 1, "-- select a ticket --");
745 _this.ticketsel.el.set_active_iter(iter);
746 var tickets = RooTicket.singleton().tickets;
747 foreach(var ticket in tickets) {
751 el.set_value(iter, 0, ticket.id);
752 el.set_value(iter, 1, "#%s %s".printf( ticket.id, ticket.summary));
754 if (ticket.id == tid) {
755 _this.ticketsel.el.set_active_iter(iter);
760 _this.ticketsel.loading = false;
761 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
767 public class Xcls_Label16 : Object
770 private NewBranch _this;
776 public Xcls_Label16(NewBranch _owner )
779 this.el = new Gtk.Label( "Use this as branch name" );
783 // set gobject values
784 this.el.halign = Gtk.Align.START;
785 this.el.justify = Gtk.Justification.RIGHT;
786 this.el.xalign = 0.900000f;
789 // user defined functions
792 public class Xcls_name : Object
795 private NewBranch _this;
801 public Xcls_name(NewBranch _owner )
805 this.el = new Gtk.Entry();
809 // set gobject values
810 this.el.visible = true;
813 // user defined functions
816 public class Xcls_branchbtn : Object
818 public Gtk.Button el;
819 private NewBranch _this;
825 public Xcls_branchbtn(NewBranch _owner )
828 _this.branchbtn = this;
829 this.el = new Gtk.Button();
833 // set gobject values
834 this.el.label = "Create Branch";
839 this.el.get_style_context().add_class("suggested-action");
843 this.el.clicked.connect( () => {
845 GLib.debug("fire response = 1");
847 var ticket_id = _this.ticketsel.selectedTicketId();
849 if (ticket_id == "") {
850 _this.ticketsel.el.get_child().get_style_context().add_class("warning");
854 _this.el.response(1);
858 // user defined functions
859 public void updateState () {
861 var ticket_id = _this.ticketsel.selectedTicketId();
863 if (ticket_id == "") {
864 this.el.set_sensitive(false);
868 this.el.set_sensitive(true);
873 public class Xcls_Box19 : Object
876 private NewBranch _this;
882 public Xcls_Box19(NewBranch _owner )
885 this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
889 // set gobject values
890 var child_0 = new Xcls_btn_not_me( _this );
892 this.el.add ( child_0.el );
893 var child_1 = new Xcls_btn_closed( _this );
895 this.el.add ( child_1.el );
896 var child_2 = new Xcls_Label22( _this );
898 this.el.add ( child_2.el );
901 // user defined functions
903 public class Xcls_btn_not_me : Object
905 public Gtk.CheckButton el;
906 private NewBranch _this;
912 public Xcls_btn_not_me(NewBranch _owner )
915 _this.btn_not_me = this;
916 this.el = new Gtk.CheckButton();
920 // set gobject values
921 this.el.label = "Show tickets not assigned to me";
924 this.el.toggled.connect( () => {
925 var project_id = _this.projectsel.selectedProjectId();
926 _this.dbmodel.loadTickets(project_id);
930 // user defined functions
933 public class Xcls_btn_closed : Object
935 public Gtk.CheckButton el;
936 private NewBranch _this;
942 public Xcls_btn_closed(NewBranch _owner )
945 _this.btn_closed = this;
946 this.el = new Gtk.CheckButton();
950 // set gobject values
951 this.el.label = "Show closed Tickets";
954 this.el.toggled.connect( () => {
955 var project_id = _this.projectsel.selectedProjectId();
956 _this.dbmodel.loadTickets(project_id);
961 // user defined functions
964 public class Xcls_Label22 : Object
967 private NewBranch _this;
973 public Xcls_Label22(NewBranch _owner )
976 this.el = new Gtk.Label( "<a href=\"refresh\">Refresh Ticket list</a>" );
980 // set gobject values
981 this.el.halign = Gtk.Align.END;
982 this.el.hexpand = true;
983 this.el.use_markup = true;
986 this.el.activate_link.connect( (uri) => {
987 if (uri == "refresh") {
989 var curproj = RooProject.getProjectByRepo(_this.repo);
990 _this.prmodel.loadProjects(curproj == null ? "": curproj.id);
992 _this.dbmodel.loadTickets(curproj == null ? "": curproj.id);
998 // user defined functions
1003 public class Xcls_scrolled_window : Object
1005 public Gtk.ScrolledWindow el;
1006 private NewBranch _this;
1012 public Xcls_scrolled_window(NewBranch _owner )
1015 _this.scrolled_window = this;
1016 this.el = new Gtk.ScrolledWindow( null, null );
1020 // set gobject values
1021 this.el.height_request = 500;
1022 this.el.vexpand = true;
1023 var child_0 = new Xcls_view( _this );
1025 this.el.add ( child_0.el );
1030 this.el.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);
1034 // user defined functions
1036 public class Xcls_view : Object
1038 public WebKit.WebView el;
1039 private NewBranch _this;
1045 public Xcls_view(NewBranch _owner )
1049 this.el = new WebKit.WebView();
1053 // set gobject values
1056 // user defined functions
1057 public void loadTicket (string tid) {
1059 _this.el.get_size(out w, out h);
1062 _this.scrolled_window.el.hide();
1063 _this.el.resize(w, 150);
1065 _this.scrolled_window.el.show();
1066 _this.el.resize(w, 800);
1069 var rs = RooTicket.singleton();
1070 var uri = new WebKit.URIRequest("https://roojs.com/admin.php/MTrack/View/" + tid);
1071 var hd = uri.get_http_headers();
1072 var authCode = Base64.encode ("%s:%s".printf(rs.username, rs.password).data);
1073 hd.append("Authorization", "Basic %s".printf(authCode));
1075 this.el.load_request(uri);
1081 public class Xcls_create_ticket_tab : Object
1084 private NewBranch _this;
1090 public Xcls_create_ticket_tab(NewBranch _owner )
1093 _this.create_ticket_tab = this;
1094 this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
1098 // set gobject values
1099 this.el.homogeneous = false;
1100 var child_0 = new Xcls_table( _this );
1102 this.el.pack_start ( child_0.el , false,false,0 );
1105 // user defined functions
1106 public void load_data () {
1110 Timeout.add_seconds(1, () => {
1112 RooProject? curproj = null;
1113 if (_this.repo != null) {
1114 curproj = RooProject.getProjectByRepo(_this.repo);
1116 _this.prmodel.loadProjects(curproj == null ? "" : curproj.id);
1117 if (curproj != null) {
1120 var rt = RooTicket.singleton();
1121 rt.loadProjectOptions(curproj.id);
1123 _this.msmodel.loadMilestones();
1124 _this.primodel.loadPriorities();
1125 _this.sevmodel.loadSeverities();
1126 _this.clmodel.loadClassifications();
1127 _this.devmodel.loadDevelopers();
1130 _this.summary.el.set_text("");
1131 _this.description.el.buffer.text = "";
1132 //_this.spinner.el.stop();
1133 //_this.spinner.el.hide();
1135 _this.table.el.show();
1136 //_this.summary.el.grab_focus();
1142 public class Xcls_table : Object
1144 public Gtk.Table el;
1145 private NewBranch _this;
1151 public Xcls_table(NewBranch _owner )
1155 this.el = new Gtk.Table( 14, 4, true );
1159 // set gobject values
1160 this.el.expand = false;
1162 this.el.column_spacing = 4;
1163 this.el.vexpand = false;
1164 var child_0 = new Xcls_Label27( _this );
1166 this.el.attach_defaults ( child_0.el , 0,1,0,1 );
1167 var child_1 = new Xcls_Label28( _this );
1169 this.el.attach_defaults ( child_1.el , 1,2,0,1 );
1170 var child_2 = new Xcls_project_id( _this );
1172 this.el.attach_defaults ( child_2.el , 0,1,1,2 );
1173 var child_3 = new Xcls_summary( _this );
1175 this.el.attach_defaults ( child_3.el , 1,4,1,2 );
1176 var child_4 = new Xcls_Label33( _this );
1178 this.el.attach_defaults ( child_4.el , 0,1,2,3 );
1179 var child_5 = new Xcls_milestone_id( _this );
1181 this.el.attach_defaults ( child_5.el , 0,1,3,4 );
1182 var child_6 = new Xcls_Label36( _this );
1184 this.el.attach_defaults ( child_6.el , 1,4,2,3 );
1185 var child_7 = new Xcls_description( _this );
1187 this.el.attach_defaults ( child_7.el , 1,4,3,12 );
1188 var child_8 = new Xcls_Label38( _this );
1190 this.el.attach_defaults ( child_8.el , 0,1,4,5 );
1191 var child_9 = new Xcls_priority_id( _this );
1193 this.el.attach_defaults ( child_9.el , 0,1,5,6 );
1194 var child_10 = new Xcls_Label41( _this );
1196 this.el.attach_defaults ( child_10.el , 0,1,6,7 );
1197 var child_11 = new Xcls_severity_id( _this );
1199 this.el.attach_defaults ( child_11.el , 0,1,7,8 );
1200 var child_12 = new Xcls_Label44( _this );
1202 this.el.attach_defaults ( child_12.el , 0,1,8,9 );
1203 var child_13 = new Xcls_classification_id( _this );
1205 this.el.attach_defaults ( child_13.el , 0,1,9,10 );
1206 var child_14 = new Xcls_Label47( _this );
1208 this.el.attach_defaults ( child_14.el , 0,1,10,11 );
1209 var child_15 = new Xcls_developer_id( _this );
1211 this.el.attach_defaults ( child_15.el , 0,1,11,12 );
1212 var child_16 = new Xcls_Button50( _this );
1214 this.el.attach_defaults ( child_16.el , 0,4,13,14 );
1217 // user defined functions
1219 public class Xcls_Label27 : Object
1221 public Gtk.Label el;
1222 private NewBranch _this;
1228 public Xcls_Label27(NewBranch _owner )
1231 this.el = new Gtk.Label( "Project" );
1235 // set gobject values
1236 this.el.halign = Gtk.Align.START;
1237 this.el.visible = true;
1240 // user defined functions
1243 public class Xcls_Label28 : Object
1245 public Gtk.Label el;
1246 private NewBranch _this;
1252 public Xcls_Label28(NewBranch _owner )
1255 this.el = new Gtk.Label( "Summary" );
1259 // set gobject values
1260 this.el.halign = Gtk.Align.START;
1261 this.el.visible = true;
1264 // user defined functions
1267 public class Xcls_project_id : Object
1269 public Gtk.ComboBox el;
1270 private NewBranch _this;
1274 public bool loading;
1277 public Xcls_project_id(NewBranch _owner )
1280 _this.project_id = this;
1281 this.el = new Gtk.ComboBox.with_entry();
1284 this.loading = false;
1286 // set gobject values
1287 var child_0 = new Xcls_tprcellrenderer( _this );
1289 this.el.pack_start ( child_0.el , true );
1290 var child_1 = new Xcls_tprmodel( _this );
1292 this.el.set_model ( child_1.el );
1296 this.el.set_entry_text_column(1);
1299 this.el.changed.connect( () => {
1303 var project_id = this.selectedProjectId();
1305 var rt = RooTicket.singleton();
1306 rt.loadProjectOptions(project_id);
1308 _this.msmodel.loadMilestones();
1309 _this.primodel.loadPriorities();
1310 _this.sevmodel.loadSeverities();
1311 _this.clmodel.loadClassifications();
1312 _this.devmodel.loadDevelopers();
1314 // affects projects and milestones..
1317 /*if (this.loading) {
1320 var ticket_id = this.selectedTicketId();
1322 var name = RooTicket.singleton().usernameLocal();
1324 if (ticket_id == "" || ticket_id == null) {
1326 var dt = new DateTime.now_local();
1327 _this.name.el.set_text("wip_%s_%s".printf(name,dt.format("%Y_%b_%d")));
1332 var ticket = RooTicket.singleton().getById(ticket_id);
1334 _this.name.el.set_text("wip_%s_T%s_%s".printf(name,ticket.id, ticket.summaryToBranchName()));
1336 //GLib.debug (//"Selection: %s, %s\n", (string) val1, (string) val2);
1341 // user defined functions
1342 public string selectedProjectId () {
1347 this.el.get_active_iter (out iter);
1348 _this.tprmodel.el.get_value (iter, 0, out val1);
1351 return (string) val1;
1358 public class Xcls_tprcellrenderer : Object
1360 public Gtk.CellRendererText el;
1361 private NewBranch _this;
1367 public Xcls_tprcellrenderer(NewBranch _owner )
1370 _this.tprcellrenderer = this;
1371 this.el = new Gtk.CellRendererText();
1375 // set gobject values
1378 // user defined functions
1381 public class Xcls_tprmodel : Object
1383 public Gtk.ListStore el;
1384 private NewBranch _this;
1390 public Xcls_tprmodel(NewBranch _owner )
1393 _this.tprmodel = this;
1394 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
1398 // set gobject values
1401 // user defined functions
1402 public void loadProjects (string id) {
1405 _this.project_id.loading = true;
1411 el.append(out iter);
1414 el.set_value(iter, 0, "");
1415 el.set_value(iter, 1, "-- select a project --");
1417 _this.project_id.el.set_active_iter(iter);
1420 foreach(var project in RooProject.projects()) {
1422 el.append(out iter);
1424 el.set_value(iter, 0, project.id);
1425 el.set_value(iter, 1, project.name );
1426 if (id == project.id) {
1427 _this.project_id.el.set_active_iter(iter);
1432 _this.project_id.loading = false;
1433 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
1439 public class Xcls_summary : Object
1441 public Gtk.Entry el;
1442 private NewBranch _this;
1448 public Xcls_summary(NewBranch _owner )
1451 _this.summary = this;
1452 this.el = new Gtk.Entry();
1456 // set gobject values
1457 this.el.visible = true;
1460 // user defined functions
1463 public class Xcls_Label33 : Object
1465 public Gtk.Label el;
1466 private NewBranch _this;
1472 public Xcls_Label33(NewBranch _owner )
1475 this.el = new Gtk.Label( "Milestone" );
1479 // set gobject values
1480 this.el.halign = Gtk.Align.START;
1481 this.el.justify = Gtk.Justification.RIGHT;
1482 this.el.xalign = 0.900000f;
1485 // user defined functions
1488 public class Xcls_milestone_id : Object
1490 public Gtk.ComboBox el;
1491 private NewBranch _this;
1495 public bool loading;
1498 public Xcls_milestone_id(NewBranch _owner )
1501 _this.milestone_id = this;
1502 this.el = new Gtk.ComboBox.with_entry();
1505 this.loading = false;
1507 // set gobject values
1508 var child_0 = new Xcls_msmodel( _this );
1510 this.el.set_model ( child_0.el );
1514 this.el.set_entry_text_column(1);
1517 // user defined functions
1518 public string selectedMilestoneId () {
1523 this.el.get_active_iter (out iter);
1524 _this.msmodel.el.get_value (iter, 0, out val1);
1527 return (string) val1;
1534 public class Xcls_msmodel : Object
1536 public Gtk.ListStore el;
1537 private NewBranch _this;
1543 public Xcls_msmodel(NewBranch _owner )
1546 _this.msmodel = this;
1547 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
1551 // set gobject values
1554 // user defined functions
1555 public void loadMilestones ( ) {
1557 var rt = RooTicket.singleton();
1558 // rt.loadProjects();
1560 _this.milestone_id.loading = true;
1566 el.append(out iter);
1569 el.set_value(iter, 0, "");
1570 el.set_value(iter, 1, "-- select a milestone --");
1571 _this.milestone_id.el.set_active_iter(iter);
1573 var projects = rt.milestones;
1574 foreach(var project in projects) {
1576 el.append(out iter);
1578 el.set_value(iter, 0, project.id);
1579 el.set_value(iter, 1, project.display_name );
1580 // if (id == project.id) {
1581 // _this.milestone.el.set_active_iter(iter);
1587 _this.milestone_id.loading = false;
1588 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
1594 public class Xcls_Label36 : Object
1596 public Gtk.Label el;
1597 private NewBranch _this;
1603 public Xcls_Label36(NewBranch _owner )
1606 this.el = new Gtk.Label( "Description" );
1610 // set gobject values
1611 this.el.halign = Gtk.Align.START;
1614 // user defined functions
1617 public class Xcls_description : Object
1619 public Gtk.TextView el;
1620 private NewBranch _this;
1626 public Xcls_description(NewBranch _owner )
1629 _this.description = this;
1630 this.el = new Gtk.TextView();
1634 // set gobject values
1635 this.el.border_width = 1;
1638 // user defined functions
1641 public class Xcls_Label38 : Object
1643 public Gtk.Label el;
1644 private NewBranch _this;
1650 public Xcls_Label38(NewBranch _owner )
1653 this.el = new Gtk.Label( "Priority" );
1657 // set gobject values
1658 this.el.halign = Gtk.Align.START;
1659 this.el.xalign = 0.900000f;
1662 // user defined functions
1665 public class Xcls_priority_id : Object
1667 public Gtk.ComboBox el;
1668 private NewBranch _this;
1672 public bool loading;
1675 public Xcls_priority_id(NewBranch _owner )
1678 _this.priority_id = this;
1679 this.el = new Gtk.ComboBox.with_entry();
1682 this.loading = false;
1684 // set gobject values
1685 var child_0 = new Xcls_primodel( _this );
1687 this.el.set_model ( child_0.el );
1691 this.el.set_entry_text_column(1);
1694 // user defined functions
1695 public string selectedPriorityId () {
1700 this.el.get_active_iter (out iter);
1701 _this.primodel.el.get_value (iter, 0, out val1);
1704 return (string) val1;
1711 public class Xcls_primodel : Object
1713 public Gtk.ListStore el;
1714 private NewBranch _this;
1720 public Xcls_primodel(NewBranch _owner )
1723 _this.primodel = this;
1724 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
1728 // set gobject values
1731 // user defined functions
1732 public void loadPriorities ( ) {
1734 var rt = RooTicket.singleton();
1735 // rt.loadProjects();
1737 _this.priority_id.loading = true;
1744 var projects = rt.priorities;
1745 foreach(var project in projects) {
1747 el.append(out iter);
1749 el.set_value(iter, 0, project.id);
1750 el.set_value(iter, 1, project.display_name );
1751 if ("normal" == project.name) {
1752 _this.priority_id.el.set_active_iter(iter);
1757 _this.priority_id.loading = false;
1764 public class Xcls_Label41 : Object
1766 public Gtk.Label el;
1767 private NewBranch _this;
1773 public Xcls_Label41(NewBranch _owner )
1776 this.el = new Gtk.Label( "Severity" );
1780 // set gobject values
1781 this.el.halign = Gtk.Align.START;
1784 // user defined functions
1787 public class Xcls_severity_id : Object
1789 public Gtk.ComboBox el;
1790 private NewBranch _this;
1794 public bool loading;
1797 public Xcls_severity_id(NewBranch _owner )
1800 _this.severity_id = this;
1801 this.el = new Gtk.ComboBox.with_entry();
1804 this.loading = false;
1806 // set gobject values
1807 var child_0 = new Xcls_sevmodel( _this );
1809 this.el.set_model ( child_0.el );
1813 this.el.set_entry_text_column(1);
1816 // user defined functions
1817 public string selectedSeverityId () {
1822 this.el.get_active_iter (out iter);
1823 _this.sevmodel.el.get_value (iter, 0, out val1);
1826 return (string) val1;
1833 public class Xcls_sevmodel : Object
1835 public Gtk.ListStore el;
1836 private NewBranch _this;
1842 public Xcls_sevmodel(NewBranch _owner )
1845 _this.sevmodel = this;
1846 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
1850 // set gobject values
1853 // user defined functions
1854 public void loadSeverities () {
1856 var rt = RooTicket.singleton();
1857 //rt.loadProjects();
1859 _this.severity_id.loading = true;
1865 var projects = rt.serverities;
1866 foreach(var project in projects) {
1868 el.append(out iter);
1870 el.set_value(iter, 0, project.id);
1871 el.set_value(iter, 1, project.display_name );
1872 if ("normal" == project.name) {
1873 _this.severity_id.el.set_active_iter(iter);
1878 _this.severity_id.loading = false;
1879 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
1885 public class Xcls_Label44 : Object
1887 public Gtk.Label el;
1888 private NewBranch _this;
1894 public Xcls_Label44(NewBranch _owner )
1897 this.el = new Gtk.Label( "Classification" );
1901 // set gobject values
1902 this.el.halign = Gtk.Align.START;
1905 // user defined functions
1908 public class Xcls_classification_id : Object
1910 public Gtk.ComboBox el;
1911 private NewBranch _this;
1915 public bool loading;
1918 public Xcls_classification_id(NewBranch _owner )
1921 _this.classification_id = this;
1922 this.el = new Gtk.ComboBox.with_entry();
1925 this.loading = false;
1927 // set gobject values
1928 var child_0 = new Xcls_clmodel( _this );
1930 this.el.set_model ( child_0.el );
1934 this.el.set_entry_text_column(1);
1937 // user defined functions
1938 public string selectedClassificationId () {
1943 this.el.get_active_iter (out iter);
1944 _this.clmodel.el.get_value (iter, 0, out val1);
1947 return (string) val1;
1954 public class Xcls_clmodel : Object
1956 public Gtk.ListStore el;
1957 private NewBranch _this;
1963 public Xcls_clmodel(NewBranch _owner )
1966 _this.clmodel = this;
1967 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
1971 // set gobject values
1974 // user defined functions
1975 public void loadClassifications ( ) {
1977 var rt = RooTicket.singleton();
1978 // rt.loadProjects();
1980 _this.classification_id.loading = true;
1986 el.append(out iter);
1989 var projects = rt.classifications;
1990 foreach(var project in projects) {
1992 el.append(out iter);
1994 el.set_value(iter, 0, project.id);
1995 el.set_value(iter, 1, project.display_name );
1996 if ("bug" == project.name) {
1997 _this.classification_id.el.set_active_iter(iter);
2002 _this.classification_id.loading = false;
2003 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
2009 public class Xcls_Label47 : Object
2011 public Gtk.Label el;
2012 private NewBranch _this;
2018 public Xcls_Label47(NewBranch _owner )
2021 this.el = new Gtk.Label( "Assign to" );
2025 // set gobject values
2026 this.el.halign = Gtk.Align.START;
2029 // user defined functions
2032 public class Xcls_developer_id : Object
2034 public Gtk.ComboBox el;
2035 private NewBranch _this;
2039 public bool loading;
2042 public Xcls_developer_id(NewBranch _owner )
2045 _this.developer_id = this;
2046 this.el = new Gtk.ComboBox.with_entry();
2049 this.loading = false;
2051 // set gobject values
2052 var child_0 = new Xcls_devmodel( _this );
2054 this.el.set_model ( child_0.el );
2058 this.el.set_entry_text_column(1);
2061 // user defined functions
2062 public string selectedDeveloperId () {
2067 this.el.get_active_iter (out iter);
2068 _this.devmodel.el.get_value (iter, 0, out val1);
2071 return (string) val1;
2078 public class Xcls_devmodel : Object
2080 public Gtk.ListStore el;
2081 private NewBranch _this;
2087 public Xcls_devmodel(NewBranch _owner )
2090 _this.devmodel = this;
2091 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
2095 // set gobject values
2098 // user defined functions
2099 public void loadDevelopers ( ) {
2101 var rt = RooTicket.singleton();
2102 //rt.loadProjects();
2104 _this.developer_id.loading = true;
2110 el.append(out iter);
2113 el.set_value(iter, 0, "");
2114 el.set_value(iter, 1, "-- select a developer --");
2116 _this.developer_id.el.set_active_iter(iter);
2119 var peps = rt.developers;
2120 foreach(var p in peps) {
2122 el.append(out iter);
2124 el.set_value(iter, 0, p.id);
2125 el.set_value(iter, 1, p.display_name );
2126 if (rt.authuser_id == p.id) {
2127 _this.developer_id.el.set_active_iter(iter);
2131 _this.developer_id.loading = false;
2132 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
2138 public class Xcls_Button50 : Object
2140 public Gtk.Button el;
2141 private NewBranch _this;
2147 public Xcls_Button50(NewBranch _owner )
2150 this.el = new Gtk.Button();
2154 // set gobject values
2155 this.el.label = "Create Ticket & Branch";
2160 this.el.get_style_context().add_class("suggested-action");
2164 this.el.clicked.connect( () => {
2165 GLib.debug("fire response = 1");
2168 var invalid = false;
2170 // validate first...
2171 _this.project_id.el.get_child().get_style_context().remove_class("warning");
2172 if (_this.project_id.selectedProjectId() == "") {
2173 _this.project_id.el.get_child().get_style_context().add_class("warning");
2177 _this.milestone_id.el.get_child().get_style_context().remove_class("warning");
2179 _this.priority_id.el.get_child().get_style_context().remove_class("warning");
2180 if (_this.priority_id.selectedPriorityId() == "") {
2181 _this.priority_id.el.get_child().get_style_context().add_class("warning");
2185 _this.classification_id.el.get_child().get_style_context().remove_class("warning");
2186 if (_this.classification_id.selectedClassificationId() == "") {
2187 _this.classification_id.el.get_child().get_style_context().add_class("warning");
2191 _this.developer_id.el.get_child().get_style_context().remove_class("warning");
2192 if (_this.developer_id.selectedDeveloperId() == "") {
2193 _this.developer_id.el.get_child().get_style_context().add_class("warning");
2197 _this.summary.el.get_style_context().remove_class("warning");
2198 if (_this.summary.el.get_text() == "") {
2199 _this.summary.el.get_style_context().add_class("warning");
2203 _this.description.el.get_style_context().remove_class("warning");
2208 GLib.debug("for is valid");
2210 _this.el.response(1);
2214 // user defined functions
2219 public class Xcls_quick_commit_tab : Object
2222 private NewBranch _this;
2228 public Xcls_quick_commit_tab(NewBranch _owner )
2231 _this.quick_commit_tab = this;
2232 this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
2236 // set gobject values
2237 this.el.homogeneous = false;
2238 var child_0 = new Xcls_Table52( _this );
2240 this.el.pack_start ( child_0.el , false,false,0 );
2241 var child_1 = new Xcls_ScrolledWindow56( _this );
2243 this.el.add ( child_1.el );
2246 // user defined functions
2247 public void load_data () {
2248 _this.commit_message.el.set_text("");
2252 public class Xcls_Table52 : Object
2254 public Gtk.Table el;
2255 private NewBranch _this;
2261 public Xcls_Table52(NewBranch _owner )
2264 this.el = new Gtk.Table( 2, 5, true );
2268 // set gobject values
2269 this.el.expand = false;
2271 this.el.column_spacing = 4;
2272 this.el.vexpand = false;
2273 var child_0 = new Xcls_Label53( _this );
2275 this.el.attach_defaults ( child_0.el , 0,1,0,1 );
2276 var child_1 = new Xcls_commit_message( _this );
2278 this.el.attach_defaults ( child_1.el , 0,4,1,2 );
2279 var child_2 = new Xcls_createbtn( _this );
2281 this.el.attach_defaults ( child_2.el , 4,5,1,2 );
2284 // user defined functions
2286 public class Xcls_Label53 : Object
2288 public Gtk.Label el;
2289 private NewBranch _this;
2295 public Xcls_Label53(NewBranch _owner )
2298 this.el = new Gtk.Label( "Just commit with this comment" );
2302 // set gobject values
2303 this.el.halign = Gtk.Align.START;
2304 this.el.justify = Gtk.Justification.RIGHT;
2305 this.el.xalign = 0.900000f;
2308 // user defined functions
2311 public class Xcls_commit_message : Object
2313 public Gtk.Entry el;
2314 private NewBranch _this;
2320 public Xcls_commit_message(NewBranch _owner )
2323 _this.commit_message = this;
2324 this.el = new Gtk.Entry();
2328 // set gobject values
2329 this.el.visible = true;
2332 // user defined functions
2335 public class Xcls_createbtn : Object
2337 public Gtk.Button el;
2338 private NewBranch _this;
2344 public Xcls_createbtn(NewBranch _owner )
2347 _this.createbtn = this;
2348 this.el = new Gtk.Button();
2352 // set gobject values
2353 this.el.label = "Commit Changes";
2358 this.el.get_style_context().add_class("suggested-action");
2362 this.el.clicked.connect( () => {
2364 GLib.debug("fire response = 1");
2366 var ticket_id = _this.ticketsel.selectedTicketId();
2368 if (ticket_id == "") {
2369 _this.ticketsel.el.get_child().get_style_context().add_class("warning");
2373 _this.el.response(1);
2377 // user defined functions
2378 public void updateState () {
2380 var ticket_id = _this.ticketsel.selectedTicketId();
2382 if (ticket_id == "") {
2383 this.el.set_sensitive(false);
2387 this.el.set_sensitive(true);
2393 public class Xcls_ScrolledWindow56 : Object
2395 public Gtk.ScrolledWindow el;
2396 private NewBranch _this;
2402 public Xcls_ScrolledWindow56(NewBranch _owner )
2405 this.el = new Gtk.ScrolledWindow( null, null );
2409 // set gobject values
2410 this.el.height_request = 400;
2411 this.el.vexpand = true;
2412 var child_0 = new Xcls_diff_view( _this );
2414 this.el.add ( child_0.el );
2417 // user defined functions
2419 public class Xcls_diff_view : Object
2421 public Gtk.SourceView el;
2422 private NewBranch _this;
2428 public Xcls_diff_view(NewBranch _owner )
2431 _this.diff_view = this;
2432 this.el = new Gtk.SourceView();
2438 var description = Pango.FontDescription.from_string("monospace");
2439 description.set_size(9000);
2440 this.el.override_font(description);
2441 var lm = Gtk.SourceLanguageManager.get_default();
2443 ((Gtk.SourceBuffer)(this.el.get_buffer())).set_language(
2444 lm.get_language("diff")
2448 // user defined functions