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_notebook notebook;
16 public Xcls_label_select_ticket label_select_ticket;
17 public Xcls_label_create_ticket label_create_ticket;
18 public Xcls_label_quick_commit label_quick_commit;
19 public Xcls_select_ticket_tab select_ticket_tab;
20 public Xcls_projectsel projectsel;
21 public Xcls_prcellrenderer prcellrenderer;
22 public Xcls_prmodel prmodel;
23 public Xcls_ticketsel ticketsel;
24 public Xcls_dbcellrenderer dbcellrenderer;
25 public Xcls_dbmodel dbmodel;
26 public Xcls_name name;
27 public Xcls_branchbtn branchbtn;
28 public Xcls_btn_not_me btn_not_me;
29 public Xcls_btn_closed btn_closed;
30 public Xcls_scrolled_window scrolled_window;
31 public Xcls_view view;
32 public Xcls_create_ticket_tab create_ticket_tab;
33 public Xcls_table table;
34 public Xcls_project_id project_id;
35 public Xcls_tprcellrenderer tprcellrenderer;
36 public Xcls_tprmodel tprmodel;
37 public Xcls_summary summary;
38 public Xcls_milestone_id milestone_id;
39 public Xcls_msmodel msmodel;
40 public Xcls_description description;
41 public Xcls_priority_id priority_id;
42 public Xcls_primodel primodel;
43 public Xcls_severity_id severity_id;
44 public Xcls_sevmodel sevmodel;
45 public Xcls_classification_id classification_id;
46 public Xcls_clmodel clmodel;
47 public Xcls_developer_id developer_id;
48 public Xcls_devmodel devmodel;
49 public Xcls_spinner spinner;
50 public Xcls_quick_commit_tab quick_commit_tab;
51 public Xcls_commit_message commit_message;
52 public Xcls_createbtn createbtn;
53 public Xcls_diff_view diff_view;
58 public Gee.ArrayList<GitMonitorQueue> queue;
64 this.el = new Gtk.Dialog();
72 this.el.title = "Create a working branch ";
73 this.el.default_height = 500;
74 this.el.default_width = 500;
75 this.el.deletable = true;
77 var child_0 = new Xcls_notebook( _this );
79 this.el.get_content_area().add ( child_0.el );
82 this.el.delete_event.connect( (self, event) => {
87 this.el.response.connect( (self, response_id) => {
89 GLib.debug("got %d", (int) response_id);
94 // have they selected a ticket..
95 // make that the current active ticket?
96 // we really need to store locally what ticket is being worked on..
97 // in theory we could be working on multiple project and not merging..
98 // -- each repo would have their active ticket (only one per repo)
99 // -- so we could just store that in there
100 // -- initial load can check the contents of the ticket files on first scan.
103 if (response_id < 1) {
105 this.running = false;
109 switch(response_id) {
113 var ticket_id = _this.ticketsel.selectedTicketId();
115 if (this.repo != null) {
116 var bn = _this.name.el.get_text();
118 var res = this.repo.setActiveTicket(
119 RooTicket.singleton().getById(ticket_id != "" ? ticket_id : "-1"), bn
122 // start the monitoring..
123 GitMonitor.gitmonitor.start();
128 case 2: // create ticket + branch
131 case 3: // just commit...
137 this.running = false;
147 // user defined functions
148 public void show ( GitRepo repo, Gee.ArrayList<GitMonitorQueue> queue, string tid = "" )
150 // this.el.set_gravity(Gdk.Gravity.NORTH);
151 if (this.running) { // should not happen!!
152 GLib.error("new branch show called, when already being displayed?");
158 GitMonitor.gitmonitor.stop();
162 this.el.move((Gdk.Screen.width() / 2)- 250 ,0);
163 this.el.set_default_size( 500,200); // not sure why it grows..
171 this.el.set_keep_above(true);
173 _this.notebook.el.set_current_page(0);
175 _this.select_ticket_tab.load_data(tid);
176 //_this.create_ticket_tab.load_data();
177 //_this.quick_commit_tab.load_data();
178 _this.commit_message.el.set_text("");
188 public class Xcls_notebook : Object
190 public Gtk.Notebook el;
191 private NewBranch _this;
197 public Xcls_notebook(NewBranch _owner )
200 _this.notebook = this;
201 this.el = new Gtk.Notebook();
205 // set gobject values
206 this.el.vexpand = true;
207 var child_0 = new Xcls_label_select_ticket( _this );
209 var child_1 = new Xcls_label_create_ticket( _this );
211 var child_2 = new Xcls_label_quick_commit( _this );
213 var child_3 = new Xcls_select_ticket_tab( _this );
215 this.el.append_page ( child_3.el , _this.label_select_ticket.el );
216 var child_4 = new Xcls_create_ticket_tab( _this );
218 this.el.append_page ( child_4.el , _this.label_create_ticket.el );
219 var child_5 = new Xcls_quick_commit_tab( _this );
221 this.el.append_page ( child_5.el , _this.label_quick_commit.el );
224 this.el.switch_page.connect( (page, page_num) => {
225 GLib.debug("Switch to page: %d", (int)page_num);
228 break; // do nothing.. it's already loaded at start.
230 _this.create_ticket_tab.load_data();
233 _this.quick_commit_tab.load_data();
241 // user defined functions
243 public class Xcls_label_select_ticket : Object
246 private NewBranch _this;
252 public Xcls_label_select_ticket(NewBranch _owner )
255 _this.label_select_ticket = this;
256 this.el = new Gtk.Label( "Select Existing Ticket to work on" );
260 // set gobject values
263 // user defined functions
266 public class Xcls_label_create_ticket : Object
269 private NewBranch _this;
275 public Xcls_label_create_ticket(NewBranch _owner )
278 _this.label_create_ticket = this;
279 this.el = new Gtk.Label( "Create a New Ticket" );
283 // set gobject values
286 // user defined functions
289 public class Xcls_label_quick_commit : Object
292 private NewBranch _this;
298 public Xcls_label_quick_commit(NewBranch _owner )
301 _this.label_quick_commit = this;
302 this.el = new Gtk.Label( "Quick Commit" );
306 // set gobject values
309 // user defined functions
312 public class Xcls_select_ticket_tab : Object
315 private NewBranch _this;
321 public Xcls_select_ticket_tab(NewBranch _owner )
324 _this.select_ticket_tab = this;
325 this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
329 // set gobject values
330 this.el.homogeneous = false;
331 var child_0 = new Xcls_Table7( _this );
333 this.el.pack_start ( child_0.el , false,false,0 );
334 var child_1 = new Xcls_scrolled_window( _this );
336 this.el.add ( child_1.el );
339 // user defined functions
340 public void load_data (string tid = "") {
342 GLib.debug("Loading tickets");
344 var curproj = RooProject.getProjectByRepo(_this.repo);
345 _this.prmodel.loadProjects(curproj == null ? "" : curproj.id);
347 _this.dbmodel.loadTickets(curproj == null ? "": curproj.id, tid);
348 _this.branchbtn.updateState();
350 _this.ticketsel.el.get_child().get_style_context().remove_class("warning");
352 var name = RooTicket.singleton().usernameLocal();
353 var ticket = RooTicket.singleton().getById(tid);
354 _this.name.el.set_text("wip_%s_T%s_%s".printf(name,ticket.id, ticket.summaryToBranchName()));
356 _this.ticketsel.el.get_child().get_style_context().add_class("warning");
358 _this.view.loadTicket(tid);
363 public class Xcls_Table7 : Object
366 private NewBranch _this;
372 public Xcls_Table7(NewBranch _owner )
375 this.el = new Gtk.Table( 5, 5, true );
379 // set gobject values
380 this.el.expand = false;
382 this.el.column_spacing = 4;
383 this.el.vexpand = false;
384 var child_0 = new Xcls_Label8( _this );
386 this.el.attach_defaults ( child_0.el , 0,1,0,1 );
387 var child_1 = new Xcls_Label9( _this );
389 this.el.attach_defaults ( child_1.el , 1,2,0,1 );
390 var child_2 = new Xcls_projectsel( _this );
392 this.el.attach_defaults ( child_2.el , 0,1,1,2 );
393 var child_3 = new Xcls_ticketsel( _this );
395 this.el.attach_defaults ( child_3.el , 1,5,1,2 );
396 var child_4 = new Xcls_Label16( _this );
398 this.el.attach_defaults ( child_4.el , 0,1,3,4 );
399 var child_5 = new Xcls_name( _this );
401 this.el.attach_defaults ( child_5.el , 0,4,4,5 );
402 var child_6 = new Xcls_branchbtn( _this );
404 this.el.attach_defaults ( child_6.el , 4,5,4,5 );
405 var child_7 = new Xcls_Box19( _this );
407 this.el.attach_defaults ( child_7.el , 0,5,2,3 );
410 // user defined functions
412 public class Xcls_Label8 : Object
415 private NewBranch _this;
421 public Xcls_Label8(NewBranch _owner )
424 this.el = new Gtk.Label( "Project" );
428 // set gobject values
429 this.el.halign = Gtk.Align.START;
430 this.el.justify = Gtk.Justification.RIGHT;
431 this.el.visible = true;
434 // user defined functions
437 public class Xcls_Label9 : Object
440 private NewBranch _this;
446 public Xcls_Label9(NewBranch _owner )
449 this.el = new Gtk.Label( "Ticket" );
453 // set gobject values
454 this.el.halign = Gtk.Align.START;
455 this.el.visible = true;
458 // user defined functions
461 public class Xcls_projectsel : Object
463 public Gtk.ComboBox el;
464 private NewBranch _this;
471 public Xcls_projectsel(NewBranch _owner )
474 _this.projectsel = this;
475 this.el = new Gtk.ComboBox.with_entry();
478 this.loading = false;
480 // set gobject values
481 var child_0 = new Xcls_prcellrenderer( _this );
483 this.el.pack_start ( child_0.el , true );
484 var child_1 = new Xcls_prmodel( _this );
486 this.el.set_model ( child_1.el );
490 this.el.set_entry_text_column(1);
493 this.el.changed.connect( () => {
497 var project_id = this.selectedProjectId();
498 _this.dbmodel.loadTickets(project_id);
501 /*if (this.loading) {
504 var ticket_id = this.selectedTicketId();
506 var name = RooTicket.singleton().usernameLocal();
508 if (ticket_id == "" || ticket_id == null) {
510 var dt = new DateTime.now_local();
511 _this.name.el.set_text("wip_%s_%s".printf(name,dt.format("%Y_%b_%d")));
516 var ticket = RooTicket.singleton().getById(ticket_id);
518 _this.name.el.set_text("wip_%s_T%s_%s".printf(name,ticket.id, ticket.summaryToBranchName()));
520 //GLib.debug (//"Selection: %s, %s\n", (string) val1, (string) val2);
525 // user defined functions
526 public string selectedProjectId () {
531 this.el.get_active_iter (out iter);
532 _this.prmodel.el.get_value (iter, 0, out val1);
535 return (string) val1;
542 public class Xcls_prcellrenderer : Object
544 public Gtk.CellRendererText el;
545 private NewBranch _this;
551 public Xcls_prcellrenderer(NewBranch _owner )
554 _this.prcellrenderer = this;
555 this.el = new Gtk.CellRendererText();
559 // set gobject values
562 // user defined functions
565 public class Xcls_prmodel : Object
567 public Gtk.ListStore el;
568 private NewBranch _this;
574 public Xcls_prmodel(NewBranch _owner )
577 _this.prmodel = this;
578 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
582 // set gobject values
585 // user defined functions
586 public void loadProjects (string id) {
590 _this.projectsel.loading = true;
599 el.set_value(iter, 0, "");
600 el.set_value(iter, 1, "-- select a project --");
602 _this.projectsel.el.set_active_iter(iter);
605 foreach(var project in RooProject.projects()) {
609 el.set_value(iter, 0, project.id);
610 el.set_value(iter, 1, project.name );
611 if (id == project.id) {
612 _this.projectsel.el.set_active_iter(iter);
617 _this.projectsel.loading = false;
618 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
624 public class Xcls_ticketsel : Object
626 public Gtk.ComboBox el;
627 private NewBranch _this;
634 public Xcls_ticketsel(NewBranch _owner )
637 _this.ticketsel = this;
638 this.el = new Gtk.ComboBox.with_entry();
641 this.loading = false;
643 // set gobject values
644 var child_0 = new Xcls_dbcellrenderer( _this );
646 this.el.pack_start ( child_0.el , true );
647 var child_1 = new Xcls_dbmodel( _this );
649 this.el.set_model ( child_1.el );
653 //this.el.add_attribute(_this.dbcellrenderer.el , "markup", 1 );
654 this.el.set_entry_text_column(1);
655 this.el.get_child().set_sensitive(false);
658 this.el.changed.connect( () => {
662 var ticket_id = this.selectedTicketId();
664 var name = RooTicket.singleton().usernameLocal();
666 this.el.get_child().get_style_context().remove_class("warning");
667 if (ticket_id == "" || ticket_id == null) {
669 var dt = new DateTime.now_local();
670 _this.name.el.set_text("wip_%s_%s".printf(name,dt.format("%Y_%b_%d")));
671 _this.view.loadTicket("");
673 this.el.get_child().get_style_context().add_class("warning");
674 _this.createbtn.updateState();
679 var ticket = RooTicket.singleton().getById(ticket_id);
681 _this.name.el.set_text("wip_%s_T%s_%s".printf(name,ticket.id, ticket.summaryToBranchName()));
682 _this.scrolled_window.el.show();
684 _this.view.loadTicket(ticket.id);
685 _this.branchbtn.updateState();
687 //GLib.debug (//"Selection: %s, %s\n", (string) val1, (string) val2);
691 // user defined functions
692 public string selectedTicketId () {
697 this.el.get_active_iter (out iter);
698 _this.dbmodel.el.get_value (iter, 0, out val1);
701 return (string) val1;
708 public class Xcls_dbcellrenderer : Object
710 public Gtk.CellRendererText el;
711 private NewBranch _this;
717 public Xcls_dbcellrenderer(NewBranch _owner )
720 _this.dbcellrenderer = this;
721 this.el = new Gtk.CellRendererText();
725 // set gobject values
728 // user defined functions
731 public class Xcls_dbmodel : Object
733 public Gtk.ListStore el;
734 private NewBranch _this;
740 public Xcls_dbmodel(NewBranch _owner )
743 _this.dbmodel = this;
744 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
748 // set gobject values
751 // user defined functions
752 public void loadTickets (string project_id , string tid = "") {
756 // fixme .. get project id from selection..
758 RooTicket.singleton().loadTickets(
760 _this.btn_not_me.el.active ? RooTicket.Who.ANYBODY : RooTicket.Who.ME,
761 _this.btn_closed.el.active ? RooTicket.Status.ALL : RooTicket.Status.ACTIVE
764 _this.ticketsel.loading = true;
773 el.set_value(iter, 0, "");
774 el.set_value(iter, 1, "-- select a ticket --");
776 _this.ticketsel.el.set_active_iter(iter);
777 var tickets = RooTicket.singleton().tickets;
778 foreach(var ticket in tickets) {
782 el.set_value(iter, 0, ticket.id);
783 el.set_value(iter, 1, "#%s %s".printf( ticket.id, ticket.summary));
785 if (ticket.id == tid) {
786 _this.ticketsel.el.set_active_iter(iter);
791 _this.ticketsel.loading = false;
792 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
798 public class Xcls_Label16 : Object
801 private NewBranch _this;
807 public Xcls_Label16(NewBranch _owner )
810 this.el = new Gtk.Label( "Use this as branch name" );
814 // set gobject values
815 this.el.halign = Gtk.Align.START;
816 this.el.justify = Gtk.Justification.RIGHT;
817 this.el.xalign = 0.900000f;
820 // user defined functions
823 public class Xcls_name : Object
826 private NewBranch _this;
832 public Xcls_name(NewBranch _owner )
836 this.el = new Gtk.Entry();
840 // set gobject values
841 this.el.visible = true;
844 // user defined functions
847 public class Xcls_branchbtn : Object
849 public Gtk.Button el;
850 private NewBranch _this;
856 public Xcls_branchbtn(NewBranch _owner )
859 _this.branchbtn = this;
860 this.el = new Gtk.Button();
864 // set gobject values
865 this.el.label = "Create Branch";
870 this.el.get_style_context().add_class("suggested-action");
874 this.el.clicked.connect( () => {
876 GLib.debug("fire response = 1");
878 var ticket_id = _this.ticketsel.selectedTicketId();
880 if (ticket_id == "") {
881 _this.ticketsel.el.get_child().get_style_context().add_class("warning");
885 _this.el.response(1);
889 // user defined functions
890 public void updateState () {
892 var ticket_id = _this.ticketsel.selectedTicketId();
894 if (ticket_id == "") {
895 this.el.set_sensitive(false);
899 this.el.set_sensitive(true);
904 public class Xcls_Box19 : Object
907 private NewBranch _this;
913 public Xcls_Box19(NewBranch _owner )
916 this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
920 // set gobject values
921 var child_0 = new Xcls_btn_not_me( _this );
923 this.el.add ( child_0.el );
924 var child_1 = new Xcls_btn_closed( _this );
926 this.el.add ( child_1.el );
927 var child_2 = new Xcls_Label22( _this );
929 this.el.add ( child_2.el );
932 // user defined functions
934 public class Xcls_btn_not_me : Object
936 public Gtk.CheckButton el;
937 private NewBranch _this;
943 public Xcls_btn_not_me(NewBranch _owner )
946 _this.btn_not_me = this;
947 this.el = new Gtk.CheckButton();
951 // set gobject values
952 this.el.label = "Show tickets not assigned to me";
955 this.el.toggled.connect( () => {
956 var project_id = _this.projectsel.selectedProjectId();
957 _this.dbmodel.loadTickets(project_id);
961 // user defined functions
964 public class Xcls_btn_closed : Object
966 public Gtk.CheckButton el;
967 private NewBranch _this;
973 public Xcls_btn_closed(NewBranch _owner )
976 _this.btn_closed = this;
977 this.el = new Gtk.CheckButton();
981 // set gobject values
982 this.el.label = "Show closed Tickets";
985 this.el.toggled.connect( () => {
986 var project_id = _this.projectsel.selectedProjectId();
987 _this.dbmodel.loadTickets(project_id);
992 // user defined functions
995 public class Xcls_Label22 : Object
998 private NewBranch _this;
1004 public Xcls_Label22(NewBranch _owner )
1007 this.el = new Gtk.Label( "<a href=\"refresh\">Refresh Ticket list</a>" );
1011 // set gobject values
1012 this.el.halign = Gtk.Align.END;
1013 this.el.hexpand = true;
1014 this.el.use_markup = true;
1017 this.el.activate_link.connect( (uri) => {
1018 if (uri == "refresh") {
1019 RooProject.reload();
1020 var curproj = RooProject.getProjectByRepo(_this.repo);
1021 _this.prmodel.loadProjects(curproj == null ? "": curproj.id);
1023 _this.dbmodel.loadTickets(curproj == null ? "": curproj.id);
1029 // user defined functions
1034 public class Xcls_scrolled_window : Object
1036 public Gtk.ScrolledWindow el;
1037 private NewBranch _this;
1043 public Xcls_scrolled_window(NewBranch _owner )
1046 _this.scrolled_window = this;
1047 this.el = new Gtk.ScrolledWindow( null, null );
1051 // set gobject values
1052 this.el.height_request = 500;
1053 this.el.vexpand = true;
1054 var child_0 = new Xcls_view( _this );
1056 this.el.add ( child_0.el );
1061 this.el.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);
1065 // user defined functions
1067 public class Xcls_view : Object
1069 public WebKit.WebView el;
1070 private NewBranch _this;
1076 public Xcls_view(NewBranch _owner )
1080 this.el = new WebKit.WebView();
1084 // set gobject values
1087 // user defined functions
1088 public void loadTicket (string tid) {
1090 _this.el.get_size(out w, out h);
1093 _this.scrolled_window.el.hide();
1094 _this.el.resize(w, 150);
1096 _this.scrolled_window.el.show();
1097 _this.el.resize(w, 800);
1100 var rs = RooTicket.singleton();
1101 var uri = new WebKit.URIRequest("https://roojs.com/admin.php/MTrack/View/" + tid);
1102 var hd = uri.get_http_headers();
1103 var authCode = Base64.encode ("%s:%s".printf(rs.username, rs.password).data);
1104 hd.append("Authorization", "Basic %s".printf(authCode));
1106 this.el.load_request(uri);
1112 public class Xcls_create_ticket_tab : Object
1115 private NewBranch _this;
1121 public Xcls_create_ticket_tab(NewBranch _owner )
1124 _this.create_ticket_tab = this;
1125 this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
1129 // set gobject values
1130 this.el.homogeneous = false;
1131 var child_0 = new Xcls_table( _this );
1133 this.el.pack_start ( child_0.el , false,false,0 );
1134 var child_1 = new Xcls_spinner( _this );
1136 this.el.add ( child_1.el );
1139 // user defined functions
1140 public void load_data () {
1142 _this.table.el.hide();
1143 _this.spinner.el.show();
1144 _this.spinner.el.start();
1146 Timeout.add_seconds(1, () => {
1148 RooProject? curproj = null;
1149 if (_this.repo != null) {
1150 curproj = RooProject.getProjectByRepo(_this.repo);
1152 _this.tprmodel.loadProjects(curproj == null ? "" : curproj.id);
1153 if (curproj != null) {
1156 var rt = RooTicket.singleton();
1157 rt.loadProjectOptions(curproj.id);
1159 _this.msmodel.loadMilestones();
1160 _this.primodel.loadPriorities();
1161 _this.sevmodel.loadSeverities();
1162 _this.clmodel.loadClassifications();
1163 _this.devmodel.loadDevelopers();
1166 _this.summary.el.set_text("");
1167 _this.description.el.buffer.text = "";
1168 _this.spinner.el.stop();
1169 _this.spinner.el.hide();
1171 _this.table.el.show();
1172 //_this.summary.el.grab_focus();
1178 public class Xcls_table : Object
1180 public Gtk.Table el;
1181 private NewBranch _this;
1187 public Xcls_table(NewBranch _owner )
1191 this.el = new Gtk.Table( 14, 4, true );
1195 // set gobject values
1196 this.el.expand = false;
1198 this.el.column_spacing = 4;
1199 this.el.vexpand = false;
1200 var child_0 = new Xcls_Label27( _this );
1202 this.el.attach_defaults ( child_0.el , 0,1,0,1 );
1203 var child_1 = new Xcls_Label28( _this );
1205 this.el.attach_defaults ( child_1.el , 1,2,0,1 );
1206 var child_2 = new Xcls_project_id( _this );
1208 this.el.attach_defaults ( child_2.el , 0,1,1,2 );
1209 var child_3 = new Xcls_summary( _this );
1211 this.el.attach_defaults ( child_3.el , 1,4,1,2 );
1212 var child_4 = new Xcls_Label33( _this );
1214 this.el.attach_defaults ( child_4.el , 0,1,2,3 );
1215 var child_5 = new Xcls_milestone_id( _this );
1217 this.el.attach_defaults ( child_5.el , 0,1,3,4 );
1218 var child_6 = new Xcls_Label36( _this );
1220 this.el.attach_defaults ( child_6.el , 1,4,2,3 );
1221 var child_7 = new Xcls_description( _this );
1223 this.el.attach_defaults ( child_7.el , 1,4,3,12 );
1224 var child_8 = new Xcls_Label38( _this );
1226 this.el.attach_defaults ( child_8.el , 0,1,4,5 );
1227 var child_9 = new Xcls_priority_id( _this );
1229 this.el.attach_defaults ( child_9.el , 0,1,5,6 );
1230 var child_10 = new Xcls_Label41( _this );
1232 this.el.attach_defaults ( child_10.el , 0,1,6,7 );
1233 var child_11 = new Xcls_severity_id( _this );
1235 this.el.attach_defaults ( child_11.el , 0,1,7,8 );
1236 var child_12 = new Xcls_Label44( _this );
1238 this.el.attach_defaults ( child_12.el , 0,1,8,9 );
1239 var child_13 = new Xcls_classification_id( _this );
1241 this.el.attach_defaults ( child_13.el , 0,1,9,10 );
1242 var child_14 = new Xcls_Label47( _this );
1244 this.el.attach_defaults ( child_14.el , 0,1,10,11 );
1245 var child_15 = new Xcls_developer_id( _this );
1247 this.el.attach_defaults ( child_15.el , 0,1,11,12 );
1248 var child_16 = new Xcls_Button50( _this );
1250 this.el.attach_defaults ( child_16.el , 0,4,13,14 );
1253 // user defined functions
1255 public class Xcls_Label27 : Object
1257 public Gtk.Label el;
1258 private NewBranch _this;
1264 public Xcls_Label27(NewBranch _owner )
1267 this.el = new Gtk.Label( "Project" );
1271 // set gobject values
1272 this.el.halign = Gtk.Align.START;
1273 this.el.visible = true;
1276 // user defined functions
1279 public class Xcls_Label28 : Object
1281 public Gtk.Label el;
1282 private NewBranch _this;
1288 public Xcls_Label28(NewBranch _owner )
1291 this.el = new Gtk.Label( "Summary" );
1295 // set gobject values
1296 this.el.halign = Gtk.Align.START;
1297 this.el.visible = true;
1300 // user defined functions
1303 public class Xcls_project_id : Object
1305 public Gtk.ComboBox el;
1306 private NewBranch _this;
1310 public bool loading;
1313 public Xcls_project_id(NewBranch _owner )
1316 _this.project_id = this;
1317 this.el = new Gtk.ComboBox.with_entry();
1320 this.loading = false;
1322 // set gobject values
1323 var child_0 = new Xcls_tprcellrenderer( _this );
1325 this.el.pack_start ( child_0.el , true );
1326 var child_1 = new Xcls_tprmodel( _this );
1328 this.el.set_model ( child_1.el );
1332 this.el.set_entry_text_column(1);
1335 this.el.changed.connect( () => {
1339 var project_id = this.selectedProjectId();
1341 var rt = RooTicket.singleton();
1342 rt.loadProjectOptions(project_id);
1344 _this.msmodel.loadMilestones();
1345 _this.primodel.loadPriorities();
1346 _this.sevmodel.loadSeverities();
1347 _this.clmodel.loadClassifications();
1348 _this.devmodel.loadDevelopers();
1350 // affects projects and milestones..
1353 /*if (this.loading) {
1356 var ticket_id = this.selectedTicketId();
1358 var name = RooTicket.singleton().usernameLocal();
1360 if (ticket_id == "" || ticket_id == null) {
1362 var dt = new DateTime.now_local();
1363 _this.name.el.set_text("wip_%s_%s".printf(name,dt.format("%Y_%b_%d")));
1368 var ticket = RooTicket.singleton().getById(ticket_id);
1370 _this.name.el.set_text("wip_%s_T%s_%s".printf(name,ticket.id, ticket.summaryToBranchName()));
1372 //GLib.debug (//"Selection: %s, %s\n", (string) val1, (string) val2);
1377 // user defined functions
1378 public string selectedProjectId () {
1383 this.el.get_active_iter (out iter);
1384 _this.tprmodel.el.get_value (iter, 0, out val1);
1387 return (string) val1;
1394 public class Xcls_tprcellrenderer : Object
1396 public Gtk.CellRendererText el;
1397 private NewBranch _this;
1403 public Xcls_tprcellrenderer(NewBranch _owner )
1406 _this.tprcellrenderer = this;
1407 this.el = new Gtk.CellRendererText();
1411 // set gobject values
1414 // user defined functions
1417 public class Xcls_tprmodel : Object
1419 public Gtk.ListStore el;
1420 private NewBranch _this;
1426 public Xcls_tprmodel(NewBranch _owner )
1429 _this.tprmodel = this;
1430 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
1434 // set gobject values
1437 // user defined functions
1438 public void loadProjects (string id) {
1441 _this.project_id.loading = true;
1447 el.append(out iter);
1450 el.set_value(iter, 0, "");
1451 el.set_value(iter, 1, "-- select a project --");
1453 _this.project_id.el.set_active_iter(iter);
1456 foreach(var project in RooProject.projects()) {
1458 el.append(out iter);
1460 el.set_value(iter, 0, project.id);
1461 el.set_value(iter, 1, project.name );
1462 if (id == project.id) {
1463 _this.project_id.el.set_active_iter(iter);
1468 _this.project_id.loading = false;
1469 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
1475 public class Xcls_summary : Object
1477 public Gtk.Entry el;
1478 private NewBranch _this;
1484 public Xcls_summary(NewBranch _owner )
1487 _this.summary = this;
1488 this.el = new Gtk.Entry();
1492 // set gobject values
1493 this.el.visible = true;
1496 // user defined functions
1499 public class Xcls_Label33 : Object
1501 public Gtk.Label el;
1502 private NewBranch _this;
1508 public Xcls_Label33(NewBranch _owner )
1511 this.el = new Gtk.Label( "Milestone" );
1515 // set gobject values
1516 this.el.halign = Gtk.Align.START;
1517 this.el.justify = Gtk.Justification.RIGHT;
1518 this.el.xalign = 0.900000f;
1521 // user defined functions
1524 public class Xcls_milestone_id : Object
1526 public Gtk.ComboBox el;
1527 private NewBranch _this;
1531 public bool loading;
1534 public Xcls_milestone_id(NewBranch _owner )
1537 _this.milestone_id = this;
1538 this.el = new Gtk.ComboBox.with_entry();
1541 this.loading = false;
1543 // set gobject values
1544 var child_0 = new Xcls_msmodel( _this );
1546 this.el.set_model ( child_0.el );
1550 this.el.set_entry_text_column(1);
1553 // user defined functions
1554 public string selectedMilestoneId () {
1559 this.el.get_active_iter (out iter);
1560 _this.msmodel.el.get_value (iter, 0, out val1);
1563 return (string) val1;
1570 public class Xcls_msmodel : Object
1572 public Gtk.ListStore el;
1573 private NewBranch _this;
1579 public Xcls_msmodel(NewBranch _owner )
1582 _this.msmodel = this;
1583 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
1587 // set gobject values
1590 // user defined functions
1591 public void loadMilestones ( ) {
1593 var rt = RooTicket.singleton();
1594 // rt.loadProjects();
1596 _this.milestone_id.loading = true;
1602 el.append(out iter);
1605 el.set_value(iter, 0, "");
1606 el.set_value(iter, 1, "-- select a milestone --");
1607 _this.milestone_id.el.set_active_iter(iter);
1609 var projects = rt.milestones;
1610 foreach(var project in projects) {
1612 el.append(out iter);
1614 el.set_value(iter, 0, project.id);
1615 el.set_value(iter, 1, project.display_name );
1616 // if (id == project.id) {
1617 // _this.milestone.el.set_active_iter(iter);
1623 _this.milestone_id.loading = false;
1624 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
1630 public class Xcls_Label36 : Object
1632 public Gtk.Label el;
1633 private NewBranch _this;
1639 public Xcls_Label36(NewBranch _owner )
1642 this.el = new Gtk.Label( "Description" );
1646 // set gobject values
1647 this.el.halign = Gtk.Align.START;
1650 // user defined functions
1653 public class Xcls_description : Object
1655 public Gtk.TextView el;
1656 private NewBranch _this;
1662 public Xcls_description(NewBranch _owner )
1665 _this.description = this;
1666 this.el = new Gtk.TextView();
1670 // set gobject values
1671 this.el.border_width = 1;
1674 // user defined functions
1677 public class Xcls_Label38 : Object
1679 public Gtk.Label el;
1680 private NewBranch _this;
1686 public Xcls_Label38(NewBranch _owner )
1689 this.el = new Gtk.Label( "Priority" );
1693 // set gobject values
1694 this.el.halign = Gtk.Align.START;
1695 this.el.xalign = 0.900000f;
1698 // user defined functions
1701 public class Xcls_priority_id : Object
1703 public Gtk.ComboBox el;
1704 private NewBranch _this;
1708 public bool loading;
1711 public Xcls_priority_id(NewBranch _owner )
1714 _this.priority_id = this;
1715 this.el = new Gtk.ComboBox.with_entry();
1718 this.loading = false;
1720 // set gobject values
1721 var child_0 = new Xcls_primodel( _this );
1723 this.el.set_model ( child_0.el );
1727 this.el.set_entry_text_column(1);
1730 // user defined functions
1731 public string selectedPriorityId () {
1736 this.el.get_active_iter (out iter);
1737 _this.primodel.el.get_value (iter, 0, out val1);
1740 return (string) val1;
1747 public class Xcls_primodel : Object
1749 public Gtk.ListStore el;
1750 private NewBranch _this;
1756 public Xcls_primodel(NewBranch _owner )
1759 _this.primodel = this;
1760 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
1764 // set gobject values
1767 // user defined functions
1768 public void loadPriorities ( ) {
1770 var rt = RooTicket.singleton();
1771 // rt.loadProjects();
1773 _this.priority_id.loading = true;
1780 var projects = rt.priorities;
1781 foreach(var project in projects) {
1783 el.append(out iter);
1785 el.set_value(iter, 0, project.id);
1786 el.set_value(iter, 1, project.display_name );
1787 if ("normal" == project.name) {
1788 _this.priority_id.el.set_active_iter(iter);
1793 _this.priority_id.loading = false;
1800 public class Xcls_Label41 : Object
1802 public Gtk.Label el;
1803 private NewBranch _this;
1809 public Xcls_Label41(NewBranch _owner )
1812 this.el = new Gtk.Label( "Severity" );
1816 // set gobject values
1817 this.el.halign = Gtk.Align.START;
1820 // user defined functions
1823 public class Xcls_severity_id : Object
1825 public Gtk.ComboBox el;
1826 private NewBranch _this;
1830 public bool loading;
1833 public Xcls_severity_id(NewBranch _owner )
1836 _this.severity_id = this;
1837 this.el = new Gtk.ComboBox.with_entry();
1840 this.loading = false;
1842 // set gobject values
1843 var child_0 = new Xcls_sevmodel( _this );
1845 this.el.set_model ( child_0.el );
1849 this.el.set_entry_text_column(1);
1852 // user defined functions
1853 public string selectedSeverityId () {
1858 this.el.get_active_iter (out iter);
1859 _this.sevmodel.el.get_value (iter, 0, out val1);
1862 return (string) val1;
1869 public class Xcls_sevmodel : Object
1871 public Gtk.ListStore el;
1872 private NewBranch _this;
1878 public Xcls_sevmodel(NewBranch _owner )
1881 _this.sevmodel = this;
1882 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
1886 // set gobject values
1889 // user defined functions
1890 public void loadSeverities () {
1892 var rt = RooTicket.singleton();
1893 //rt.loadProjects();
1895 _this.severity_id.loading = true;
1901 var projects = rt.serverities;
1902 foreach(var project in projects) {
1904 el.append(out iter);
1906 el.set_value(iter, 0, project.id);
1907 el.set_value(iter, 1, project.display_name );
1908 if ("normal" == project.name) {
1909 _this.severity_id.el.set_active_iter(iter);
1914 _this.severity_id.loading = false;
1915 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
1921 public class Xcls_Label44 : Object
1923 public Gtk.Label el;
1924 private NewBranch _this;
1930 public Xcls_Label44(NewBranch _owner )
1933 this.el = new Gtk.Label( "Classification" );
1937 // set gobject values
1938 this.el.halign = Gtk.Align.START;
1941 // user defined functions
1944 public class Xcls_classification_id : Object
1946 public Gtk.ComboBox el;
1947 private NewBranch _this;
1951 public bool loading;
1954 public Xcls_classification_id(NewBranch _owner )
1957 _this.classification_id = this;
1958 this.el = new Gtk.ComboBox.with_entry();
1961 this.loading = false;
1963 // set gobject values
1964 var child_0 = new Xcls_clmodel( _this );
1966 this.el.set_model ( child_0.el );
1970 this.el.set_entry_text_column(1);
1973 // user defined functions
1974 public string selectedClassificationId () {
1979 this.el.get_active_iter (out iter);
1980 _this.clmodel.el.get_value (iter, 0, out val1);
1983 return (string) val1;
1990 public class Xcls_clmodel : Object
1992 public Gtk.ListStore el;
1993 private NewBranch _this;
1999 public Xcls_clmodel(NewBranch _owner )
2002 _this.clmodel = this;
2003 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
2007 // set gobject values
2010 // user defined functions
2011 public void loadClassifications ( ) {
2013 var rt = RooTicket.singleton();
2014 // rt.loadProjects();
2016 _this.classification_id.loading = true;
2022 el.append(out iter);
2025 var projects = rt.classifications;
2026 foreach(var project in projects) {
2028 el.append(out iter);
2030 el.set_value(iter, 0, project.id);
2031 el.set_value(iter, 1, project.display_name );
2032 if ("bug" == project.name) {
2033 _this.classification_id.el.set_active_iter(iter);
2038 _this.classification_id.loading = false;
2039 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
2045 public class Xcls_Label47 : Object
2047 public Gtk.Label el;
2048 private NewBranch _this;
2054 public Xcls_Label47(NewBranch _owner )
2057 this.el = new Gtk.Label( "Assign to" );
2061 // set gobject values
2062 this.el.halign = Gtk.Align.START;
2065 // user defined functions
2068 public class Xcls_developer_id : Object
2070 public Gtk.ComboBox el;
2071 private NewBranch _this;
2075 public bool loading;
2078 public Xcls_developer_id(NewBranch _owner )
2081 _this.developer_id = this;
2082 this.el = new Gtk.ComboBox.with_entry();
2085 this.loading = false;
2087 // set gobject values
2088 var child_0 = new Xcls_devmodel( _this );
2090 this.el.set_model ( child_0.el );
2094 this.el.set_entry_text_column(1);
2097 // user defined functions
2098 public string selectedDeveloperId () {
2103 this.el.get_active_iter (out iter);
2104 _this.devmodel.el.get_value (iter, 0, out val1);
2107 return (string) val1;
2114 public class Xcls_devmodel : Object
2116 public Gtk.ListStore el;
2117 private NewBranch _this;
2123 public Xcls_devmodel(NewBranch _owner )
2126 _this.devmodel = this;
2127 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
2131 // set gobject values
2134 // user defined functions
2135 public void loadDevelopers ( ) {
2137 var rt = RooTicket.singleton();
2138 //rt.loadProjects();
2140 _this.developer_id.loading = true;
2146 el.append(out iter);
2149 el.set_value(iter, 0, "");
2150 el.set_value(iter, 1, "-- select a developer --");
2152 _this.developer_id.el.set_active_iter(iter);
2155 var peps = rt.developers;
2156 foreach(var p in peps) {
2158 el.append(out iter);
2160 el.set_value(iter, 0, p.id);
2161 el.set_value(iter, 1, p.display_name );
2162 if (rt.authuser_id == p.id) {
2163 _this.developer_id.el.set_active_iter(iter);
2167 _this.developer_id.loading = false;
2168 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
2174 public class Xcls_Button50 : Object
2176 public Gtk.Button el;
2177 private NewBranch _this;
2183 public Xcls_Button50(NewBranch _owner )
2186 this.el = new Gtk.Button();
2190 // set gobject values
2191 this.el.label = "Create Ticket & Branch";
2196 this.el.get_style_context().add_class("suggested-action");
2200 this.el.clicked.connect( () => {
2201 GLib.debug("fire response = 1");
2204 var invalid = false;
2206 // validate first...
2207 _this.project_id.el.get_child().get_style_context().remove_class("warning");
2208 if (_this.project_id.selectedProjectId() == "") {
2209 _this.project_id.el.get_child().get_style_context().add_class("warning");
2213 _this.milestone_id.el.get_child().get_style_context().remove_class("warning");
2215 _this.priority_id.el.get_child().get_style_context().remove_class("warning");
2216 if (_this.priority_id.selectedPriorityId() == "") {
2217 _this.priority_id.el.get_child().get_style_context().add_class("warning");
2221 _this.classification_id.el.get_child().get_style_context().remove_class("warning");
2222 if (_this.classification_id.selectedClassificationId() == "") {
2223 _this.classification_id.el.get_child().get_style_context().add_class("warning");
2227 _this.developer_id.el.get_child().get_style_context().remove_class("warning");
2228 if (_this.developer_id.selectedDeveloperId() == "") {
2229 _this.developer_id.el.get_child().get_style_context().add_class("warning");
2233 _this.summary.el.get_style_context().remove_class("warning");
2234 if (_this.summary.el.get_text() == "") {
2235 _this.summary.el.get_style_context().add_class("warning");
2239 _this.description.el.get_style_context().remove_class("warning");
2244 GLib.debug("for is valid");
2246 _this.el.response(1);
2250 // user defined functions
2254 public class Xcls_spinner : Object
2256 public Gtk.Spinner el;
2257 private NewBranch _this;
2263 public Xcls_spinner(NewBranch _owner )
2266 _this.spinner = this;
2267 this.el = new Gtk.Spinner();
2271 // set gobject values
2272 this.el.hexpand = true;
2273 this.el.vexpand = true;
2276 // user defined functions
2280 public class Xcls_quick_commit_tab : Object
2283 private NewBranch _this;
2289 public Xcls_quick_commit_tab(NewBranch _owner )
2292 _this.quick_commit_tab = this;
2293 this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
2297 // set gobject values
2298 this.el.homogeneous = false;
2299 var child_0 = new Xcls_Table53( _this );
2301 this.el.pack_start ( child_0.el , false,false,0 );
2302 var child_1 = new Xcls_ScrolledWindow57( _this );
2304 this.el.add ( child_1.el );
2307 // user defined functions
2308 public void load_data () {
2310 _this.createbtn.updateState();
2313 public class Xcls_Table53 : Object
2315 public Gtk.Table el;
2316 private NewBranch _this;
2322 public Xcls_Table53(NewBranch _owner )
2325 this.el = new Gtk.Table( 3, 5, true );
2329 // set gobject values
2330 this.el.expand = false;
2332 this.el.column_spacing = 4;
2333 this.el.vexpand = false;
2334 var child_0 = new Xcls_Label54( _this );
2336 this.el.attach_defaults ( child_0.el , 0,1,0,1 );
2337 var child_1 = new Xcls_commit_message( _this );
2339 this.el.attach_defaults ( child_1.el , 0,5,1,2 );
2340 var child_2 = new Xcls_createbtn( _this );
2342 this.el.attach_defaults ( child_2.el , 0,5,2,3 );
2345 // user defined functions
2347 public class Xcls_Label54 : Object
2349 public Gtk.Label el;
2350 private NewBranch _this;
2356 public Xcls_Label54(NewBranch _owner )
2359 this.el = new Gtk.Label( "Just commit with this comment" );
2363 // set gobject values
2364 this.el.halign = Gtk.Align.START;
2365 this.el.justify = Gtk.Justification.RIGHT;
2366 this.el.xalign = 0.900000f;
2369 // user defined functions
2372 public class Xcls_commit_message : Object
2374 public Gtk.Entry el;
2375 private NewBranch _this;
2381 public Xcls_commit_message(NewBranch _owner )
2384 _this.commit_message = this;
2385 this.el = new Gtk.Entry();
2389 // set gobject values
2390 this.el.visible = true;
2393 this.el.key_release_event.connect( () => {
2395 _this.createbtn.updateState();
2400 // user defined functions
2403 public class Xcls_createbtn : Object
2405 public Gtk.Button el;
2406 private NewBranch _this;
2412 public Xcls_createbtn(NewBranch _owner )
2415 _this.createbtn = this;
2416 this.el = new Gtk.Button();
2420 // set gobject values
2421 this.el.label = "Commit Changes";
2426 this.el.get_style_context().add_class("suggested-action");
2430 this.el.clicked.connect( () => {
2432 GLib.debug("fire response = 1");
2436 _this.el.response(3);
2440 // user defined functions
2441 public void updateState () {
2443 var msg = _this.commit_message.el.get_text();
2446 this.el.set_sensitive(false);
2450 this.el.set_sensitive(true);
2456 public class Xcls_ScrolledWindow57 : Object
2458 public Gtk.ScrolledWindow el;
2459 private NewBranch _this;
2465 public Xcls_ScrolledWindow57(NewBranch _owner )
2468 this.el = new Gtk.ScrolledWindow( null, null );
2472 // set gobject values
2473 this.el.height_request = 400;
2474 this.el.vexpand = true;
2475 var child_0 = new Xcls_diff_view( _this );
2477 this.el.add ( child_0.el );
2480 // user defined functions
2482 public class Xcls_diff_view : Object
2484 public Gtk.SourceView el;
2485 private NewBranch _this;
2491 public Xcls_diff_view(NewBranch _owner )
2494 _this.diff_view = this;
2495 this.el = new Gtk.SourceView();
2501 var description = Pango.FontDescription.from_string("monospace");
2502 description.set_size(9000);
2503 this.el.override_font(description);
2504 var lm = Gtk.SourceLanguageManager.get_default();
2506 ((Gtk.SourceBuffer)(this.el.get_buffer())).set_language(
2507 lm.get_language("diff")
2511 // user defined functions