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_createbtn createbtn;
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_prcellrenderer prcellrenderer;
34 public Xcls_prmodel prmodel;
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?");
141 GitMonitor.gitmonitor.stop();
147 this.el.move((Gdk.Screen.width() / 2)- 250 ,0);
148 this.el.set_default_size( 500,200); // not sure why it grows..
149 GLib.debug("Loading tickets");
153 this.el.set_keep_above(true);
156 var curproj = RooProject.getProjectByRepo(this.repo);
157 _this.prmodel.loadProjects(curproj == null ? "" : curproj.id);
159 _this.dbmodel.loadTickets(curproj == null ? "": curproj.id, tid);
160 _this.createbtn.updateState();
162 _this.ticketsel.el.get_child().get_style_context().remove_class("warning");
164 var name = RooTicket.singleton().usernameLocal();
165 var ticket = RooTicket.singleton().getById(tid);
166 _this.name.el.set_text("wip_%s_T%s_%s".printf(name,ticket.id, ticket.summaryToBranchName()));
168 _this.ticketsel.el.get_child().get_style_context().add_class("warning");
170 _this.view.loadTicket(tid);
181 public class Xcls_Notebook2 : Object
183 public Gtk.Notebook el;
184 private NewBranch _this;
190 public Xcls_Notebook2(NewBranch _owner )
193 this.el = new Gtk.Notebook();
197 // set gobject values
198 this.el.vexpand = true;
199 var child_0 = new Xcls_label_select_ticket( _this );
201 var child_1 = new Xcls_label_create_ticket( _this );
203 var child_2 = new Xcls_label_quick_commit( _this );
205 var child_3 = new Xcls_select_ticket_tab( _this );
207 this.el.append_page ( child_3.el , _this.label_select_ticket.el );
208 var child_4 = new Xcls_Box25( _this );
210 this.el.append_page ( child_4.el , _this.label_create_ticket.el );
211 var child_5 = new Xcls_Box51( _this );
213 this.el.append_page ( child_5.el , _this.label_quick_commit.el );
216 // user defined functions
218 public class Xcls_label_select_ticket : Object
221 private NewBranch _this;
227 public Xcls_label_select_ticket(NewBranch _owner )
230 _this.label_select_ticket = this;
231 this.el = new Gtk.Label( "Select Existing Ticket to work on" );
235 // set gobject values
238 // user defined functions
241 public class Xcls_label_create_ticket : Object
244 private NewBranch _this;
250 public Xcls_label_create_ticket(NewBranch _owner )
253 _this.label_create_ticket = this;
254 this.el = new Gtk.Label( "Create a New Ticket" );
258 // set gobject values
261 // user defined functions
264 public class Xcls_label_quick_commit : Object
267 private NewBranch _this;
273 public Xcls_label_quick_commit(NewBranch _owner )
276 _this.label_quick_commit = this;
277 this.el = new Gtk.Label( "Quick Commit" );
281 // set gobject values
284 // user defined functions
287 public class Xcls_select_ticket_tab : Object
290 private NewBranch _this;
296 public Xcls_select_ticket_tab(NewBranch _owner )
299 _this.select_ticket_tab = this;
300 this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
304 // set gobject values
305 this.el.homogeneous = false;
306 var child_0 = new Xcls_Table7( _this );
308 this.el.pack_start ( child_0.el , false,false,0 );
309 var child_1 = new Xcls_scrolled_window( _this );
311 this.el.add ( child_1.el );
314 // user defined functions
315 public void load_data () {
319 public class Xcls_Table7 : Object
322 private NewBranch _this;
328 public Xcls_Table7(NewBranch _owner )
331 this.el = new Gtk.Table( 5, 5, true );
335 // set gobject values
336 this.el.expand = false;
338 this.el.column_spacing = 4;
339 this.el.vexpand = false;
340 var child_0 = new Xcls_Label8( _this );
342 this.el.attach_defaults ( child_0.el , 0,1,0,1 );
343 var child_1 = new Xcls_Label9( _this );
345 this.el.attach_defaults ( child_1.el , 1,2,0,1 );
346 var child_2 = new Xcls_projectsel( _this );
348 this.el.attach_defaults ( child_2.el , 0,1,1,2 );
349 var child_3 = new Xcls_ticketsel( _this );
351 this.el.attach_defaults ( child_3.el , 1,5,1,2 );
352 var child_4 = new Xcls_Label16( _this );
354 this.el.attach_defaults ( child_4.el , 0,1,3,4 );
355 var child_5 = new Xcls_name( _this );
357 this.el.attach_defaults ( child_5.el , 0,4,4,5 );
358 var child_6 = new Xcls_createbtn( _this );
360 this.el.attach_defaults ( child_6.el , 4,5,4,5 );
361 var child_7 = new Xcls_Box19( _this );
363 this.el.attach_defaults ( child_7.el , 0,5,2,3 );
366 // user defined functions
368 public class Xcls_Label8 : Object
371 private NewBranch _this;
377 public Xcls_Label8(NewBranch _owner )
380 this.el = new Gtk.Label( "Project" );
384 // set gobject values
385 this.el.halign = Gtk.Align.START;
386 this.el.justify = Gtk.Justification.RIGHT;
387 this.el.visible = true;
390 // user defined functions
393 public class Xcls_Label9 : Object
396 private NewBranch _this;
402 public Xcls_Label9(NewBranch _owner )
405 this.el = new Gtk.Label( "Ticket" );
409 // set gobject values
410 this.el.halign = Gtk.Align.START;
411 this.el.visible = true;
414 // user defined functions
417 public class Xcls_projectsel : Object
419 public Gtk.ComboBox el;
420 private NewBranch _this;
427 public Xcls_projectsel(NewBranch _owner )
430 _this.projectsel = this;
431 this.el = new Gtk.ComboBox.with_entry();
434 this.loading = false;
436 // set gobject values
437 var child_0 = new Xcls_prcellrenderer( _this );
439 this.el.pack_start ( child_0.el , true );
440 var child_1 = new Xcls_prmodel( _this );
442 this.el.set_model ( child_1.el );
446 this.el.set_entry_text_column(1);
449 this.el.changed.connect( () => {
453 var project_id = this.selectedProjectId();
454 _this.dbmodel.loadTickets(project_id);
457 /*if (this.loading) {
460 var ticket_id = this.selectedTicketId();
462 var name = RooTicket.singleton().usernameLocal();
464 if (ticket_id == "" || ticket_id == null) {
466 var dt = new DateTime.now_local();
467 _this.name.el.set_text("wip_%s_%s".printf(name,dt.format("%Y_%b_%d")));
472 var ticket = RooTicket.singleton().getById(ticket_id);
474 _this.name.el.set_text("wip_%s_T%s_%s".printf(name,ticket.id, ticket.summaryToBranchName()));
476 //GLib.debug (//"Selection: %s, %s\n", (string) val1, (string) val2);
481 // user defined functions
482 public string selectedProjectId () {
487 this.el.get_active_iter (out iter);
488 _this.prmodel.el.get_value (iter, 0, out val1);
491 return (string) val1;
498 public class Xcls_prcellrenderer : Object
500 public Gtk.CellRendererText el;
501 private NewBranch _this;
507 public Xcls_prcellrenderer(NewBranch _owner )
510 _this.prcellrenderer = this;
511 this.el = new Gtk.CellRendererText();
515 // set gobject values
518 // user defined functions
521 public class Xcls_prmodel : Object
523 public Gtk.ListStore el;
524 private NewBranch _this;
530 public Xcls_prmodel(NewBranch _owner )
533 _this.prmodel = this;
534 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
538 // set gobject values
541 // user defined functions
542 public void loadProjects (string id) {
546 _this.projectsel.loading = true;
555 el.set_value(iter, 0, "");
556 el.set_value(iter, 1, "-- select a project --");
558 _this.projectsel.el.set_active_iter(iter);
561 foreach(var project in RooProject.projects()) {
565 el.set_value(iter, 0, project.id);
566 el.set_value(iter, 1, project.name );
567 if (id == project.id) {
568 _this.projectsel.el.set_active_iter(iter);
573 _this.projectsel.loading = false;
574 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
580 public class Xcls_ticketsel : Object
582 public Gtk.ComboBox el;
583 private NewBranch _this;
590 public Xcls_ticketsel(NewBranch _owner )
593 _this.ticketsel = this;
594 this.el = new Gtk.ComboBox.with_entry();
597 this.loading = false;
599 // set gobject values
600 var child_0 = new Xcls_dbcellrenderer( _this );
602 this.el.pack_start ( child_0.el , true );
603 var child_1 = new Xcls_dbmodel( _this );
605 this.el.set_model ( child_1.el );
609 //this.el.add_attribute(_this.dbcellrenderer.el , "markup", 1 );
610 this.el.set_entry_text_column(1);
611 this.el.get_child().set_sensitive(false);
614 this.el.changed.connect( () => {
618 var ticket_id = this.selectedTicketId();
620 var name = RooTicket.singleton().usernameLocal();
622 this.el.get_child().get_style_context().remove_class("warning");
623 if (ticket_id == "" || ticket_id == null) {
625 var dt = new DateTime.now_local();
626 _this.name.el.set_text("wip_%s_%s".printf(name,dt.format("%Y_%b_%d")));
627 _this.view.loadTicket("");
629 this.el.get_child().get_style_context().add_class("warning");
630 _this.createbtn.updateState();
635 var ticket = RooTicket.singleton().getById(ticket_id);
637 _this.name.el.set_text("wip_%s_T%s_%s".printf(name,ticket.id, ticket.summaryToBranchName()));
638 _this.scrolled_window.el.show();
640 _this.view.loadTicket(ticket.id);
641 _this.createbtn.updateState();
643 //GLib.debug (//"Selection: %s, %s\n", (string) val1, (string) val2);
647 // user defined functions
648 public string selectedTicketId () {
653 this.el.get_active_iter (out iter);
654 _this.dbmodel.el.get_value (iter, 0, out val1);
657 return (string) val1;
664 public class Xcls_dbcellrenderer : Object
666 public Gtk.CellRendererText el;
667 private NewBranch _this;
673 public Xcls_dbcellrenderer(NewBranch _owner )
676 _this.dbcellrenderer = this;
677 this.el = new Gtk.CellRendererText();
681 // set gobject values
684 // user defined functions
687 public class Xcls_dbmodel : Object
689 public Gtk.ListStore el;
690 private NewBranch _this;
696 public Xcls_dbmodel(NewBranch _owner )
699 _this.dbmodel = this;
700 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
704 // set gobject values
707 // user defined functions
708 public void loadTickets (string project_id , string tid = "") {
712 // fixme .. get project id from selection..
714 RooTicket.singleton().loadTickets(
716 _this.btn_not_me.el.active ? RooTicket.Who.ANYBODY : RooTicket.Who.ME,
717 _this.btn_closed.el.active ? RooTicket.Status.ALL : RooTicket.Status.ACTIVE
720 _this.ticketsel.loading = true;
729 el.set_value(iter, 0, "");
730 el.set_value(iter, 1, "-- select a ticket --");
732 _this.ticketsel.el.set_active_iter(iter);
733 var tickets = RooTicket.singleton().tickets;
734 foreach(var ticket in tickets) {
738 el.set_value(iter, 0, ticket.id);
739 el.set_value(iter, 1, "#%s %s".printf( ticket.id, ticket.summary));
741 if (ticket.id == tid) {
742 _this.ticketsel.el.set_active_iter(iter);
747 _this.ticketsel.loading = false;
748 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
754 public class Xcls_Label16 : Object
757 private NewBranch _this;
763 public Xcls_Label16(NewBranch _owner )
766 this.el = new Gtk.Label( "Use this as branch name" );
770 // set gobject values
771 this.el.halign = Gtk.Align.START;
772 this.el.justify = Gtk.Justification.RIGHT;
773 this.el.xalign = 0.900000f;
776 // user defined functions
779 public class Xcls_name : Object
782 private NewBranch _this;
788 public Xcls_name(NewBranch _owner )
792 this.el = new Gtk.Entry();
796 // set gobject values
797 this.el.visible = true;
800 // user defined functions
803 public class Xcls_createbtn : Object
805 public Gtk.Button el;
806 private NewBranch _this;
812 public Xcls_createbtn(NewBranch _owner )
815 _this.createbtn = this;
816 this.el = new Gtk.Button();
820 // set gobject values
821 this.el.label = "Create Branch";
826 this.el.get_style_context().add_class("suggested-action");
830 this.el.clicked.connect( () => {
832 GLib.debug("fire response = 1");
834 var ticket_id = _this.ticketsel.selectedTicketId();
836 if (ticket_id == "") {
837 _this.ticketsel.el.get_child().get_style_context().add_class("warning");
841 _this.el.response(1);
845 // user defined functions
846 public void updateState () {
848 var ticket_id = _this.ticketsel.selectedTicketId();
850 if (ticket_id == "") {
851 this.el.set_sensitive(false);
855 this.el.set_sensitive(true);
860 public class Xcls_Box19 : Object
863 private NewBranch _this;
869 public Xcls_Box19(NewBranch _owner )
872 this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
876 // set gobject values
877 var child_0 = new Xcls_btn_not_me( _this );
879 this.el.add ( child_0.el );
880 var child_1 = new Xcls_btn_closed( _this );
882 this.el.add ( child_1.el );
883 var child_2 = new Xcls_Label22( _this );
885 this.el.add ( child_2.el );
888 // user defined functions
890 public class Xcls_btn_not_me : Object
892 public Gtk.CheckButton el;
893 private NewBranch _this;
899 public Xcls_btn_not_me(NewBranch _owner )
902 _this.btn_not_me = this;
903 this.el = new Gtk.CheckButton();
907 // set gobject values
908 this.el.label = "Show tickets not assigned to me";
911 this.el.toggled.connect( () => {
912 var project_id = _this.projectsel.selectedProjectId();
913 _this.dbmodel.loadTickets(project_id);
917 // user defined functions
920 public class Xcls_btn_closed : Object
922 public Gtk.CheckButton el;
923 private NewBranch _this;
929 public Xcls_btn_closed(NewBranch _owner )
932 _this.btn_closed = this;
933 this.el = new Gtk.CheckButton();
937 // set gobject values
938 this.el.label = "Show closed Tickets";
941 this.el.toggled.connect( () => {
942 var project_id = _this.projectsel.selectedProjectId();
943 _this.dbmodel.loadTickets(project_id);
948 // user defined functions
951 public class Xcls_Label22 : Object
954 private NewBranch _this;
960 public Xcls_Label22(NewBranch _owner )
963 this.el = new Gtk.Label( "<a href=\"refresh\">Refresh Ticket list</a>" );
967 // set gobject values
968 this.el.halign = Gtk.Align.END;
969 this.el.hexpand = true;
970 this.el.use_markup = true;
973 this.el.activate_link.connect( (uri) => {
974 if (uri == "refresh") {
976 var curproj = RooProject.getProjectByRepo(_this.repo);
977 _this.prmodel.loadProjects(curproj == null ? "": curproj.id);
979 _this.dbmodel.loadTickets(curproj == null ? "": curproj.id);
985 // user defined functions
990 public class Xcls_scrolled_window : Object
992 public Gtk.ScrolledWindow el;
993 private NewBranch _this;
999 public Xcls_scrolled_window(NewBranch _owner )
1002 _this.scrolled_window = this;
1003 this.el = new Gtk.ScrolledWindow( null, null );
1007 // set gobject values
1008 this.el.height_request = 500;
1009 this.el.vexpand = true;
1010 var child_0 = new Xcls_view( _this );
1012 this.el.add ( child_0.el );
1017 this.el.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);
1021 // user defined functions
1023 public class Xcls_view : Object
1025 public WebKit.WebView el;
1026 private NewBranch _this;
1032 public Xcls_view(NewBranch _owner )
1036 this.el = new WebKit.WebView();
1040 // set gobject values
1043 // user defined functions
1044 public void loadTicket (string tid) {
1046 _this.el.get_size(out w, out h);
1049 _this.scrolled_window.el.hide();
1050 _this.el.resize(w, 150);
1052 _this.scrolled_window.el.show();
1053 _this.el.resize(w, 800);
1056 var rs = RooTicket.singleton();
1057 var uri = new WebKit.URIRequest("https://roojs.com/admin.php/MTrack/View/" + tid);
1058 var hd = uri.get_http_headers();
1059 var authCode = Base64.encode ("%s:%s".printf(rs.username, rs.password).data);
1060 hd.append("Authorization", "Basic %s".printf(authCode));
1062 this.el.load_request(uri);
1068 public class Xcls_Box25 : Object
1071 private NewBranch _this;
1077 public Xcls_Box25(NewBranch _owner )
1080 this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
1084 // set gobject values
1085 this.el.homogeneous = false;
1086 var child_0 = new Xcls_table( _this );
1088 this.el.pack_start ( child_0.el , false,false,0 );
1091 // user defined functions
1093 public class Xcls_table : Object
1095 public Gtk.Table el;
1096 private NewBranch _this;
1102 public Xcls_table(NewBranch _owner )
1106 this.el = new Gtk.Table( 14, 4, true );
1110 // set gobject values
1111 this.el.expand = false;
1113 this.el.column_spacing = 4;
1114 this.el.vexpand = false;
1115 var child_0 = new Xcls_Label27( _this );
1117 this.el.attach_defaults ( child_0.el , 0,1,0,1 );
1118 var child_1 = new Xcls_Label28( _this );
1120 this.el.attach_defaults ( child_1.el , 1,2,0,1 );
1121 var child_2 = new Xcls_project_id( _this );
1123 this.el.attach_defaults ( child_2.el , 0,1,1,2 );
1124 var child_3 = new Xcls_summary( _this );
1126 this.el.attach_defaults ( child_3.el , 1,4,1,2 );
1127 var child_4 = new Xcls_Label33( _this );
1129 this.el.attach_defaults ( child_4.el , 0,1,2,3 );
1130 var child_5 = new Xcls_milestone_id( _this );
1132 this.el.attach_defaults ( child_5.el , 0,1,3,4 );
1133 var child_6 = new Xcls_Label36( _this );
1135 this.el.attach_defaults ( child_6.el , 1,4,2,3 );
1136 var child_7 = new Xcls_description( _this );
1138 this.el.attach_defaults ( child_7.el , 1,4,3,12 );
1139 var child_8 = new Xcls_Label38( _this );
1141 this.el.attach_defaults ( child_8.el , 0,1,4,5 );
1142 var child_9 = new Xcls_priority_id( _this );
1144 this.el.attach_defaults ( child_9.el , 0,1,5,6 );
1145 var child_10 = new Xcls_Label41( _this );
1147 this.el.attach_defaults ( child_10.el , 0,1,6,7 );
1148 var child_11 = new Xcls_severity_id( _this );
1150 this.el.attach_defaults ( child_11.el , 0,1,7,8 );
1151 var child_12 = new Xcls_Label44( _this );
1153 this.el.attach_defaults ( child_12.el , 0,1,8,9 );
1154 var child_13 = new Xcls_classification_id( _this );
1156 this.el.attach_defaults ( child_13.el , 0,1,9,10 );
1157 var child_14 = new Xcls_Label47( _this );
1159 this.el.attach_defaults ( child_14.el , 0,1,10,11 );
1160 var child_15 = new Xcls_developer_id( _this );
1162 this.el.attach_defaults ( child_15.el , 0,1,11,12 );
1163 var child_16 = new Xcls_Button50( _this );
1165 this.el.attach_defaults ( child_16.el , 0,4,13,14 );
1168 // user defined functions
1170 public class Xcls_Label27 : Object
1172 public Gtk.Label el;
1173 private NewBranch _this;
1179 public Xcls_Label27(NewBranch _owner )
1182 this.el = new Gtk.Label( "Project" );
1186 // set gobject values
1187 this.el.halign = Gtk.Align.START;
1188 this.el.visible = true;
1191 // user defined functions
1194 public class Xcls_Label28 : Object
1196 public Gtk.Label el;
1197 private NewBranch _this;
1203 public Xcls_Label28(NewBranch _owner )
1206 this.el = new Gtk.Label( "Summary" );
1210 // set gobject values
1211 this.el.halign = Gtk.Align.START;
1212 this.el.visible = true;
1215 // user defined functions
1218 public class Xcls_project_id : Object
1220 public Gtk.ComboBox el;
1221 private NewBranch _this;
1225 public bool loading;
1228 public Xcls_project_id(NewBranch _owner )
1231 _this.project_id = this;
1232 this.el = new Gtk.ComboBox.with_entry();
1235 this.loading = false;
1237 // set gobject values
1238 var child_0 = new Xcls_prcellrenderer( _this );
1240 this.el.pack_start ( child_0.el , true );
1241 var child_1 = new Xcls_prmodel( _this );
1243 this.el.set_model ( child_1.el );
1247 this.el.set_entry_text_column(1);
1250 this.el.changed.connect( () => {
1254 var project_id = this.selectedProjectId();
1256 var rt = RooTicket.singleton();
1257 rt.loadProjectOptions(project_id);
1259 _this.msmodel.loadMilestones();
1260 _this.primodel.loadPriorities();
1261 _this.sevmodel.loadSeverities();
1262 _this.clmodel.loadClassifications();
1263 _this.devmodel.loadDevelopers();
1265 // affects projects and milestones..
1268 /*if (this.loading) {
1271 var ticket_id = this.selectedTicketId();
1273 var name = RooTicket.singleton().usernameLocal();
1275 if (ticket_id == "" || ticket_id == null) {
1277 var dt = new DateTime.now_local();
1278 _this.name.el.set_text("wip_%s_%s".printf(name,dt.format("%Y_%b_%d")));
1283 var ticket = RooTicket.singleton().getById(ticket_id);
1285 _this.name.el.set_text("wip_%s_T%s_%s".printf(name,ticket.id, ticket.summaryToBranchName()));
1287 //GLib.debug (//"Selection: %s, %s\n", (string) val1, (string) val2);
1292 // user defined functions
1293 public string selectedProjectId () {
1298 this.el.get_active_iter (out iter);
1299 _this.prmodel.el.get_value (iter, 0, out val1);
1302 return (string) val1;
1309 public class Xcls_prcellrenderer : Object
1311 public Gtk.CellRendererText el;
1312 private NewBranch _this;
1318 public Xcls_prcellrenderer(NewBranch _owner )
1321 _this.prcellrenderer = this;
1322 this.el = new Gtk.CellRendererText();
1326 // set gobject values
1329 // user defined functions
1332 public class Xcls_prmodel : Object
1334 public Gtk.ListStore el;
1335 private NewBranch _this;
1341 public Xcls_prmodel(NewBranch _owner )
1344 _this.prmodel = this;
1345 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
1349 // set gobject values
1352 // user defined functions
1353 public void loadProjects (string id) {
1356 _this.project_id.loading = true;
1362 el.append(out iter);
1365 el.set_value(iter, 0, "");
1366 el.set_value(iter, 1, "-- select a project --");
1368 _this.project_id.el.set_active_iter(iter);
1371 foreach(var project in RooProject.projects()) {
1373 el.append(out iter);
1375 el.set_value(iter, 0, project.id);
1376 el.set_value(iter, 1, project.name );
1377 if (id == project.id) {
1378 _this.project_id.el.set_active_iter(iter);
1383 _this.project_id.loading = false;
1384 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
1390 public class Xcls_summary : Object
1392 public Gtk.Entry el;
1393 private NewBranch _this;
1399 public Xcls_summary(NewBranch _owner )
1402 _this.summary = this;
1403 this.el = new Gtk.Entry();
1407 // set gobject values
1408 this.el.visible = true;
1411 // user defined functions
1414 public class Xcls_Label33 : Object
1416 public Gtk.Label el;
1417 private NewBranch _this;
1423 public Xcls_Label33(NewBranch _owner )
1426 this.el = new Gtk.Label( "Milestone" );
1430 // set gobject values
1431 this.el.halign = Gtk.Align.START;
1432 this.el.justify = Gtk.Justification.RIGHT;
1433 this.el.xalign = 0.900000f;
1436 // user defined functions
1439 public class Xcls_milestone_id : Object
1441 public Gtk.ComboBox el;
1442 private NewBranch _this;
1446 public bool loading;
1449 public Xcls_milestone_id(NewBranch _owner )
1452 _this.milestone_id = this;
1453 this.el = new Gtk.ComboBox.with_entry();
1456 this.loading = false;
1458 // set gobject values
1459 var child_0 = new Xcls_msmodel( _this );
1461 this.el.set_model ( child_0.el );
1465 this.el.set_entry_text_column(1);
1468 // user defined functions
1469 public string selectedMilestoneId () {
1474 this.el.get_active_iter (out iter);
1475 _this.msmodel.el.get_value (iter, 0, out val1);
1478 return (string) val1;
1485 public class Xcls_msmodel : Object
1487 public Gtk.ListStore el;
1488 private NewBranch _this;
1494 public Xcls_msmodel(NewBranch _owner )
1497 _this.msmodel = this;
1498 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
1502 // set gobject values
1505 // user defined functions
1506 public void loadMilestones ( ) {
1508 var rt = RooTicket.singleton();
1509 // rt.loadProjects();
1511 _this.milestone_id.loading = true;
1517 el.append(out iter);
1520 el.set_value(iter, 0, "");
1521 el.set_value(iter, 1, "-- select a milestone --");
1522 _this.milestone_id.el.set_active_iter(iter);
1524 var projects = rt.milestones;
1525 foreach(var project in projects) {
1527 el.append(out iter);
1529 el.set_value(iter, 0, project.id);
1530 el.set_value(iter, 1, project.display_name );
1531 // if (id == project.id) {
1532 // _this.milestone.el.set_active_iter(iter);
1538 _this.milestone_id.loading = false;
1539 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
1545 public class Xcls_Label36 : Object
1547 public Gtk.Label el;
1548 private NewBranch _this;
1554 public Xcls_Label36(NewBranch _owner )
1557 this.el = new Gtk.Label( "Description" );
1561 // set gobject values
1562 this.el.halign = Gtk.Align.START;
1565 // user defined functions
1568 public class Xcls_description : Object
1570 public Gtk.TextView el;
1571 private NewBranch _this;
1577 public Xcls_description(NewBranch _owner )
1580 _this.description = this;
1581 this.el = new Gtk.TextView();
1585 // set gobject values
1586 this.el.border_width = 1;
1589 // user defined functions
1592 public class Xcls_Label38 : Object
1594 public Gtk.Label el;
1595 private NewBranch _this;
1601 public Xcls_Label38(NewBranch _owner )
1604 this.el = new Gtk.Label( "Priority" );
1608 // set gobject values
1609 this.el.halign = Gtk.Align.START;
1610 this.el.xalign = 0.900000f;
1613 // user defined functions
1616 public class Xcls_priority_id : Object
1618 public Gtk.ComboBox el;
1619 private NewBranch _this;
1623 public bool loading;
1626 public Xcls_priority_id(NewBranch _owner )
1629 _this.priority_id = this;
1630 this.el = new Gtk.ComboBox.with_entry();
1633 this.loading = false;
1635 // set gobject values
1636 var child_0 = new Xcls_primodel( _this );
1638 this.el.set_model ( child_0.el );
1642 this.el.set_entry_text_column(1);
1645 // user defined functions
1646 public string selectedPriorityId () {
1651 this.el.get_active_iter (out iter);
1652 _this.primodel.el.get_value (iter, 0, out val1);
1655 return (string) val1;
1662 public class Xcls_primodel : Object
1664 public Gtk.ListStore el;
1665 private NewBranch _this;
1671 public Xcls_primodel(NewBranch _owner )
1674 _this.primodel = this;
1675 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
1679 // set gobject values
1682 // user defined functions
1683 public void loadPriorities ( ) {
1685 var rt = RooTicket.singleton();
1686 // rt.loadProjects();
1688 _this.priority_id.loading = true;
1695 var projects = rt.priorities;
1696 foreach(var project in projects) {
1698 el.append(out iter);
1700 el.set_value(iter, 0, project.id);
1701 el.set_value(iter, 1, project.display_name );
1702 if ("normal" == project.name) {
1703 _this.priority_id.el.set_active_iter(iter);
1708 _this.priority_id.loading = false;
1715 public class Xcls_Label41 : Object
1717 public Gtk.Label el;
1718 private NewBranch _this;
1724 public Xcls_Label41(NewBranch _owner )
1727 this.el = new Gtk.Label( "Severity" );
1731 // set gobject values
1732 this.el.halign = Gtk.Align.START;
1735 // user defined functions
1738 public class Xcls_severity_id : Object
1740 public Gtk.ComboBox el;
1741 private NewBranch _this;
1745 public bool loading;
1748 public Xcls_severity_id(NewBranch _owner )
1751 _this.severity_id = this;
1752 this.el = new Gtk.ComboBox.with_entry();
1755 this.loading = false;
1757 // set gobject values
1758 var child_0 = new Xcls_sevmodel( _this );
1760 this.el.set_model ( child_0.el );
1764 this.el.set_entry_text_column(1);
1767 // user defined functions
1768 public string selectedSeverityId () {
1773 this.el.get_active_iter (out iter);
1774 _this.sevmodel.el.get_value (iter, 0, out val1);
1777 return (string) val1;
1784 public class Xcls_sevmodel : Object
1786 public Gtk.ListStore el;
1787 private NewBranch _this;
1793 public Xcls_sevmodel(NewBranch _owner )
1796 _this.sevmodel = this;
1797 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
1801 // set gobject values
1804 // user defined functions
1805 public void loadSeverities () {
1807 var rt = RooTicket.singleton();
1808 //rt.loadProjects();
1810 _this.severity_id.loading = true;
1816 var projects = rt.serverities;
1817 foreach(var project in projects) {
1819 el.append(out iter);
1821 el.set_value(iter, 0, project.id);
1822 el.set_value(iter, 1, project.display_name );
1823 if ("normal" == project.name) {
1824 _this.severity_id.el.set_active_iter(iter);
1829 _this.severity_id.loading = false;
1830 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
1836 public class Xcls_Label44 : Object
1838 public Gtk.Label el;
1839 private NewBranch _this;
1845 public Xcls_Label44(NewBranch _owner )
1848 this.el = new Gtk.Label( "Classification" );
1852 // set gobject values
1853 this.el.halign = Gtk.Align.START;
1856 // user defined functions
1859 public class Xcls_classification_id : Object
1861 public Gtk.ComboBox el;
1862 private NewBranch _this;
1866 public bool loading;
1869 public Xcls_classification_id(NewBranch _owner )
1872 _this.classification_id = this;
1873 this.el = new Gtk.ComboBox.with_entry();
1876 this.loading = false;
1878 // set gobject values
1879 var child_0 = new Xcls_clmodel( _this );
1881 this.el.set_model ( child_0.el );
1885 this.el.set_entry_text_column(1);
1888 // user defined functions
1889 public string selectedClassificationId () {
1894 this.el.get_active_iter (out iter);
1895 _this.clmodel.el.get_value (iter, 0, out val1);
1898 return (string) val1;
1905 public class Xcls_clmodel : Object
1907 public Gtk.ListStore el;
1908 private NewBranch _this;
1914 public Xcls_clmodel(NewBranch _owner )
1917 _this.clmodel = this;
1918 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
1922 // set gobject values
1925 // user defined functions
1926 public void loadClassifications ( ) {
1928 var rt = RooTicket.singleton();
1929 // rt.loadProjects();
1931 _this.classification_id.loading = true;
1937 el.append(out iter);
1940 var projects = rt.classifications;
1941 foreach(var project in projects) {
1943 el.append(out iter);
1945 el.set_value(iter, 0, project.id);
1946 el.set_value(iter, 1, project.display_name );
1947 if ("bug" == project.name) {
1948 _this.classification_id.el.set_active_iter(iter);
1953 _this.classification_id.loading = false;
1954 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
1960 public class Xcls_Label47 : Object
1962 public Gtk.Label el;
1963 private NewBranch _this;
1969 public Xcls_Label47(NewBranch _owner )
1972 this.el = new Gtk.Label( "Assign to" );
1976 // set gobject values
1977 this.el.halign = Gtk.Align.START;
1980 // user defined functions
1983 public class Xcls_developer_id : Object
1985 public Gtk.ComboBox el;
1986 private NewBranch _this;
1990 public bool loading;
1993 public Xcls_developer_id(NewBranch _owner )
1996 _this.developer_id = this;
1997 this.el = new Gtk.ComboBox.with_entry();
2000 this.loading = false;
2002 // set gobject values
2003 var child_0 = new Xcls_devmodel( _this );
2005 this.el.set_model ( child_0.el );
2009 this.el.set_entry_text_column(1);
2012 // user defined functions
2013 public string selectedDeveloperId () {
2018 this.el.get_active_iter (out iter);
2019 _this.devmodel.el.get_value (iter, 0, out val1);
2022 return (string) val1;
2029 public class Xcls_devmodel : Object
2031 public Gtk.ListStore el;
2032 private NewBranch _this;
2038 public Xcls_devmodel(NewBranch _owner )
2041 _this.devmodel = this;
2042 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
2046 // set gobject values
2049 // user defined functions
2050 public void loadDevelopers ( ) {
2052 var rt = RooTicket.singleton();
2053 //rt.loadProjects();
2055 _this.developer_id.loading = true;
2061 el.append(out iter);
2064 el.set_value(iter, 0, "");
2065 el.set_value(iter, 1, "-- select a developer --");
2067 _this.developer_id.el.set_active_iter(iter);
2070 var peps = rt.developers;
2071 foreach(var p in peps) {
2073 el.append(out iter);
2075 el.set_value(iter, 0, p.id);
2076 el.set_value(iter, 1, p.display_name );
2077 if (rt.authuser_id == p.id) {
2078 _this.developer_id.el.set_active_iter(iter);
2082 _this.developer_id.loading = false;
2083 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
2089 public class Xcls_Button50 : Object
2091 public Gtk.Button el;
2092 private NewBranch _this;
2098 public Xcls_Button50(NewBranch _owner )
2101 this.el = new Gtk.Button();
2105 // set gobject values
2106 this.el.label = "Create Ticket & Branch";
2111 this.el.get_style_context().add_class("suggested-action");
2115 this.el.clicked.connect( () => {
2116 GLib.debug("fire response = 1");
2119 var invalid = false;
2121 // validate first...
2122 _this.project_id.el.get_child().get_style_context().remove_class("warning");
2123 if (_this.project_id.selectedProjectId() == "") {
2124 _this.project_id.el.get_child().get_style_context().add_class("warning");
2128 _this.milestone_id.el.get_child().get_style_context().remove_class("warning");
2130 _this.priority_id.el.get_child().get_style_context().remove_class("warning");
2131 if (_this.priority_id.selectedPriorityId() == "") {
2132 _this.priority_id.el.get_child().get_style_context().add_class("warning");
2136 _this.classification_id.el.get_child().get_style_context().remove_class("warning");
2137 if (_this.classification_id.selectedClassificationId() == "") {
2138 _this.classification_id.el.get_child().get_style_context().add_class("warning");
2142 _this.developer_id.el.get_child().get_style_context().remove_class("warning");
2143 if (_this.developer_id.selectedDeveloperId() == "") {
2144 _this.developer_id.el.get_child().get_style_context().add_class("warning");
2148 _this.summary.el.get_style_context().remove_class("warning");
2149 if (_this.summary.el.get_text() == "") {
2150 _this.summary.el.get_style_context().add_class("warning");
2154 _this.description.el.get_style_context().remove_class("warning");
2159 GLib.debug("for is valid");
2161 _this.el.response(1);
2165 // user defined functions
2170 public class Xcls_Box51 : Object
2173 private NewBranch _this;
2179 public Xcls_Box51(NewBranch _owner )
2182 this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
2186 // set gobject values
2187 this.el.homogeneous = false;
2188 var child_0 = new Xcls_Table52( _this );
2190 this.el.pack_start ( child_0.el , false,false,0 );
2191 var child_1 = new Xcls_ScrolledWindow56( _this );
2193 this.el.add ( child_1.el );
2196 // user defined functions
2198 public class Xcls_Table52 : Object
2200 public Gtk.Table el;
2201 private NewBranch _this;
2207 public Xcls_Table52(NewBranch _owner )
2210 this.el = new Gtk.Table( 2, 5, true );
2214 // set gobject values
2215 this.el.expand = false;
2217 this.el.column_spacing = 4;
2218 this.el.vexpand = false;
2219 var child_0 = new Xcls_Label53( _this );
2221 this.el.attach_defaults ( child_0.el , 0,1,0,1 );
2222 var child_1 = new Xcls_commit_message( _this );
2224 this.el.attach_defaults ( child_1.el , 0,4,1,2 );
2225 var child_2 = new Xcls_createbtn( _this );
2227 this.el.attach_defaults ( child_2.el , 4,5,1,2 );
2230 // user defined functions
2232 public class Xcls_Label53 : Object
2234 public Gtk.Label el;
2235 private NewBranch _this;
2241 public Xcls_Label53(NewBranch _owner )
2244 this.el = new Gtk.Label( "Just commit with this comment" );
2248 // set gobject values
2249 this.el.halign = Gtk.Align.START;
2250 this.el.justify = Gtk.Justification.RIGHT;
2251 this.el.xalign = 0.900000f;
2254 // user defined functions
2257 public class Xcls_commit_message : Object
2259 public Gtk.Entry el;
2260 private NewBranch _this;
2266 public Xcls_commit_message(NewBranch _owner )
2269 _this.commit_message = this;
2270 this.el = new Gtk.Entry();
2274 // set gobject values
2275 this.el.visible = true;
2278 // user defined functions
2281 public class Xcls_createbtn : Object
2283 public Gtk.Button el;
2284 private NewBranch _this;
2290 public Xcls_createbtn(NewBranch _owner )
2293 _this.createbtn = this;
2294 this.el = new Gtk.Button();
2298 // set gobject values
2299 this.el.label = "Commit Changes";
2304 this.el.get_style_context().add_class("suggested-action");
2308 this.el.clicked.connect( () => {
2310 GLib.debug("fire response = 1");
2312 var ticket_id = _this.ticketsel.selectedTicketId();
2314 if (ticket_id == "") {
2315 _this.ticketsel.el.get_child().get_style_context().add_class("warning");
2319 _this.el.response(1);
2323 // user defined functions
2324 public void updateState () {
2326 var ticket_id = _this.ticketsel.selectedTicketId();
2328 if (ticket_id == "") {
2329 this.el.set_sensitive(false);
2333 this.el.set_sensitive(true);
2339 public class Xcls_ScrolledWindow56 : Object
2341 public Gtk.ScrolledWindow el;
2342 private NewBranch _this;
2348 public Xcls_ScrolledWindow56(NewBranch _owner )
2351 this.el = new Gtk.ScrolledWindow( null, null );
2355 // set gobject values
2356 this.el.height_request = 400;
2357 this.el.vexpand = true;
2358 var child_0 = new Xcls_diff_view( _this );
2360 this.el.add ( child_0.el );
2363 // user defined functions
2365 public class Xcls_diff_view : Object
2367 public Gtk.SourceView el;
2368 private NewBranch _this;
2374 public Xcls_diff_view(NewBranch _owner )
2377 _this.diff_view = this;
2378 this.el = new Gtk.SourceView();
2384 var description = Pango.FontDescription.from_string("monospace");
2385 description.set_size(9000);
2386 this.el.override_font(description);
2387 var lm = Gtk.SourceLanguageManager.get_default();
2389 ((Gtk.SourceBuffer)(this.el.get_buffer())).set_language(
2390 lm.get_language("diff")
2394 // user defined functions