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_projectsel projectsel;
19 public Xcls_prcellrenderer prcellrenderer;
20 public Xcls_prmodel prmodel;
21 public Xcls_ticketsel ticketsel;
22 public Xcls_dbcellrenderer dbcellrenderer;
23 public Xcls_dbmodel dbmodel;
24 public Xcls_name name;
25 public Xcls_createbtn createbtn;
26 public Xcls_btn_not_me btn_not_me;
27 public Xcls_btn_closed btn_closed;
28 public Xcls_scrolled_window scrolled_window;
29 public Xcls_view view;
30 public Xcls_table table;
31 public Xcls_project_id project_id;
32 public Xcls_prcellrenderer prcellrenderer;
33 public Xcls_prmodel prmodel;
34 public Xcls_summary summary;
35 public Xcls_milestone_id milestone_id;
36 public Xcls_msmodel msmodel;
37 public Xcls_description description;
38 public Xcls_priority_id priority_id;
39 public Xcls_primodel primodel;
40 public Xcls_severity_id severity_id;
41 public Xcls_sevmodel sevmodel;
42 public Xcls_classification_id classification_id;
43 public Xcls_clmodel clmodel;
44 public Xcls_developer_id developer_id;
45 public Xcls_devmodel devmodel;
46 public Xcls_commit_message commit_message;
47 public Xcls_createbtn createbtn;
48 public Xcls_diff_view diff_view;
53 public Gee.ArrayList<GitMonitorQueue> queue;
59 this.el = new Gtk.Dialog();
67 this.el.title = "Create a working branch ";
68 this.el.default_height = 500;
69 this.el.default_width = 500;
70 this.el.deletable = true;
72 var child_0 = new Xcls_Notebook2( _this );
74 this.el.get_content_area().add ( child_0.el );
77 this.el.delete_event.connect( (self, event) => {
82 this.el.response.connect( (self, response_id) => {
84 GLib.debug("got %d", (int) response_id);
89 // have they selected a ticket..
90 // make that the current active ticket?
91 // we really need to store locally what ticket is being worked on..
92 // in theory we could be working on multiple project and not merging..
93 // -- each repo would have their active ticket (only one per repo)
94 // -- so we could just store that in there
95 // -- initial load can check the contents of the ticket files on first scan.
98 if (response_id < 1) {
100 this.running = false;
104 var ticket_id = _this.ticketsel.selectedTicketId();
106 if (this.repo != null) {
107 var bn = _this.name.el.get_text();
109 var res = this.repo.setActiveTicket(
110 RooTicket.singleton().getById(ticket_id != "" ? ticket_id : "-1"), bn
113 // start the monitoring..
114 GitMonitor.gitmonitor.start();
120 this.running = false;
130 // user defined functions
131 public void show ( GitRepo repo, Gee.ArrayList<GitMonitorQueue> queue, string tid = "" )
133 // this.el.set_gravity(Gdk.Gravity.NORTH);
134 if (this.running) { // should not happen!!
135 GLib.error("new branch show called, when already being displayed?");
140 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..
148 GLib.debug("Loading tickets");
152 this.el.set_keep_above(true);
155 var curproj = RooProject.getProjectByRepo(this.repo);
156 _this.prmodel.loadProjects(curproj == null ? "" : curproj.id);
158 _this.dbmodel.loadTickets(curproj == null ? "": curproj.id, tid);
159 _this.createbtn.updateState();
161 _this.ticketsel.el.get_child().get_style_context().remove_class("warning");
163 var name = RooTicket.singleton().usernameLocal();
164 var ticket = RooTicket.singleton().getById(tid);
165 _this.name.el.set_text("wip_%s_T%s_%s".printf(name,ticket.id, ticket.summaryToBranchName()));
167 _this.ticketsel.el.get_child().get_style_context().add_class("warning");
169 _this.view.loadTicket(tid);
173 public class Xcls_Notebook2 : Object
175 public Gtk.Notebook el;
176 private NewBranch _this;
182 public Xcls_Notebook2(NewBranch _owner )
185 this.el = new Gtk.Notebook();
189 // set gobject values
190 this.el.vexpand = true;
191 var child_0 = new Xcls_label_select_ticket( _this );
193 var child_1 = new Xcls_label_create_ticket( _this );
195 var child_2 = new Xcls_label_quick_commit( _this );
197 var child_3 = new Xcls_Box6( _this );
199 this.el.append_page ( child_3.el , _this.label_select_ticket.el );
200 var child_4 = new Xcls_Box25( _this );
202 this.el.append_page ( child_4.el , _this.label_create_ticket.el );
203 var child_5 = new Xcls_Box51( _this );
205 this.el.append_page ( child_5.el , _this.label_quick_commit.el );
208 // user defined functions
210 public class Xcls_label_select_ticket : Object
213 private NewBranch _this;
219 public Xcls_label_select_ticket(NewBranch _owner )
222 _this.label_select_ticket = this;
223 this.el = new Gtk.Label( "Select Existing Ticket to work on" );
227 // set gobject values
230 // user defined functions
233 public class Xcls_label_create_ticket : Object
236 private NewBranch _this;
242 public Xcls_label_create_ticket(NewBranch _owner )
245 _this.label_create_ticket = this;
246 this.el = new Gtk.Label( "Create a New Ticket" );
250 // set gobject values
253 // user defined functions
256 public class Xcls_label_quick_commit : Object
259 private NewBranch _this;
265 public Xcls_label_quick_commit(NewBranch _owner )
268 _this.label_quick_commit = this;
269 this.el = new Gtk.Label( "Quick Commit" );
273 // set gobject values
276 // user defined functions
279 public class Xcls_Box6 : Object
282 private NewBranch _this;
288 public Xcls_Box6(NewBranch _owner )
291 this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
295 // set gobject values
296 this.el.homogeneous = false;
297 var child_0 = new Xcls_Table7( _this );
299 this.el.pack_start ( child_0.el , false,false,0 );
300 var child_1 = new Xcls_scrolled_window( _this );
302 this.el.add ( child_1.el );
305 // user defined functions
307 public class Xcls_Table7 : Object
310 private NewBranch _this;
316 public Xcls_Table7(NewBranch _owner )
319 this.el = new Gtk.Table( 5, 5, true );
323 // set gobject values
324 this.el.expand = false;
326 this.el.column_spacing = 4;
327 this.el.vexpand = false;
328 var child_0 = new Xcls_Label8( _this );
330 this.el.attach_defaults ( child_0.el , 0,1,0,1 );
331 var child_1 = new Xcls_Label9( _this );
333 this.el.attach_defaults ( child_1.el , 1,2,0,1 );
334 var child_2 = new Xcls_projectsel( _this );
336 this.el.attach_defaults ( child_2.el , 0,1,1,2 );
337 var child_3 = new Xcls_ticketsel( _this );
339 this.el.attach_defaults ( child_3.el , 1,5,1,2 );
340 var child_4 = new Xcls_Label16( _this );
342 this.el.attach_defaults ( child_4.el , 0,1,3,4 );
343 var child_5 = new Xcls_name( _this );
345 this.el.attach_defaults ( child_5.el , 0,4,4,5 );
346 var child_6 = new Xcls_createbtn( _this );
348 this.el.attach_defaults ( child_6.el , 4,5,4,5 );
349 var child_7 = new Xcls_Box19( _this );
351 this.el.attach_defaults ( child_7.el , 0,5,2,3 );
354 // user defined functions
356 public class Xcls_Label8 : Object
359 private NewBranch _this;
365 public Xcls_Label8(NewBranch _owner )
368 this.el = new Gtk.Label( "Project" );
372 // set gobject values
373 this.el.halign = Gtk.Align.START;
374 this.el.justify = Gtk.Justification.RIGHT;
375 this.el.visible = true;
378 // user defined functions
381 public class Xcls_Label9 : Object
384 private NewBranch _this;
390 public Xcls_Label9(NewBranch _owner )
393 this.el = new Gtk.Label( "Ticket" );
397 // set gobject values
398 this.el.halign = Gtk.Align.START;
399 this.el.visible = true;
402 // user defined functions
405 public class Xcls_projectsel : Object
407 public Gtk.ComboBox el;
408 private NewBranch _this;
415 public Xcls_projectsel(NewBranch _owner )
418 _this.projectsel = this;
419 this.el = new Gtk.ComboBox.with_entry();
422 this.loading = false;
424 // set gobject values
425 var child_0 = new Xcls_prcellrenderer( _this );
427 this.el.pack_start ( child_0.el , true );
428 var child_1 = new Xcls_prmodel( _this );
430 this.el.set_model ( child_1.el );
434 this.el.set_entry_text_column(1);
437 this.el.changed.connect( () => {
441 var project_id = this.selectedProjectId();
442 _this.dbmodel.loadTickets(project_id);
445 /*if (this.loading) {
448 var ticket_id = this.selectedTicketId();
450 var name = RooTicket.singleton().usernameLocal();
452 if (ticket_id == "" || ticket_id == null) {
454 var dt = new DateTime.now_local();
455 _this.name.el.set_text("wip_%s_%s".printf(name,dt.format("%Y_%b_%d")));
460 var ticket = RooTicket.singleton().getById(ticket_id);
462 _this.name.el.set_text("wip_%s_T%s_%s".printf(name,ticket.id, ticket.summaryToBranchName()));
464 //GLib.debug (//"Selection: %s, %s\n", (string) val1, (string) val2);
469 // user defined functions
470 public string selectedProjectId () {
475 this.el.get_active_iter (out iter);
476 _this.prmodel.el.get_value (iter, 0, out val1);
479 return (string) val1;
486 public class Xcls_prcellrenderer : Object
488 public Gtk.CellRendererText el;
489 private NewBranch _this;
495 public Xcls_prcellrenderer(NewBranch _owner )
498 _this.prcellrenderer = this;
499 this.el = new Gtk.CellRendererText();
503 // set gobject values
506 // user defined functions
509 public class Xcls_prmodel : Object
511 public Gtk.ListStore el;
512 private NewBranch _this;
518 public Xcls_prmodel(NewBranch _owner )
521 _this.prmodel = this;
522 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
526 // set gobject values
529 // user defined functions
530 public void loadProjects (string id) {
534 _this.projectsel.loading = true;
543 el.set_value(iter, 0, "");
544 el.set_value(iter, 1, "-- select a project --");
546 _this.projectsel.el.set_active_iter(iter);
549 foreach(var project in RooProject.projects()) {
553 el.set_value(iter, 0, project.id);
554 el.set_value(iter, 1, project.name );
555 if (id == project.id) {
556 _this.projectsel.el.set_active_iter(iter);
561 _this.projectsel.loading = false;
562 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
568 public class Xcls_ticketsel : Object
570 public Gtk.ComboBox el;
571 private NewBranch _this;
578 public Xcls_ticketsel(NewBranch _owner )
581 _this.ticketsel = this;
582 this.el = new Gtk.ComboBox.with_entry();
585 this.loading = false;
587 // set gobject values
588 var child_0 = new Xcls_dbcellrenderer( _this );
590 this.el.pack_start ( child_0.el , true );
591 var child_1 = new Xcls_dbmodel( _this );
593 this.el.set_model ( child_1.el );
597 //this.el.add_attribute(_this.dbcellrenderer.el , "markup", 1 );
598 this.el.set_entry_text_column(1);
599 this.el.get_child().set_sensitive(false);
602 this.el.changed.connect( () => {
606 var ticket_id = this.selectedTicketId();
608 var name = RooTicket.singleton().usernameLocal();
610 this.el.get_child().get_style_context().remove_class("warning");
611 if (ticket_id == "" || ticket_id == null) {
613 var dt = new DateTime.now_local();
614 _this.name.el.set_text("wip_%s_%s".printf(name,dt.format("%Y_%b_%d")));
615 _this.view.loadTicket("");
617 this.el.get_child().get_style_context().add_class("warning");
618 _this.createbtn.updateState();
623 var ticket = RooTicket.singleton().getById(ticket_id);
625 _this.name.el.set_text("wip_%s_T%s_%s".printf(name,ticket.id, ticket.summaryToBranchName()));
626 _this.scrolled_window.el.show();
628 _this.view.loadTicket(ticket.id);
629 _this.createbtn.updateState();
631 //GLib.debug (//"Selection: %s, %s\n", (string) val1, (string) val2);
635 // user defined functions
636 public string selectedTicketId () {
641 this.el.get_active_iter (out iter);
642 _this.dbmodel.el.get_value (iter, 0, out val1);
645 return (string) val1;
652 public class Xcls_dbcellrenderer : Object
654 public Gtk.CellRendererText el;
655 private NewBranch _this;
661 public Xcls_dbcellrenderer(NewBranch _owner )
664 _this.dbcellrenderer = this;
665 this.el = new Gtk.CellRendererText();
669 // set gobject values
672 // user defined functions
675 public class Xcls_dbmodel : Object
677 public Gtk.ListStore el;
678 private NewBranch _this;
684 public Xcls_dbmodel(NewBranch _owner )
687 _this.dbmodel = this;
688 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
692 // set gobject values
695 // user defined functions
696 public void loadTickets (string project_id , string tid = "") {
700 // fixme .. get project id from selection..
702 RooTicket.singleton().loadTickets(
704 _this.btn_not_me.el.active ? RooTicket.Who.ANYBODY : RooTicket.Who.ME,
705 _this.btn_closed.el.active ? RooTicket.Status.ALL : RooTicket.Status.ACTIVE
708 _this.ticketsel.loading = true;
717 el.set_value(iter, 0, "");
718 el.set_value(iter, 1, "-- select a ticket --");
720 _this.ticketsel.el.set_active_iter(iter);
721 var tickets = RooTicket.singleton().tickets;
722 foreach(var ticket in tickets) {
726 el.set_value(iter, 0, ticket.id);
727 el.set_value(iter, 1, "#%s %s".printf( ticket.id, ticket.summary));
729 if (ticket.id == tid) {
730 _this.ticketsel.el.set_active_iter(iter);
735 _this.ticketsel.loading = false;
736 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
742 public class Xcls_Label16 : Object
745 private NewBranch _this;
751 public Xcls_Label16(NewBranch _owner )
754 this.el = new Gtk.Label( "Use this as branch name" );
758 // set gobject values
759 this.el.halign = Gtk.Align.START;
760 this.el.justify = Gtk.Justification.RIGHT;
761 this.el.xalign = 0.900000f;
764 // user defined functions
767 public class Xcls_name : Object
770 private NewBranch _this;
776 public Xcls_name(NewBranch _owner )
780 this.el = new Gtk.Entry();
784 // set gobject values
785 this.el.visible = true;
788 // user defined functions
791 public class Xcls_createbtn : Object
793 public Gtk.Button el;
794 private NewBranch _this;
800 public Xcls_createbtn(NewBranch _owner )
803 _this.createbtn = this;
804 this.el = new Gtk.Button();
808 // set gobject values
809 this.el.label = "Create Branch";
814 this.el.get_style_context().add_class("suggested-action");
818 this.el.clicked.connect( () => {
820 GLib.debug("fire response = 1");
822 var ticket_id = _this.ticketsel.selectedTicketId();
824 if (ticket_id == "") {
825 _this.ticketsel.el.get_child().get_style_context().add_class("warning");
829 _this.el.response(1);
833 // user defined functions
834 public void updateState () {
836 var ticket_id = _this.ticketsel.selectedTicketId();
838 if (ticket_id == "") {
839 this.el.set_sensitive(false);
843 this.el.set_sensitive(true);
848 public class Xcls_Box19 : Object
851 private NewBranch _this;
857 public Xcls_Box19(NewBranch _owner )
860 this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
864 // set gobject values
865 var child_0 = new Xcls_btn_not_me( _this );
867 this.el.add ( child_0.el );
868 var child_1 = new Xcls_btn_closed( _this );
870 this.el.add ( child_1.el );
871 var child_2 = new Xcls_Label22( _this );
873 this.el.add ( child_2.el );
876 // user defined functions
878 public class Xcls_btn_not_me : Object
880 public Gtk.CheckButton el;
881 private NewBranch _this;
887 public Xcls_btn_not_me(NewBranch _owner )
890 _this.btn_not_me = this;
891 this.el = new Gtk.CheckButton();
895 // set gobject values
896 this.el.label = "Show tickets not assigned to me";
899 this.el.toggled.connect( () => {
900 var project_id = _this.projectsel.selectedProjectId();
901 _this.dbmodel.loadTickets(project_id);
905 // user defined functions
908 public class Xcls_btn_closed : Object
910 public Gtk.CheckButton el;
911 private NewBranch _this;
917 public Xcls_btn_closed(NewBranch _owner )
920 _this.btn_closed = this;
921 this.el = new Gtk.CheckButton();
925 // set gobject values
926 this.el.label = "Show closed Tickets";
929 this.el.toggled.connect( () => {
930 var project_id = _this.projectsel.selectedProjectId();
931 _this.dbmodel.loadTickets(project_id);
936 // user defined functions
939 public class Xcls_Label22 : Object
942 private NewBranch _this;
948 public Xcls_Label22(NewBranch _owner )
951 this.el = new Gtk.Label( "<a href=\"refresh\">Refresh Ticket list</a>" );
955 // set gobject values
956 this.el.halign = Gtk.Align.END;
957 this.el.hexpand = true;
958 this.el.use_markup = true;
961 this.el.activate_link.connect( (uri) => {
962 if (uri == "refresh") {
964 var curproj = RooProject.getProjectByRepo(_this.repo);
965 _this.prmodel.loadProjects(curproj == null ? "": curproj.id);
967 _this.dbmodel.loadTickets(curproj == null ? "": curproj.id);
973 // user defined functions
978 public class Xcls_scrolled_window : Object
980 public Gtk.ScrolledWindow el;
981 private NewBranch _this;
987 public Xcls_scrolled_window(NewBranch _owner )
990 _this.scrolled_window = this;
991 this.el = new Gtk.ScrolledWindow( null, null );
995 // set gobject values
996 this.el.height_request = 500;
997 this.el.vexpand = true;
998 var child_0 = new Xcls_view( _this );
1000 this.el.add ( child_0.el );
1005 this.el.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);
1009 // user defined functions
1011 public class Xcls_view : Object
1013 public WebKit.WebView el;
1014 private NewBranch _this;
1020 public Xcls_view(NewBranch _owner )
1024 this.el = new WebKit.WebView();
1028 // set gobject values
1031 // user defined functions
1032 public void loadTicket (string tid) {
1034 _this.el.get_size(out w, out h);
1037 _this.scrolled_window.el.hide();
1038 _this.el.resize(w, 150);
1040 _this.scrolled_window.el.show();
1041 _this.el.resize(w, 800);
1044 var rs = RooTicket.singleton();
1045 var uri = new WebKit.URIRequest("https://roojs.com/admin.php/MTrack/View/" + tid);
1046 var hd = uri.get_http_headers();
1047 var authCode = Base64.encode ("%s:%s".printf(rs.username, rs.password).data);
1048 hd.append("Authorization", "Basic %s".printf(authCode));
1050 this.el.load_request(uri);
1056 public class Xcls_Box25 : Object
1059 private NewBranch _this;
1065 public Xcls_Box25(NewBranch _owner )
1068 this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
1072 // set gobject values
1073 this.el.homogeneous = false;
1074 var child_0 = new Xcls_table( _this );
1076 this.el.pack_start ( child_0.el , false,false,0 );
1079 // user defined functions
1081 public class Xcls_table : Object
1083 public Gtk.Table el;
1084 private NewBranch _this;
1090 public Xcls_table(NewBranch _owner )
1094 this.el = new Gtk.Table( 14, 4, true );
1098 // set gobject values
1099 this.el.expand = false;
1101 this.el.column_spacing = 4;
1102 this.el.vexpand = false;
1103 var child_0 = new Xcls_Label27( _this );
1105 this.el.attach_defaults ( child_0.el , 0,1,0,1 );
1106 var child_1 = new Xcls_Label28( _this );
1108 this.el.attach_defaults ( child_1.el , 1,2,0,1 );
1109 var child_2 = new Xcls_project_id( _this );
1111 this.el.attach_defaults ( child_2.el , 0,1,1,2 );
1112 var child_3 = new Xcls_summary( _this );
1114 this.el.attach_defaults ( child_3.el , 1,4,1,2 );
1115 var child_4 = new Xcls_Label33( _this );
1117 this.el.attach_defaults ( child_4.el , 0,1,2,3 );
1118 var child_5 = new Xcls_milestone_id( _this );
1120 this.el.attach_defaults ( child_5.el , 0,1,3,4 );
1121 var child_6 = new Xcls_Label36( _this );
1123 this.el.attach_defaults ( child_6.el , 1,4,2,3 );
1124 var child_7 = new Xcls_description( _this );
1126 this.el.attach_defaults ( child_7.el , 1,4,3,12 );
1127 var child_8 = new Xcls_Label38( _this );
1129 this.el.attach_defaults ( child_8.el , 0,1,4,5 );
1130 var child_9 = new Xcls_priority_id( _this );
1132 this.el.attach_defaults ( child_9.el , 0,1,5,6 );
1133 var child_10 = new Xcls_Label41( _this );
1135 this.el.attach_defaults ( child_10.el , 0,1,6,7 );
1136 var child_11 = new Xcls_severity_id( _this );
1138 this.el.attach_defaults ( child_11.el , 0,1,7,8 );
1139 var child_12 = new Xcls_Label44( _this );
1141 this.el.attach_defaults ( child_12.el , 0,1,8,9 );
1142 var child_13 = new Xcls_classification_id( _this );
1144 this.el.attach_defaults ( child_13.el , 0,1,9,10 );
1145 var child_14 = new Xcls_Label47( _this );
1147 this.el.attach_defaults ( child_14.el , 0,1,10,11 );
1148 var child_15 = new Xcls_developer_id( _this );
1150 this.el.attach_defaults ( child_15.el , 0,1,11,12 );
1151 var child_16 = new Xcls_Button50( _this );
1153 this.el.attach_defaults ( child_16.el , 0,4,13,14 );
1156 // user defined functions
1158 public class Xcls_Label27 : Object
1160 public Gtk.Label el;
1161 private NewBranch _this;
1167 public Xcls_Label27(NewBranch _owner )
1170 this.el = new Gtk.Label( "Project" );
1174 // set gobject values
1175 this.el.halign = Gtk.Align.START;
1176 this.el.visible = true;
1179 // user defined functions
1182 public class Xcls_Label28 : Object
1184 public Gtk.Label el;
1185 private NewBranch _this;
1191 public Xcls_Label28(NewBranch _owner )
1194 this.el = new Gtk.Label( "Summary" );
1198 // set gobject values
1199 this.el.halign = Gtk.Align.START;
1200 this.el.visible = true;
1203 // user defined functions
1206 public class Xcls_project_id : Object
1208 public Gtk.ComboBox el;
1209 private NewBranch _this;
1213 public bool loading;
1216 public Xcls_project_id(NewBranch _owner )
1219 _this.project_id = this;
1220 this.el = new Gtk.ComboBox.with_entry();
1223 this.loading = false;
1225 // set gobject values
1226 var child_0 = new Xcls_prcellrenderer( _this );
1228 this.el.pack_start ( child_0.el , true );
1229 var child_1 = new Xcls_prmodel( _this );
1231 this.el.set_model ( child_1.el );
1235 this.el.set_entry_text_column(1);
1238 this.el.changed.connect( () => {
1242 var project_id = this.selectedProjectId();
1244 var rt = RooTicket.singleton();
1245 rt.loadProjectOptions(project_id);
1247 _this.msmodel.loadMilestones();
1248 _this.primodel.loadPriorities();
1249 _this.sevmodel.loadSeverities();
1250 _this.clmodel.loadClassifications();
1251 _this.devmodel.loadDevelopers();
1253 // affects projects and milestones..
1256 /*if (this.loading) {
1259 var ticket_id = this.selectedTicketId();
1261 var name = RooTicket.singleton().usernameLocal();
1263 if (ticket_id == "" || ticket_id == null) {
1265 var dt = new DateTime.now_local();
1266 _this.name.el.set_text("wip_%s_%s".printf(name,dt.format("%Y_%b_%d")));
1271 var ticket = RooTicket.singleton().getById(ticket_id);
1273 _this.name.el.set_text("wip_%s_T%s_%s".printf(name,ticket.id, ticket.summaryToBranchName()));
1275 //GLib.debug (//"Selection: %s, %s\n", (string) val1, (string) val2);
1280 // user defined functions
1281 public string selectedProjectId () {
1286 this.el.get_active_iter (out iter);
1287 _this.prmodel.el.get_value (iter, 0, out val1);
1290 return (string) val1;
1297 public class Xcls_prcellrenderer : Object
1299 public Gtk.CellRendererText el;
1300 private NewBranch _this;
1306 public Xcls_prcellrenderer(NewBranch _owner )
1309 _this.prcellrenderer = this;
1310 this.el = new Gtk.CellRendererText();
1314 // set gobject values
1317 // user defined functions
1320 public class Xcls_prmodel : Object
1322 public Gtk.ListStore el;
1323 private NewBranch _this;
1329 public Xcls_prmodel(NewBranch _owner )
1332 _this.prmodel = this;
1333 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
1337 // set gobject values
1340 // user defined functions
1341 public void loadProjects (string id) {
1344 _this.project_id.loading = true;
1350 el.append(out iter);
1353 el.set_value(iter, 0, "");
1354 el.set_value(iter, 1, "-- select a project --");
1356 _this.project_id.el.set_active_iter(iter);
1359 foreach(var project in RooProject.projects()) {
1361 el.append(out iter);
1363 el.set_value(iter, 0, project.id);
1364 el.set_value(iter, 1, project.name );
1365 if (id == project.id) {
1366 _this.project_id.el.set_active_iter(iter);
1371 _this.project_id.loading = false;
1372 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
1378 public class Xcls_summary : Object
1380 public Gtk.Entry el;
1381 private NewBranch _this;
1387 public Xcls_summary(NewBranch _owner )
1390 _this.summary = this;
1391 this.el = new Gtk.Entry();
1395 // set gobject values
1396 this.el.visible = true;
1399 // user defined functions
1402 public class Xcls_Label33 : Object
1404 public Gtk.Label el;
1405 private NewBranch _this;
1411 public Xcls_Label33(NewBranch _owner )
1414 this.el = new Gtk.Label( "Milestone" );
1418 // set gobject values
1419 this.el.halign = Gtk.Align.START;
1420 this.el.justify = Gtk.Justification.RIGHT;
1421 this.el.xalign = 0.900000f;
1424 // user defined functions
1427 public class Xcls_milestone_id : Object
1429 public Gtk.ComboBox el;
1430 private NewBranch _this;
1434 public bool loading;
1437 public Xcls_milestone_id(NewBranch _owner )
1440 _this.milestone_id = this;
1441 this.el = new Gtk.ComboBox.with_entry();
1444 this.loading = false;
1446 // set gobject values
1447 var child_0 = new Xcls_msmodel( _this );
1449 this.el.set_model ( child_0.el );
1453 this.el.set_entry_text_column(1);
1456 // user defined functions
1457 public string selectedMilestoneId () {
1462 this.el.get_active_iter (out iter);
1463 _this.msmodel.el.get_value (iter, 0, out val1);
1466 return (string) val1;
1473 public class Xcls_msmodel : Object
1475 public Gtk.ListStore el;
1476 private NewBranch _this;
1482 public Xcls_msmodel(NewBranch _owner )
1485 _this.msmodel = this;
1486 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
1490 // set gobject values
1493 // user defined functions
1494 public void loadMilestones ( ) {
1496 var rt = RooTicket.singleton();
1497 // rt.loadProjects();
1499 _this.milestone_id.loading = true;
1505 el.append(out iter);
1508 el.set_value(iter, 0, "");
1509 el.set_value(iter, 1, "-- select a milestone --");
1510 _this.milestone_id.el.set_active_iter(iter);
1512 var projects = rt.milestones;
1513 foreach(var project in projects) {
1515 el.append(out iter);
1517 el.set_value(iter, 0, project.id);
1518 el.set_value(iter, 1, project.display_name );
1519 // if (id == project.id) {
1520 // _this.milestone.el.set_active_iter(iter);
1526 _this.milestone_id.loading = false;
1527 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
1533 public class Xcls_Label36 : Object
1535 public Gtk.Label el;
1536 private NewBranch _this;
1542 public Xcls_Label36(NewBranch _owner )
1545 this.el = new Gtk.Label( "Description" );
1549 // set gobject values
1550 this.el.halign = Gtk.Align.START;
1553 // user defined functions
1556 public class Xcls_description : Object
1558 public Gtk.TextView el;
1559 private NewBranch _this;
1565 public Xcls_description(NewBranch _owner )
1568 _this.description = this;
1569 this.el = new Gtk.TextView();
1573 // set gobject values
1574 this.el.border_width = 1;
1577 // user defined functions
1580 public class Xcls_Label38 : Object
1582 public Gtk.Label el;
1583 private NewBranch _this;
1589 public Xcls_Label38(NewBranch _owner )
1592 this.el = new Gtk.Label( "Priority" );
1596 // set gobject values
1597 this.el.halign = Gtk.Align.START;
1598 this.el.xalign = 0.900000f;
1601 // user defined functions
1604 public class Xcls_priority_id : Object
1606 public Gtk.ComboBox el;
1607 private NewBranch _this;
1611 public bool loading;
1614 public Xcls_priority_id(NewBranch _owner )
1617 _this.priority_id = this;
1618 this.el = new Gtk.ComboBox.with_entry();
1621 this.loading = false;
1623 // set gobject values
1624 var child_0 = new Xcls_primodel( _this );
1626 this.el.set_model ( child_0.el );
1630 this.el.set_entry_text_column(1);
1633 // user defined functions
1634 public string selectedPriorityId () {
1639 this.el.get_active_iter (out iter);
1640 _this.primodel.el.get_value (iter, 0, out val1);
1643 return (string) val1;
1650 public class Xcls_primodel : Object
1652 public Gtk.ListStore el;
1653 private NewBranch _this;
1659 public Xcls_primodel(NewBranch _owner )
1662 _this.primodel = this;
1663 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
1667 // set gobject values
1670 // user defined functions
1671 public void loadPriorities ( ) {
1673 var rt = RooTicket.singleton();
1674 // rt.loadProjects();
1676 _this.priority_id.loading = true;
1683 var projects = rt.priorities;
1684 foreach(var project in projects) {
1686 el.append(out iter);
1688 el.set_value(iter, 0, project.id);
1689 el.set_value(iter, 1, project.display_name );
1690 if ("normal" == project.name) {
1691 _this.priority_id.el.set_active_iter(iter);
1696 _this.priority_id.loading = false;
1703 public class Xcls_Label41 : Object
1705 public Gtk.Label el;
1706 private NewBranch _this;
1712 public Xcls_Label41(NewBranch _owner )
1715 this.el = new Gtk.Label( "Severity" );
1719 // set gobject values
1720 this.el.halign = Gtk.Align.START;
1723 // user defined functions
1726 public class Xcls_severity_id : Object
1728 public Gtk.ComboBox el;
1729 private NewBranch _this;
1733 public bool loading;
1736 public Xcls_severity_id(NewBranch _owner )
1739 _this.severity_id = this;
1740 this.el = new Gtk.ComboBox.with_entry();
1743 this.loading = false;
1745 // set gobject values
1746 var child_0 = new Xcls_sevmodel( _this );
1748 this.el.set_model ( child_0.el );
1752 this.el.set_entry_text_column(1);
1755 // user defined functions
1756 public string selectedSeverityId () {
1761 this.el.get_active_iter (out iter);
1762 _this.sevmodel.el.get_value (iter, 0, out val1);
1765 return (string) val1;
1772 public class Xcls_sevmodel : Object
1774 public Gtk.ListStore el;
1775 private NewBranch _this;
1781 public Xcls_sevmodel(NewBranch _owner )
1784 _this.sevmodel = this;
1785 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
1789 // set gobject values
1792 // user defined functions
1793 public void loadSeverities () {
1795 var rt = RooTicket.singleton();
1796 //rt.loadProjects();
1798 _this.severity_id.loading = true;
1804 var projects = rt.serverities;
1805 foreach(var project in projects) {
1807 el.append(out iter);
1809 el.set_value(iter, 0, project.id);
1810 el.set_value(iter, 1, project.display_name );
1811 if ("normal" == project.name) {
1812 _this.severity_id.el.set_active_iter(iter);
1817 _this.severity_id.loading = false;
1818 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
1824 public class Xcls_Label44 : Object
1826 public Gtk.Label el;
1827 private NewBranch _this;
1833 public Xcls_Label44(NewBranch _owner )
1836 this.el = new Gtk.Label( "Classification" );
1840 // set gobject values
1841 this.el.halign = Gtk.Align.START;
1844 // user defined functions
1847 public class Xcls_classification_id : Object
1849 public Gtk.ComboBox el;
1850 private NewBranch _this;
1854 public bool loading;
1857 public Xcls_classification_id(NewBranch _owner )
1860 _this.classification_id = this;
1861 this.el = new Gtk.ComboBox.with_entry();
1864 this.loading = false;
1866 // set gobject values
1867 var child_0 = new Xcls_clmodel( _this );
1869 this.el.set_model ( child_0.el );
1873 this.el.set_entry_text_column(1);
1876 // user defined functions
1877 public string selectedClassificationId () {
1882 this.el.get_active_iter (out iter);
1883 _this.clmodel.el.get_value (iter, 0, out val1);
1886 return (string) val1;
1893 public class Xcls_clmodel : Object
1895 public Gtk.ListStore el;
1896 private NewBranch _this;
1902 public Xcls_clmodel(NewBranch _owner )
1905 _this.clmodel = this;
1906 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
1910 // set gobject values
1913 // user defined functions
1914 public void loadClassifications ( ) {
1916 var rt = RooTicket.singleton();
1917 // rt.loadProjects();
1919 _this.classification_id.loading = true;
1925 el.append(out iter);
1928 var projects = rt.classifications;
1929 foreach(var project in projects) {
1931 el.append(out iter);
1933 el.set_value(iter, 0, project.id);
1934 el.set_value(iter, 1, project.display_name );
1935 if ("bug" == project.name) {
1936 _this.classification_id.el.set_active_iter(iter);
1941 _this.classification_id.loading = false;
1942 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
1948 public class Xcls_Label47 : Object
1950 public Gtk.Label el;
1951 private NewBranch _this;
1957 public Xcls_Label47(NewBranch _owner )
1960 this.el = new Gtk.Label( "Assign to" );
1964 // set gobject values
1965 this.el.halign = Gtk.Align.START;
1968 // user defined functions
1971 public class Xcls_developer_id : Object
1973 public Gtk.ComboBox el;
1974 private NewBranch _this;
1978 public bool loading;
1981 public Xcls_developer_id(NewBranch _owner )
1984 _this.developer_id = this;
1985 this.el = new Gtk.ComboBox.with_entry();
1988 this.loading = false;
1990 // set gobject values
1991 var child_0 = new Xcls_devmodel( _this );
1993 this.el.set_model ( child_0.el );
1997 this.el.set_entry_text_column(1);
2000 // user defined functions
2001 public string selectedDeveloperId () {
2006 this.el.get_active_iter (out iter);
2007 _this.devmodel.el.get_value (iter, 0, out val1);
2010 return (string) val1;
2017 public class Xcls_devmodel : Object
2019 public Gtk.ListStore el;
2020 private NewBranch _this;
2026 public Xcls_devmodel(NewBranch _owner )
2029 _this.devmodel = this;
2030 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
2034 // set gobject values
2037 // user defined functions
2038 public void loadDevelopers ( ) {
2040 var rt = RooTicket.singleton();
2041 //rt.loadProjects();
2043 _this.developer_id.loading = true;
2049 el.append(out iter);
2052 el.set_value(iter, 0, "");
2053 el.set_value(iter, 1, "-- select a developer --");
2055 _this.developer_id.el.set_active_iter(iter);
2058 var peps = rt.developers;
2059 foreach(var p in peps) {
2061 el.append(out iter);
2063 el.set_value(iter, 0, p.id);
2064 el.set_value(iter, 1, p.display_name );
2065 if (rt.authuser_id == p.id) {
2066 _this.developer_id.el.set_active_iter(iter);
2070 _this.developer_id.loading = false;
2071 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
2077 public class Xcls_Button50 : Object
2079 public Gtk.Button el;
2080 private NewBranch _this;
2086 public Xcls_Button50(NewBranch _owner )
2089 this.el = new Gtk.Button();
2093 // set gobject values
2094 this.el.label = "Create Ticket & Branch";
2099 this.el.get_style_context().add_class("suggested-action");
2103 this.el.clicked.connect( () => {
2104 GLib.debug("fire response = 1");
2107 var invalid = false;
2109 // validate first...
2110 _this.project_id.el.get_child().get_style_context().remove_class("warning");
2111 if (_this.project_id.selectedProjectId() == "") {
2112 _this.project_id.el.get_child().get_style_context().add_class("warning");
2116 _this.milestone_id.el.get_child().get_style_context().remove_class("warning");
2118 _this.priority_id.el.get_child().get_style_context().remove_class("warning");
2119 if (_this.priority_id.selectedPriorityId() == "") {
2120 _this.priority_id.el.get_child().get_style_context().add_class("warning");
2124 _this.classification_id.el.get_child().get_style_context().remove_class("warning");
2125 if (_this.classification_id.selectedClassificationId() == "") {
2126 _this.classification_id.el.get_child().get_style_context().add_class("warning");
2130 _this.developer_id.el.get_child().get_style_context().remove_class("warning");
2131 if (_this.developer_id.selectedDeveloperId() == "") {
2132 _this.developer_id.el.get_child().get_style_context().add_class("warning");
2136 _this.summary.el.get_style_context().remove_class("warning");
2137 if (_this.summary.el.get_text() == "") {
2138 _this.summary.el.get_style_context().add_class("warning");
2142 _this.description.el.get_style_context().remove_class("warning");
2147 GLib.debug("for is valid");
2149 _this.el.response(1);
2153 // user defined functions
2158 public class Xcls_Box51 : Object
2161 private NewBranch _this;
2167 public Xcls_Box51(NewBranch _owner )
2170 this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
2174 // set gobject values
2175 this.el.homogeneous = false;
2176 var child_0 = new Xcls_Table52( _this );
2178 this.el.pack_start ( child_0.el , false,false,0 );
2179 var child_1 = new Xcls_ScrolledWindow56( _this );
2181 this.el.pack_start ( child_1.el , true,true,0 );
2184 // user defined functions
2186 public class Xcls_Table52 : Object
2188 public Gtk.Table el;
2189 private NewBranch _this;
2195 public Xcls_Table52(NewBranch _owner )
2198 this.el = new Gtk.Table( 5, 5, true );
2202 // set gobject values
2203 this.el.expand = false;
2205 this.el.column_spacing = 4;
2206 this.el.vexpand = false;
2207 var child_0 = new Xcls_Label53( _this );
2209 this.el.attach_defaults ( child_0.el , 0,1,0,1 );
2210 var child_1 = new Xcls_commit_message( _this );
2212 this.el.attach_defaults ( child_1.el , 0,4,1,2 );
2213 var child_2 = new Xcls_createbtn( _this );
2215 this.el.attach_defaults ( child_2.el , 4,5,1,2 );
2218 // user defined functions
2220 public class Xcls_Label53 : Object
2222 public Gtk.Label el;
2223 private NewBranch _this;
2229 public Xcls_Label53(NewBranch _owner )
2232 this.el = new Gtk.Label( "Commit Message" );
2236 // set gobject values
2237 this.el.halign = Gtk.Align.START;
2238 this.el.justify = Gtk.Justification.RIGHT;
2239 this.el.xalign = 0.900000f;
2242 // user defined functions
2245 public class Xcls_commit_message : Object
2247 public Gtk.Entry el;
2248 private NewBranch _this;
2254 public Xcls_commit_message(NewBranch _owner )
2257 _this.commit_message = this;
2258 this.el = new Gtk.Entry();
2262 // set gobject values
2263 this.el.visible = true;
2266 // user defined functions
2269 public class Xcls_createbtn : Object
2271 public Gtk.Button el;
2272 private NewBranch _this;
2278 public Xcls_createbtn(NewBranch _owner )
2281 _this.createbtn = this;
2282 this.el = new Gtk.Button();
2286 // set gobject values
2287 this.el.label = "Commit Changes";
2292 this.el.get_style_context().add_class("suggested-action");
2296 this.el.clicked.connect( () => {
2298 GLib.debug("fire response = 1");
2300 var ticket_id = _this.ticketsel.selectedTicketId();
2302 if (ticket_id == "") {
2303 _this.ticketsel.el.get_child().get_style_context().add_class("warning");
2307 _this.el.response(1);
2311 // user defined functions
2312 public void updateState () {
2314 var ticket_id = _this.ticketsel.selectedTicketId();
2316 if (ticket_id == "") {
2317 this.el.set_sensitive(false);
2321 this.el.set_sensitive(true);
2327 public class Xcls_ScrolledWindow56 : Object
2329 public Gtk.ScrolledWindow el;
2330 private NewBranch _this;
2336 public Xcls_ScrolledWindow56(NewBranch _owner )
2339 this.el = new Gtk.ScrolledWindow( null, null );
2343 // set gobject values
2344 this.el.height_request = 400;
2345 var child_0 = new Xcls_diff_view( _this );
2347 this.el.add ( child_0.el );
2350 // user defined functions
2352 public class Xcls_diff_view : Object
2354 public Gtk.SourceView el;
2355 private NewBranch _this;
2361 public Xcls_diff_view(NewBranch _owner )
2364 _this.diff_view = this;
2365 this.el = new Gtk.SourceView();
2371 var description = Pango.FontDescription.from_string("monospace");
2372 description.set_size(9000);
2373 this.el.override_font(description);
2374 var lm = Gtk.SourceLanguageManager.get_default();
2376 ((Gtk.SourceBuffer)(this.el.get_buffer())).set_language(
2377 lm.get_language("diff")
2381 // user defined functions