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 () {
1128 _this.table.el.hide();
1129 _this.spinner.el.show();
1130 _this.spinner.el.start();
1132 Timeout.add_seconds(1, () => {
1134 RooProject? curproj = null;
1135 if (_this.repo != null) {
1136 curproj = RooProject.getProjectByRepo(_this.repo);
1138 _this.tprmodel.loadProjects(curproj == null ? "" : curproj.id);
1139 if (curproj != null) {
1142 var rt = RooTicket.singleton();
1143 rt.loadProjectOptions(curproj.id);
1145 _this.msmodel.loadMilestones();
1146 _this.primodel.loadPriorities();
1147 _this.sevmodel.loadSeverities();
1148 _this.clmodel.loadClassifications();
1149 _this.devmodel.loadDevelopers();
1152 _this.summary.el.set_text("");
1153 _this.description.el.buffer.text = "";
1154 _this.spinner.el.stop();
1155 _this.spinner.el.hide();
1157 _this.table.el.show();
1158 //_this.summary.el.grab_focus();
1164 public class Xcls_table : Object
1166 public Gtk.Table el;
1167 private NewBranch _this;
1173 public Xcls_table(NewBranch _owner )
1177 this.el = new Gtk.Table( 14, 4, true );
1181 // set gobject values
1182 this.el.expand = false;
1184 this.el.column_spacing = 4;
1185 this.el.vexpand = false;
1186 var child_0 = new Xcls_Label27( _this );
1188 this.el.attach_defaults ( child_0.el , 0,1,0,1 );
1189 var child_1 = new Xcls_Label28( _this );
1191 this.el.attach_defaults ( child_1.el , 1,2,0,1 );
1192 var child_2 = new Xcls_project_id( _this );
1194 this.el.attach_defaults ( child_2.el , 0,1,1,2 );
1195 var child_3 = new Xcls_summary( _this );
1197 this.el.attach_defaults ( child_3.el , 1,4,1,2 );
1198 var child_4 = new Xcls_Label33( _this );
1200 this.el.attach_defaults ( child_4.el , 0,1,2,3 );
1201 var child_5 = new Xcls_milestone_id( _this );
1203 this.el.attach_defaults ( child_5.el , 0,1,3,4 );
1204 var child_6 = new Xcls_Label36( _this );
1206 this.el.attach_defaults ( child_6.el , 1,4,2,3 );
1207 var child_7 = new Xcls_description( _this );
1209 this.el.attach_defaults ( child_7.el , 1,4,3,12 );
1210 var child_8 = new Xcls_Label38( _this );
1212 this.el.attach_defaults ( child_8.el , 0,1,4,5 );
1213 var child_9 = new Xcls_priority_id( _this );
1215 this.el.attach_defaults ( child_9.el , 0,1,5,6 );
1216 var child_10 = new Xcls_Label41( _this );
1218 this.el.attach_defaults ( child_10.el , 0,1,6,7 );
1219 var child_11 = new Xcls_severity_id( _this );
1221 this.el.attach_defaults ( child_11.el , 0,1,7,8 );
1222 var child_12 = new Xcls_Label44( _this );
1224 this.el.attach_defaults ( child_12.el , 0,1,8,9 );
1225 var child_13 = new Xcls_classification_id( _this );
1227 this.el.attach_defaults ( child_13.el , 0,1,9,10 );
1228 var child_14 = new Xcls_Label47( _this );
1230 this.el.attach_defaults ( child_14.el , 0,1,10,11 );
1231 var child_15 = new Xcls_developer_id( _this );
1233 this.el.attach_defaults ( child_15.el , 0,1,11,12 );
1234 var child_16 = new Xcls_Button50( _this );
1236 this.el.attach_defaults ( child_16.el , 0,4,13,14 );
1239 // user defined functions
1241 public class Xcls_Label27 : Object
1243 public Gtk.Label el;
1244 private NewBranch _this;
1250 public Xcls_Label27(NewBranch _owner )
1253 this.el = new Gtk.Label( "Project" );
1257 // set gobject values
1258 this.el.halign = Gtk.Align.START;
1259 this.el.visible = true;
1262 // user defined functions
1265 public class Xcls_Label28 : Object
1267 public Gtk.Label el;
1268 private NewBranch _this;
1274 public Xcls_Label28(NewBranch _owner )
1277 this.el = new Gtk.Label( "Summary" );
1281 // set gobject values
1282 this.el.halign = Gtk.Align.START;
1283 this.el.visible = true;
1286 // user defined functions
1289 public class Xcls_project_id : Object
1291 public Gtk.ComboBox el;
1292 private NewBranch _this;
1296 public bool loading;
1299 public Xcls_project_id(NewBranch _owner )
1302 _this.project_id = this;
1303 this.el = new Gtk.ComboBox.with_entry();
1306 this.loading = false;
1308 // set gobject values
1309 var child_0 = new Xcls_tprcellrenderer( _this );
1311 this.el.pack_start ( child_0.el , true );
1312 var child_1 = new Xcls_tprmodel( _this );
1314 this.el.set_model ( child_1.el );
1318 this.el.set_entry_text_column(1);
1321 this.el.changed.connect( () => {
1325 var project_id = this.selectedProjectId();
1327 var rt = RooTicket.singleton();
1328 rt.loadProjectOptions(project_id);
1330 _this.msmodel.loadMilestones();
1331 _this.primodel.loadPriorities();
1332 _this.sevmodel.loadSeverities();
1333 _this.clmodel.loadClassifications();
1334 _this.devmodel.loadDevelopers();
1336 // affects projects and milestones..
1339 /*if (this.loading) {
1342 var ticket_id = this.selectedTicketId();
1344 var name = RooTicket.singleton().usernameLocal();
1346 if (ticket_id == "" || ticket_id == null) {
1348 var dt = new DateTime.now_local();
1349 _this.name.el.set_text("wip_%s_%s".printf(name,dt.format("%Y_%b_%d")));
1354 var ticket = RooTicket.singleton().getById(ticket_id);
1356 _this.name.el.set_text("wip_%s_T%s_%s".printf(name,ticket.id, ticket.summaryToBranchName()));
1358 //GLib.debug (//"Selection: %s, %s\n", (string) val1, (string) val2);
1363 // user defined functions
1364 public string selectedProjectId () {
1369 this.el.get_active_iter (out iter);
1370 _this.tprmodel.el.get_value (iter, 0, out val1);
1373 return (string) val1;
1380 public class Xcls_tprcellrenderer : Object
1382 public Gtk.CellRendererText el;
1383 private NewBranch _this;
1389 public Xcls_tprcellrenderer(NewBranch _owner )
1392 _this.tprcellrenderer = this;
1393 this.el = new Gtk.CellRendererText();
1397 // set gobject values
1400 // user defined functions
1403 public class Xcls_tprmodel : Object
1405 public Gtk.ListStore el;
1406 private NewBranch _this;
1412 public Xcls_tprmodel(NewBranch _owner )
1415 _this.tprmodel = this;
1416 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
1420 // set gobject values
1423 // user defined functions
1424 public void loadProjects (string id) {
1427 _this.project_id.loading = true;
1433 el.append(out iter);
1436 el.set_value(iter, 0, "");
1437 el.set_value(iter, 1, "-- select a project --");
1439 _this.project_id.el.set_active_iter(iter);
1442 foreach(var project in RooProject.projects()) {
1444 el.append(out iter);
1446 el.set_value(iter, 0, project.id);
1447 el.set_value(iter, 1, project.name );
1448 if (id == project.id) {
1449 _this.project_id.el.set_active_iter(iter);
1454 _this.project_id.loading = false;
1455 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
1461 public class Xcls_summary : Object
1463 public Gtk.Entry el;
1464 private NewBranch _this;
1470 public Xcls_summary(NewBranch _owner )
1473 _this.summary = this;
1474 this.el = new Gtk.Entry();
1478 // set gobject values
1479 this.el.visible = true;
1482 // user defined functions
1485 public class Xcls_Label33 : Object
1487 public Gtk.Label el;
1488 private NewBranch _this;
1494 public Xcls_Label33(NewBranch _owner )
1497 this.el = new Gtk.Label( "Milestone" );
1501 // set gobject values
1502 this.el.halign = Gtk.Align.START;
1503 this.el.justify = Gtk.Justification.RIGHT;
1504 this.el.xalign = 0.900000f;
1507 // user defined functions
1510 public class Xcls_milestone_id : Object
1512 public Gtk.ComboBox el;
1513 private NewBranch _this;
1517 public bool loading;
1520 public Xcls_milestone_id(NewBranch _owner )
1523 _this.milestone_id = this;
1524 this.el = new Gtk.ComboBox.with_entry();
1527 this.loading = false;
1529 // set gobject values
1530 var child_0 = new Xcls_msmodel( _this );
1532 this.el.set_model ( child_0.el );
1536 this.el.set_entry_text_column(1);
1539 // user defined functions
1540 public string selectedMilestoneId () {
1545 this.el.get_active_iter (out iter);
1546 _this.msmodel.el.get_value (iter, 0, out val1);
1549 return (string) val1;
1556 public class Xcls_msmodel : Object
1558 public Gtk.ListStore el;
1559 private NewBranch _this;
1565 public Xcls_msmodel(NewBranch _owner )
1568 _this.msmodel = this;
1569 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
1573 // set gobject values
1576 // user defined functions
1577 public void loadMilestones ( ) {
1579 var rt = RooTicket.singleton();
1580 // rt.loadProjects();
1582 _this.milestone_id.loading = true;
1588 el.append(out iter);
1591 el.set_value(iter, 0, "");
1592 el.set_value(iter, 1, "-- select a milestone --");
1593 _this.milestone_id.el.set_active_iter(iter);
1595 var projects = rt.milestones;
1596 foreach(var project in projects) {
1598 el.append(out iter);
1600 el.set_value(iter, 0, project.id);
1601 el.set_value(iter, 1, project.display_name );
1602 // if (id == project.id) {
1603 // _this.milestone.el.set_active_iter(iter);
1609 _this.milestone_id.loading = false;
1610 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
1616 public class Xcls_Label36 : Object
1618 public Gtk.Label el;
1619 private NewBranch _this;
1625 public Xcls_Label36(NewBranch _owner )
1628 this.el = new Gtk.Label( "Description" );
1632 // set gobject values
1633 this.el.halign = Gtk.Align.START;
1636 // user defined functions
1639 public class Xcls_description : Object
1641 public Gtk.TextView el;
1642 private NewBranch _this;
1648 public Xcls_description(NewBranch _owner )
1651 _this.description = this;
1652 this.el = new Gtk.TextView();
1656 // set gobject values
1657 this.el.border_width = 1;
1660 // user defined functions
1663 public class Xcls_Label38 : Object
1665 public Gtk.Label el;
1666 private NewBranch _this;
1672 public Xcls_Label38(NewBranch _owner )
1675 this.el = new Gtk.Label( "Priority" );
1679 // set gobject values
1680 this.el.halign = Gtk.Align.START;
1681 this.el.xalign = 0.900000f;
1684 // user defined functions
1687 public class Xcls_priority_id : Object
1689 public Gtk.ComboBox el;
1690 private NewBranch _this;
1694 public bool loading;
1697 public Xcls_priority_id(NewBranch _owner )
1700 _this.priority_id = this;
1701 this.el = new Gtk.ComboBox.with_entry();
1704 this.loading = false;
1706 // set gobject values
1707 var child_0 = new Xcls_primodel( _this );
1709 this.el.set_model ( child_0.el );
1713 this.el.set_entry_text_column(1);
1716 // user defined functions
1717 public string selectedPriorityId () {
1722 this.el.get_active_iter (out iter);
1723 _this.primodel.el.get_value (iter, 0, out val1);
1726 return (string) val1;
1733 public class Xcls_primodel : Object
1735 public Gtk.ListStore el;
1736 private NewBranch _this;
1742 public Xcls_primodel(NewBranch _owner )
1745 _this.primodel = this;
1746 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
1750 // set gobject values
1753 // user defined functions
1754 public void loadPriorities ( ) {
1756 var rt = RooTicket.singleton();
1757 // rt.loadProjects();
1759 _this.priority_id.loading = true;
1766 var projects = rt.priorities;
1767 foreach(var project in projects) {
1769 el.append(out iter);
1771 el.set_value(iter, 0, project.id);
1772 el.set_value(iter, 1, project.display_name );
1773 if ("normal" == project.name) {
1774 _this.priority_id.el.set_active_iter(iter);
1779 _this.priority_id.loading = false;
1786 public class Xcls_Label41 : Object
1788 public Gtk.Label el;
1789 private NewBranch _this;
1795 public Xcls_Label41(NewBranch _owner )
1798 this.el = new Gtk.Label( "Severity" );
1802 // set gobject values
1803 this.el.halign = Gtk.Align.START;
1806 // user defined functions
1809 public class Xcls_severity_id : Object
1811 public Gtk.ComboBox el;
1812 private NewBranch _this;
1816 public bool loading;
1819 public Xcls_severity_id(NewBranch _owner )
1822 _this.severity_id = this;
1823 this.el = new Gtk.ComboBox.with_entry();
1826 this.loading = false;
1828 // set gobject values
1829 var child_0 = new Xcls_sevmodel( _this );
1831 this.el.set_model ( child_0.el );
1835 this.el.set_entry_text_column(1);
1838 // user defined functions
1839 public string selectedSeverityId () {
1844 this.el.get_active_iter (out iter);
1845 _this.sevmodel.el.get_value (iter, 0, out val1);
1848 return (string) val1;
1855 public class Xcls_sevmodel : Object
1857 public Gtk.ListStore el;
1858 private NewBranch _this;
1864 public Xcls_sevmodel(NewBranch _owner )
1867 _this.sevmodel = this;
1868 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
1872 // set gobject values
1875 // user defined functions
1876 public void loadSeverities () {
1878 var rt = RooTicket.singleton();
1879 //rt.loadProjects();
1881 _this.severity_id.loading = true;
1887 var projects = rt.serverities;
1888 foreach(var project in projects) {
1890 el.append(out iter);
1892 el.set_value(iter, 0, project.id);
1893 el.set_value(iter, 1, project.display_name );
1894 if ("normal" == project.name) {
1895 _this.severity_id.el.set_active_iter(iter);
1900 _this.severity_id.loading = false;
1901 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
1907 public class Xcls_Label44 : Object
1909 public Gtk.Label el;
1910 private NewBranch _this;
1916 public Xcls_Label44(NewBranch _owner )
1919 this.el = new Gtk.Label( "Classification" );
1923 // set gobject values
1924 this.el.halign = Gtk.Align.START;
1927 // user defined functions
1930 public class Xcls_classification_id : Object
1932 public Gtk.ComboBox el;
1933 private NewBranch _this;
1937 public bool loading;
1940 public Xcls_classification_id(NewBranch _owner )
1943 _this.classification_id = this;
1944 this.el = new Gtk.ComboBox.with_entry();
1947 this.loading = false;
1949 // set gobject values
1950 var child_0 = new Xcls_clmodel( _this );
1952 this.el.set_model ( child_0.el );
1956 this.el.set_entry_text_column(1);
1959 // user defined functions
1960 public string selectedClassificationId () {
1965 this.el.get_active_iter (out iter);
1966 _this.clmodel.el.get_value (iter, 0, out val1);
1969 return (string) val1;
1976 public class Xcls_clmodel : Object
1978 public Gtk.ListStore el;
1979 private NewBranch _this;
1985 public Xcls_clmodel(NewBranch _owner )
1988 _this.clmodel = this;
1989 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
1993 // set gobject values
1996 // user defined functions
1997 public void loadClassifications ( ) {
1999 var rt = RooTicket.singleton();
2000 // rt.loadProjects();
2002 _this.classification_id.loading = true;
2008 el.append(out iter);
2011 var projects = rt.classifications;
2012 foreach(var project in projects) {
2014 el.append(out iter);
2016 el.set_value(iter, 0, project.id);
2017 el.set_value(iter, 1, project.display_name );
2018 if ("bug" == project.name) {
2019 _this.classification_id.el.set_active_iter(iter);
2024 _this.classification_id.loading = false;
2025 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
2031 public class Xcls_Label47 : Object
2033 public Gtk.Label el;
2034 private NewBranch _this;
2040 public Xcls_Label47(NewBranch _owner )
2043 this.el = new Gtk.Label( "Assign to" );
2047 // set gobject values
2048 this.el.halign = Gtk.Align.START;
2051 // user defined functions
2054 public class Xcls_developer_id : Object
2056 public Gtk.ComboBox el;
2057 private NewBranch _this;
2061 public bool loading;
2064 public Xcls_developer_id(NewBranch _owner )
2067 _this.developer_id = this;
2068 this.el = new Gtk.ComboBox.with_entry();
2071 this.loading = false;
2073 // set gobject values
2074 var child_0 = new Xcls_devmodel( _this );
2076 this.el.set_model ( child_0.el );
2080 this.el.set_entry_text_column(1);
2083 // user defined functions
2084 public string selectedDeveloperId () {
2089 this.el.get_active_iter (out iter);
2090 _this.devmodel.el.get_value (iter, 0, out val1);
2093 return (string) val1;
2100 public class Xcls_devmodel : Object
2102 public Gtk.ListStore el;
2103 private NewBranch _this;
2109 public Xcls_devmodel(NewBranch _owner )
2112 _this.devmodel = this;
2113 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
2117 // set gobject values
2120 // user defined functions
2121 public void loadDevelopers ( ) {
2123 var rt = RooTicket.singleton();
2124 //rt.loadProjects();
2126 _this.developer_id.loading = true;
2132 el.append(out iter);
2135 el.set_value(iter, 0, "");
2136 el.set_value(iter, 1, "-- select a developer --");
2138 _this.developer_id.el.set_active_iter(iter);
2141 var peps = rt.developers;
2142 foreach(var p in peps) {
2144 el.append(out iter);
2146 el.set_value(iter, 0, p.id);
2147 el.set_value(iter, 1, p.display_name );
2148 if (rt.authuser_id == p.id) {
2149 _this.developer_id.el.set_active_iter(iter);
2153 _this.developer_id.loading = false;
2154 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
2160 public class Xcls_Button50 : Object
2162 public Gtk.Button el;
2163 private NewBranch _this;
2169 public Xcls_Button50(NewBranch _owner )
2172 this.el = new Gtk.Button();
2176 // set gobject values
2177 this.el.label = "Create Ticket & Branch";
2182 this.el.get_style_context().add_class("suggested-action");
2186 this.el.clicked.connect( () => {
2187 GLib.debug("fire response = 1");
2190 var invalid = false;
2192 // validate first...
2193 _this.project_id.el.get_child().get_style_context().remove_class("warning");
2194 if (_this.project_id.selectedProjectId() == "") {
2195 _this.project_id.el.get_child().get_style_context().add_class("warning");
2199 _this.milestone_id.el.get_child().get_style_context().remove_class("warning");
2201 _this.priority_id.el.get_child().get_style_context().remove_class("warning");
2202 if (_this.priority_id.selectedPriorityId() == "") {
2203 _this.priority_id.el.get_child().get_style_context().add_class("warning");
2207 _this.classification_id.el.get_child().get_style_context().remove_class("warning");
2208 if (_this.classification_id.selectedClassificationId() == "") {
2209 _this.classification_id.el.get_child().get_style_context().add_class("warning");
2213 _this.developer_id.el.get_child().get_style_context().remove_class("warning");
2214 if (_this.developer_id.selectedDeveloperId() == "") {
2215 _this.developer_id.el.get_child().get_style_context().add_class("warning");
2219 _this.summary.el.get_style_context().remove_class("warning");
2220 if (_this.summary.el.get_text() == "") {
2221 _this.summary.el.get_style_context().add_class("warning");
2225 _this.description.el.get_style_context().remove_class("warning");
2230 GLib.debug("for is valid");
2232 _this.el.response(1);
2236 // user defined functions
2240 public class Xcls_spinner : Object
2242 public Gtk.Spinner el;
2243 private NewBranch _this;
2249 public Xcls_spinner(NewBranch _owner )
2252 _this.spinner = this;
2253 this.el = new Gtk.Spinner();
2257 // set gobject values
2258 this.el.hexpand = true;
2259 this.el.vexpand = true;
2262 // user defined functions
2266 public class Xcls_quick_commit_tab : Object
2269 private NewBranch _this;
2275 public Xcls_quick_commit_tab(NewBranch _owner )
2278 _this.quick_commit_tab = this;
2279 this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
2283 // set gobject values
2284 this.el.homogeneous = false;
2285 var child_0 = new Xcls_Table53( _this );
2287 this.el.pack_start ( child_0.el , false,false,0 );
2288 var child_1 = new Xcls_ScrolledWindow57( _this );
2290 this.el.add ( child_1.el );
2293 // user defined functions
2294 public void load_data () {
2295 _this.commit_message.el.set_text("");
2299 public class Xcls_Table53 : Object
2301 public Gtk.Table el;
2302 private NewBranch _this;
2308 public Xcls_Table53(NewBranch _owner )
2311 this.el = new Gtk.Table( 2, 5, true );
2315 // set gobject values
2316 this.el.expand = false;
2318 this.el.column_spacing = 4;
2319 this.el.vexpand = false;
2320 var child_0 = new Xcls_Label54( _this );
2322 this.el.attach_defaults ( child_0.el , 0,1,0,1 );
2323 var child_1 = new Xcls_commit_message( _this );
2325 this.el.attach_defaults ( child_1.el , 0,4,1,2 );
2326 var child_2 = new Xcls_createbtn( _this );
2328 this.el.attach_defaults ( child_2.el , 4,5,1,2 );
2331 // user defined functions
2333 public class Xcls_Label54 : Object
2335 public Gtk.Label el;
2336 private NewBranch _this;
2342 public Xcls_Label54(NewBranch _owner )
2345 this.el = new Gtk.Label( "Just commit with this comment" );
2349 // set gobject values
2350 this.el.halign = Gtk.Align.START;
2351 this.el.justify = Gtk.Justification.RIGHT;
2352 this.el.xalign = 0.900000f;
2355 // user defined functions
2358 public class Xcls_commit_message : Object
2360 public Gtk.Entry el;
2361 private NewBranch _this;
2367 public Xcls_commit_message(NewBranch _owner )
2370 _this.commit_message = this;
2371 this.el = new Gtk.Entry();
2375 // set gobject values
2376 this.el.visible = true;
2379 // user defined functions
2382 public class Xcls_createbtn : Object
2384 public Gtk.Button el;
2385 private NewBranch _this;
2391 public Xcls_createbtn(NewBranch _owner )
2394 _this.createbtn = this;
2395 this.el = new Gtk.Button();
2399 // set gobject values
2400 this.el.label = "Commit Changes";
2405 this.el.get_style_context().add_class("suggested-action");
2409 this.el.clicked.connect( () => {
2411 GLib.debug("fire response = 1");
2413 var ticket_id = _this.ticketsel.selectedTicketId();
2415 if (ticket_id == "") {
2416 _this.ticketsel.el.get_child().get_style_context().add_class("warning");
2420 _this.el.response(1);
2424 // user defined functions
2425 public void updateState () {
2427 var ticket_id = _this.ticketsel.selectedTicketId();
2429 if (ticket_id == "") {
2430 this.el.set_sensitive(false);
2434 this.el.set_sensitive(true);
2440 public class Xcls_ScrolledWindow57 : Object
2442 public Gtk.ScrolledWindow el;
2443 private NewBranch _this;
2449 public Xcls_ScrolledWindow57(NewBranch _owner )
2452 this.el = new Gtk.ScrolledWindow( null, null );
2456 // set gobject values
2457 this.el.height_request = 400;
2458 this.el.vexpand = true;
2459 var child_0 = new Xcls_diff_view( _this );
2461 this.el.add ( child_0.el );
2464 // user defined functions
2466 public class Xcls_diff_view : Object
2468 public Gtk.SourceView el;
2469 private NewBranch _this;
2475 public Xcls_diff_view(NewBranch _owner )
2478 _this.diff_view = this;
2479 this.el = new Gtk.SourceView();
2485 var description = Pango.FontDescription.from_string("monospace");
2486 description.set_size(9000);
2487 this.el.override_font(description);
2488 var lm = Gtk.SourceLanguageManager.get_default();
2490 ((Gtk.SourceBuffer)(this.el.get_buffer())).set_language(
2491 lm.get_language("diff")
2495 // user defined functions