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
316 public class Xcls_Table7 : Object
319 private NewBranch _this;
325 public Xcls_Table7(NewBranch _owner )
328 this.el = new Gtk.Table( 5, 5, true );
332 // set gobject values
333 this.el.expand = false;
335 this.el.column_spacing = 4;
336 this.el.vexpand = false;
337 var child_0 = new Xcls_Label8( _this );
339 this.el.attach_defaults ( child_0.el , 0,1,0,1 );
340 var child_1 = new Xcls_Label9( _this );
342 this.el.attach_defaults ( child_1.el , 1,2,0,1 );
343 var child_2 = new Xcls_projectsel( _this );
345 this.el.attach_defaults ( child_2.el , 0,1,1,2 );
346 var child_3 = new Xcls_ticketsel( _this );
348 this.el.attach_defaults ( child_3.el , 1,5,1,2 );
349 var child_4 = new Xcls_Label16( _this );
351 this.el.attach_defaults ( child_4.el , 0,1,3,4 );
352 var child_5 = new Xcls_name( _this );
354 this.el.attach_defaults ( child_5.el , 0,4,4,5 );
355 var child_6 = new Xcls_createbtn( _this );
357 this.el.attach_defaults ( child_6.el , 4,5,4,5 );
358 var child_7 = new Xcls_Box19( _this );
360 this.el.attach_defaults ( child_7.el , 0,5,2,3 );
363 // user defined functions
365 public class Xcls_Label8 : Object
368 private NewBranch _this;
374 public Xcls_Label8(NewBranch _owner )
377 this.el = new Gtk.Label( "Project" );
381 // set gobject values
382 this.el.halign = Gtk.Align.START;
383 this.el.justify = Gtk.Justification.RIGHT;
384 this.el.visible = true;
387 // user defined functions
390 public class Xcls_Label9 : Object
393 private NewBranch _this;
399 public Xcls_Label9(NewBranch _owner )
402 this.el = new Gtk.Label( "Ticket" );
406 // set gobject values
407 this.el.halign = Gtk.Align.START;
408 this.el.visible = true;
411 // user defined functions
414 public class Xcls_projectsel : Object
416 public Gtk.ComboBox el;
417 private NewBranch _this;
424 public Xcls_projectsel(NewBranch _owner )
427 _this.projectsel = this;
428 this.el = new Gtk.ComboBox.with_entry();
431 this.loading = false;
433 // set gobject values
434 var child_0 = new Xcls_prcellrenderer( _this );
436 this.el.pack_start ( child_0.el , true );
437 var child_1 = new Xcls_prmodel( _this );
439 this.el.set_model ( child_1.el );
443 this.el.set_entry_text_column(1);
446 this.el.changed.connect( () => {
450 var project_id = this.selectedProjectId();
451 _this.dbmodel.loadTickets(project_id);
454 /*if (this.loading) {
457 var ticket_id = this.selectedTicketId();
459 var name = RooTicket.singleton().usernameLocal();
461 if (ticket_id == "" || ticket_id == null) {
463 var dt = new DateTime.now_local();
464 _this.name.el.set_text("wip_%s_%s".printf(name,dt.format("%Y_%b_%d")));
469 var ticket = RooTicket.singleton().getById(ticket_id);
471 _this.name.el.set_text("wip_%s_T%s_%s".printf(name,ticket.id, ticket.summaryToBranchName()));
473 //GLib.debug (//"Selection: %s, %s\n", (string) val1, (string) val2);
478 // user defined functions
479 public string selectedProjectId () {
484 this.el.get_active_iter (out iter);
485 _this.prmodel.el.get_value (iter, 0, out val1);
488 return (string) val1;
495 public class Xcls_prcellrenderer : Object
497 public Gtk.CellRendererText el;
498 private NewBranch _this;
504 public Xcls_prcellrenderer(NewBranch _owner )
507 _this.prcellrenderer = this;
508 this.el = new Gtk.CellRendererText();
512 // set gobject values
515 // user defined functions
518 public class Xcls_prmodel : Object
520 public Gtk.ListStore el;
521 private NewBranch _this;
527 public Xcls_prmodel(NewBranch _owner )
530 _this.prmodel = this;
531 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
535 // set gobject values
538 // user defined functions
539 public void loadProjects (string id) {
543 _this.projectsel.loading = true;
552 el.set_value(iter, 0, "");
553 el.set_value(iter, 1, "-- select a project --");
555 _this.projectsel.el.set_active_iter(iter);
558 foreach(var project in RooProject.projects()) {
562 el.set_value(iter, 0, project.id);
563 el.set_value(iter, 1, project.name );
564 if (id == project.id) {
565 _this.projectsel.el.set_active_iter(iter);
570 _this.projectsel.loading = false;
571 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
577 public class Xcls_ticketsel : Object
579 public Gtk.ComboBox el;
580 private NewBranch _this;
587 public Xcls_ticketsel(NewBranch _owner )
590 _this.ticketsel = this;
591 this.el = new Gtk.ComboBox.with_entry();
594 this.loading = false;
596 // set gobject values
597 var child_0 = new Xcls_dbcellrenderer( _this );
599 this.el.pack_start ( child_0.el , true );
600 var child_1 = new Xcls_dbmodel( _this );
602 this.el.set_model ( child_1.el );
606 //this.el.add_attribute(_this.dbcellrenderer.el , "markup", 1 );
607 this.el.set_entry_text_column(1);
608 this.el.get_child().set_sensitive(false);
611 this.el.changed.connect( () => {
615 var ticket_id = this.selectedTicketId();
617 var name = RooTicket.singleton().usernameLocal();
619 this.el.get_child().get_style_context().remove_class("warning");
620 if (ticket_id == "" || ticket_id == null) {
622 var dt = new DateTime.now_local();
623 _this.name.el.set_text("wip_%s_%s".printf(name,dt.format("%Y_%b_%d")));
624 _this.view.loadTicket("");
626 this.el.get_child().get_style_context().add_class("warning");
627 _this.createbtn.updateState();
632 var ticket = RooTicket.singleton().getById(ticket_id);
634 _this.name.el.set_text("wip_%s_T%s_%s".printf(name,ticket.id, ticket.summaryToBranchName()));
635 _this.scrolled_window.el.show();
637 _this.view.loadTicket(ticket.id);
638 _this.createbtn.updateState();
640 //GLib.debug (//"Selection: %s, %s\n", (string) val1, (string) val2);
644 // user defined functions
645 public string selectedTicketId () {
650 this.el.get_active_iter (out iter);
651 _this.dbmodel.el.get_value (iter, 0, out val1);
654 return (string) val1;
661 public class Xcls_dbcellrenderer : Object
663 public Gtk.CellRendererText el;
664 private NewBranch _this;
670 public Xcls_dbcellrenderer(NewBranch _owner )
673 _this.dbcellrenderer = this;
674 this.el = new Gtk.CellRendererText();
678 // set gobject values
681 // user defined functions
684 public class Xcls_dbmodel : Object
686 public Gtk.ListStore el;
687 private NewBranch _this;
693 public Xcls_dbmodel(NewBranch _owner )
696 _this.dbmodel = this;
697 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
701 // set gobject values
704 // user defined functions
705 public void loadTickets (string project_id , string tid = "") {
709 // fixme .. get project id from selection..
711 RooTicket.singleton().loadTickets(
713 _this.btn_not_me.el.active ? RooTicket.Who.ANYBODY : RooTicket.Who.ME,
714 _this.btn_closed.el.active ? RooTicket.Status.ALL : RooTicket.Status.ACTIVE
717 _this.ticketsel.loading = true;
726 el.set_value(iter, 0, "");
727 el.set_value(iter, 1, "-- select a ticket --");
729 _this.ticketsel.el.set_active_iter(iter);
730 var tickets = RooTicket.singleton().tickets;
731 foreach(var ticket in tickets) {
735 el.set_value(iter, 0, ticket.id);
736 el.set_value(iter, 1, "#%s %s".printf( ticket.id, ticket.summary));
738 if (ticket.id == tid) {
739 _this.ticketsel.el.set_active_iter(iter);
744 _this.ticketsel.loading = false;
745 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
751 public class Xcls_Label16 : Object
754 private NewBranch _this;
760 public Xcls_Label16(NewBranch _owner )
763 this.el = new Gtk.Label( "Use this as branch name" );
767 // set gobject values
768 this.el.halign = Gtk.Align.START;
769 this.el.justify = Gtk.Justification.RIGHT;
770 this.el.xalign = 0.900000f;
773 // user defined functions
776 public class Xcls_name : Object
779 private NewBranch _this;
785 public Xcls_name(NewBranch _owner )
789 this.el = new Gtk.Entry();
793 // set gobject values
794 this.el.visible = true;
797 // user defined functions
800 public class Xcls_createbtn : Object
802 public Gtk.Button el;
803 private NewBranch _this;
809 public Xcls_createbtn(NewBranch _owner )
812 _this.createbtn = this;
813 this.el = new Gtk.Button();
817 // set gobject values
818 this.el.label = "Create Branch";
823 this.el.get_style_context().add_class("suggested-action");
827 this.el.clicked.connect( () => {
829 GLib.debug("fire response = 1");
831 var ticket_id = _this.ticketsel.selectedTicketId();
833 if (ticket_id == "") {
834 _this.ticketsel.el.get_child().get_style_context().add_class("warning");
838 _this.el.response(1);
842 // user defined functions
843 public void updateState () {
845 var ticket_id = _this.ticketsel.selectedTicketId();
847 if (ticket_id == "") {
848 this.el.set_sensitive(false);
852 this.el.set_sensitive(true);
857 public class Xcls_Box19 : Object
860 private NewBranch _this;
866 public Xcls_Box19(NewBranch _owner )
869 this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
873 // set gobject values
874 var child_0 = new Xcls_btn_not_me( _this );
876 this.el.add ( child_0.el );
877 var child_1 = new Xcls_btn_closed( _this );
879 this.el.add ( child_1.el );
880 var child_2 = new Xcls_Label22( _this );
882 this.el.add ( child_2.el );
885 // user defined functions
887 public class Xcls_btn_not_me : Object
889 public Gtk.CheckButton el;
890 private NewBranch _this;
896 public Xcls_btn_not_me(NewBranch _owner )
899 _this.btn_not_me = this;
900 this.el = new Gtk.CheckButton();
904 // set gobject values
905 this.el.label = "Show tickets not assigned to me";
908 this.el.toggled.connect( () => {
909 var project_id = _this.projectsel.selectedProjectId();
910 _this.dbmodel.loadTickets(project_id);
914 // user defined functions
917 public class Xcls_btn_closed : Object
919 public Gtk.CheckButton el;
920 private NewBranch _this;
926 public Xcls_btn_closed(NewBranch _owner )
929 _this.btn_closed = this;
930 this.el = new Gtk.CheckButton();
934 // set gobject values
935 this.el.label = "Show closed Tickets";
938 this.el.toggled.connect( () => {
939 var project_id = _this.projectsel.selectedProjectId();
940 _this.dbmodel.loadTickets(project_id);
945 // user defined functions
948 public class Xcls_Label22 : Object
951 private NewBranch _this;
957 public Xcls_Label22(NewBranch _owner )
960 this.el = new Gtk.Label( "<a href=\"refresh\">Refresh Ticket list</a>" );
964 // set gobject values
965 this.el.halign = Gtk.Align.END;
966 this.el.hexpand = true;
967 this.el.use_markup = true;
970 this.el.activate_link.connect( (uri) => {
971 if (uri == "refresh") {
973 var curproj = RooProject.getProjectByRepo(_this.repo);
974 _this.prmodel.loadProjects(curproj == null ? "": curproj.id);
976 _this.dbmodel.loadTickets(curproj == null ? "": curproj.id);
982 // user defined functions
987 public class Xcls_scrolled_window : Object
989 public Gtk.ScrolledWindow el;
990 private NewBranch _this;
996 public Xcls_scrolled_window(NewBranch _owner )
999 _this.scrolled_window = this;
1000 this.el = new Gtk.ScrolledWindow( null, null );
1004 // set gobject values
1005 this.el.height_request = 500;
1006 this.el.vexpand = true;
1007 var child_0 = new Xcls_view( _this );
1009 this.el.add ( child_0.el );
1014 this.el.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);
1018 // user defined functions
1020 public class Xcls_view : Object
1022 public WebKit.WebView el;
1023 private NewBranch _this;
1029 public Xcls_view(NewBranch _owner )
1033 this.el = new WebKit.WebView();
1037 // set gobject values
1040 // user defined functions
1041 public void loadTicket (string tid) {
1043 _this.el.get_size(out w, out h);
1046 _this.scrolled_window.el.hide();
1047 _this.el.resize(w, 150);
1049 _this.scrolled_window.el.show();
1050 _this.el.resize(w, 800);
1053 var rs = RooTicket.singleton();
1054 var uri = new WebKit.URIRequest("https://roojs.com/admin.php/MTrack/View/" + tid);
1055 var hd = uri.get_http_headers();
1056 var authCode = Base64.encode ("%s:%s".printf(rs.username, rs.password).data);
1057 hd.append("Authorization", "Basic %s".printf(authCode));
1059 this.el.load_request(uri);
1065 public class Xcls_Box25 : Object
1068 private NewBranch _this;
1074 public Xcls_Box25(NewBranch _owner )
1077 this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
1081 // set gobject values
1082 this.el.homogeneous = false;
1083 var child_0 = new Xcls_table( _this );
1085 this.el.pack_start ( child_0.el , false,false,0 );
1088 // user defined functions
1090 public class Xcls_table : Object
1092 public Gtk.Table el;
1093 private NewBranch _this;
1099 public Xcls_table(NewBranch _owner )
1103 this.el = new Gtk.Table( 14, 4, true );
1107 // set gobject values
1108 this.el.expand = false;
1110 this.el.column_spacing = 4;
1111 this.el.vexpand = false;
1112 var child_0 = new Xcls_Label27( _this );
1114 this.el.attach_defaults ( child_0.el , 0,1,0,1 );
1115 var child_1 = new Xcls_Label28( _this );
1117 this.el.attach_defaults ( child_1.el , 1,2,0,1 );
1118 var child_2 = new Xcls_project_id( _this );
1120 this.el.attach_defaults ( child_2.el , 0,1,1,2 );
1121 var child_3 = new Xcls_summary( _this );
1123 this.el.attach_defaults ( child_3.el , 1,4,1,2 );
1124 var child_4 = new Xcls_Label33( _this );
1126 this.el.attach_defaults ( child_4.el , 0,1,2,3 );
1127 var child_5 = new Xcls_milestone_id( _this );
1129 this.el.attach_defaults ( child_5.el , 0,1,3,4 );
1130 var child_6 = new Xcls_Label36( _this );
1132 this.el.attach_defaults ( child_6.el , 1,4,2,3 );
1133 var child_7 = new Xcls_description( _this );
1135 this.el.attach_defaults ( child_7.el , 1,4,3,12 );
1136 var child_8 = new Xcls_Label38( _this );
1138 this.el.attach_defaults ( child_8.el , 0,1,4,5 );
1139 var child_9 = new Xcls_priority_id( _this );
1141 this.el.attach_defaults ( child_9.el , 0,1,5,6 );
1142 var child_10 = new Xcls_Label41( _this );
1144 this.el.attach_defaults ( child_10.el , 0,1,6,7 );
1145 var child_11 = new Xcls_severity_id( _this );
1147 this.el.attach_defaults ( child_11.el , 0,1,7,8 );
1148 var child_12 = new Xcls_Label44( _this );
1150 this.el.attach_defaults ( child_12.el , 0,1,8,9 );
1151 var child_13 = new Xcls_classification_id( _this );
1153 this.el.attach_defaults ( child_13.el , 0,1,9,10 );
1154 var child_14 = new Xcls_Label47( _this );
1156 this.el.attach_defaults ( child_14.el , 0,1,10,11 );
1157 var child_15 = new Xcls_developer_id( _this );
1159 this.el.attach_defaults ( child_15.el , 0,1,11,12 );
1160 var child_16 = new Xcls_Button50( _this );
1162 this.el.attach_defaults ( child_16.el , 0,4,13,14 );
1165 // user defined functions
1167 public class Xcls_Label27 : Object
1169 public Gtk.Label el;
1170 private NewBranch _this;
1176 public Xcls_Label27(NewBranch _owner )
1179 this.el = new Gtk.Label( "Project" );
1183 // set gobject values
1184 this.el.halign = Gtk.Align.START;
1185 this.el.visible = true;
1188 // user defined functions
1191 public class Xcls_Label28 : Object
1193 public Gtk.Label el;
1194 private NewBranch _this;
1200 public Xcls_Label28(NewBranch _owner )
1203 this.el = new Gtk.Label( "Summary" );
1207 // set gobject values
1208 this.el.halign = Gtk.Align.START;
1209 this.el.visible = true;
1212 // user defined functions
1215 public class Xcls_project_id : Object
1217 public Gtk.ComboBox el;
1218 private NewBranch _this;
1222 public bool loading;
1225 public Xcls_project_id(NewBranch _owner )
1228 _this.project_id = this;
1229 this.el = new Gtk.ComboBox.with_entry();
1232 this.loading = false;
1234 // set gobject values
1235 var child_0 = new Xcls_prcellrenderer( _this );
1237 this.el.pack_start ( child_0.el , true );
1238 var child_1 = new Xcls_prmodel( _this );
1240 this.el.set_model ( child_1.el );
1244 this.el.set_entry_text_column(1);
1247 this.el.changed.connect( () => {
1251 var project_id = this.selectedProjectId();
1253 var rt = RooTicket.singleton();
1254 rt.loadProjectOptions(project_id);
1256 _this.msmodel.loadMilestones();
1257 _this.primodel.loadPriorities();
1258 _this.sevmodel.loadSeverities();
1259 _this.clmodel.loadClassifications();
1260 _this.devmodel.loadDevelopers();
1262 // affects projects and milestones..
1265 /*if (this.loading) {
1268 var ticket_id = this.selectedTicketId();
1270 var name = RooTicket.singleton().usernameLocal();
1272 if (ticket_id == "" || ticket_id == null) {
1274 var dt = new DateTime.now_local();
1275 _this.name.el.set_text("wip_%s_%s".printf(name,dt.format("%Y_%b_%d")));
1280 var ticket = RooTicket.singleton().getById(ticket_id);
1282 _this.name.el.set_text("wip_%s_T%s_%s".printf(name,ticket.id, ticket.summaryToBranchName()));
1284 //GLib.debug (//"Selection: %s, %s\n", (string) val1, (string) val2);
1289 // user defined functions
1290 public string selectedProjectId () {
1295 this.el.get_active_iter (out iter);
1296 _this.prmodel.el.get_value (iter, 0, out val1);
1299 return (string) val1;
1306 public class Xcls_prcellrenderer : Object
1308 public Gtk.CellRendererText el;
1309 private NewBranch _this;
1315 public Xcls_prcellrenderer(NewBranch _owner )
1318 _this.prcellrenderer = this;
1319 this.el = new Gtk.CellRendererText();
1323 // set gobject values
1326 // user defined functions
1329 public class Xcls_prmodel : Object
1331 public Gtk.ListStore el;
1332 private NewBranch _this;
1338 public Xcls_prmodel(NewBranch _owner )
1341 _this.prmodel = this;
1342 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
1346 // set gobject values
1349 // user defined functions
1350 public void loadProjects (string id) {
1353 _this.project_id.loading = true;
1359 el.append(out iter);
1362 el.set_value(iter, 0, "");
1363 el.set_value(iter, 1, "-- select a project --");
1365 _this.project_id.el.set_active_iter(iter);
1368 foreach(var project in RooProject.projects()) {
1370 el.append(out iter);
1372 el.set_value(iter, 0, project.id);
1373 el.set_value(iter, 1, project.name );
1374 if (id == project.id) {
1375 _this.project_id.el.set_active_iter(iter);
1380 _this.project_id.loading = false;
1381 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
1387 public class Xcls_summary : Object
1389 public Gtk.Entry el;
1390 private NewBranch _this;
1396 public Xcls_summary(NewBranch _owner )
1399 _this.summary = this;
1400 this.el = new Gtk.Entry();
1404 // set gobject values
1405 this.el.visible = true;
1408 // user defined functions
1411 public class Xcls_Label33 : Object
1413 public Gtk.Label el;
1414 private NewBranch _this;
1420 public Xcls_Label33(NewBranch _owner )
1423 this.el = new Gtk.Label( "Milestone" );
1427 // set gobject values
1428 this.el.halign = Gtk.Align.START;
1429 this.el.justify = Gtk.Justification.RIGHT;
1430 this.el.xalign = 0.900000f;
1433 // user defined functions
1436 public class Xcls_milestone_id : Object
1438 public Gtk.ComboBox el;
1439 private NewBranch _this;
1443 public bool loading;
1446 public Xcls_milestone_id(NewBranch _owner )
1449 _this.milestone_id = this;
1450 this.el = new Gtk.ComboBox.with_entry();
1453 this.loading = false;
1455 // set gobject values
1456 var child_0 = new Xcls_msmodel( _this );
1458 this.el.set_model ( child_0.el );
1462 this.el.set_entry_text_column(1);
1465 // user defined functions
1466 public string selectedMilestoneId () {
1471 this.el.get_active_iter (out iter);
1472 _this.msmodel.el.get_value (iter, 0, out val1);
1475 return (string) val1;
1482 public class Xcls_msmodel : Object
1484 public Gtk.ListStore el;
1485 private NewBranch _this;
1491 public Xcls_msmodel(NewBranch _owner )
1494 _this.msmodel = this;
1495 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
1499 // set gobject values
1502 // user defined functions
1503 public void loadMilestones ( ) {
1505 var rt = RooTicket.singleton();
1506 // rt.loadProjects();
1508 _this.milestone_id.loading = true;
1514 el.append(out iter);
1517 el.set_value(iter, 0, "");
1518 el.set_value(iter, 1, "-- select a milestone --");
1519 _this.milestone_id.el.set_active_iter(iter);
1521 var projects = rt.milestones;
1522 foreach(var project in projects) {
1524 el.append(out iter);
1526 el.set_value(iter, 0, project.id);
1527 el.set_value(iter, 1, project.display_name );
1528 // if (id == project.id) {
1529 // _this.milestone.el.set_active_iter(iter);
1535 _this.milestone_id.loading = false;
1536 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
1542 public class Xcls_Label36 : Object
1544 public Gtk.Label el;
1545 private NewBranch _this;
1551 public Xcls_Label36(NewBranch _owner )
1554 this.el = new Gtk.Label( "Description" );
1558 // set gobject values
1559 this.el.halign = Gtk.Align.START;
1562 // user defined functions
1565 public class Xcls_description : Object
1567 public Gtk.TextView el;
1568 private NewBranch _this;
1574 public Xcls_description(NewBranch _owner )
1577 _this.description = this;
1578 this.el = new Gtk.TextView();
1582 // set gobject values
1583 this.el.border_width = 1;
1586 // user defined functions
1589 public class Xcls_Label38 : Object
1591 public Gtk.Label el;
1592 private NewBranch _this;
1598 public Xcls_Label38(NewBranch _owner )
1601 this.el = new Gtk.Label( "Priority" );
1605 // set gobject values
1606 this.el.halign = Gtk.Align.START;
1607 this.el.xalign = 0.900000f;
1610 // user defined functions
1613 public class Xcls_priority_id : Object
1615 public Gtk.ComboBox el;
1616 private NewBranch _this;
1620 public bool loading;
1623 public Xcls_priority_id(NewBranch _owner )
1626 _this.priority_id = this;
1627 this.el = new Gtk.ComboBox.with_entry();
1630 this.loading = false;
1632 // set gobject values
1633 var child_0 = new Xcls_primodel( _this );
1635 this.el.set_model ( child_0.el );
1639 this.el.set_entry_text_column(1);
1642 // user defined functions
1643 public string selectedPriorityId () {
1648 this.el.get_active_iter (out iter);
1649 _this.primodel.el.get_value (iter, 0, out val1);
1652 return (string) val1;
1659 public class Xcls_primodel : Object
1661 public Gtk.ListStore el;
1662 private NewBranch _this;
1668 public Xcls_primodel(NewBranch _owner )
1671 _this.primodel = this;
1672 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
1676 // set gobject values
1679 // user defined functions
1680 public void loadPriorities ( ) {
1682 var rt = RooTicket.singleton();
1683 // rt.loadProjects();
1685 _this.priority_id.loading = true;
1692 var projects = rt.priorities;
1693 foreach(var project in projects) {
1695 el.append(out iter);
1697 el.set_value(iter, 0, project.id);
1698 el.set_value(iter, 1, project.display_name );
1699 if ("normal" == project.name) {
1700 _this.priority_id.el.set_active_iter(iter);
1705 _this.priority_id.loading = false;
1712 public class Xcls_Label41 : Object
1714 public Gtk.Label el;
1715 private NewBranch _this;
1721 public Xcls_Label41(NewBranch _owner )
1724 this.el = new Gtk.Label( "Severity" );
1728 // set gobject values
1729 this.el.halign = Gtk.Align.START;
1732 // user defined functions
1735 public class Xcls_severity_id : Object
1737 public Gtk.ComboBox el;
1738 private NewBranch _this;
1742 public bool loading;
1745 public Xcls_severity_id(NewBranch _owner )
1748 _this.severity_id = this;
1749 this.el = new Gtk.ComboBox.with_entry();
1752 this.loading = false;
1754 // set gobject values
1755 var child_0 = new Xcls_sevmodel( _this );
1757 this.el.set_model ( child_0.el );
1761 this.el.set_entry_text_column(1);
1764 // user defined functions
1765 public string selectedSeverityId () {
1770 this.el.get_active_iter (out iter);
1771 _this.sevmodel.el.get_value (iter, 0, out val1);
1774 return (string) val1;
1781 public class Xcls_sevmodel : Object
1783 public Gtk.ListStore el;
1784 private NewBranch _this;
1790 public Xcls_sevmodel(NewBranch _owner )
1793 _this.sevmodel = this;
1794 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
1798 // set gobject values
1801 // user defined functions
1802 public void loadSeverities () {
1804 var rt = RooTicket.singleton();
1805 //rt.loadProjects();
1807 _this.severity_id.loading = true;
1813 var projects = rt.serverities;
1814 foreach(var project in projects) {
1816 el.append(out iter);
1818 el.set_value(iter, 0, project.id);
1819 el.set_value(iter, 1, project.display_name );
1820 if ("normal" == project.name) {
1821 _this.severity_id.el.set_active_iter(iter);
1826 _this.severity_id.loading = false;
1827 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
1833 public class Xcls_Label44 : Object
1835 public Gtk.Label el;
1836 private NewBranch _this;
1842 public Xcls_Label44(NewBranch _owner )
1845 this.el = new Gtk.Label( "Classification" );
1849 // set gobject values
1850 this.el.halign = Gtk.Align.START;
1853 // user defined functions
1856 public class Xcls_classification_id : Object
1858 public Gtk.ComboBox el;
1859 private NewBranch _this;
1863 public bool loading;
1866 public Xcls_classification_id(NewBranch _owner )
1869 _this.classification_id = this;
1870 this.el = new Gtk.ComboBox.with_entry();
1873 this.loading = false;
1875 // set gobject values
1876 var child_0 = new Xcls_clmodel( _this );
1878 this.el.set_model ( child_0.el );
1882 this.el.set_entry_text_column(1);
1885 // user defined functions
1886 public string selectedClassificationId () {
1891 this.el.get_active_iter (out iter);
1892 _this.clmodel.el.get_value (iter, 0, out val1);
1895 return (string) val1;
1902 public class Xcls_clmodel : Object
1904 public Gtk.ListStore el;
1905 private NewBranch _this;
1911 public Xcls_clmodel(NewBranch _owner )
1914 _this.clmodel = this;
1915 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
1919 // set gobject values
1922 // user defined functions
1923 public void loadClassifications ( ) {
1925 var rt = RooTicket.singleton();
1926 // rt.loadProjects();
1928 _this.classification_id.loading = true;
1934 el.append(out iter);
1937 var projects = rt.classifications;
1938 foreach(var project in projects) {
1940 el.append(out iter);
1942 el.set_value(iter, 0, project.id);
1943 el.set_value(iter, 1, project.display_name );
1944 if ("bug" == project.name) {
1945 _this.classification_id.el.set_active_iter(iter);
1950 _this.classification_id.loading = false;
1951 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
1957 public class Xcls_Label47 : Object
1959 public Gtk.Label el;
1960 private NewBranch _this;
1966 public Xcls_Label47(NewBranch _owner )
1969 this.el = new Gtk.Label( "Assign to" );
1973 // set gobject values
1974 this.el.halign = Gtk.Align.START;
1977 // user defined functions
1980 public class Xcls_developer_id : Object
1982 public Gtk.ComboBox el;
1983 private NewBranch _this;
1987 public bool loading;
1990 public Xcls_developer_id(NewBranch _owner )
1993 _this.developer_id = this;
1994 this.el = new Gtk.ComboBox.with_entry();
1997 this.loading = false;
1999 // set gobject values
2000 var child_0 = new Xcls_devmodel( _this );
2002 this.el.set_model ( child_0.el );
2006 this.el.set_entry_text_column(1);
2009 // user defined functions
2010 public string selectedDeveloperId () {
2015 this.el.get_active_iter (out iter);
2016 _this.devmodel.el.get_value (iter, 0, out val1);
2019 return (string) val1;
2026 public class Xcls_devmodel : Object
2028 public Gtk.ListStore el;
2029 private NewBranch _this;
2035 public Xcls_devmodel(NewBranch _owner )
2038 _this.devmodel = this;
2039 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
2043 // set gobject values
2046 // user defined functions
2047 public void loadDevelopers ( ) {
2049 var rt = RooTicket.singleton();
2050 //rt.loadProjects();
2052 _this.developer_id.loading = true;
2058 el.append(out iter);
2061 el.set_value(iter, 0, "");
2062 el.set_value(iter, 1, "-- select a developer --");
2064 _this.developer_id.el.set_active_iter(iter);
2067 var peps = rt.developers;
2068 foreach(var p in peps) {
2070 el.append(out iter);
2072 el.set_value(iter, 0, p.id);
2073 el.set_value(iter, 1, p.display_name );
2074 if (rt.authuser_id == p.id) {
2075 _this.developer_id.el.set_active_iter(iter);
2079 _this.developer_id.loading = false;
2080 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
2086 public class Xcls_Button50 : Object
2088 public Gtk.Button el;
2089 private NewBranch _this;
2095 public Xcls_Button50(NewBranch _owner )
2098 this.el = new Gtk.Button();
2102 // set gobject values
2103 this.el.label = "Create Ticket & Branch";
2108 this.el.get_style_context().add_class("suggested-action");
2112 this.el.clicked.connect( () => {
2113 GLib.debug("fire response = 1");
2116 var invalid = false;
2118 // validate first...
2119 _this.project_id.el.get_child().get_style_context().remove_class("warning");
2120 if (_this.project_id.selectedProjectId() == "") {
2121 _this.project_id.el.get_child().get_style_context().add_class("warning");
2125 _this.milestone_id.el.get_child().get_style_context().remove_class("warning");
2127 _this.priority_id.el.get_child().get_style_context().remove_class("warning");
2128 if (_this.priority_id.selectedPriorityId() == "") {
2129 _this.priority_id.el.get_child().get_style_context().add_class("warning");
2133 _this.classification_id.el.get_child().get_style_context().remove_class("warning");
2134 if (_this.classification_id.selectedClassificationId() == "") {
2135 _this.classification_id.el.get_child().get_style_context().add_class("warning");
2139 _this.developer_id.el.get_child().get_style_context().remove_class("warning");
2140 if (_this.developer_id.selectedDeveloperId() == "") {
2141 _this.developer_id.el.get_child().get_style_context().add_class("warning");
2145 _this.summary.el.get_style_context().remove_class("warning");
2146 if (_this.summary.el.get_text() == "") {
2147 _this.summary.el.get_style_context().add_class("warning");
2151 _this.description.el.get_style_context().remove_class("warning");
2156 GLib.debug("for is valid");
2158 _this.el.response(1);
2162 // user defined functions
2167 public class Xcls_Box51 : Object
2170 private NewBranch _this;
2176 public Xcls_Box51(NewBranch _owner )
2179 this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
2183 // set gobject values
2184 this.el.homogeneous = false;
2185 var child_0 = new Xcls_Table52( _this );
2187 this.el.pack_start ( child_0.el , false,false,0 );
2188 var child_1 = new Xcls_ScrolledWindow56( _this );
2190 this.el.add ( child_1.el );
2193 // user defined functions
2195 public class Xcls_Table52 : Object
2197 public Gtk.Table el;
2198 private NewBranch _this;
2204 public Xcls_Table52(NewBranch _owner )
2207 this.el = new Gtk.Table( 2, 5, true );
2211 // set gobject values
2212 this.el.expand = false;
2214 this.el.column_spacing = 4;
2215 this.el.vexpand = false;
2216 var child_0 = new Xcls_Label53( _this );
2218 this.el.attach_defaults ( child_0.el , 0,1,0,1 );
2219 var child_1 = new Xcls_commit_message( _this );
2221 this.el.attach_defaults ( child_1.el , 0,4,1,2 );
2222 var child_2 = new Xcls_createbtn( _this );
2224 this.el.attach_defaults ( child_2.el , 4,5,1,2 );
2227 // user defined functions
2229 public class Xcls_Label53 : Object
2231 public Gtk.Label el;
2232 private NewBranch _this;
2238 public Xcls_Label53(NewBranch _owner )
2241 this.el = new Gtk.Label( "Just commit with this comment" );
2245 // set gobject values
2246 this.el.halign = Gtk.Align.START;
2247 this.el.justify = Gtk.Justification.RIGHT;
2248 this.el.xalign = 0.900000f;
2251 // user defined functions
2254 public class Xcls_commit_message : Object
2256 public Gtk.Entry el;
2257 private NewBranch _this;
2263 public Xcls_commit_message(NewBranch _owner )
2266 _this.commit_message = this;
2267 this.el = new Gtk.Entry();
2271 // set gobject values
2272 this.el.visible = true;
2275 // user defined functions
2278 public class Xcls_createbtn : Object
2280 public Gtk.Button el;
2281 private NewBranch _this;
2287 public Xcls_createbtn(NewBranch _owner )
2290 _this.createbtn = this;
2291 this.el = new Gtk.Button();
2295 // set gobject values
2296 this.el.label = "Commit Changes";
2301 this.el.get_style_context().add_class("suggested-action");
2305 this.el.clicked.connect( () => {
2307 GLib.debug("fire response = 1");
2309 var ticket_id = _this.ticketsel.selectedTicketId();
2311 if (ticket_id == "") {
2312 _this.ticketsel.el.get_child().get_style_context().add_class("warning");
2316 _this.el.response(1);
2320 // user defined functions
2321 public void updateState () {
2323 var ticket_id = _this.ticketsel.selectedTicketId();
2325 if (ticket_id == "") {
2326 this.el.set_sensitive(false);
2330 this.el.set_sensitive(true);
2336 public class Xcls_ScrolledWindow56 : Object
2338 public Gtk.ScrolledWindow el;
2339 private NewBranch _this;
2345 public Xcls_ScrolledWindow56(NewBranch _owner )
2348 this.el = new Gtk.ScrolledWindow( null, null );
2352 // set gobject values
2353 this.el.height_request = 400;
2354 this.el.vexpand = true;
2355 var child_0 = new Xcls_diff_view( _this );
2357 this.el.add ( child_0.el );
2360 // user defined functions
2362 public class Xcls_diff_view : Object
2364 public Gtk.SourceView el;
2365 private NewBranch _this;
2371 public Xcls_diff_view(NewBranch _owner )
2374 _this.diff_view = this;
2375 this.el = new Gtk.SourceView();
2381 var description = Pango.FontDescription.from_string("monospace");
2382 description.set_size(9000);
2383 this.el.override_font(description);
2384 var lm = Gtk.SourceLanguageManager.get_default();
2386 ((Gtk.SourceBuffer)(this.el.get_buffer())).set_language(
2387 lm.get_language("diff")
2391 // user defined functions