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_table table;
32 public Xcls_project_id project_id;
33 public Xcls_tprcellrenderer tprcellrenderer;
34 public Xcls_tprmodel tprmodel;
35 public Xcls_summary summary;
36 public Xcls_milestone_id milestone_id;
37 public Xcls_msmodel msmodel;
38 public Xcls_description description;
39 public Xcls_priority_id priority_id;
40 public Xcls_primodel primodel;
41 public Xcls_severity_id severity_id;
42 public Xcls_sevmodel sevmodel;
43 public Xcls_classification_id classification_id;
44 public Xcls_clmodel clmodel;
45 public Xcls_developer_id developer_id;
46 public Xcls_devmodel devmodel;
47 public Xcls_commit_message commit_message;
48 public Xcls_createbtn createbtn;
49 public Xcls_diff_view diff_view;
54 public Gee.ArrayList<GitMonitorQueue> queue;
60 this.el = new Gtk.Dialog();
68 this.el.title = "Create a working branch ";
69 this.el.default_height = 500;
70 this.el.default_width = 500;
71 this.el.deletable = true;
73 var child_0 = new Xcls_Notebook2( _this );
75 this.el.get_content_area().add ( child_0.el );
78 this.el.delete_event.connect( (self, event) => {
83 this.el.response.connect( (self, response_id) => {
85 GLib.debug("got %d", (int) response_id);
90 // have they selected a ticket..
91 // make that the current active ticket?
92 // we really need to store locally what ticket is being worked on..
93 // in theory we could be working on multiple project and not merging..
94 // -- each repo would have their active ticket (only one per repo)
95 // -- so we could just store that in there
96 // -- initial load can check the contents of the ticket files on first scan.
99 if (response_id < 1) {
101 this.running = false;
105 var ticket_id = _this.ticketsel.selectedTicketId();
107 if (this.repo != null) {
108 var bn = _this.name.el.get_text();
110 var res = this.repo.setActiveTicket(
111 RooTicket.singleton().getById(ticket_id != "" ? ticket_id : "-1"), bn
114 // start the monitoring..
115 GitMonitor.gitmonitor.start();
121 this.running = false;
131 // user defined functions
132 public void show ( GitRepo repo, Gee.ArrayList<GitMonitorQueue> queue, string tid = "" )
134 // this.el.set_gravity(Gdk.Gravity.NORTH);
135 if (this.running) { // should not happen!!
136 GLib.error("new branch show called, when already being displayed?");
142 GitMonitor.gitmonitor.stop();
146 this.el.move((Gdk.Screen.width() / 2)- 250 ,0);
147 this.el.set_default_size( 500,200); // not sure why it grows..
155 this.el.set_keep_above(true);
157 _this.select_ticket_tab.load_data(tid);
158 _this.create_ticket_tab.load_data();
159 _this.quick_commit_tab.load_data();
170 public class Xcls_Notebook2 : Object
172 public Gtk.Notebook el;
173 private NewBranch _this;
179 public Xcls_Notebook2(NewBranch _owner )
182 this.el = new Gtk.Notebook();
186 // set gobject values
187 this.el.vexpand = true;
188 var child_0 = new Xcls_label_select_ticket( _this );
190 var child_1 = new Xcls_label_create_ticket( _this );
192 var child_2 = new Xcls_label_quick_commit( _this );
194 var child_3 = new Xcls_select_ticket_tab( _this );
196 this.el.append_page ( child_3.el , _this.label_select_ticket.el );
197 var child_4 = new Xcls_Box25( _this );
199 this.el.append_page ( child_4.el , _this.label_create_ticket.el );
200 var child_5 = new Xcls_Box51( _this );
202 this.el.append_page ( child_5.el , _this.label_quick_commit.el );
205 // user defined functions
207 public class Xcls_label_select_ticket : Object
210 private NewBranch _this;
216 public Xcls_label_select_ticket(NewBranch _owner )
219 _this.label_select_ticket = this;
220 this.el = new Gtk.Label( "Select Existing Ticket to work on" );
224 // set gobject values
227 // user defined functions
230 public class Xcls_label_create_ticket : Object
233 private NewBranch _this;
239 public Xcls_label_create_ticket(NewBranch _owner )
242 _this.label_create_ticket = this;
243 this.el = new Gtk.Label( "Create a New Ticket" );
247 // set gobject values
250 // user defined functions
253 public class Xcls_label_quick_commit : Object
256 private NewBranch _this;
262 public Xcls_label_quick_commit(NewBranch _owner )
265 _this.label_quick_commit = this;
266 this.el = new Gtk.Label( "Quick Commit" );
270 // set gobject values
273 // user defined functions
276 public class Xcls_select_ticket_tab : Object
279 private NewBranch _this;
285 public Xcls_select_ticket_tab(NewBranch _owner )
288 _this.select_ticket_tab = this;
289 this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
293 // set gobject values
294 this.el.homogeneous = false;
295 var child_0 = new Xcls_Table7( _this );
297 this.el.pack_start ( child_0.el , false,false,0 );
298 var child_1 = new Xcls_scrolled_window( _this );
300 this.el.add ( child_1.el );
303 // user defined functions
304 public void load_data () {
306 GLib.debug("Loading tickets");
308 var curproj = RooProject.getProjectByRepo(_this.repo);
309 _this.prmodel.loadProjects(curproj == null ? "" : curproj.id);
311 _this.dbmodel.loadTickets(curproj == null ? "": curproj.id, tid);
312 _this.branchbtn.updateState();
314 _this.ticketsel.el.get_child().get_style_context().remove_class("warning");
316 var name = RooTicket.singleton().usernameLocal();
317 var ticket = RooTicket.singleton().getById(tid);
318 _this.name.el.set_text("wip_%s_T%s_%s".printf(name,ticket.id, ticket.summaryToBranchName()));
320 _this.ticketsel.el.get_child().get_style_context().add_class("warning");
322 _this.view.loadTicket(tid);
327 public class Xcls_Table7 : Object
330 private NewBranch _this;
336 public Xcls_Table7(NewBranch _owner )
339 this.el = new Gtk.Table( 5, 5, true );
343 // set gobject values
344 this.el.expand = false;
346 this.el.column_spacing = 4;
347 this.el.vexpand = false;
348 var child_0 = new Xcls_Label8( _this );
350 this.el.attach_defaults ( child_0.el , 0,1,0,1 );
351 var child_1 = new Xcls_Label9( _this );
353 this.el.attach_defaults ( child_1.el , 1,2,0,1 );
354 var child_2 = new Xcls_projectsel( _this );
356 this.el.attach_defaults ( child_2.el , 0,1,1,2 );
357 var child_3 = new Xcls_ticketsel( _this );
359 this.el.attach_defaults ( child_3.el , 1,5,1,2 );
360 var child_4 = new Xcls_Label16( _this );
362 this.el.attach_defaults ( child_4.el , 0,1,3,4 );
363 var child_5 = new Xcls_name( _this );
365 this.el.attach_defaults ( child_5.el , 0,4,4,5 );
366 var child_6 = new Xcls_branchbtn( _this );
368 this.el.attach_defaults ( child_6.el , 4,5,4,5 );
369 var child_7 = new Xcls_Box19( _this );
371 this.el.attach_defaults ( child_7.el , 0,5,2,3 );
374 // user defined functions
376 public class Xcls_Label8 : Object
379 private NewBranch _this;
385 public Xcls_Label8(NewBranch _owner )
388 this.el = new Gtk.Label( "Project" );
392 // set gobject values
393 this.el.halign = Gtk.Align.START;
394 this.el.justify = Gtk.Justification.RIGHT;
395 this.el.visible = true;
398 // user defined functions
401 public class Xcls_Label9 : Object
404 private NewBranch _this;
410 public Xcls_Label9(NewBranch _owner )
413 this.el = new Gtk.Label( "Ticket" );
417 // set gobject values
418 this.el.halign = Gtk.Align.START;
419 this.el.visible = true;
422 // user defined functions
425 public class Xcls_projectsel : Object
427 public Gtk.ComboBox el;
428 private NewBranch _this;
435 public Xcls_projectsel(NewBranch _owner )
438 _this.projectsel = this;
439 this.el = new Gtk.ComboBox.with_entry();
442 this.loading = false;
444 // set gobject values
445 var child_0 = new Xcls_prcellrenderer( _this );
447 this.el.pack_start ( child_0.el , true );
448 var child_1 = new Xcls_prmodel( _this );
450 this.el.set_model ( child_1.el );
454 this.el.set_entry_text_column(1);
457 this.el.changed.connect( () => {
461 var project_id = this.selectedProjectId();
462 _this.dbmodel.loadTickets(project_id);
465 /*if (this.loading) {
468 var ticket_id = this.selectedTicketId();
470 var name = RooTicket.singleton().usernameLocal();
472 if (ticket_id == "" || ticket_id == null) {
474 var dt = new DateTime.now_local();
475 _this.name.el.set_text("wip_%s_%s".printf(name,dt.format("%Y_%b_%d")));
480 var ticket = RooTicket.singleton().getById(ticket_id);
482 _this.name.el.set_text("wip_%s_T%s_%s".printf(name,ticket.id, ticket.summaryToBranchName()));
484 //GLib.debug (//"Selection: %s, %s\n", (string) val1, (string) val2);
489 // user defined functions
490 public string selectedProjectId () {
495 this.el.get_active_iter (out iter);
496 _this.prmodel.el.get_value (iter, 0, out val1);
499 return (string) val1;
506 public class Xcls_prcellrenderer : Object
508 public Gtk.CellRendererText el;
509 private NewBranch _this;
515 public Xcls_prcellrenderer(NewBranch _owner )
518 _this.prcellrenderer = this;
519 this.el = new Gtk.CellRendererText();
523 // set gobject values
526 // user defined functions
529 public class Xcls_prmodel : Object
531 public Gtk.ListStore el;
532 private NewBranch _this;
538 public Xcls_prmodel(NewBranch _owner )
541 _this.prmodel = this;
542 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
546 // set gobject values
549 // user defined functions
550 public void loadProjects (string id) {
554 _this.projectsel.loading = true;
563 el.set_value(iter, 0, "");
564 el.set_value(iter, 1, "-- select a project --");
566 _this.projectsel.el.set_active_iter(iter);
569 foreach(var project in RooProject.projects()) {
573 el.set_value(iter, 0, project.id);
574 el.set_value(iter, 1, project.name );
575 if (id == project.id) {
576 _this.projectsel.el.set_active_iter(iter);
581 _this.projectsel.loading = false;
582 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
588 public class Xcls_ticketsel : Object
590 public Gtk.ComboBox el;
591 private NewBranch _this;
598 public Xcls_ticketsel(NewBranch _owner )
601 _this.ticketsel = this;
602 this.el = new Gtk.ComboBox.with_entry();
605 this.loading = false;
607 // set gobject values
608 var child_0 = new Xcls_dbcellrenderer( _this );
610 this.el.pack_start ( child_0.el , true );
611 var child_1 = new Xcls_dbmodel( _this );
613 this.el.set_model ( child_1.el );
617 //this.el.add_attribute(_this.dbcellrenderer.el , "markup", 1 );
618 this.el.set_entry_text_column(1);
619 this.el.get_child().set_sensitive(false);
622 this.el.changed.connect( () => {
626 var ticket_id = this.selectedTicketId();
628 var name = RooTicket.singleton().usernameLocal();
630 this.el.get_child().get_style_context().remove_class("warning");
631 if (ticket_id == "" || ticket_id == null) {
633 var dt = new DateTime.now_local();
634 _this.name.el.set_text("wip_%s_%s".printf(name,dt.format("%Y_%b_%d")));
635 _this.view.loadTicket("");
637 this.el.get_child().get_style_context().add_class("warning");
638 _this.createbtn.updateState();
643 var ticket = RooTicket.singleton().getById(ticket_id);
645 _this.name.el.set_text("wip_%s_T%s_%s".printf(name,ticket.id, ticket.summaryToBranchName()));
646 _this.scrolled_window.el.show();
648 _this.view.loadTicket(ticket.id);
649 _this.branchbtn.updateState();
651 //GLib.debug (//"Selection: %s, %s\n", (string) val1, (string) val2);
655 // user defined functions
656 public string selectedTicketId () {
661 this.el.get_active_iter (out iter);
662 _this.dbmodel.el.get_value (iter, 0, out val1);
665 return (string) val1;
672 public class Xcls_dbcellrenderer : Object
674 public Gtk.CellRendererText el;
675 private NewBranch _this;
681 public Xcls_dbcellrenderer(NewBranch _owner )
684 _this.dbcellrenderer = this;
685 this.el = new Gtk.CellRendererText();
689 // set gobject values
692 // user defined functions
695 public class Xcls_dbmodel : Object
697 public Gtk.ListStore el;
698 private NewBranch _this;
704 public Xcls_dbmodel(NewBranch _owner )
707 _this.dbmodel = this;
708 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
712 // set gobject values
715 // user defined functions
716 public void loadTickets (string project_id , string tid = "") {
720 // fixme .. get project id from selection..
722 RooTicket.singleton().loadTickets(
724 _this.btn_not_me.el.active ? RooTicket.Who.ANYBODY : RooTicket.Who.ME,
725 _this.btn_closed.el.active ? RooTicket.Status.ALL : RooTicket.Status.ACTIVE
728 _this.ticketsel.loading = true;
737 el.set_value(iter, 0, "");
738 el.set_value(iter, 1, "-- select a ticket --");
740 _this.ticketsel.el.set_active_iter(iter);
741 var tickets = RooTicket.singleton().tickets;
742 foreach(var ticket in tickets) {
746 el.set_value(iter, 0, ticket.id);
747 el.set_value(iter, 1, "#%s %s".printf( ticket.id, ticket.summary));
749 if (ticket.id == tid) {
750 _this.ticketsel.el.set_active_iter(iter);
755 _this.ticketsel.loading = false;
756 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
762 public class Xcls_Label16 : Object
765 private NewBranch _this;
771 public Xcls_Label16(NewBranch _owner )
774 this.el = new Gtk.Label( "Use this as branch name" );
778 // set gobject values
779 this.el.halign = Gtk.Align.START;
780 this.el.justify = Gtk.Justification.RIGHT;
781 this.el.xalign = 0.900000f;
784 // user defined functions
787 public class Xcls_name : Object
790 private NewBranch _this;
796 public Xcls_name(NewBranch _owner )
800 this.el = new Gtk.Entry();
804 // set gobject values
805 this.el.visible = true;
808 // user defined functions
811 public class Xcls_branchbtn : Object
813 public Gtk.Button el;
814 private NewBranch _this;
820 public Xcls_branchbtn(NewBranch _owner )
823 _this.branchbtn = this;
824 this.el = new Gtk.Button();
828 // set gobject values
829 this.el.label = "Create Branch";
834 this.el.get_style_context().add_class("suggested-action");
838 this.el.clicked.connect( () => {
840 GLib.debug("fire response = 1");
842 var ticket_id = _this.ticketsel.selectedTicketId();
844 if (ticket_id == "") {
845 _this.ticketsel.el.get_child().get_style_context().add_class("warning");
849 _this.el.response(1);
853 // user defined functions
854 public void updateState () {
856 var ticket_id = _this.ticketsel.selectedTicketId();
858 if (ticket_id == "") {
859 this.el.set_sensitive(false);
863 this.el.set_sensitive(true);
868 public class Xcls_Box19 : Object
871 private NewBranch _this;
877 public Xcls_Box19(NewBranch _owner )
880 this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
884 // set gobject values
885 var child_0 = new Xcls_btn_not_me( _this );
887 this.el.add ( child_0.el );
888 var child_1 = new Xcls_btn_closed( _this );
890 this.el.add ( child_1.el );
891 var child_2 = new Xcls_Label22( _this );
893 this.el.add ( child_2.el );
896 // user defined functions
898 public class Xcls_btn_not_me : Object
900 public Gtk.CheckButton el;
901 private NewBranch _this;
907 public Xcls_btn_not_me(NewBranch _owner )
910 _this.btn_not_me = this;
911 this.el = new Gtk.CheckButton();
915 // set gobject values
916 this.el.label = "Show tickets not assigned to me";
919 this.el.toggled.connect( () => {
920 var project_id = _this.projectsel.selectedProjectId();
921 _this.dbmodel.loadTickets(project_id);
925 // user defined functions
928 public class Xcls_btn_closed : Object
930 public Gtk.CheckButton el;
931 private NewBranch _this;
937 public Xcls_btn_closed(NewBranch _owner )
940 _this.btn_closed = this;
941 this.el = new Gtk.CheckButton();
945 // set gobject values
946 this.el.label = "Show closed Tickets";
949 this.el.toggled.connect( () => {
950 var project_id = _this.projectsel.selectedProjectId();
951 _this.dbmodel.loadTickets(project_id);
956 // user defined functions
959 public class Xcls_Label22 : Object
962 private NewBranch _this;
968 public Xcls_Label22(NewBranch _owner )
971 this.el = new Gtk.Label( "<a href=\"refresh\">Refresh Ticket list</a>" );
975 // set gobject values
976 this.el.halign = Gtk.Align.END;
977 this.el.hexpand = true;
978 this.el.use_markup = true;
981 this.el.activate_link.connect( (uri) => {
982 if (uri == "refresh") {
984 var curproj = RooProject.getProjectByRepo(_this.repo);
985 _this.prmodel.loadProjects(curproj == null ? "": curproj.id);
987 _this.dbmodel.loadTickets(curproj == null ? "": curproj.id);
993 // user defined functions
998 public class Xcls_scrolled_window : Object
1000 public Gtk.ScrolledWindow el;
1001 private NewBranch _this;
1007 public Xcls_scrolled_window(NewBranch _owner )
1010 _this.scrolled_window = this;
1011 this.el = new Gtk.ScrolledWindow( null, null );
1015 // set gobject values
1016 this.el.height_request = 500;
1017 this.el.vexpand = true;
1018 var child_0 = new Xcls_view( _this );
1020 this.el.add ( child_0.el );
1025 this.el.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);
1029 // user defined functions
1031 public class Xcls_view : Object
1033 public WebKit.WebView el;
1034 private NewBranch _this;
1040 public Xcls_view(NewBranch _owner )
1044 this.el = new WebKit.WebView();
1048 // set gobject values
1051 // user defined functions
1052 public void loadTicket (string tid) {
1054 _this.el.get_size(out w, out h);
1057 _this.scrolled_window.el.hide();
1058 _this.el.resize(w, 150);
1060 _this.scrolled_window.el.show();
1061 _this.el.resize(w, 800);
1064 var rs = RooTicket.singleton();
1065 var uri = new WebKit.URIRequest("https://roojs.com/admin.php/MTrack/View/" + tid);
1066 var hd = uri.get_http_headers();
1067 var authCode = Base64.encode ("%s:%s".printf(rs.username, rs.password).data);
1068 hd.append("Authorization", "Basic %s".printf(authCode));
1070 this.el.load_request(uri);
1076 public class Xcls_Box25 : Object
1079 private NewBranch _this;
1085 public Xcls_Box25(NewBranch _owner )
1088 this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
1092 // set gobject values
1093 this.el.homogeneous = false;
1094 var child_0 = new Xcls_table( _this );
1096 this.el.pack_start ( child_0.el , false,false,0 );
1099 // user defined functions
1101 public class Xcls_table : Object
1103 public Gtk.Table el;
1104 private NewBranch _this;
1110 public Xcls_table(NewBranch _owner )
1114 this.el = new Gtk.Table( 14, 4, true );
1118 // set gobject values
1119 this.el.expand = false;
1121 this.el.column_spacing = 4;
1122 this.el.vexpand = false;
1123 var child_0 = new Xcls_Label27( _this );
1125 this.el.attach_defaults ( child_0.el , 0,1,0,1 );
1126 var child_1 = new Xcls_Label28( _this );
1128 this.el.attach_defaults ( child_1.el , 1,2,0,1 );
1129 var child_2 = new Xcls_project_id( _this );
1131 this.el.attach_defaults ( child_2.el , 0,1,1,2 );
1132 var child_3 = new Xcls_summary( _this );
1134 this.el.attach_defaults ( child_3.el , 1,4,1,2 );
1135 var child_4 = new Xcls_Label33( _this );
1137 this.el.attach_defaults ( child_4.el , 0,1,2,3 );
1138 var child_5 = new Xcls_milestone_id( _this );
1140 this.el.attach_defaults ( child_5.el , 0,1,3,4 );
1141 var child_6 = new Xcls_Label36( _this );
1143 this.el.attach_defaults ( child_6.el , 1,4,2,3 );
1144 var child_7 = new Xcls_description( _this );
1146 this.el.attach_defaults ( child_7.el , 1,4,3,12 );
1147 var child_8 = new Xcls_Label38( _this );
1149 this.el.attach_defaults ( child_8.el , 0,1,4,5 );
1150 var child_9 = new Xcls_priority_id( _this );
1152 this.el.attach_defaults ( child_9.el , 0,1,5,6 );
1153 var child_10 = new Xcls_Label41( _this );
1155 this.el.attach_defaults ( child_10.el , 0,1,6,7 );
1156 var child_11 = new Xcls_severity_id( _this );
1158 this.el.attach_defaults ( child_11.el , 0,1,7,8 );
1159 var child_12 = new Xcls_Label44( _this );
1161 this.el.attach_defaults ( child_12.el , 0,1,8,9 );
1162 var child_13 = new Xcls_classification_id( _this );
1164 this.el.attach_defaults ( child_13.el , 0,1,9,10 );
1165 var child_14 = new Xcls_Label47( _this );
1167 this.el.attach_defaults ( child_14.el , 0,1,10,11 );
1168 var child_15 = new Xcls_developer_id( _this );
1170 this.el.attach_defaults ( child_15.el , 0,1,11,12 );
1171 var child_16 = new Xcls_Button50( _this );
1173 this.el.attach_defaults ( child_16.el , 0,4,13,14 );
1176 // user defined functions
1178 public class Xcls_Label27 : Object
1180 public Gtk.Label el;
1181 private NewBranch _this;
1187 public Xcls_Label27(NewBranch _owner )
1190 this.el = new Gtk.Label( "Project" );
1194 // set gobject values
1195 this.el.halign = Gtk.Align.START;
1196 this.el.visible = true;
1199 // user defined functions
1202 public class Xcls_Label28 : Object
1204 public Gtk.Label el;
1205 private NewBranch _this;
1211 public Xcls_Label28(NewBranch _owner )
1214 this.el = new Gtk.Label( "Summary" );
1218 // set gobject values
1219 this.el.halign = Gtk.Align.START;
1220 this.el.visible = true;
1223 // user defined functions
1226 public class Xcls_project_id : Object
1228 public Gtk.ComboBox el;
1229 private NewBranch _this;
1233 public bool loading;
1236 public Xcls_project_id(NewBranch _owner )
1239 _this.project_id = this;
1240 this.el = new Gtk.ComboBox.with_entry();
1243 this.loading = false;
1245 // set gobject values
1246 var child_0 = new Xcls_tprcellrenderer( _this );
1248 this.el.pack_start ( child_0.el , true );
1249 var child_1 = new Xcls_tprmodel( _this );
1251 this.el.set_model ( child_1.el );
1255 this.el.set_entry_text_column(1);
1258 this.el.changed.connect( () => {
1262 var project_id = this.selectedProjectId();
1264 var rt = RooTicket.singleton();
1265 rt.loadProjectOptions(project_id);
1267 _this.msmodel.loadMilestones();
1268 _this.primodel.loadPriorities();
1269 _this.sevmodel.loadSeverities();
1270 _this.clmodel.loadClassifications();
1271 _this.devmodel.loadDevelopers();
1273 // affects projects and milestones..
1276 /*if (this.loading) {
1279 var ticket_id = this.selectedTicketId();
1281 var name = RooTicket.singleton().usernameLocal();
1283 if (ticket_id == "" || ticket_id == null) {
1285 var dt = new DateTime.now_local();
1286 _this.name.el.set_text("wip_%s_%s".printf(name,dt.format("%Y_%b_%d")));
1291 var ticket = RooTicket.singleton().getById(ticket_id);
1293 _this.name.el.set_text("wip_%s_T%s_%s".printf(name,ticket.id, ticket.summaryToBranchName()));
1295 //GLib.debug (//"Selection: %s, %s\n", (string) val1, (string) val2);
1300 // user defined functions
1301 public string selectedProjectId () {
1306 this.el.get_active_iter (out iter);
1307 _this.tprmodel.el.get_value (iter, 0, out val1);
1310 return (string) val1;
1317 public class Xcls_tprcellrenderer : Object
1319 public Gtk.CellRendererText el;
1320 private NewBranch _this;
1326 public Xcls_tprcellrenderer(NewBranch _owner )
1329 _this.tprcellrenderer = this;
1330 this.el = new Gtk.CellRendererText();
1334 // set gobject values
1337 // user defined functions
1340 public class Xcls_tprmodel : Object
1342 public Gtk.ListStore el;
1343 private NewBranch _this;
1349 public Xcls_tprmodel(NewBranch _owner )
1352 _this.tprmodel = this;
1353 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
1357 // set gobject values
1360 // user defined functions
1361 public void loadProjects (string id) {
1364 _this.project_id.loading = true;
1370 el.append(out iter);
1373 el.set_value(iter, 0, "");
1374 el.set_value(iter, 1, "-- select a project --");
1376 _this.project_id.el.set_active_iter(iter);
1379 foreach(var project in RooProject.projects()) {
1381 el.append(out iter);
1383 el.set_value(iter, 0, project.id);
1384 el.set_value(iter, 1, project.name );
1385 if (id == project.id) {
1386 _this.project_id.el.set_active_iter(iter);
1391 _this.project_id.loading = false;
1392 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
1398 public class Xcls_summary : Object
1400 public Gtk.Entry el;
1401 private NewBranch _this;
1407 public Xcls_summary(NewBranch _owner )
1410 _this.summary = this;
1411 this.el = new Gtk.Entry();
1415 // set gobject values
1416 this.el.visible = true;
1419 // user defined functions
1422 public class Xcls_Label33 : Object
1424 public Gtk.Label el;
1425 private NewBranch _this;
1431 public Xcls_Label33(NewBranch _owner )
1434 this.el = new Gtk.Label( "Milestone" );
1438 // set gobject values
1439 this.el.halign = Gtk.Align.START;
1440 this.el.justify = Gtk.Justification.RIGHT;
1441 this.el.xalign = 0.900000f;
1444 // user defined functions
1447 public class Xcls_milestone_id : Object
1449 public Gtk.ComboBox el;
1450 private NewBranch _this;
1454 public bool loading;
1457 public Xcls_milestone_id(NewBranch _owner )
1460 _this.milestone_id = this;
1461 this.el = new Gtk.ComboBox.with_entry();
1464 this.loading = false;
1466 // set gobject values
1467 var child_0 = new Xcls_msmodel( _this );
1469 this.el.set_model ( child_0.el );
1473 this.el.set_entry_text_column(1);
1476 // user defined functions
1477 public string selectedMilestoneId () {
1482 this.el.get_active_iter (out iter);
1483 _this.msmodel.el.get_value (iter, 0, out val1);
1486 return (string) val1;
1493 public class Xcls_msmodel : Object
1495 public Gtk.ListStore el;
1496 private NewBranch _this;
1502 public Xcls_msmodel(NewBranch _owner )
1505 _this.msmodel = this;
1506 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
1510 // set gobject values
1513 // user defined functions
1514 public void loadMilestones ( ) {
1516 var rt = RooTicket.singleton();
1517 // rt.loadProjects();
1519 _this.milestone_id.loading = true;
1525 el.append(out iter);
1528 el.set_value(iter, 0, "");
1529 el.set_value(iter, 1, "-- select a milestone --");
1530 _this.milestone_id.el.set_active_iter(iter);
1532 var projects = rt.milestones;
1533 foreach(var project in projects) {
1535 el.append(out iter);
1537 el.set_value(iter, 0, project.id);
1538 el.set_value(iter, 1, project.display_name );
1539 // if (id == project.id) {
1540 // _this.milestone.el.set_active_iter(iter);
1546 _this.milestone_id.loading = false;
1547 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
1553 public class Xcls_Label36 : Object
1555 public Gtk.Label el;
1556 private NewBranch _this;
1562 public Xcls_Label36(NewBranch _owner )
1565 this.el = new Gtk.Label( "Description" );
1569 // set gobject values
1570 this.el.halign = Gtk.Align.START;
1573 // user defined functions
1576 public class Xcls_description : Object
1578 public Gtk.TextView el;
1579 private NewBranch _this;
1585 public Xcls_description(NewBranch _owner )
1588 _this.description = this;
1589 this.el = new Gtk.TextView();
1593 // set gobject values
1594 this.el.border_width = 1;
1597 // user defined functions
1600 public class Xcls_Label38 : Object
1602 public Gtk.Label el;
1603 private NewBranch _this;
1609 public Xcls_Label38(NewBranch _owner )
1612 this.el = new Gtk.Label( "Priority" );
1616 // set gobject values
1617 this.el.halign = Gtk.Align.START;
1618 this.el.xalign = 0.900000f;
1621 // user defined functions
1624 public class Xcls_priority_id : Object
1626 public Gtk.ComboBox el;
1627 private NewBranch _this;
1631 public bool loading;
1634 public Xcls_priority_id(NewBranch _owner )
1637 _this.priority_id = this;
1638 this.el = new Gtk.ComboBox.with_entry();
1641 this.loading = false;
1643 // set gobject values
1644 var child_0 = new Xcls_primodel( _this );
1646 this.el.set_model ( child_0.el );
1650 this.el.set_entry_text_column(1);
1653 // user defined functions
1654 public string selectedPriorityId () {
1659 this.el.get_active_iter (out iter);
1660 _this.primodel.el.get_value (iter, 0, out val1);
1663 return (string) val1;
1670 public class Xcls_primodel : Object
1672 public Gtk.ListStore el;
1673 private NewBranch _this;
1679 public Xcls_primodel(NewBranch _owner )
1682 _this.primodel = this;
1683 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
1687 // set gobject values
1690 // user defined functions
1691 public void loadPriorities ( ) {
1693 var rt = RooTicket.singleton();
1694 // rt.loadProjects();
1696 _this.priority_id.loading = true;
1703 var projects = rt.priorities;
1704 foreach(var project in projects) {
1706 el.append(out iter);
1708 el.set_value(iter, 0, project.id);
1709 el.set_value(iter, 1, project.display_name );
1710 if ("normal" == project.name) {
1711 _this.priority_id.el.set_active_iter(iter);
1716 _this.priority_id.loading = false;
1723 public class Xcls_Label41 : Object
1725 public Gtk.Label el;
1726 private NewBranch _this;
1732 public Xcls_Label41(NewBranch _owner )
1735 this.el = new Gtk.Label( "Severity" );
1739 // set gobject values
1740 this.el.halign = Gtk.Align.START;
1743 // user defined functions
1746 public class Xcls_severity_id : Object
1748 public Gtk.ComboBox el;
1749 private NewBranch _this;
1753 public bool loading;
1756 public Xcls_severity_id(NewBranch _owner )
1759 _this.severity_id = this;
1760 this.el = new Gtk.ComboBox.with_entry();
1763 this.loading = false;
1765 // set gobject values
1766 var child_0 = new Xcls_sevmodel( _this );
1768 this.el.set_model ( child_0.el );
1772 this.el.set_entry_text_column(1);
1775 // user defined functions
1776 public string selectedSeverityId () {
1781 this.el.get_active_iter (out iter);
1782 _this.sevmodel.el.get_value (iter, 0, out val1);
1785 return (string) val1;
1792 public class Xcls_sevmodel : Object
1794 public Gtk.ListStore el;
1795 private NewBranch _this;
1801 public Xcls_sevmodel(NewBranch _owner )
1804 _this.sevmodel = this;
1805 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
1809 // set gobject values
1812 // user defined functions
1813 public void loadSeverities () {
1815 var rt = RooTicket.singleton();
1816 //rt.loadProjects();
1818 _this.severity_id.loading = true;
1824 var projects = rt.serverities;
1825 foreach(var project in projects) {
1827 el.append(out iter);
1829 el.set_value(iter, 0, project.id);
1830 el.set_value(iter, 1, project.display_name );
1831 if ("normal" == project.name) {
1832 _this.severity_id.el.set_active_iter(iter);
1837 _this.severity_id.loading = false;
1838 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
1844 public class Xcls_Label44 : Object
1846 public Gtk.Label el;
1847 private NewBranch _this;
1853 public Xcls_Label44(NewBranch _owner )
1856 this.el = new Gtk.Label( "Classification" );
1860 // set gobject values
1861 this.el.halign = Gtk.Align.START;
1864 // user defined functions
1867 public class Xcls_classification_id : Object
1869 public Gtk.ComboBox el;
1870 private NewBranch _this;
1874 public bool loading;
1877 public Xcls_classification_id(NewBranch _owner )
1880 _this.classification_id = this;
1881 this.el = new Gtk.ComboBox.with_entry();
1884 this.loading = false;
1886 // set gobject values
1887 var child_0 = new Xcls_clmodel( _this );
1889 this.el.set_model ( child_0.el );
1893 this.el.set_entry_text_column(1);
1896 // user defined functions
1897 public string selectedClassificationId () {
1902 this.el.get_active_iter (out iter);
1903 _this.clmodel.el.get_value (iter, 0, out val1);
1906 return (string) val1;
1913 public class Xcls_clmodel : Object
1915 public Gtk.ListStore el;
1916 private NewBranch _this;
1922 public Xcls_clmodel(NewBranch _owner )
1925 _this.clmodel = this;
1926 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
1930 // set gobject values
1933 // user defined functions
1934 public void loadClassifications ( ) {
1936 var rt = RooTicket.singleton();
1937 // rt.loadProjects();
1939 _this.classification_id.loading = true;
1945 el.append(out iter);
1948 var projects = rt.classifications;
1949 foreach(var project in projects) {
1951 el.append(out iter);
1953 el.set_value(iter, 0, project.id);
1954 el.set_value(iter, 1, project.display_name );
1955 if ("bug" == project.name) {
1956 _this.classification_id.el.set_active_iter(iter);
1961 _this.classification_id.loading = false;
1962 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
1968 public class Xcls_Label47 : Object
1970 public Gtk.Label el;
1971 private NewBranch _this;
1977 public Xcls_Label47(NewBranch _owner )
1980 this.el = new Gtk.Label( "Assign to" );
1984 // set gobject values
1985 this.el.halign = Gtk.Align.START;
1988 // user defined functions
1991 public class Xcls_developer_id : Object
1993 public Gtk.ComboBox el;
1994 private NewBranch _this;
1998 public bool loading;
2001 public Xcls_developer_id(NewBranch _owner )
2004 _this.developer_id = this;
2005 this.el = new Gtk.ComboBox.with_entry();
2008 this.loading = false;
2010 // set gobject values
2011 var child_0 = new Xcls_devmodel( _this );
2013 this.el.set_model ( child_0.el );
2017 this.el.set_entry_text_column(1);
2020 // user defined functions
2021 public string selectedDeveloperId () {
2026 this.el.get_active_iter (out iter);
2027 _this.devmodel.el.get_value (iter, 0, out val1);
2030 return (string) val1;
2037 public class Xcls_devmodel : Object
2039 public Gtk.ListStore el;
2040 private NewBranch _this;
2046 public Xcls_devmodel(NewBranch _owner )
2049 _this.devmodel = this;
2050 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
2054 // set gobject values
2057 // user defined functions
2058 public void loadDevelopers ( ) {
2060 var rt = RooTicket.singleton();
2061 //rt.loadProjects();
2063 _this.developer_id.loading = true;
2069 el.append(out iter);
2072 el.set_value(iter, 0, "");
2073 el.set_value(iter, 1, "-- select a developer --");
2075 _this.developer_id.el.set_active_iter(iter);
2078 var peps = rt.developers;
2079 foreach(var p in peps) {
2081 el.append(out iter);
2083 el.set_value(iter, 0, p.id);
2084 el.set_value(iter, 1, p.display_name );
2085 if (rt.authuser_id == p.id) {
2086 _this.developer_id.el.set_active_iter(iter);
2090 _this.developer_id.loading = false;
2091 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
2097 public class Xcls_Button50 : Object
2099 public Gtk.Button el;
2100 private NewBranch _this;
2106 public Xcls_Button50(NewBranch _owner )
2109 this.el = new Gtk.Button();
2113 // set gobject values
2114 this.el.label = "Create Ticket & Branch";
2119 this.el.get_style_context().add_class("suggested-action");
2123 this.el.clicked.connect( () => {
2124 GLib.debug("fire response = 1");
2127 var invalid = false;
2129 // validate first...
2130 _this.project_id.el.get_child().get_style_context().remove_class("warning");
2131 if (_this.project_id.selectedProjectId() == "") {
2132 _this.project_id.el.get_child().get_style_context().add_class("warning");
2136 _this.milestone_id.el.get_child().get_style_context().remove_class("warning");
2138 _this.priority_id.el.get_child().get_style_context().remove_class("warning");
2139 if (_this.priority_id.selectedPriorityId() == "") {
2140 _this.priority_id.el.get_child().get_style_context().add_class("warning");
2144 _this.classification_id.el.get_child().get_style_context().remove_class("warning");
2145 if (_this.classification_id.selectedClassificationId() == "") {
2146 _this.classification_id.el.get_child().get_style_context().add_class("warning");
2150 _this.developer_id.el.get_child().get_style_context().remove_class("warning");
2151 if (_this.developer_id.selectedDeveloperId() == "") {
2152 _this.developer_id.el.get_child().get_style_context().add_class("warning");
2156 _this.summary.el.get_style_context().remove_class("warning");
2157 if (_this.summary.el.get_text() == "") {
2158 _this.summary.el.get_style_context().add_class("warning");
2162 _this.description.el.get_style_context().remove_class("warning");
2167 GLib.debug("for is valid");
2169 _this.el.response(1);
2173 // user defined functions
2178 public class Xcls_Box51 : Object
2181 private NewBranch _this;
2187 public Xcls_Box51(NewBranch _owner )
2190 this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
2194 // set gobject values
2195 this.el.homogeneous = false;
2196 var child_0 = new Xcls_Table52( _this );
2198 this.el.pack_start ( child_0.el , false,false,0 );
2199 var child_1 = new Xcls_ScrolledWindow56( _this );
2201 this.el.add ( child_1.el );
2204 // user defined functions
2206 public class Xcls_Table52 : Object
2208 public Gtk.Table el;
2209 private NewBranch _this;
2215 public Xcls_Table52(NewBranch _owner )
2218 this.el = new Gtk.Table( 2, 5, true );
2222 // set gobject values
2223 this.el.expand = false;
2225 this.el.column_spacing = 4;
2226 this.el.vexpand = false;
2227 var child_0 = new Xcls_Label53( _this );
2229 this.el.attach_defaults ( child_0.el , 0,1,0,1 );
2230 var child_1 = new Xcls_commit_message( _this );
2232 this.el.attach_defaults ( child_1.el , 0,4,1,2 );
2233 var child_2 = new Xcls_createbtn( _this );
2235 this.el.attach_defaults ( child_2.el , 4,5,1,2 );
2238 // user defined functions
2240 public class Xcls_Label53 : Object
2242 public Gtk.Label el;
2243 private NewBranch _this;
2249 public Xcls_Label53(NewBranch _owner )
2252 this.el = new Gtk.Label( "Just commit with this comment" );
2256 // set gobject values
2257 this.el.halign = Gtk.Align.START;
2258 this.el.justify = Gtk.Justification.RIGHT;
2259 this.el.xalign = 0.900000f;
2262 // user defined functions
2265 public class Xcls_commit_message : Object
2267 public Gtk.Entry el;
2268 private NewBranch _this;
2274 public Xcls_commit_message(NewBranch _owner )
2277 _this.commit_message = this;
2278 this.el = new Gtk.Entry();
2282 // set gobject values
2283 this.el.visible = true;
2286 // user defined functions
2289 public class Xcls_createbtn : Object
2291 public Gtk.Button el;
2292 private NewBranch _this;
2298 public Xcls_createbtn(NewBranch _owner )
2301 _this.createbtn = this;
2302 this.el = new Gtk.Button();
2306 // set gobject values
2307 this.el.label = "Commit Changes";
2312 this.el.get_style_context().add_class("suggested-action");
2316 this.el.clicked.connect( () => {
2318 GLib.debug("fire response = 1");
2320 var ticket_id = _this.ticketsel.selectedTicketId();
2322 if (ticket_id == "") {
2323 _this.ticketsel.el.get_child().get_style_context().add_class("warning");
2327 _this.el.response(1);
2331 // user defined functions
2332 public void updateState () {
2334 var ticket_id = _this.ticketsel.selectedTicketId();
2336 if (ticket_id == "") {
2337 this.el.set_sensitive(false);
2341 this.el.set_sensitive(true);
2347 public class Xcls_ScrolledWindow56 : Object
2349 public Gtk.ScrolledWindow el;
2350 private NewBranch _this;
2356 public Xcls_ScrolledWindow56(NewBranch _owner )
2359 this.el = new Gtk.ScrolledWindow( null, null );
2363 // set gobject values
2364 this.el.height_request = 400;
2365 this.el.vexpand = true;
2366 var child_0 = new Xcls_diff_view( _this );
2368 this.el.add ( child_0.el );
2371 // user defined functions
2373 public class Xcls_diff_view : Object
2375 public Gtk.SourceView el;
2376 private NewBranch _this;
2382 public Xcls_diff_view(NewBranch _owner )
2385 _this.diff_view = this;
2386 this.el = new Gtk.SourceView();
2392 var description = Pango.FontDescription.from_string("monospace");
2393 description.set_size(9000);
2394 this.el.override_font(description);
2395 var lm = Gtk.SourceLanguageManager.get_default();
2397 ((Gtk.SourceBuffer)(this.el.get_buffer())).set_language(
2398 lm.get_language("diff")
2402 // user defined functions