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_spinner spinner;
49 public Xcls_quick_commit_tab quick_commit_tab;
50 public Xcls_commit_message commit_message;
51 public Xcls_createbtn createbtn;
52 public Xcls_diff_view diff_view;
57 public Gee.ArrayList<GitMonitorQueue> queue;
63 this.el = new Gtk.Dialog();
71 this.el.title = "Create a working branch ";
72 this.el.default_height = 500;
73 this.el.default_width = 500;
74 this.el.deletable = true;
76 var child_0 = new Xcls_Notebook2( _this );
78 this.el.get_content_area().add ( child_0.el );
81 this.el.delete_event.connect( (self, event) => {
86 this.el.response.connect( (self, response_id) => {
88 GLib.debug("got %d", (int) response_id);
93 // have they selected a ticket..
94 // make that the current active ticket?
95 // we really need to store locally what ticket is being worked on..
96 // in theory we could be working on multiple project and not merging..
97 // -- each repo would have their active ticket (only one per repo)
98 // -- so we could just store that in there
99 // -- initial load can check the contents of the ticket files on first scan.
102 if (response_id < 1) {
104 this.running = false;
108 var ticket_id = _this.ticketsel.selectedTicketId();
110 if (this.repo != null) {
111 var bn = _this.name.el.get_text();
113 var res = this.repo.setActiveTicket(
114 RooTicket.singleton().getById(ticket_id != "" ? ticket_id : "-1"), bn
117 // start the monitoring..
118 GitMonitor.gitmonitor.start();
124 this.running = false;
134 // user defined functions
135 public void show ( GitRepo repo, Gee.ArrayList<GitMonitorQueue> queue, string tid = "" )
137 // this.el.set_gravity(Gdk.Gravity.NORTH);
138 if (this.running) { // should not happen!!
139 GLib.error("new branch show called, when already being displayed?");
145 GitMonitor.gitmonitor.stop();
149 this.el.move((Gdk.Screen.width() / 2)- 250 ,0);
150 this.el.set_default_size( 500,200); // not sure why it grows..
158 this.el.set_keep_above(true);
160 _this.notebook.el.set_current_page(0);
162 _this.select_ticket_tab.load_data(tid);
163 //_this.create_ticket_tab.load_data();
164 //_this.quick_commit_tab.load_data();
175 public class Xcls_Notebook2 : Object
177 public Gtk.Notebook el;
178 private NewBranch _this;
184 public Xcls_Notebook2(NewBranch _owner )
187 this.el = new Gtk.Notebook();
191 // set gobject values
192 this.el.vexpand = true;
193 var child_0 = new Xcls_label_select_ticket( _this );
195 var child_1 = new Xcls_label_create_ticket( _this );
197 var child_2 = new Xcls_label_quick_commit( _this );
199 var child_3 = new Xcls_select_ticket_tab( _this );
201 this.el.append_page ( child_3.el , _this.label_select_ticket.el );
202 var child_4 = new Xcls_create_ticket_tab( _this );
204 this.el.append_page ( child_4.el , _this.label_create_ticket.el );
205 var child_5 = new Xcls_quick_commit_tab( _this );
207 this.el.append_page ( child_5.el , _this.label_quick_commit.el );
210 this.el.switch_page.connect( (page, page_num) => {
211 GLib.debug("Switch to page: %d", (int)page_num);
214 break; // do nothing.. it's already loaded at start.
216 _this.create_ticket_tab.load_data();
219 _this.quick_commit_tab.load_data();
227 // user defined functions
229 public class Xcls_label_select_ticket : Object
232 private NewBranch _this;
238 public Xcls_label_select_ticket(NewBranch _owner )
241 _this.label_select_ticket = this;
242 this.el = new Gtk.Label( "Select Existing Ticket to work on" );
246 // set gobject values
249 // user defined functions
252 public class Xcls_label_create_ticket : Object
255 private NewBranch _this;
261 public Xcls_label_create_ticket(NewBranch _owner )
264 _this.label_create_ticket = this;
265 this.el = new Gtk.Label( "Create a New Ticket" );
269 // set gobject values
272 // user defined functions
275 public class Xcls_label_quick_commit : Object
278 private NewBranch _this;
284 public Xcls_label_quick_commit(NewBranch _owner )
287 _this.label_quick_commit = this;
288 this.el = new Gtk.Label( "Quick Commit" );
292 // set gobject values
295 // user defined functions
298 public class Xcls_select_ticket_tab : Object
301 private NewBranch _this;
307 public Xcls_select_ticket_tab(NewBranch _owner )
310 _this.select_ticket_tab = this;
311 this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
315 // set gobject values
316 this.el.homogeneous = false;
317 var child_0 = new Xcls_Table7( _this );
319 this.el.pack_start ( child_0.el , false,false,0 );
320 var child_1 = new Xcls_scrolled_window( _this );
322 this.el.add ( child_1.el );
325 // user defined functions
326 public void load_data (string tid = "") {
328 GLib.debug("Loading tickets");
330 var curproj = RooProject.getProjectByRepo(_this.repo);
331 _this.prmodel.loadProjects(curproj == null ? "" : curproj.id);
333 _this.dbmodel.loadTickets(curproj == null ? "": curproj.id, tid);
334 _this.branchbtn.updateState();
336 _this.ticketsel.el.get_child().get_style_context().remove_class("warning");
338 var name = RooTicket.singleton().usernameLocal();
339 var ticket = RooTicket.singleton().getById(tid);
340 _this.name.el.set_text("wip_%s_T%s_%s".printf(name,ticket.id, ticket.summaryToBranchName()));
342 _this.ticketsel.el.get_child().get_style_context().add_class("warning");
344 _this.view.loadTicket(tid);
349 public class Xcls_Table7 : Object
352 private NewBranch _this;
358 public Xcls_Table7(NewBranch _owner )
361 this.el = new Gtk.Table( 5, 5, true );
365 // set gobject values
366 this.el.expand = false;
368 this.el.column_spacing = 4;
369 this.el.vexpand = false;
370 var child_0 = new Xcls_Label8( _this );
372 this.el.attach_defaults ( child_0.el , 0,1,0,1 );
373 var child_1 = new Xcls_Label9( _this );
375 this.el.attach_defaults ( child_1.el , 1,2,0,1 );
376 var child_2 = new Xcls_projectsel( _this );
378 this.el.attach_defaults ( child_2.el , 0,1,1,2 );
379 var child_3 = new Xcls_ticketsel( _this );
381 this.el.attach_defaults ( child_3.el , 1,5,1,2 );
382 var child_4 = new Xcls_Label16( _this );
384 this.el.attach_defaults ( child_4.el , 0,1,3,4 );
385 var child_5 = new Xcls_name( _this );
387 this.el.attach_defaults ( child_5.el , 0,4,4,5 );
388 var child_6 = new Xcls_branchbtn( _this );
390 this.el.attach_defaults ( child_6.el , 4,5,4,5 );
391 var child_7 = new Xcls_Box19( _this );
393 this.el.attach_defaults ( child_7.el , 0,5,2,3 );
396 // user defined functions
398 public class Xcls_Label8 : Object
401 private NewBranch _this;
407 public Xcls_Label8(NewBranch _owner )
410 this.el = new Gtk.Label( "Project" );
414 // set gobject values
415 this.el.halign = Gtk.Align.START;
416 this.el.justify = Gtk.Justification.RIGHT;
417 this.el.visible = true;
420 // user defined functions
423 public class Xcls_Label9 : Object
426 private NewBranch _this;
432 public Xcls_Label9(NewBranch _owner )
435 this.el = new Gtk.Label( "Ticket" );
439 // set gobject values
440 this.el.halign = Gtk.Align.START;
441 this.el.visible = true;
444 // user defined functions
447 public class Xcls_projectsel : Object
449 public Gtk.ComboBox el;
450 private NewBranch _this;
457 public Xcls_projectsel(NewBranch _owner )
460 _this.projectsel = this;
461 this.el = new Gtk.ComboBox.with_entry();
464 this.loading = false;
466 // set gobject values
467 var child_0 = new Xcls_prcellrenderer( _this );
469 this.el.pack_start ( child_0.el , true );
470 var child_1 = new Xcls_prmodel( _this );
472 this.el.set_model ( child_1.el );
476 this.el.set_entry_text_column(1);
479 this.el.changed.connect( () => {
483 var project_id = this.selectedProjectId();
484 _this.dbmodel.loadTickets(project_id);
487 /*if (this.loading) {
490 var ticket_id = this.selectedTicketId();
492 var name = RooTicket.singleton().usernameLocal();
494 if (ticket_id == "" || ticket_id == null) {
496 var dt = new DateTime.now_local();
497 _this.name.el.set_text("wip_%s_%s".printf(name,dt.format("%Y_%b_%d")));
502 var ticket = RooTicket.singleton().getById(ticket_id);
504 _this.name.el.set_text("wip_%s_T%s_%s".printf(name,ticket.id, ticket.summaryToBranchName()));
506 //GLib.debug (//"Selection: %s, %s\n", (string) val1, (string) val2);
511 // user defined functions
512 public string selectedProjectId () {
517 this.el.get_active_iter (out iter);
518 _this.prmodel.el.get_value (iter, 0, out val1);
521 return (string) val1;
528 public class Xcls_prcellrenderer : Object
530 public Gtk.CellRendererText el;
531 private NewBranch _this;
537 public Xcls_prcellrenderer(NewBranch _owner )
540 _this.prcellrenderer = this;
541 this.el = new Gtk.CellRendererText();
545 // set gobject values
548 // user defined functions
551 public class Xcls_prmodel : Object
553 public Gtk.ListStore el;
554 private NewBranch _this;
560 public Xcls_prmodel(NewBranch _owner )
563 _this.prmodel = this;
564 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
568 // set gobject values
571 // user defined functions
572 public void loadProjects (string id) {
576 _this.projectsel.loading = true;
585 el.set_value(iter, 0, "");
586 el.set_value(iter, 1, "-- select a project --");
588 _this.projectsel.el.set_active_iter(iter);
591 foreach(var project in RooProject.projects()) {
595 el.set_value(iter, 0, project.id);
596 el.set_value(iter, 1, project.name );
597 if (id == project.id) {
598 _this.projectsel.el.set_active_iter(iter);
603 _this.projectsel.loading = false;
604 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
610 public class Xcls_ticketsel : Object
612 public Gtk.ComboBox el;
613 private NewBranch _this;
620 public Xcls_ticketsel(NewBranch _owner )
623 _this.ticketsel = this;
624 this.el = new Gtk.ComboBox.with_entry();
627 this.loading = false;
629 // set gobject values
630 var child_0 = new Xcls_dbcellrenderer( _this );
632 this.el.pack_start ( child_0.el , true );
633 var child_1 = new Xcls_dbmodel( _this );
635 this.el.set_model ( child_1.el );
639 //this.el.add_attribute(_this.dbcellrenderer.el , "markup", 1 );
640 this.el.set_entry_text_column(1);
641 this.el.get_child().set_sensitive(false);
644 this.el.changed.connect( () => {
648 var ticket_id = this.selectedTicketId();
650 var name = RooTicket.singleton().usernameLocal();
652 this.el.get_child().get_style_context().remove_class("warning");
653 if (ticket_id == "" || ticket_id == null) {
655 var dt = new DateTime.now_local();
656 _this.name.el.set_text("wip_%s_%s".printf(name,dt.format("%Y_%b_%d")));
657 _this.view.loadTicket("");
659 this.el.get_child().get_style_context().add_class("warning");
660 _this.createbtn.updateState();
665 var ticket = RooTicket.singleton().getById(ticket_id);
667 _this.name.el.set_text("wip_%s_T%s_%s".printf(name,ticket.id, ticket.summaryToBranchName()));
668 _this.scrolled_window.el.show();
670 _this.view.loadTicket(ticket.id);
671 _this.branchbtn.updateState();
673 //GLib.debug (//"Selection: %s, %s\n", (string) val1, (string) val2);
677 // user defined functions
678 public string selectedTicketId () {
683 this.el.get_active_iter (out iter);
684 _this.dbmodel.el.get_value (iter, 0, out val1);
687 return (string) val1;
694 public class Xcls_dbcellrenderer : Object
696 public Gtk.CellRendererText el;
697 private NewBranch _this;
703 public Xcls_dbcellrenderer(NewBranch _owner )
706 _this.dbcellrenderer = this;
707 this.el = new Gtk.CellRendererText();
711 // set gobject values
714 // user defined functions
717 public class Xcls_dbmodel : Object
719 public Gtk.ListStore el;
720 private NewBranch _this;
726 public Xcls_dbmodel(NewBranch _owner )
729 _this.dbmodel = this;
730 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
734 // set gobject values
737 // user defined functions
738 public void loadTickets (string project_id , string tid = "") {
742 // fixme .. get project id from selection..
744 RooTicket.singleton().loadTickets(
746 _this.btn_not_me.el.active ? RooTicket.Who.ANYBODY : RooTicket.Who.ME,
747 _this.btn_closed.el.active ? RooTicket.Status.ALL : RooTicket.Status.ACTIVE
750 _this.ticketsel.loading = true;
759 el.set_value(iter, 0, "");
760 el.set_value(iter, 1, "-- select a ticket --");
762 _this.ticketsel.el.set_active_iter(iter);
763 var tickets = RooTicket.singleton().tickets;
764 foreach(var ticket in tickets) {
768 el.set_value(iter, 0, ticket.id);
769 el.set_value(iter, 1, "#%s %s".printf( ticket.id, ticket.summary));
771 if (ticket.id == tid) {
772 _this.ticketsel.el.set_active_iter(iter);
777 _this.ticketsel.loading = false;
778 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
784 public class Xcls_Label16 : Object
787 private NewBranch _this;
793 public Xcls_Label16(NewBranch _owner )
796 this.el = new Gtk.Label( "Use this as branch name" );
800 // set gobject values
801 this.el.halign = Gtk.Align.START;
802 this.el.justify = Gtk.Justification.RIGHT;
803 this.el.xalign = 0.900000f;
806 // user defined functions
809 public class Xcls_name : Object
812 private NewBranch _this;
818 public Xcls_name(NewBranch _owner )
822 this.el = new Gtk.Entry();
826 // set gobject values
827 this.el.visible = true;
830 // user defined functions
833 public class Xcls_branchbtn : Object
835 public Gtk.Button el;
836 private NewBranch _this;
842 public Xcls_branchbtn(NewBranch _owner )
845 _this.branchbtn = this;
846 this.el = new Gtk.Button();
850 // set gobject values
851 this.el.label = "Create Branch";
856 this.el.get_style_context().add_class("suggested-action");
860 this.el.clicked.connect( () => {
862 GLib.debug("fire response = 1");
864 var ticket_id = _this.ticketsel.selectedTicketId();
866 if (ticket_id == "") {
867 _this.ticketsel.el.get_child().get_style_context().add_class("warning");
871 _this.el.response(1);
875 // user defined functions
876 public void updateState () {
878 var ticket_id = _this.ticketsel.selectedTicketId();
880 if (ticket_id == "") {
881 this.el.set_sensitive(false);
885 this.el.set_sensitive(true);
890 public class Xcls_Box19 : Object
893 private NewBranch _this;
899 public Xcls_Box19(NewBranch _owner )
902 this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
906 // set gobject values
907 var child_0 = new Xcls_btn_not_me( _this );
909 this.el.add ( child_0.el );
910 var child_1 = new Xcls_btn_closed( _this );
912 this.el.add ( child_1.el );
913 var child_2 = new Xcls_Label22( _this );
915 this.el.add ( child_2.el );
918 // user defined functions
920 public class Xcls_btn_not_me : Object
922 public Gtk.CheckButton el;
923 private NewBranch _this;
929 public Xcls_btn_not_me(NewBranch _owner )
932 _this.btn_not_me = this;
933 this.el = new Gtk.CheckButton();
937 // set gobject values
938 this.el.label = "Show tickets not assigned to me";
941 this.el.toggled.connect( () => {
942 var project_id = _this.projectsel.selectedProjectId();
943 _this.dbmodel.loadTickets(project_id);
947 // user defined functions
950 public class Xcls_btn_closed : Object
952 public Gtk.CheckButton el;
953 private NewBranch _this;
959 public Xcls_btn_closed(NewBranch _owner )
962 _this.btn_closed = this;
963 this.el = new Gtk.CheckButton();
967 // set gobject values
968 this.el.label = "Show closed Tickets";
971 this.el.toggled.connect( () => {
972 var project_id = _this.projectsel.selectedProjectId();
973 _this.dbmodel.loadTickets(project_id);
978 // user defined functions
981 public class Xcls_Label22 : Object
984 private NewBranch _this;
990 public Xcls_Label22(NewBranch _owner )
993 this.el = new Gtk.Label( "<a href=\"refresh\">Refresh Ticket list</a>" );
997 // set gobject values
998 this.el.halign = Gtk.Align.END;
999 this.el.hexpand = true;
1000 this.el.use_markup = true;
1003 this.el.activate_link.connect( (uri) => {
1004 if (uri == "refresh") {
1005 RooProject.reload();
1006 var curproj = RooProject.getProjectByRepo(_this.repo);
1007 _this.prmodel.loadProjects(curproj == null ? "": curproj.id);
1009 _this.dbmodel.loadTickets(curproj == null ? "": curproj.id);
1015 // user defined functions
1020 public class Xcls_scrolled_window : Object
1022 public Gtk.ScrolledWindow el;
1023 private NewBranch _this;
1029 public Xcls_scrolled_window(NewBranch _owner )
1032 _this.scrolled_window = this;
1033 this.el = new Gtk.ScrolledWindow( null, null );
1037 // set gobject values
1038 this.el.height_request = 500;
1039 this.el.vexpand = true;
1040 var child_0 = new Xcls_view( _this );
1042 this.el.add ( child_0.el );
1047 this.el.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);
1051 // user defined functions
1053 public class Xcls_view : Object
1055 public WebKit.WebView el;
1056 private NewBranch _this;
1062 public Xcls_view(NewBranch _owner )
1066 this.el = new WebKit.WebView();
1070 // set gobject values
1073 // user defined functions
1074 public void loadTicket (string tid) {
1076 _this.el.get_size(out w, out h);
1079 _this.scrolled_window.el.hide();
1080 _this.el.resize(w, 150);
1082 _this.scrolled_window.el.show();
1083 _this.el.resize(w, 800);
1086 var rs = RooTicket.singleton();
1087 var uri = new WebKit.URIRequest("https://roojs.com/admin.php/MTrack/View/" + tid);
1088 var hd = uri.get_http_headers();
1089 var authCode = Base64.encode ("%s:%s".printf(rs.username, rs.password).data);
1090 hd.append("Authorization", "Basic %s".printf(authCode));
1092 this.el.load_request(uri);
1098 public class Xcls_create_ticket_tab : Object
1101 private NewBranch _this;
1107 public Xcls_create_ticket_tab(NewBranch _owner )
1110 _this.create_ticket_tab = this;
1111 this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
1115 // set gobject values
1116 this.el.homogeneous = false;
1117 var child_0 = new Xcls_table( _this );
1119 this.el.pack_start ( child_0.el , false,false,0 );
1120 var child_1 = new Xcls_spinner( _this );
1122 this.el.add ( child_1.el );
1125 // user defined functions
1126 public void load_data () {
1130 Timeout.add_seconds(1, () => {
1132 RooProject? curproj = null;
1133 if (_this.repo != null) {
1134 curproj = RooProject.getProjectByRepo(_this.repo);
1136 _this.prmodel.loadProjects(curproj == null ? "" : curproj.id);
1137 if (curproj != null) {
1140 var rt = RooTicket.singleton();
1141 rt.loadProjectOptions(curproj.id);
1143 _this.msmodel.loadMilestones();
1144 _this.primodel.loadPriorities();
1145 _this.sevmodel.loadSeverities();
1146 _this.clmodel.loadClassifications();
1147 _this.devmodel.loadDevelopers();
1150 _this.summary.el.set_text("");
1151 _this.description.el.buffer.text = "";
1152 //_this.spinner.el.stop();
1153 //_this.spinner.el.hide();
1155 _this.table.el.show();
1156 //_this.summary.el.grab_focus();
1162 public class Xcls_table : Object
1164 public Gtk.Table el;
1165 private NewBranch _this;
1171 public Xcls_table(NewBranch _owner )
1175 this.el = new Gtk.Table( 14, 4, true );
1179 // set gobject values
1180 this.el.expand = false;
1182 this.el.column_spacing = 4;
1183 this.el.vexpand = false;
1184 var child_0 = new Xcls_Label27( _this );
1186 this.el.attach_defaults ( child_0.el , 0,1,0,1 );
1187 var child_1 = new Xcls_Label28( _this );
1189 this.el.attach_defaults ( child_1.el , 1,2,0,1 );
1190 var child_2 = new Xcls_project_id( _this );
1192 this.el.attach_defaults ( child_2.el , 0,1,1,2 );
1193 var child_3 = new Xcls_summary( _this );
1195 this.el.attach_defaults ( child_3.el , 1,4,1,2 );
1196 var child_4 = new Xcls_Label33( _this );
1198 this.el.attach_defaults ( child_4.el , 0,1,2,3 );
1199 var child_5 = new Xcls_milestone_id( _this );
1201 this.el.attach_defaults ( child_5.el , 0,1,3,4 );
1202 var child_6 = new Xcls_Label36( _this );
1204 this.el.attach_defaults ( child_6.el , 1,4,2,3 );
1205 var child_7 = new Xcls_description( _this );
1207 this.el.attach_defaults ( child_7.el , 1,4,3,12 );
1208 var child_8 = new Xcls_Label38( _this );
1210 this.el.attach_defaults ( child_8.el , 0,1,4,5 );
1211 var child_9 = new Xcls_priority_id( _this );
1213 this.el.attach_defaults ( child_9.el , 0,1,5,6 );
1214 var child_10 = new Xcls_Label41( _this );
1216 this.el.attach_defaults ( child_10.el , 0,1,6,7 );
1217 var child_11 = new Xcls_severity_id( _this );
1219 this.el.attach_defaults ( child_11.el , 0,1,7,8 );
1220 var child_12 = new Xcls_Label44( _this );
1222 this.el.attach_defaults ( child_12.el , 0,1,8,9 );
1223 var child_13 = new Xcls_classification_id( _this );
1225 this.el.attach_defaults ( child_13.el , 0,1,9,10 );
1226 var child_14 = new Xcls_Label47( _this );
1228 this.el.attach_defaults ( child_14.el , 0,1,10,11 );
1229 var child_15 = new Xcls_developer_id( _this );
1231 this.el.attach_defaults ( child_15.el , 0,1,11,12 );
1232 var child_16 = new Xcls_Button50( _this );
1234 this.el.attach_defaults ( child_16.el , 0,4,13,14 );
1237 // user defined functions
1239 public class Xcls_Label27 : Object
1241 public Gtk.Label el;
1242 private NewBranch _this;
1248 public Xcls_Label27(NewBranch _owner )
1251 this.el = new Gtk.Label( "Project" );
1255 // set gobject values
1256 this.el.halign = Gtk.Align.START;
1257 this.el.visible = true;
1260 // user defined functions
1263 public class Xcls_Label28 : Object
1265 public Gtk.Label el;
1266 private NewBranch _this;
1272 public Xcls_Label28(NewBranch _owner )
1275 this.el = new Gtk.Label( "Summary" );
1279 // set gobject values
1280 this.el.halign = Gtk.Align.START;
1281 this.el.visible = true;
1284 // user defined functions
1287 public class Xcls_project_id : Object
1289 public Gtk.ComboBox el;
1290 private NewBranch _this;
1294 public bool loading;
1297 public Xcls_project_id(NewBranch _owner )
1300 _this.project_id = this;
1301 this.el = new Gtk.ComboBox.with_entry();
1304 this.loading = false;
1306 // set gobject values
1307 var child_0 = new Xcls_tprcellrenderer( _this );
1309 this.el.pack_start ( child_0.el , true );
1310 var child_1 = new Xcls_tprmodel( _this );
1312 this.el.set_model ( child_1.el );
1316 this.el.set_entry_text_column(1);
1319 this.el.changed.connect( () => {
1323 var project_id = this.selectedProjectId();
1325 var rt = RooTicket.singleton();
1326 rt.loadProjectOptions(project_id);
1328 _this.msmodel.loadMilestones();
1329 _this.primodel.loadPriorities();
1330 _this.sevmodel.loadSeverities();
1331 _this.clmodel.loadClassifications();
1332 _this.devmodel.loadDevelopers();
1334 // affects projects and milestones..
1337 /*if (this.loading) {
1340 var ticket_id = this.selectedTicketId();
1342 var name = RooTicket.singleton().usernameLocal();
1344 if (ticket_id == "" || ticket_id == null) {
1346 var dt = new DateTime.now_local();
1347 _this.name.el.set_text("wip_%s_%s".printf(name,dt.format("%Y_%b_%d")));
1352 var ticket = RooTicket.singleton().getById(ticket_id);
1354 _this.name.el.set_text("wip_%s_T%s_%s".printf(name,ticket.id, ticket.summaryToBranchName()));
1356 //GLib.debug (//"Selection: %s, %s\n", (string) val1, (string) val2);
1361 // user defined functions
1362 public string selectedProjectId () {
1367 this.el.get_active_iter (out iter);
1368 _this.tprmodel.el.get_value (iter, 0, out val1);
1371 return (string) val1;
1378 public class Xcls_tprcellrenderer : Object
1380 public Gtk.CellRendererText el;
1381 private NewBranch _this;
1387 public Xcls_tprcellrenderer(NewBranch _owner )
1390 _this.tprcellrenderer = this;
1391 this.el = new Gtk.CellRendererText();
1395 // set gobject values
1398 // user defined functions
1401 public class Xcls_tprmodel : Object
1403 public Gtk.ListStore el;
1404 private NewBranch _this;
1410 public Xcls_tprmodel(NewBranch _owner )
1413 _this.tprmodel = this;
1414 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
1418 // set gobject values
1421 // user defined functions
1422 public void loadProjects (string id) {
1425 _this.project_id.loading = true;
1431 el.append(out iter);
1434 el.set_value(iter, 0, "");
1435 el.set_value(iter, 1, "-- select a project --");
1437 _this.project_id.el.set_active_iter(iter);
1440 foreach(var project in RooProject.projects()) {
1442 el.append(out iter);
1444 el.set_value(iter, 0, project.id);
1445 el.set_value(iter, 1, project.name );
1446 if (id == project.id) {
1447 _this.project_id.el.set_active_iter(iter);
1452 _this.project_id.loading = false;
1453 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
1459 public class Xcls_summary : Object
1461 public Gtk.Entry el;
1462 private NewBranch _this;
1468 public Xcls_summary(NewBranch _owner )
1471 _this.summary = this;
1472 this.el = new Gtk.Entry();
1476 // set gobject values
1477 this.el.visible = true;
1480 // user defined functions
1483 public class Xcls_Label33 : Object
1485 public Gtk.Label el;
1486 private NewBranch _this;
1492 public Xcls_Label33(NewBranch _owner )
1495 this.el = new Gtk.Label( "Milestone" );
1499 // set gobject values
1500 this.el.halign = Gtk.Align.START;
1501 this.el.justify = Gtk.Justification.RIGHT;
1502 this.el.xalign = 0.900000f;
1505 // user defined functions
1508 public class Xcls_milestone_id : Object
1510 public Gtk.ComboBox el;
1511 private NewBranch _this;
1515 public bool loading;
1518 public Xcls_milestone_id(NewBranch _owner )
1521 _this.milestone_id = this;
1522 this.el = new Gtk.ComboBox.with_entry();
1525 this.loading = false;
1527 // set gobject values
1528 var child_0 = new Xcls_msmodel( _this );
1530 this.el.set_model ( child_0.el );
1534 this.el.set_entry_text_column(1);
1537 // user defined functions
1538 public string selectedMilestoneId () {
1543 this.el.get_active_iter (out iter);
1544 _this.msmodel.el.get_value (iter, 0, out val1);
1547 return (string) val1;
1554 public class Xcls_msmodel : Object
1556 public Gtk.ListStore el;
1557 private NewBranch _this;
1563 public Xcls_msmodel(NewBranch _owner )
1566 _this.msmodel = this;
1567 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
1571 // set gobject values
1574 // user defined functions
1575 public void loadMilestones ( ) {
1577 var rt = RooTicket.singleton();
1578 // rt.loadProjects();
1580 _this.milestone_id.loading = true;
1586 el.append(out iter);
1589 el.set_value(iter, 0, "");
1590 el.set_value(iter, 1, "-- select a milestone --");
1591 _this.milestone_id.el.set_active_iter(iter);
1593 var projects = rt.milestones;
1594 foreach(var project in projects) {
1596 el.append(out iter);
1598 el.set_value(iter, 0, project.id);
1599 el.set_value(iter, 1, project.display_name );
1600 // if (id == project.id) {
1601 // _this.milestone.el.set_active_iter(iter);
1607 _this.milestone_id.loading = false;
1608 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
1614 public class Xcls_Label36 : Object
1616 public Gtk.Label el;
1617 private NewBranch _this;
1623 public Xcls_Label36(NewBranch _owner )
1626 this.el = new Gtk.Label( "Description" );
1630 // set gobject values
1631 this.el.halign = Gtk.Align.START;
1634 // user defined functions
1637 public class Xcls_description : Object
1639 public Gtk.TextView el;
1640 private NewBranch _this;
1646 public Xcls_description(NewBranch _owner )
1649 _this.description = this;
1650 this.el = new Gtk.TextView();
1654 // set gobject values
1655 this.el.border_width = 1;
1658 // user defined functions
1661 public class Xcls_Label38 : Object
1663 public Gtk.Label el;
1664 private NewBranch _this;
1670 public Xcls_Label38(NewBranch _owner )
1673 this.el = new Gtk.Label( "Priority" );
1677 // set gobject values
1678 this.el.halign = Gtk.Align.START;
1679 this.el.xalign = 0.900000f;
1682 // user defined functions
1685 public class Xcls_priority_id : Object
1687 public Gtk.ComboBox el;
1688 private NewBranch _this;
1692 public bool loading;
1695 public Xcls_priority_id(NewBranch _owner )
1698 _this.priority_id = this;
1699 this.el = new Gtk.ComboBox.with_entry();
1702 this.loading = false;
1704 // set gobject values
1705 var child_0 = new Xcls_primodel( _this );
1707 this.el.set_model ( child_0.el );
1711 this.el.set_entry_text_column(1);
1714 // user defined functions
1715 public string selectedPriorityId () {
1720 this.el.get_active_iter (out iter);
1721 _this.primodel.el.get_value (iter, 0, out val1);
1724 return (string) val1;
1731 public class Xcls_primodel : Object
1733 public Gtk.ListStore el;
1734 private NewBranch _this;
1740 public Xcls_primodel(NewBranch _owner )
1743 _this.primodel = this;
1744 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
1748 // set gobject values
1751 // user defined functions
1752 public void loadPriorities ( ) {
1754 var rt = RooTicket.singleton();
1755 // rt.loadProjects();
1757 _this.priority_id.loading = true;
1764 var projects = rt.priorities;
1765 foreach(var project in projects) {
1767 el.append(out iter);
1769 el.set_value(iter, 0, project.id);
1770 el.set_value(iter, 1, project.display_name );
1771 if ("normal" == project.name) {
1772 _this.priority_id.el.set_active_iter(iter);
1777 _this.priority_id.loading = false;
1784 public class Xcls_Label41 : Object
1786 public Gtk.Label el;
1787 private NewBranch _this;
1793 public Xcls_Label41(NewBranch _owner )
1796 this.el = new Gtk.Label( "Severity" );
1800 // set gobject values
1801 this.el.halign = Gtk.Align.START;
1804 // user defined functions
1807 public class Xcls_severity_id : Object
1809 public Gtk.ComboBox el;
1810 private NewBranch _this;
1814 public bool loading;
1817 public Xcls_severity_id(NewBranch _owner )
1820 _this.severity_id = this;
1821 this.el = new Gtk.ComboBox.with_entry();
1824 this.loading = false;
1826 // set gobject values
1827 var child_0 = new Xcls_sevmodel( _this );
1829 this.el.set_model ( child_0.el );
1833 this.el.set_entry_text_column(1);
1836 // user defined functions
1837 public string selectedSeverityId () {
1842 this.el.get_active_iter (out iter);
1843 _this.sevmodel.el.get_value (iter, 0, out val1);
1846 return (string) val1;
1853 public class Xcls_sevmodel : Object
1855 public Gtk.ListStore el;
1856 private NewBranch _this;
1862 public Xcls_sevmodel(NewBranch _owner )
1865 _this.sevmodel = this;
1866 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
1870 // set gobject values
1873 // user defined functions
1874 public void loadSeverities () {
1876 var rt = RooTicket.singleton();
1877 //rt.loadProjects();
1879 _this.severity_id.loading = true;
1885 var projects = rt.serverities;
1886 foreach(var project in projects) {
1888 el.append(out iter);
1890 el.set_value(iter, 0, project.id);
1891 el.set_value(iter, 1, project.display_name );
1892 if ("normal" == project.name) {
1893 _this.severity_id.el.set_active_iter(iter);
1898 _this.severity_id.loading = false;
1899 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
1905 public class Xcls_Label44 : Object
1907 public Gtk.Label el;
1908 private NewBranch _this;
1914 public Xcls_Label44(NewBranch _owner )
1917 this.el = new Gtk.Label( "Classification" );
1921 // set gobject values
1922 this.el.halign = Gtk.Align.START;
1925 // user defined functions
1928 public class Xcls_classification_id : Object
1930 public Gtk.ComboBox el;
1931 private NewBranch _this;
1935 public bool loading;
1938 public Xcls_classification_id(NewBranch _owner )
1941 _this.classification_id = this;
1942 this.el = new Gtk.ComboBox.with_entry();
1945 this.loading = false;
1947 // set gobject values
1948 var child_0 = new Xcls_clmodel( _this );
1950 this.el.set_model ( child_0.el );
1954 this.el.set_entry_text_column(1);
1957 // user defined functions
1958 public string selectedClassificationId () {
1963 this.el.get_active_iter (out iter);
1964 _this.clmodel.el.get_value (iter, 0, out val1);
1967 return (string) val1;
1974 public class Xcls_clmodel : Object
1976 public Gtk.ListStore el;
1977 private NewBranch _this;
1983 public Xcls_clmodel(NewBranch _owner )
1986 _this.clmodel = this;
1987 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
1991 // set gobject values
1994 // user defined functions
1995 public void loadClassifications ( ) {
1997 var rt = RooTicket.singleton();
1998 // rt.loadProjects();
2000 _this.classification_id.loading = true;
2006 el.append(out iter);
2009 var projects = rt.classifications;
2010 foreach(var project in projects) {
2012 el.append(out iter);
2014 el.set_value(iter, 0, project.id);
2015 el.set_value(iter, 1, project.display_name );
2016 if ("bug" == project.name) {
2017 _this.classification_id.el.set_active_iter(iter);
2022 _this.classification_id.loading = false;
2023 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
2029 public class Xcls_Label47 : Object
2031 public Gtk.Label el;
2032 private NewBranch _this;
2038 public Xcls_Label47(NewBranch _owner )
2041 this.el = new Gtk.Label( "Assign to" );
2045 // set gobject values
2046 this.el.halign = Gtk.Align.START;
2049 // user defined functions
2052 public class Xcls_developer_id : Object
2054 public Gtk.ComboBox el;
2055 private NewBranch _this;
2059 public bool loading;
2062 public Xcls_developer_id(NewBranch _owner )
2065 _this.developer_id = this;
2066 this.el = new Gtk.ComboBox.with_entry();
2069 this.loading = false;
2071 // set gobject values
2072 var child_0 = new Xcls_devmodel( _this );
2074 this.el.set_model ( child_0.el );
2078 this.el.set_entry_text_column(1);
2081 // user defined functions
2082 public string selectedDeveloperId () {
2087 this.el.get_active_iter (out iter);
2088 _this.devmodel.el.get_value (iter, 0, out val1);
2091 return (string) val1;
2098 public class Xcls_devmodel : Object
2100 public Gtk.ListStore el;
2101 private NewBranch _this;
2107 public Xcls_devmodel(NewBranch _owner )
2110 _this.devmodel = this;
2111 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
2115 // set gobject values
2118 // user defined functions
2119 public void loadDevelopers ( ) {
2121 var rt = RooTicket.singleton();
2122 //rt.loadProjects();
2124 _this.developer_id.loading = true;
2130 el.append(out iter);
2133 el.set_value(iter, 0, "");
2134 el.set_value(iter, 1, "-- select a developer --");
2136 _this.developer_id.el.set_active_iter(iter);
2139 var peps = rt.developers;
2140 foreach(var p in peps) {
2142 el.append(out iter);
2144 el.set_value(iter, 0, p.id);
2145 el.set_value(iter, 1, p.display_name );
2146 if (rt.authuser_id == p.id) {
2147 _this.developer_id.el.set_active_iter(iter);
2151 _this.developer_id.loading = false;
2152 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
2158 public class Xcls_Button50 : Object
2160 public Gtk.Button el;
2161 private NewBranch _this;
2167 public Xcls_Button50(NewBranch _owner )
2170 this.el = new Gtk.Button();
2174 // set gobject values
2175 this.el.label = "Create Ticket & Branch";
2180 this.el.get_style_context().add_class("suggested-action");
2184 this.el.clicked.connect( () => {
2185 GLib.debug("fire response = 1");
2188 var invalid = false;
2190 // validate first...
2191 _this.project_id.el.get_child().get_style_context().remove_class("warning");
2192 if (_this.project_id.selectedProjectId() == "") {
2193 _this.project_id.el.get_child().get_style_context().add_class("warning");
2197 _this.milestone_id.el.get_child().get_style_context().remove_class("warning");
2199 _this.priority_id.el.get_child().get_style_context().remove_class("warning");
2200 if (_this.priority_id.selectedPriorityId() == "") {
2201 _this.priority_id.el.get_child().get_style_context().add_class("warning");
2205 _this.classification_id.el.get_child().get_style_context().remove_class("warning");
2206 if (_this.classification_id.selectedClassificationId() == "") {
2207 _this.classification_id.el.get_child().get_style_context().add_class("warning");
2211 _this.developer_id.el.get_child().get_style_context().remove_class("warning");
2212 if (_this.developer_id.selectedDeveloperId() == "") {
2213 _this.developer_id.el.get_child().get_style_context().add_class("warning");
2217 _this.summary.el.get_style_context().remove_class("warning");
2218 if (_this.summary.el.get_text() == "") {
2219 _this.summary.el.get_style_context().add_class("warning");
2223 _this.description.el.get_style_context().remove_class("warning");
2228 GLib.debug("for is valid");
2230 _this.el.response(1);
2234 // user defined functions
2238 public class Xcls_spinner : Object
2240 public Gtk.Spinner el;
2241 private NewBranch _this;
2247 public Xcls_spinner(NewBranch _owner )
2250 _this.spinner = this;
2251 this.el = new Gtk.Spinner();
2255 // set gobject values
2256 this.el.hexpand = true;
2257 this.el.vexpand = true;
2260 // user defined functions
2264 public class Xcls_quick_commit_tab : Object
2267 private NewBranch _this;
2273 public Xcls_quick_commit_tab(NewBranch _owner )
2276 _this.quick_commit_tab = this;
2277 this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
2281 // set gobject values
2282 this.el.homogeneous = false;
2283 var child_0 = new Xcls_Table53( _this );
2285 this.el.pack_start ( child_0.el , false,false,0 );
2286 var child_1 = new Xcls_ScrolledWindow57( _this );
2288 this.el.add ( child_1.el );
2291 // user defined functions
2292 public void load_data () {
2293 _this.commit_message.el.set_text("");
2297 public class Xcls_Table53 : Object
2299 public Gtk.Table el;
2300 private NewBranch _this;
2306 public Xcls_Table53(NewBranch _owner )
2309 this.el = new Gtk.Table( 2, 5, true );
2313 // set gobject values
2314 this.el.expand = false;
2316 this.el.column_spacing = 4;
2317 this.el.vexpand = false;
2318 var child_0 = new Xcls_Label54( _this );
2320 this.el.attach_defaults ( child_0.el , 0,1,0,1 );
2321 var child_1 = new Xcls_commit_message( _this );
2323 this.el.attach_defaults ( child_1.el , 0,4,1,2 );
2324 var child_2 = new Xcls_createbtn( _this );
2326 this.el.attach_defaults ( child_2.el , 4,5,1,2 );
2329 // user defined functions
2331 public class Xcls_Label54 : Object
2333 public Gtk.Label el;
2334 private NewBranch _this;
2340 public Xcls_Label54(NewBranch _owner )
2343 this.el = new Gtk.Label( "Just commit with this comment" );
2347 // set gobject values
2348 this.el.halign = Gtk.Align.START;
2349 this.el.justify = Gtk.Justification.RIGHT;
2350 this.el.xalign = 0.900000f;
2353 // user defined functions
2356 public class Xcls_commit_message : Object
2358 public Gtk.Entry el;
2359 private NewBranch _this;
2365 public Xcls_commit_message(NewBranch _owner )
2368 _this.commit_message = this;
2369 this.el = new Gtk.Entry();
2373 // set gobject values
2374 this.el.visible = true;
2377 // user defined functions
2380 public class Xcls_createbtn : Object
2382 public Gtk.Button el;
2383 private NewBranch _this;
2389 public Xcls_createbtn(NewBranch _owner )
2392 _this.createbtn = this;
2393 this.el = new Gtk.Button();
2397 // set gobject values
2398 this.el.label = "Commit Changes";
2403 this.el.get_style_context().add_class("suggested-action");
2407 this.el.clicked.connect( () => {
2409 GLib.debug("fire response = 1");
2411 var ticket_id = _this.ticketsel.selectedTicketId();
2413 if (ticket_id == "") {
2414 _this.ticketsel.el.get_child().get_style_context().add_class("warning");
2418 _this.el.response(1);
2422 // user defined functions
2423 public void updateState () {
2425 var ticket_id = _this.ticketsel.selectedTicketId();
2427 if (ticket_id == "") {
2428 this.el.set_sensitive(false);
2432 this.el.set_sensitive(true);
2438 public class Xcls_ScrolledWindow57 : Object
2440 public Gtk.ScrolledWindow el;
2441 private NewBranch _this;
2447 public Xcls_ScrolledWindow57(NewBranch _owner )
2450 this.el = new Gtk.ScrolledWindow( null, null );
2454 // set gobject values
2455 this.el.height_request = 400;
2456 this.el.vexpand = true;
2457 var child_0 = new Xcls_diff_view( _this );
2459 this.el.add ( child_0.el );
2462 // user defined functions
2464 public class Xcls_diff_view : Object
2466 public Gtk.SourceView el;
2467 private NewBranch _this;
2473 public Xcls_diff_view(NewBranch _owner )
2476 _this.diff_view = this;
2477 this.el = new Gtk.SourceView();
2483 var description = Pango.FontDescription.from_string("monospace");
2484 description.set_size(9000);
2485 this.el.override_font(description);
2486 var lm = Gtk.SourceLanguageManager.get_default();
2488 ((Gtk.SourceBuffer)(this.el.get_buffer())).set_language(
2489 lm.get_language("diff")
2493 // user defined functions