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...
135 this.running = false;
145 // user defined functions
146 public void show ( GitRepo repo, Gee.ArrayList<GitMonitorQueue> queue, string tid = "" )
148 // this.el.set_gravity(Gdk.Gravity.NORTH);
149 if (this.running) { // should not happen!!
150 GLib.error("new branch show called, when already being displayed?");
156 GitMonitor.gitmonitor.stop();
160 this.el.move((Gdk.Screen.width() / 2)- 250 ,0);
161 this.el.set_default_size( 500,200); // not sure why it grows..
169 this.el.set_keep_above(true);
171 _this.notebook.el.set_current_page(0);
173 _this.select_ticket_tab.load_data(tid);
174 //_this.create_ticket_tab.load_data();
175 //_this.quick_commit_tab.load_data();
176 _this.commit_message.el.set_text("");
186 public class Xcls_notebook : Object
188 public Gtk.Notebook el;
189 private NewBranch _this;
195 public Xcls_notebook(NewBranch _owner )
198 _this.notebook = this;
199 this.el = new Gtk.Notebook();
203 // set gobject values
204 this.el.vexpand = true;
205 var child_0 = new Xcls_label_select_ticket( _this );
207 var child_1 = new Xcls_label_create_ticket( _this );
209 var child_2 = new Xcls_label_quick_commit( _this );
211 var child_3 = new Xcls_select_ticket_tab( _this );
213 this.el.append_page ( child_3.el , _this.label_select_ticket.el );
214 var child_4 = new Xcls_create_ticket_tab( _this );
216 this.el.append_page ( child_4.el , _this.label_create_ticket.el );
217 var child_5 = new Xcls_quick_commit_tab( _this );
219 this.el.append_page ( child_5.el , _this.label_quick_commit.el );
222 this.el.switch_page.connect( (page, page_num) => {
223 GLib.debug("Switch to page: %d", (int)page_num);
226 break; // do nothing.. it's already loaded at start.
228 _this.create_ticket_tab.load_data();
231 _this.quick_commit_tab.load_data();
239 // user defined functions
241 public class Xcls_label_select_ticket : Object
244 private NewBranch _this;
250 public Xcls_label_select_ticket(NewBranch _owner )
253 _this.label_select_ticket = this;
254 this.el = new Gtk.Label( "Select Existing Ticket to work on" );
258 // set gobject values
261 // user defined functions
264 public class Xcls_label_create_ticket : Object
267 private NewBranch _this;
273 public Xcls_label_create_ticket(NewBranch _owner )
276 _this.label_create_ticket = this;
277 this.el = new Gtk.Label( "Create a New Ticket" );
281 // set gobject values
284 // user defined functions
287 public class Xcls_label_quick_commit : Object
290 private NewBranch _this;
296 public Xcls_label_quick_commit(NewBranch _owner )
299 _this.label_quick_commit = this;
300 this.el = new Gtk.Label( "Quick Commit" );
304 // set gobject values
307 // user defined functions
310 public class Xcls_select_ticket_tab : Object
313 private NewBranch _this;
319 public Xcls_select_ticket_tab(NewBranch _owner )
322 _this.select_ticket_tab = this;
323 this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
327 // set gobject values
328 this.el.homogeneous = false;
329 var child_0 = new Xcls_Table7( _this );
331 this.el.pack_start ( child_0.el , false,false,0 );
332 var child_1 = new Xcls_scrolled_window( _this );
334 this.el.add ( child_1.el );
337 // user defined functions
338 public void load_data (string tid = "") {
340 GLib.debug("Loading tickets");
342 var curproj = RooProject.getProjectByRepo(_this.repo);
343 _this.prmodel.loadProjects(curproj == null ? "" : curproj.id);
345 _this.dbmodel.loadTickets(curproj == null ? "": curproj.id, tid);
346 _this.branchbtn.updateState();
348 _this.ticketsel.el.get_child().get_style_context().remove_class("warning");
350 var name = RooTicket.singleton().usernameLocal();
351 var ticket = RooTicket.singleton().getById(tid);
352 _this.name.el.set_text("wip_%s_T%s_%s".printf(name,ticket.id, ticket.summaryToBranchName()));
354 _this.ticketsel.el.get_child().get_style_context().add_class("warning");
356 _this.view.loadTicket(tid);
361 public class Xcls_Table7 : Object
364 private NewBranch _this;
370 public Xcls_Table7(NewBranch _owner )
373 this.el = new Gtk.Table( 5, 5, true );
377 // set gobject values
378 this.el.expand = false;
380 this.el.column_spacing = 4;
381 this.el.vexpand = false;
382 var child_0 = new Xcls_Label8( _this );
384 this.el.attach_defaults ( child_0.el , 0,1,0,1 );
385 var child_1 = new Xcls_Label9( _this );
387 this.el.attach_defaults ( child_1.el , 1,2,0,1 );
388 var child_2 = new Xcls_projectsel( _this );
390 this.el.attach_defaults ( child_2.el , 0,1,1,2 );
391 var child_3 = new Xcls_ticketsel( _this );
393 this.el.attach_defaults ( child_3.el , 1,5,1,2 );
394 var child_4 = new Xcls_Label16( _this );
396 this.el.attach_defaults ( child_4.el , 0,1,3,4 );
397 var child_5 = new Xcls_name( _this );
399 this.el.attach_defaults ( child_5.el , 0,4,4,5 );
400 var child_6 = new Xcls_branchbtn( _this );
402 this.el.attach_defaults ( child_6.el , 4,5,4,5 );
403 var child_7 = new Xcls_Box19( _this );
405 this.el.attach_defaults ( child_7.el , 0,5,2,3 );
408 // user defined functions
410 public class Xcls_Label8 : Object
413 private NewBranch _this;
419 public Xcls_Label8(NewBranch _owner )
422 this.el = new Gtk.Label( "Project" );
426 // set gobject values
427 this.el.halign = Gtk.Align.START;
428 this.el.justify = Gtk.Justification.RIGHT;
429 this.el.visible = true;
432 // user defined functions
435 public class Xcls_Label9 : Object
438 private NewBranch _this;
444 public Xcls_Label9(NewBranch _owner )
447 this.el = new Gtk.Label( "Ticket" );
451 // set gobject values
452 this.el.halign = Gtk.Align.START;
453 this.el.visible = true;
456 // user defined functions
459 public class Xcls_projectsel : Object
461 public Gtk.ComboBox el;
462 private NewBranch _this;
469 public Xcls_projectsel(NewBranch _owner )
472 _this.projectsel = this;
473 this.el = new Gtk.ComboBox.with_entry();
476 this.loading = false;
478 // set gobject values
479 var child_0 = new Xcls_prcellrenderer( _this );
481 this.el.pack_start ( child_0.el , true );
482 var child_1 = new Xcls_prmodel( _this );
484 this.el.set_model ( child_1.el );
488 this.el.set_entry_text_column(1);
491 this.el.changed.connect( () => {
495 var project_id = this.selectedProjectId();
496 _this.dbmodel.loadTickets(project_id);
499 /*if (this.loading) {
502 var ticket_id = this.selectedTicketId();
504 var name = RooTicket.singleton().usernameLocal();
506 if (ticket_id == "" || ticket_id == null) {
508 var dt = new DateTime.now_local();
509 _this.name.el.set_text("wip_%s_%s".printf(name,dt.format("%Y_%b_%d")));
514 var ticket = RooTicket.singleton().getById(ticket_id);
516 _this.name.el.set_text("wip_%s_T%s_%s".printf(name,ticket.id, ticket.summaryToBranchName()));
518 //GLib.debug (//"Selection: %s, %s\n", (string) val1, (string) val2);
523 // user defined functions
524 public string selectedProjectId () {
529 this.el.get_active_iter (out iter);
530 _this.prmodel.el.get_value (iter, 0, out val1);
533 return (string) val1;
540 public class Xcls_prcellrenderer : Object
542 public Gtk.CellRendererText el;
543 private NewBranch _this;
549 public Xcls_prcellrenderer(NewBranch _owner )
552 _this.prcellrenderer = this;
553 this.el = new Gtk.CellRendererText();
557 // set gobject values
560 // user defined functions
563 public class Xcls_prmodel : Object
565 public Gtk.ListStore el;
566 private NewBranch _this;
572 public Xcls_prmodel(NewBranch _owner )
575 _this.prmodel = this;
576 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
580 // set gobject values
583 // user defined functions
584 public void loadProjects (string id) {
588 _this.projectsel.loading = true;
597 el.set_value(iter, 0, "");
598 el.set_value(iter, 1, "-- select a project --");
600 _this.projectsel.el.set_active_iter(iter);
603 foreach(var project in RooProject.projects()) {
607 el.set_value(iter, 0, project.id);
608 el.set_value(iter, 1, project.name );
609 if (id == project.id) {
610 _this.projectsel.el.set_active_iter(iter);
615 _this.projectsel.loading = false;
616 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
622 public class Xcls_ticketsel : Object
624 public Gtk.ComboBox el;
625 private NewBranch _this;
632 public Xcls_ticketsel(NewBranch _owner )
635 _this.ticketsel = this;
636 this.el = new Gtk.ComboBox.with_entry();
639 this.loading = false;
641 // set gobject values
642 var child_0 = new Xcls_dbcellrenderer( _this );
644 this.el.pack_start ( child_0.el , true );
645 var child_1 = new Xcls_dbmodel( _this );
647 this.el.set_model ( child_1.el );
651 //this.el.add_attribute(_this.dbcellrenderer.el , "markup", 1 );
652 this.el.set_entry_text_column(1);
653 this.el.get_child().set_sensitive(false);
656 this.el.changed.connect( () => {
660 var ticket_id = this.selectedTicketId();
662 var name = RooTicket.singleton().usernameLocal();
664 this.el.get_child().get_style_context().remove_class("warning");
665 if (ticket_id == "" || ticket_id == null) {
667 var dt = new DateTime.now_local();
668 _this.name.el.set_text("wip_%s_%s".printf(name,dt.format("%Y_%b_%d")));
669 _this.view.loadTicket("");
671 this.el.get_child().get_style_context().add_class("warning");
672 _this.createbtn.updateState();
677 var ticket = RooTicket.singleton().getById(ticket_id);
679 _this.name.el.set_text("wip_%s_T%s_%s".printf(name,ticket.id, ticket.summaryToBranchName()));
680 _this.scrolled_window.el.show();
682 _this.view.loadTicket(ticket.id);
683 _this.branchbtn.updateState();
685 //GLib.debug (//"Selection: %s, %s\n", (string) val1, (string) val2);
689 // user defined functions
690 public string selectedTicketId () {
695 this.el.get_active_iter (out iter);
696 _this.dbmodel.el.get_value (iter, 0, out val1);
699 return (string) val1;
706 public class Xcls_dbcellrenderer : Object
708 public Gtk.CellRendererText el;
709 private NewBranch _this;
715 public Xcls_dbcellrenderer(NewBranch _owner )
718 _this.dbcellrenderer = this;
719 this.el = new Gtk.CellRendererText();
723 // set gobject values
726 // user defined functions
729 public class Xcls_dbmodel : Object
731 public Gtk.ListStore el;
732 private NewBranch _this;
738 public Xcls_dbmodel(NewBranch _owner )
741 _this.dbmodel = this;
742 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
746 // set gobject values
749 // user defined functions
750 public void loadTickets (string project_id , string tid = "") {
754 // fixme .. get project id from selection..
756 RooTicket.singleton().loadTickets(
758 _this.btn_not_me.el.active ? RooTicket.Who.ANYBODY : RooTicket.Who.ME,
759 _this.btn_closed.el.active ? RooTicket.Status.ALL : RooTicket.Status.ACTIVE
762 _this.ticketsel.loading = true;
771 el.set_value(iter, 0, "");
772 el.set_value(iter, 1, "-- select a ticket --");
774 _this.ticketsel.el.set_active_iter(iter);
775 var tickets = RooTicket.singleton().tickets;
776 foreach(var ticket in tickets) {
780 el.set_value(iter, 0, ticket.id);
781 el.set_value(iter, 1, "#%s %s".printf( ticket.id, ticket.summary));
783 if (ticket.id == tid) {
784 _this.ticketsel.el.set_active_iter(iter);
789 _this.ticketsel.loading = false;
790 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
796 public class Xcls_Label16 : Object
799 private NewBranch _this;
805 public Xcls_Label16(NewBranch _owner )
808 this.el = new Gtk.Label( "Use this as branch name" );
812 // set gobject values
813 this.el.halign = Gtk.Align.START;
814 this.el.justify = Gtk.Justification.RIGHT;
815 this.el.xalign = 0.900000f;
818 // user defined functions
821 public class Xcls_name : Object
824 private NewBranch _this;
830 public Xcls_name(NewBranch _owner )
834 this.el = new Gtk.Entry();
838 // set gobject values
839 this.el.visible = true;
842 // user defined functions
845 public class Xcls_branchbtn : Object
847 public Gtk.Button el;
848 private NewBranch _this;
854 public Xcls_branchbtn(NewBranch _owner )
857 _this.branchbtn = this;
858 this.el = new Gtk.Button();
862 // set gobject values
863 this.el.label = "Create Branch";
868 this.el.get_style_context().add_class("suggested-action");
872 this.el.clicked.connect( () => {
874 GLib.debug("fire response = 1");
876 var ticket_id = _this.ticketsel.selectedTicketId();
878 if (ticket_id == "") {
879 _this.ticketsel.el.get_child().get_style_context().add_class("warning");
883 _this.el.response(1);
887 // user defined functions
888 public void updateState () {
890 var ticket_id = _this.ticketsel.selectedTicketId();
892 if (ticket_id == "") {
893 this.el.set_sensitive(false);
897 this.el.set_sensitive(true);
902 public class Xcls_Box19 : Object
905 private NewBranch _this;
911 public Xcls_Box19(NewBranch _owner )
914 this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
918 // set gobject values
919 var child_0 = new Xcls_btn_not_me( _this );
921 this.el.add ( child_0.el );
922 var child_1 = new Xcls_btn_closed( _this );
924 this.el.add ( child_1.el );
925 var child_2 = new Xcls_Label22( _this );
927 this.el.add ( child_2.el );
930 // user defined functions
932 public class Xcls_btn_not_me : Object
934 public Gtk.CheckButton el;
935 private NewBranch _this;
941 public Xcls_btn_not_me(NewBranch _owner )
944 _this.btn_not_me = this;
945 this.el = new Gtk.CheckButton();
949 // set gobject values
950 this.el.label = "Show tickets not assigned to me";
953 this.el.toggled.connect( () => {
954 var project_id = _this.projectsel.selectedProjectId();
955 _this.dbmodel.loadTickets(project_id);
959 // user defined functions
962 public class Xcls_btn_closed : Object
964 public Gtk.CheckButton el;
965 private NewBranch _this;
971 public Xcls_btn_closed(NewBranch _owner )
974 _this.btn_closed = this;
975 this.el = new Gtk.CheckButton();
979 // set gobject values
980 this.el.label = "Show closed Tickets";
983 this.el.toggled.connect( () => {
984 var project_id = _this.projectsel.selectedProjectId();
985 _this.dbmodel.loadTickets(project_id);
990 // user defined functions
993 public class Xcls_Label22 : Object
996 private NewBranch _this;
1002 public Xcls_Label22(NewBranch _owner )
1005 this.el = new Gtk.Label( "<a href=\"refresh\">Refresh Ticket list</a>" );
1009 // set gobject values
1010 this.el.halign = Gtk.Align.END;
1011 this.el.hexpand = true;
1012 this.el.use_markup = true;
1015 this.el.activate_link.connect( (uri) => {
1016 if (uri == "refresh") {
1017 RooProject.reload();
1018 var curproj = RooProject.getProjectByRepo(_this.repo);
1019 _this.prmodel.loadProjects(curproj == null ? "": curproj.id);
1021 _this.dbmodel.loadTickets(curproj == null ? "": curproj.id);
1027 // user defined functions
1032 public class Xcls_scrolled_window : Object
1034 public Gtk.ScrolledWindow el;
1035 private NewBranch _this;
1041 public Xcls_scrolled_window(NewBranch _owner )
1044 _this.scrolled_window = this;
1045 this.el = new Gtk.ScrolledWindow( null, null );
1049 // set gobject values
1050 this.el.height_request = 500;
1051 this.el.vexpand = true;
1052 var child_0 = new Xcls_view( _this );
1054 this.el.add ( child_0.el );
1059 this.el.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);
1063 // user defined functions
1065 public class Xcls_view : Object
1067 public WebKit.WebView el;
1068 private NewBranch _this;
1074 public Xcls_view(NewBranch _owner )
1078 this.el = new WebKit.WebView();
1082 // set gobject values
1085 // user defined functions
1086 public void loadTicket (string tid) {
1088 _this.el.get_size(out w, out h);
1091 _this.scrolled_window.el.hide();
1092 _this.el.resize(w, 150);
1094 _this.scrolled_window.el.show();
1095 _this.el.resize(w, 800);
1098 var rs = RooTicket.singleton();
1099 var uri = new WebKit.URIRequest("https://roojs.com/admin.php/MTrack/View/" + tid);
1100 var hd = uri.get_http_headers();
1101 var authCode = Base64.encode ("%s:%s".printf(rs.username, rs.password).data);
1102 hd.append("Authorization", "Basic %s".printf(authCode));
1104 this.el.load_request(uri);
1110 public class Xcls_create_ticket_tab : Object
1113 private NewBranch _this;
1119 public Xcls_create_ticket_tab(NewBranch _owner )
1122 _this.create_ticket_tab = this;
1123 this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
1127 // set gobject values
1128 this.el.homogeneous = false;
1129 var child_0 = new Xcls_table( _this );
1131 this.el.pack_start ( child_0.el , false,false,0 );
1132 var child_1 = new Xcls_spinner( _this );
1134 this.el.add ( child_1.el );
1137 // user defined functions
1138 public void load_data () {
1140 _this.table.el.hide();
1141 _this.spinner.el.show();
1142 _this.spinner.el.start();
1144 Timeout.add_seconds(1, () => {
1146 RooProject? curproj = null;
1147 if (_this.repo != null) {
1148 curproj = RooProject.getProjectByRepo(_this.repo);
1150 _this.tprmodel.loadProjects(curproj == null ? "" : curproj.id);
1151 if (curproj != null) {
1154 var rt = RooTicket.singleton();
1155 rt.loadProjectOptions(curproj.id);
1157 _this.msmodel.loadMilestones();
1158 _this.primodel.loadPriorities();
1159 _this.sevmodel.loadSeverities();
1160 _this.clmodel.loadClassifications();
1161 _this.devmodel.loadDevelopers();
1164 _this.summary.el.set_text("");
1165 _this.description.el.buffer.text = "";
1166 _this.spinner.el.stop();
1167 _this.spinner.el.hide();
1169 _this.table.el.show();
1170 //_this.summary.el.grab_focus();
1176 public class Xcls_table : Object
1178 public Gtk.Table el;
1179 private NewBranch _this;
1185 public Xcls_table(NewBranch _owner )
1189 this.el = new Gtk.Table( 14, 4, true );
1193 // set gobject values
1194 this.el.expand = false;
1196 this.el.column_spacing = 4;
1197 this.el.vexpand = false;
1198 var child_0 = new Xcls_Label27( _this );
1200 this.el.attach_defaults ( child_0.el , 0,1,0,1 );
1201 var child_1 = new Xcls_Label28( _this );
1203 this.el.attach_defaults ( child_1.el , 1,2,0,1 );
1204 var child_2 = new Xcls_project_id( _this );
1206 this.el.attach_defaults ( child_2.el , 0,1,1,2 );
1207 var child_3 = new Xcls_summary( _this );
1209 this.el.attach_defaults ( child_3.el , 1,4,1,2 );
1210 var child_4 = new Xcls_Label33( _this );
1212 this.el.attach_defaults ( child_4.el , 0,1,2,3 );
1213 var child_5 = new Xcls_milestone_id( _this );
1215 this.el.attach_defaults ( child_5.el , 0,1,3,4 );
1216 var child_6 = new Xcls_Label36( _this );
1218 this.el.attach_defaults ( child_6.el , 1,4,2,3 );
1219 var child_7 = new Xcls_description( _this );
1221 this.el.attach_defaults ( child_7.el , 1,4,3,12 );
1222 var child_8 = new Xcls_Label38( _this );
1224 this.el.attach_defaults ( child_8.el , 0,1,4,5 );
1225 var child_9 = new Xcls_priority_id( _this );
1227 this.el.attach_defaults ( child_9.el , 0,1,5,6 );
1228 var child_10 = new Xcls_Label41( _this );
1230 this.el.attach_defaults ( child_10.el , 0,1,6,7 );
1231 var child_11 = new Xcls_severity_id( _this );
1233 this.el.attach_defaults ( child_11.el , 0,1,7,8 );
1234 var child_12 = new Xcls_Label44( _this );
1236 this.el.attach_defaults ( child_12.el , 0,1,8,9 );
1237 var child_13 = new Xcls_classification_id( _this );
1239 this.el.attach_defaults ( child_13.el , 0,1,9,10 );
1240 var child_14 = new Xcls_Label47( _this );
1242 this.el.attach_defaults ( child_14.el , 0,1,10,11 );
1243 var child_15 = new Xcls_developer_id( _this );
1245 this.el.attach_defaults ( child_15.el , 0,1,11,12 );
1246 var child_16 = new Xcls_Button50( _this );
1248 this.el.attach_defaults ( child_16.el , 0,4,13,14 );
1251 // user defined functions
1253 public class Xcls_Label27 : Object
1255 public Gtk.Label el;
1256 private NewBranch _this;
1262 public Xcls_Label27(NewBranch _owner )
1265 this.el = new Gtk.Label( "Project" );
1269 // set gobject values
1270 this.el.halign = Gtk.Align.START;
1271 this.el.visible = true;
1274 // user defined functions
1277 public class Xcls_Label28 : Object
1279 public Gtk.Label el;
1280 private NewBranch _this;
1286 public Xcls_Label28(NewBranch _owner )
1289 this.el = new Gtk.Label( "Summary" );
1293 // set gobject values
1294 this.el.halign = Gtk.Align.START;
1295 this.el.visible = true;
1298 // user defined functions
1301 public class Xcls_project_id : Object
1303 public Gtk.ComboBox el;
1304 private NewBranch _this;
1308 public bool loading;
1311 public Xcls_project_id(NewBranch _owner )
1314 _this.project_id = this;
1315 this.el = new Gtk.ComboBox.with_entry();
1318 this.loading = false;
1320 // set gobject values
1321 var child_0 = new Xcls_tprcellrenderer( _this );
1323 this.el.pack_start ( child_0.el , true );
1324 var child_1 = new Xcls_tprmodel( _this );
1326 this.el.set_model ( child_1.el );
1330 this.el.set_entry_text_column(1);
1333 this.el.changed.connect( () => {
1337 var project_id = this.selectedProjectId();
1339 var rt = RooTicket.singleton();
1340 rt.loadProjectOptions(project_id);
1342 _this.msmodel.loadMilestones();
1343 _this.primodel.loadPriorities();
1344 _this.sevmodel.loadSeverities();
1345 _this.clmodel.loadClassifications();
1346 _this.devmodel.loadDevelopers();
1348 // affects projects and milestones..
1351 /*if (this.loading) {
1354 var ticket_id = this.selectedTicketId();
1356 var name = RooTicket.singleton().usernameLocal();
1358 if (ticket_id == "" || ticket_id == null) {
1360 var dt = new DateTime.now_local();
1361 _this.name.el.set_text("wip_%s_%s".printf(name,dt.format("%Y_%b_%d")));
1366 var ticket = RooTicket.singleton().getById(ticket_id);
1368 _this.name.el.set_text("wip_%s_T%s_%s".printf(name,ticket.id, ticket.summaryToBranchName()));
1370 //GLib.debug (//"Selection: %s, %s\n", (string) val1, (string) val2);
1375 // user defined functions
1376 public string selectedProjectId () {
1381 this.el.get_active_iter (out iter);
1382 _this.tprmodel.el.get_value (iter, 0, out val1);
1385 return (string) val1;
1392 public class Xcls_tprcellrenderer : Object
1394 public Gtk.CellRendererText el;
1395 private NewBranch _this;
1401 public Xcls_tprcellrenderer(NewBranch _owner )
1404 _this.tprcellrenderer = this;
1405 this.el = new Gtk.CellRendererText();
1409 // set gobject values
1412 // user defined functions
1415 public class Xcls_tprmodel : Object
1417 public Gtk.ListStore el;
1418 private NewBranch _this;
1424 public Xcls_tprmodel(NewBranch _owner )
1427 _this.tprmodel = this;
1428 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
1432 // set gobject values
1435 // user defined functions
1436 public void loadProjects (string id) {
1439 _this.project_id.loading = true;
1445 el.append(out iter);
1448 el.set_value(iter, 0, "");
1449 el.set_value(iter, 1, "-- select a project --");
1451 _this.project_id.el.set_active_iter(iter);
1454 foreach(var project in RooProject.projects()) {
1456 el.append(out iter);
1458 el.set_value(iter, 0, project.id);
1459 el.set_value(iter, 1, project.name );
1460 if (id == project.id) {
1461 _this.project_id.el.set_active_iter(iter);
1466 _this.project_id.loading = false;
1467 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
1473 public class Xcls_summary : Object
1475 public Gtk.Entry el;
1476 private NewBranch _this;
1482 public Xcls_summary(NewBranch _owner )
1485 _this.summary = this;
1486 this.el = new Gtk.Entry();
1490 // set gobject values
1491 this.el.visible = true;
1494 // user defined functions
1497 public class Xcls_Label33 : Object
1499 public Gtk.Label el;
1500 private NewBranch _this;
1506 public Xcls_Label33(NewBranch _owner )
1509 this.el = new Gtk.Label( "Milestone" );
1513 // set gobject values
1514 this.el.halign = Gtk.Align.START;
1515 this.el.justify = Gtk.Justification.RIGHT;
1516 this.el.xalign = 0.900000f;
1519 // user defined functions
1522 public class Xcls_milestone_id : Object
1524 public Gtk.ComboBox el;
1525 private NewBranch _this;
1529 public bool loading;
1532 public Xcls_milestone_id(NewBranch _owner )
1535 _this.milestone_id = this;
1536 this.el = new Gtk.ComboBox.with_entry();
1539 this.loading = false;
1541 // set gobject values
1542 var child_0 = new Xcls_msmodel( _this );
1544 this.el.set_model ( child_0.el );
1548 this.el.set_entry_text_column(1);
1551 // user defined functions
1552 public string selectedMilestoneId () {
1557 this.el.get_active_iter (out iter);
1558 _this.msmodel.el.get_value (iter, 0, out val1);
1561 return (string) val1;
1568 public class Xcls_msmodel : Object
1570 public Gtk.ListStore el;
1571 private NewBranch _this;
1577 public Xcls_msmodel(NewBranch _owner )
1580 _this.msmodel = this;
1581 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
1585 // set gobject values
1588 // user defined functions
1589 public void loadMilestones ( ) {
1591 var rt = RooTicket.singleton();
1592 // rt.loadProjects();
1594 _this.milestone_id.loading = true;
1600 el.append(out iter);
1603 el.set_value(iter, 0, "");
1604 el.set_value(iter, 1, "-- select a milestone --");
1605 _this.milestone_id.el.set_active_iter(iter);
1607 var projects = rt.milestones;
1608 foreach(var project in projects) {
1610 el.append(out iter);
1612 el.set_value(iter, 0, project.id);
1613 el.set_value(iter, 1, project.display_name );
1614 // if (id == project.id) {
1615 // _this.milestone.el.set_active_iter(iter);
1621 _this.milestone_id.loading = false;
1622 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
1628 public class Xcls_Label36 : Object
1630 public Gtk.Label el;
1631 private NewBranch _this;
1637 public Xcls_Label36(NewBranch _owner )
1640 this.el = new Gtk.Label( "Description" );
1644 // set gobject values
1645 this.el.halign = Gtk.Align.START;
1648 // user defined functions
1651 public class Xcls_description : Object
1653 public Gtk.TextView el;
1654 private NewBranch _this;
1660 public Xcls_description(NewBranch _owner )
1663 _this.description = this;
1664 this.el = new Gtk.TextView();
1668 // set gobject values
1669 this.el.border_width = 1;
1672 // user defined functions
1675 public class Xcls_Label38 : Object
1677 public Gtk.Label el;
1678 private NewBranch _this;
1684 public Xcls_Label38(NewBranch _owner )
1687 this.el = new Gtk.Label( "Priority" );
1691 // set gobject values
1692 this.el.halign = Gtk.Align.START;
1693 this.el.xalign = 0.900000f;
1696 // user defined functions
1699 public class Xcls_priority_id : Object
1701 public Gtk.ComboBox el;
1702 private NewBranch _this;
1706 public bool loading;
1709 public Xcls_priority_id(NewBranch _owner )
1712 _this.priority_id = this;
1713 this.el = new Gtk.ComboBox.with_entry();
1716 this.loading = false;
1718 // set gobject values
1719 var child_0 = new Xcls_primodel( _this );
1721 this.el.set_model ( child_0.el );
1725 this.el.set_entry_text_column(1);
1728 // user defined functions
1729 public string selectedPriorityId () {
1734 this.el.get_active_iter (out iter);
1735 _this.primodel.el.get_value (iter, 0, out val1);
1738 return (string) val1;
1745 public class Xcls_primodel : Object
1747 public Gtk.ListStore el;
1748 private NewBranch _this;
1754 public Xcls_primodel(NewBranch _owner )
1757 _this.primodel = this;
1758 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
1762 // set gobject values
1765 // user defined functions
1766 public void loadPriorities ( ) {
1768 var rt = RooTicket.singleton();
1769 // rt.loadProjects();
1771 _this.priority_id.loading = true;
1778 var projects = rt.priorities;
1779 foreach(var project in projects) {
1781 el.append(out iter);
1783 el.set_value(iter, 0, project.id);
1784 el.set_value(iter, 1, project.display_name );
1785 if ("normal" == project.name) {
1786 _this.priority_id.el.set_active_iter(iter);
1791 _this.priority_id.loading = false;
1798 public class Xcls_Label41 : Object
1800 public Gtk.Label el;
1801 private NewBranch _this;
1807 public Xcls_Label41(NewBranch _owner )
1810 this.el = new Gtk.Label( "Severity" );
1814 // set gobject values
1815 this.el.halign = Gtk.Align.START;
1818 // user defined functions
1821 public class Xcls_severity_id : Object
1823 public Gtk.ComboBox el;
1824 private NewBranch _this;
1828 public bool loading;
1831 public Xcls_severity_id(NewBranch _owner )
1834 _this.severity_id = this;
1835 this.el = new Gtk.ComboBox.with_entry();
1838 this.loading = false;
1840 // set gobject values
1841 var child_0 = new Xcls_sevmodel( _this );
1843 this.el.set_model ( child_0.el );
1847 this.el.set_entry_text_column(1);
1850 // user defined functions
1851 public string selectedSeverityId () {
1856 this.el.get_active_iter (out iter);
1857 _this.sevmodel.el.get_value (iter, 0, out val1);
1860 return (string) val1;
1867 public class Xcls_sevmodel : Object
1869 public Gtk.ListStore el;
1870 private NewBranch _this;
1876 public Xcls_sevmodel(NewBranch _owner )
1879 _this.sevmodel = this;
1880 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
1884 // set gobject values
1887 // user defined functions
1888 public void loadSeverities () {
1890 var rt = RooTicket.singleton();
1891 //rt.loadProjects();
1893 _this.severity_id.loading = true;
1899 var projects = rt.serverities;
1900 foreach(var project in projects) {
1902 el.append(out iter);
1904 el.set_value(iter, 0, project.id);
1905 el.set_value(iter, 1, project.display_name );
1906 if ("normal" == project.name) {
1907 _this.severity_id.el.set_active_iter(iter);
1912 _this.severity_id.loading = false;
1913 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
1919 public class Xcls_Label44 : Object
1921 public Gtk.Label el;
1922 private NewBranch _this;
1928 public Xcls_Label44(NewBranch _owner )
1931 this.el = new Gtk.Label( "Classification" );
1935 // set gobject values
1936 this.el.halign = Gtk.Align.START;
1939 // user defined functions
1942 public class Xcls_classification_id : Object
1944 public Gtk.ComboBox el;
1945 private NewBranch _this;
1949 public bool loading;
1952 public Xcls_classification_id(NewBranch _owner )
1955 _this.classification_id = this;
1956 this.el = new Gtk.ComboBox.with_entry();
1959 this.loading = false;
1961 // set gobject values
1962 var child_0 = new Xcls_clmodel( _this );
1964 this.el.set_model ( child_0.el );
1968 this.el.set_entry_text_column(1);
1971 // user defined functions
1972 public string selectedClassificationId () {
1977 this.el.get_active_iter (out iter);
1978 _this.clmodel.el.get_value (iter, 0, out val1);
1981 return (string) val1;
1988 public class Xcls_clmodel : Object
1990 public Gtk.ListStore el;
1991 private NewBranch _this;
1997 public Xcls_clmodel(NewBranch _owner )
2000 _this.clmodel = this;
2001 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
2005 // set gobject values
2008 // user defined functions
2009 public void loadClassifications ( ) {
2011 var rt = RooTicket.singleton();
2012 // rt.loadProjects();
2014 _this.classification_id.loading = true;
2020 el.append(out iter);
2023 var projects = rt.classifications;
2024 foreach(var project in projects) {
2026 el.append(out iter);
2028 el.set_value(iter, 0, project.id);
2029 el.set_value(iter, 1, project.display_name );
2030 if ("bug" == project.name) {
2031 _this.classification_id.el.set_active_iter(iter);
2036 _this.classification_id.loading = false;
2037 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
2043 public class Xcls_Label47 : Object
2045 public Gtk.Label el;
2046 private NewBranch _this;
2052 public Xcls_Label47(NewBranch _owner )
2055 this.el = new Gtk.Label( "Assign to" );
2059 // set gobject values
2060 this.el.halign = Gtk.Align.START;
2063 // user defined functions
2066 public class Xcls_developer_id : Object
2068 public Gtk.ComboBox el;
2069 private NewBranch _this;
2073 public bool loading;
2076 public Xcls_developer_id(NewBranch _owner )
2079 _this.developer_id = this;
2080 this.el = new Gtk.ComboBox.with_entry();
2083 this.loading = false;
2085 // set gobject values
2086 var child_0 = new Xcls_devmodel( _this );
2088 this.el.set_model ( child_0.el );
2092 this.el.set_entry_text_column(1);
2095 // user defined functions
2096 public string selectedDeveloperId () {
2101 this.el.get_active_iter (out iter);
2102 _this.devmodel.el.get_value (iter, 0, out val1);
2105 return (string) val1;
2112 public class Xcls_devmodel : Object
2114 public Gtk.ListStore el;
2115 private NewBranch _this;
2121 public Xcls_devmodel(NewBranch _owner )
2124 _this.devmodel = this;
2125 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
2129 // set gobject values
2132 // user defined functions
2133 public void loadDevelopers ( ) {
2135 var rt = RooTicket.singleton();
2136 //rt.loadProjects();
2138 _this.developer_id.loading = true;
2144 el.append(out iter);
2147 el.set_value(iter, 0, "");
2148 el.set_value(iter, 1, "-- select a developer --");
2150 _this.developer_id.el.set_active_iter(iter);
2153 var peps = rt.developers;
2154 foreach(var p in peps) {
2156 el.append(out iter);
2158 el.set_value(iter, 0, p.id);
2159 el.set_value(iter, 1, p.display_name );
2160 if (rt.authuser_id == p.id) {
2161 _this.developer_id.el.set_active_iter(iter);
2165 _this.developer_id.loading = false;
2166 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
2172 public class Xcls_Button50 : Object
2174 public Gtk.Button el;
2175 private NewBranch _this;
2181 public Xcls_Button50(NewBranch _owner )
2184 this.el = new Gtk.Button();
2188 // set gobject values
2189 this.el.label = "Create Ticket & Branch";
2194 this.el.get_style_context().add_class("suggested-action");
2198 this.el.clicked.connect( () => {
2199 GLib.debug("fire response = 1");
2202 var invalid = false;
2204 // validate first...
2205 _this.project_id.el.get_child().get_style_context().remove_class("warning");
2206 if (_this.project_id.selectedProjectId() == "") {
2207 _this.project_id.el.get_child().get_style_context().add_class("warning");
2211 _this.milestone_id.el.get_child().get_style_context().remove_class("warning");
2213 _this.priority_id.el.get_child().get_style_context().remove_class("warning");
2214 if (_this.priority_id.selectedPriorityId() == "") {
2215 _this.priority_id.el.get_child().get_style_context().add_class("warning");
2219 _this.classification_id.el.get_child().get_style_context().remove_class("warning");
2220 if (_this.classification_id.selectedClassificationId() == "") {
2221 _this.classification_id.el.get_child().get_style_context().add_class("warning");
2225 _this.developer_id.el.get_child().get_style_context().remove_class("warning");
2226 if (_this.developer_id.selectedDeveloperId() == "") {
2227 _this.developer_id.el.get_child().get_style_context().add_class("warning");
2231 _this.summary.el.get_style_context().remove_class("warning");
2232 if (_this.summary.el.get_text() == "") {
2233 _this.summary.el.get_style_context().add_class("warning");
2237 _this.description.el.get_style_context().remove_class("warning");
2242 GLib.debug("for is valid");
2244 _this.el.response(1);
2248 // user defined functions
2252 public class Xcls_spinner : Object
2254 public Gtk.Spinner el;
2255 private NewBranch _this;
2261 public Xcls_spinner(NewBranch _owner )
2264 _this.spinner = this;
2265 this.el = new Gtk.Spinner();
2269 // set gobject values
2270 this.el.hexpand = true;
2271 this.el.vexpand = true;
2274 // user defined functions
2278 public class Xcls_quick_commit_tab : Object
2281 private NewBranch _this;
2287 public Xcls_quick_commit_tab(NewBranch _owner )
2290 _this.quick_commit_tab = this;
2291 this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
2295 // set gobject values
2296 this.el.homogeneous = false;
2297 var child_0 = new Xcls_Table53( _this );
2299 this.el.pack_start ( child_0.el , false,false,0 );
2300 var child_1 = new Xcls_ScrolledWindow57( _this );
2302 this.el.add ( child_1.el );
2305 // user defined functions
2306 public void load_data () {
2308 _this.createbtn.updateState();
2311 public class Xcls_Table53 : Object
2313 public Gtk.Table el;
2314 private NewBranch _this;
2320 public Xcls_Table53(NewBranch _owner )
2323 this.el = new Gtk.Table( 3, 5, true );
2327 // set gobject values
2328 this.el.expand = false;
2330 this.el.column_spacing = 4;
2331 this.el.vexpand = false;
2332 var child_0 = new Xcls_Label54( _this );
2334 this.el.attach_defaults ( child_0.el , 0,1,0,1 );
2335 var child_1 = new Xcls_commit_message( _this );
2337 this.el.attach_defaults ( child_1.el , 0,5,1,2 );
2338 var child_2 = new Xcls_createbtn( _this );
2340 this.el.attach_defaults ( child_2.el , 0,5,2,3 );
2343 // user defined functions
2345 public class Xcls_Label54 : Object
2347 public Gtk.Label el;
2348 private NewBranch _this;
2354 public Xcls_Label54(NewBranch _owner )
2357 this.el = new Gtk.Label( "Just commit with this comment" );
2361 // set gobject values
2362 this.el.halign = Gtk.Align.START;
2363 this.el.justify = Gtk.Justification.RIGHT;
2364 this.el.xalign = 0.900000f;
2367 // user defined functions
2370 public class Xcls_commit_message : Object
2372 public Gtk.Entry el;
2373 private NewBranch _this;
2379 public Xcls_commit_message(NewBranch _owner )
2382 _this.commit_message = this;
2383 this.el = new Gtk.Entry();
2387 // set gobject values
2388 this.el.visible = true;
2391 this.el.key_release_event.connect( () => {
2393 _this.createbtn.updateState();
2398 // user defined functions
2401 public class Xcls_createbtn : Object
2403 public Gtk.Button el;
2404 private NewBranch _this;
2410 public Xcls_createbtn(NewBranch _owner )
2413 _this.createbtn = this;
2414 this.el = new Gtk.Button();
2418 // set gobject values
2419 this.el.label = "Commit Changes";
2424 this.el.get_style_context().add_class("suggested-action");
2428 this.el.clicked.connect( () => {
2430 GLib.debug("fire response = 1");
2434 _this.el.response(3);
2438 // user defined functions
2439 public void updateState () {
2441 var msg = _this.commit_message.el.get_text();
2444 this.el.set_sensitive(false);
2448 this.el.set_sensitive(true);
2454 public class Xcls_ScrolledWindow57 : Object
2456 public Gtk.ScrolledWindow el;
2457 private NewBranch _this;
2463 public Xcls_ScrolledWindow57(NewBranch _owner )
2466 this.el = new Gtk.ScrolledWindow( null, null );
2470 // set gobject values
2471 this.el.height_request = 400;
2472 this.el.vexpand = true;
2473 var child_0 = new Xcls_diff_view( _this );
2475 this.el.add ( child_0.el );
2478 // user defined functions
2480 public class Xcls_diff_view : Object
2482 public Gtk.SourceView el;
2483 private NewBranch _this;
2489 public Xcls_diff_view(NewBranch _owner )
2492 _this.diff_view = this;
2493 this.el = new Gtk.SourceView();
2499 var description = Pango.FontDescription.from_string("monospace");
2500 description.set_size(9000);
2501 this.el.override_font(description);
2502 var lm = Gtk.SourceLanguageManager.get_default();
2504 ((Gtk.SourceBuffer)(this.el.get_buffer())).set_language(
2505 lm.get_language("diff")
2509 // user defined functions