1 static NewBranch _NewBranch;
3 public class NewBranch : Object
6 private NewBranch _this;
8 public static NewBranch singleton()
10 if (_NewBranch == null) {
11 _NewBranch= new NewBranch();
15 public Xcls_label_select_ticket label_select_ticket;
16 public Xcls_label_create_ticket label_create_ticket;
17 public Xcls_label_quick_commit label_quick_commit;
18 public Xcls_select_ticket_tab select_ticket_tab;
19 public Xcls_projectsel projectsel;
20 public Xcls_prcellrenderer prcellrenderer;
21 public Xcls_prmodel prmodel;
22 public Xcls_ticketsel ticketsel;
23 public Xcls_dbcellrenderer dbcellrenderer;
24 public Xcls_dbmodel dbmodel;
25 public Xcls_name name;
26 public Xcls_branchbtn branchbtn;
27 public Xcls_btn_not_me btn_not_me;
28 public Xcls_btn_closed btn_closed;
29 public Xcls_scrolled_window scrolled_window;
30 public Xcls_view view;
31 public Xcls_create_ticket_tab create_ticket_tab;
32 public Xcls_table table;
33 public Xcls_project_id project_id;
34 public Xcls_tprcellrenderer tprcellrenderer;
35 public Xcls_tprmodel tprmodel;
36 public Xcls_summary summary;
37 public Xcls_milestone_id milestone_id;
38 public Xcls_msmodel msmodel;
39 public Xcls_description description;
40 public Xcls_priority_id priority_id;
41 public Xcls_primodel primodel;
42 public Xcls_severity_id severity_id;
43 public Xcls_sevmodel sevmodel;
44 public Xcls_classification_id classification_id;
45 public Xcls_clmodel clmodel;
46 public Xcls_developer_id developer_id;
47 public Xcls_devmodel devmodel;
48 public Xcls_quick_commit_tab quick_commit_tab;
49 public Xcls_commit_message commit_message;
50 public Xcls_createbtn createbtn;
51 public Xcls_diff_view diff_view;
56 public Gee.ArrayList<GitMonitorQueue> queue;
62 this.el = new Gtk.Dialog();
70 this.el.title = "Create a working branch ";
71 this.el.default_height = 500;
72 this.el.default_width = 500;
73 this.el.deletable = true;
75 var child_0 = new Xcls_Notebook2( _this );
77 this.el.get_content_area().add ( child_0.el );
80 this.el.delete_event.connect( (self, event) => {
85 this.el.response.connect( (self, response_id) => {
87 GLib.debug("got %d", (int) response_id);
92 // have they selected a ticket..
93 // make that the current active ticket?
94 // we really need to store locally what ticket is being worked on..
95 // in theory we could be working on multiple project and not merging..
96 // -- each repo would have their active ticket (only one per repo)
97 // -- so we could just store that in there
98 // -- initial load can check the contents of the ticket files on first scan.
101 if (response_id < 1) {
103 this.running = false;
107 var ticket_id = _this.ticketsel.selectedTicketId();
109 if (this.repo != null) {
110 var bn = _this.name.el.get_text();
112 var res = this.repo.setActiveTicket(
113 RooTicket.singleton().getById(ticket_id != "" ? ticket_id : "-1"), bn
116 // start the monitoring..
117 GitMonitor.gitmonitor.start();
123 this.running = false;
133 // user defined functions
134 public void show ( GitRepo repo, Gee.ArrayList<GitMonitorQueue> queue, string tid = "" )
136 // this.el.set_gravity(Gdk.Gravity.NORTH);
137 if (this.running) { // should not happen!!
138 GLib.error("new branch show called, when already being displayed?");
144 GitMonitor.gitmonitor.stop();
148 this.el.move((Gdk.Screen.width() / 2)- 250 ,0);
149 this.el.set_default_size( 500,200); // not sure why it grows..
157 this.el.set_keep_above(true);
159 _this.select_ticket_tab.load_data(tid);
160 _this.create_ticket_tab.load_data();
161 _this.quick_commit_tab.load_data();
172 public class Xcls_Notebook2 : Object
174 public Gtk.Notebook el;
175 private NewBranch _this;
181 public Xcls_Notebook2(NewBranch _owner )
184 this.el = new Gtk.Notebook();
188 // set gobject values
189 this.el.vexpand = true;
190 var child_0 = new Xcls_label_select_ticket( _this );
192 var child_1 = new Xcls_label_create_ticket( _this );
194 var child_2 = new Xcls_label_quick_commit( _this );
196 var child_3 = new Xcls_select_ticket_tab( _this );
198 this.el.append_page ( child_3.el , _this.label_select_ticket.el );
199 var child_4 = new Xcls_create_ticket_tab( _this );
201 this.el.append_page ( child_4.el , _this.label_create_ticket.el );
202 var child_5 = new Xcls_quick_commit_tab( _this );
204 this.el.append_page ( child_5.el , _this.label_quick_commit.el );
207 this.el.switch_page.connect( (page, page_num) => {
208 GLib.debug("Switch to page: %d", (int)page_num);
213 // user defined functions
215 public class Xcls_label_select_ticket : Object
218 private NewBranch _this;
224 public Xcls_label_select_ticket(NewBranch _owner )
227 _this.label_select_ticket = this;
228 this.el = new Gtk.Label( "Select Existing Ticket to work on" );
232 // set gobject values
235 // user defined functions
238 public class Xcls_label_create_ticket : Object
241 private NewBranch _this;
247 public Xcls_label_create_ticket(NewBranch _owner )
250 _this.label_create_ticket = this;
251 this.el = new Gtk.Label( "Create a New Ticket" );
255 // set gobject values
258 // user defined functions
261 public class Xcls_label_quick_commit : Object
264 private NewBranch _this;
270 public Xcls_label_quick_commit(NewBranch _owner )
273 _this.label_quick_commit = this;
274 this.el = new Gtk.Label( "Quick Commit" );
278 // set gobject values
281 // user defined functions
284 public class Xcls_select_ticket_tab : Object
287 private NewBranch _this;
293 public Xcls_select_ticket_tab(NewBranch _owner )
296 _this.select_ticket_tab = this;
297 this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
301 // set gobject values
302 this.el.homogeneous = false;
303 var child_0 = new Xcls_Table7( _this );
305 this.el.pack_start ( child_0.el , false,false,0 );
306 var child_1 = new Xcls_scrolled_window( _this );
308 this.el.add ( child_1.el );
311 // user defined functions
312 public void load_data (string tid = "") {
314 GLib.debug("Loading tickets");
316 var curproj = RooProject.getProjectByRepo(_this.repo);
317 _this.prmodel.loadProjects(curproj == null ? "" : curproj.id);
319 _this.dbmodel.loadTickets(curproj == null ? "": curproj.id, tid);
320 _this.branchbtn.updateState();
322 _this.ticketsel.el.get_child().get_style_context().remove_class("warning");
324 var name = RooTicket.singleton().usernameLocal();
325 var ticket = RooTicket.singleton().getById(tid);
326 _this.name.el.set_text("wip_%s_T%s_%s".printf(name,ticket.id, ticket.summaryToBranchName()));
328 _this.ticketsel.el.get_child().get_style_context().add_class("warning");
330 _this.view.loadTicket(tid);
335 public class Xcls_Table7 : Object
338 private NewBranch _this;
344 public Xcls_Table7(NewBranch _owner )
347 this.el = new Gtk.Table( 5, 5, true );
351 // set gobject values
352 this.el.expand = false;
354 this.el.column_spacing = 4;
355 this.el.vexpand = false;
356 var child_0 = new Xcls_Label8( _this );
358 this.el.attach_defaults ( child_0.el , 0,1,0,1 );
359 var child_1 = new Xcls_Label9( _this );
361 this.el.attach_defaults ( child_1.el , 1,2,0,1 );
362 var child_2 = new Xcls_projectsel( _this );
364 this.el.attach_defaults ( child_2.el , 0,1,1,2 );
365 var child_3 = new Xcls_ticketsel( _this );
367 this.el.attach_defaults ( child_3.el , 1,5,1,2 );
368 var child_4 = new Xcls_Label16( _this );
370 this.el.attach_defaults ( child_4.el , 0,1,3,4 );
371 var child_5 = new Xcls_name( _this );
373 this.el.attach_defaults ( child_5.el , 0,4,4,5 );
374 var child_6 = new Xcls_branchbtn( _this );
376 this.el.attach_defaults ( child_6.el , 4,5,4,5 );
377 var child_7 = new Xcls_Box19( _this );
379 this.el.attach_defaults ( child_7.el , 0,5,2,3 );
382 // user defined functions
384 public class Xcls_Label8 : Object
387 private NewBranch _this;
393 public Xcls_Label8(NewBranch _owner )
396 this.el = new Gtk.Label( "Project" );
400 // set gobject values
401 this.el.halign = Gtk.Align.START;
402 this.el.justify = Gtk.Justification.RIGHT;
403 this.el.visible = true;
406 // user defined functions
409 public class Xcls_Label9 : Object
412 private NewBranch _this;
418 public Xcls_Label9(NewBranch _owner )
421 this.el = new Gtk.Label( "Ticket" );
425 // set gobject values
426 this.el.halign = Gtk.Align.START;
427 this.el.visible = true;
430 // user defined functions
433 public class Xcls_projectsel : Object
435 public Gtk.ComboBox el;
436 private NewBranch _this;
443 public Xcls_projectsel(NewBranch _owner )
446 _this.projectsel = this;
447 this.el = new Gtk.ComboBox.with_entry();
450 this.loading = false;
452 // set gobject values
453 var child_0 = new Xcls_prcellrenderer( _this );
455 this.el.pack_start ( child_0.el , true );
456 var child_1 = new Xcls_prmodel( _this );
458 this.el.set_model ( child_1.el );
462 this.el.set_entry_text_column(1);
465 this.el.changed.connect( () => {
469 var project_id = this.selectedProjectId();
470 _this.dbmodel.loadTickets(project_id);
473 /*if (this.loading) {
476 var ticket_id = this.selectedTicketId();
478 var name = RooTicket.singleton().usernameLocal();
480 if (ticket_id == "" || ticket_id == null) {
482 var dt = new DateTime.now_local();
483 _this.name.el.set_text("wip_%s_%s".printf(name,dt.format("%Y_%b_%d")));
488 var ticket = RooTicket.singleton().getById(ticket_id);
490 _this.name.el.set_text("wip_%s_T%s_%s".printf(name,ticket.id, ticket.summaryToBranchName()));
492 //GLib.debug (//"Selection: %s, %s\n", (string) val1, (string) val2);
497 // user defined functions
498 public string selectedProjectId () {
503 this.el.get_active_iter (out iter);
504 _this.prmodel.el.get_value (iter, 0, out val1);
507 return (string) val1;
514 public class Xcls_prcellrenderer : Object
516 public Gtk.CellRendererText el;
517 private NewBranch _this;
523 public Xcls_prcellrenderer(NewBranch _owner )
526 _this.prcellrenderer = this;
527 this.el = new Gtk.CellRendererText();
531 // set gobject values
534 // user defined functions
537 public class Xcls_prmodel : Object
539 public Gtk.ListStore el;
540 private NewBranch _this;
546 public Xcls_prmodel(NewBranch _owner )
549 _this.prmodel = this;
550 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
554 // set gobject values
557 // user defined functions
558 public void loadProjects (string id) {
562 _this.projectsel.loading = true;
571 el.set_value(iter, 0, "");
572 el.set_value(iter, 1, "-- select a project --");
574 _this.projectsel.el.set_active_iter(iter);
577 foreach(var project in RooProject.projects()) {
581 el.set_value(iter, 0, project.id);
582 el.set_value(iter, 1, project.name );
583 if (id == project.id) {
584 _this.projectsel.el.set_active_iter(iter);
589 _this.projectsel.loading = false;
590 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
596 public class Xcls_ticketsel : Object
598 public Gtk.ComboBox el;
599 private NewBranch _this;
606 public Xcls_ticketsel(NewBranch _owner )
609 _this.ticketsel = this;
610 this.el = new Gtk.ComboBox.with_entry();
613 this.loading = false;
615 // set gobject values
616 var child_0 = new Xcls_dbcellrenderer( _this );
618 this.el.pack_start ( child_0.el , true );
619 var child_1 = new Xcls_dbmodel( _this );
621 this.el.set_model ( child_1.el );
625 //this.el.add_attribute(_this.dbcellrenderer.el , "markup", 1 );
626 this.el.set_entry_text_column(1);
627 this.el.get_child().set_sensitive(false);
630 this.el.changed.connect( () => {
634 var ticket_id = this.selectedTicketId();
636 var name = RooTicket.singleton().usernameLocal();
638 this.el.get_child().get_style_context().remove_class("warning");
639 if (ticket_id == "" || ticket_id == null) {
641 var dt = new DateTime.now_local();
642 _this.name.el.set_text("wip_%s_%s".printf(name,dt.format("%Y_%b_%d")));
643 _this.view.loadTicket("");
645 this.el.get_child().get_style_context().add_class("warning");
646 _this.createbtn.updateState();
651 var ticket = RooTicket.singleton().getById(ticket_id);
653 _this.name.el.set_text("wip_%s_T%s_%s".printf(name,ticket.id, ticket.summaryToBranchName()));
654 _this.scrolled_window.el.show();
656 _this.view.loadTicket(ticket.id);
657 _this.branchbtn.updateState();
659 //GLib.debug (//"Selection: %s, %s\n", (string) val1, (string) val2);
663 // user defined functions
664 public string selectedTicketId () {
669 this.el.get_active_iter (out iter);
670 _this.dbmodel.el.get_value (iter, 0, out val1);
673 return (string) val1;
680 public class Xcls_dbcellrenderer : Object
682 public Gtk.CellRendererText el;
683 private NewBranch _this;
689 public Xcls_dbcellrenderer(NewBranch _owner )
692 _this.dbcellrenderer = this;
693 this.el = new Gtk.CellRendererText();
697 // set gobject values
700 // user defined functions
703 public class Xcls_dbmodel : Object
705 public Gtk.ListStore el;
706 private NewBranch _this;
712 public Xcls_dbmodel(NewBranch _owner )
715 _this.dbmodel = this;
716 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
720 // set gobject values
723 // user defined functions
724 public void loadTickets (string project_id , string tid = "") {
728 // fixme .. get project id from selection..
730 RooTicket.singleton().loadTickets(
732 _this.btn_not_me.el.active ? RooTicket.Who.ANYBODY : RooTicket.Who.ME,
733 _this.btn_closed.el.active ? RooTicket.Status.ALL : RooTicket.Status.ACTIVE
736 _this.ticketsel.loading = true;
745 el.set_value(iter, 0, "");
746 el.set_value(iter, 1, "-- select a ticket --");
748 _this.ticketsel.el.set_active_iter(iter);
749 var tickets = RooTicket.singleton().tickets;
750 foreach(var ticket in tickets) {
754 el.set_value(iter, 0, ticket.id);
755 el.set_value(iter, 1, "#%s %s".printf( ticket.id, ticket.summary));
757 if (ticket.id == tid) {
758 _this.ticketsel.el.set_active_iter(iter);
763 _this.ticketsel.loading = false;
764 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
770 public class Xcls_Label16 : Object
773 private NewBranch _this;
779 public Xcls_Label16(NewBranch _owner )
782 this.el = new Gtk.Label( "Use this as branch name" );
786 // set gobject values
787 this.el.halign = Gtk.Align.START;
788 this.el.justify = Gtk.Justification.RIGHT;
789 this.el.xalign = 0.900000f;
792 // user defined functions
795 public class Xcls_name : Object
798 private NewBranch _this;
804 public Xcls_name(NewBranch _owner )
808 this.el = new Gtk.Entry();
812 // set gobject values
813 this.el.visible = true;
816 // user defined functions
819 public class Xcls_branchbtn : Object
821 public Gtk.Button el;
822 private NewBranch _this;
828 public Xcls_branchbtn(NewBranch _owner )
831 _this.branchbtn = this;
832 this.el = new Gtk.Button();
836 // set gobject values
837 this.el.label = "Create Branch";
842 this.el.get_style_context().add_class("suggested-action");
846 this.el.clicked.connect( () => {
848 GLib.debug("fire response = 1");
850 var ticket_id = _this.ticketsel.selectedTicketId();
852 if (ticket_id == "") {
853 _this.ticketsel.el.get_child().get_style_context().add_class("warning");
857 _this.el.response(1);
861 // user defined functions
862 public void updateState () {
864 var ticket_id = _this.ticketsel.selectedTicketId();
866 if (ticket_id == "") {
867 this.el.set_sensitive(false);
871 this.el.set_sensitive(true);
876 public class Xcls_Box19 : Object
879 private NewBranch _this;
885 public Xcls_Box19(NewBranch _owner )
888 this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
892 // set gobject values
893 var child_0 = new Xcls_btn_not_me( _this );
895 this.el.add ( child_0.el );
896 var child_1 = new Xcls_btn_closed( _this );
898 this.el.add ( child_1.el );
899 var child_2 = new Xcls_Label22( _this );
901 this.el.add ( child_2.el );
904 // user defined functions
906 public class Xcls_btn_not_me : Object
908 public Gtk.CheckButton el;
909 private NewBranch _this;
915 public Xcls_btn_not_me(NewBranch _owner )
918 _this.btn_not_me = this;
919 this.el = new Gtk.CheckButton();
923 // set gobject values
924 this.el.label = "Show tickets not assigned to me";
927 this.el.toggled.connect( () => {
928 var project_id = _this.projectsel.selectedProjectId();
929 _this.dbmodel.loadTickets(project_id);
933 // user defined functions
936 public class Xcls_btn_closed : Object
938 public Gtk.CheckButton el;
939 private NewBranch _this;
945 public Xcls_btn_closed(NewBranch _owner )
948 _this.btn_closed = this;
949 this.el = new Gtk.CheckButton();
953 // set gobject values
954 this.el.label = "Show closed Tickets";
957 this.el.toggled.connect( () => {
958 var project_id = _this.projectsel.selectedProjectId();
959 _this.dbmodel.loadTickets(project_id);
964 // user defined functions
967 public class Xcls_Label22 : Object
970 private NewBranch _this;
976 public Xcls_Label22(NewBranch _owner )
979 this.el = new Gtk.Label( "<a href=\"refresh\">Refresh Ticket list</a>" );
983 // set gobject values
984 this.el.halign = Gtk.Align.END;
985 this.el.hexpand = true;
986 this.el.use_markup = true;
989 this.el.activate_link.connect( (uri) => {
990 if (uri == "refresh") {
992 var curproj = RooProject.getProjectByRepo(_this.repo);
993 _this.prmodel.loadProjects(curproj == null ? "": curproj.id);
995 _this.dbmodel.loadTickets(curproj == null ? "": curproj.id);
1001 // user defined functions
1006 public class Xcls_scrolled_window : Object
1008 public Gtk.ScrolledWindow el;
1009 private NewBranch _this;
1015 public Xcls_scrolled_window(NewBranch _owner )
1018 _this.scrolled_window = this;
1019 this.el = new Gtk.ScrolledWindow( null, null );
1023 // set gobject values
1024 this.el.height_request = 500;
1025 this.el.vexpand = true;
1026 var child_0 = new Xcls_view( _this );
1028 this.el.add ( child_0.el );
1033 this.el.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);
1037 // user defined functions
1039 public class Xcls_view : Object
1041 public WebKit.WebView el;
1042 private NewBranch _this;
1048 public Xcls_view(NewBranch _owner )
1052 this.el = new WebKit.WebView();
1056 // set gobject values
1059 // user defined functions
1060 public void loadTicket (string tid) {
1062 _this.el.get_size(out w, out h);
1065 _this.scrolled_window.el.hide();
1066 _this.el.resize(w, 150);
1068 _this.scrolled_window.el.show();
1069 _this.el.resize(w, 800);
1072 var rs = RooTicket.singleton();
1073 var uri = new WebKit.URIRequest("https://roojs.com/admin.php/MTrack/View/" + tid);
1074 var hd = uri.get_http_headers();
1075 var authCode = Base64.encode ("%s:%s".printf(rs.username, rs.password).data);
1076 hd.append("Authorization", "Basic %s".printf(authCode));
1078 this.el.load_request(uri);
1084 public class Xcls_create_ticket_tab : Object
1087 private NewBranch _this;
1093 public Xcls_create_ticket_tab(NewBranch _owner )
1096 _this.create_ticket_tab = this;
1097 this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
1101 // set gobject values
1102 this.el.homogeneous = false;
1103 var child_0 = new Xcls_table( _this );
1105 this.el.pack_start ( child_0.el , false,false,0 );
1108 // user defined functions
1109 public void load_data () {
1113 Timeout.add_seconds(1, () => {
1115 RooProject? curproj = null;
1116 if (_this.repo != null) {
1117 curproj = RooProject.getProjectByRepo(_this.repo);
1119 _this.prmodel.loadProjects(curproj == null ? "" : curproj.id);
1120 if (curproj != null) {
1123 var rt = RooTicket.singleton();
1124 rt.loadProjectOptions(curproj.id);
1126 _this.msmodel.loadMilestones();
1127 _this.primodel.loadPriorities();
1128 _this.sevmodel.loadSeverities();
1129 _this.clmodel.loadClassifications();
1130 _this.devmodel.loadDevelopers();
1133 _this.summary.el.set_text("");
1134 _this.description.el.buffer.text = "";
1135 //_this.spinner.el.stop();
1136 //_this.spinner.el.hide();
1138 _this.table.el.show();
1139 //_this.summary.el.grab_focus();
1145 public class Xcls_table : Object
1147 public Gtk.Table el;
1148 private NewBranch _this;
1154 public Xcls_table(NewBranch _owner )
1158 this.el = new Gtk.Table( 14, 4, true );
1162 // set gobject values
1163 this.el.expand = false;
1165 this.el.column_spacing = 4;
1166 this.el.vexpand = false;
1167 var child_0 = new Xcls_Label27( _this );
1169 this.el.attach_defaults ( child_0.el , 0,1,0,1 );
1170 var child_1 = new Xcls_Label28( _this );
1172 this.el.attach_defaults ( child_1.el , 1,2,0,1 );
1173 var child_2 = new Xcls_project_id( _this );
1175 this.el.attach_defaults ( child_2.el , 0,1,1,2 );
1176 var child_3 = new Xcls_summary( _this );
1178 this.el.attach_defaults ( child_3.el , 1,4,1,2 );
1179 var child_4 = new Xcls_Label33( _this );
1181 this.el.attach_defaults ( child_4.el , 0,1,2,3 );
1182 var child_5 = new Xcls_milestone_id( _this );
1184 this.el.attach_defaults ( child_5.el , 0,1,3,4 );
1185 var child_6 = new Xcls_Label36( _this );
1187 this.el.attach_defaults ( child_6.el , 1,4,2,3 );
1188 var child_7 = new Xcls_description( _this );
1190 this.el.attach_defaults ( child_7.el , 1,4,3,12 );
1191 var child_8 = new Xcls_Label38( _this );
1193 this.el.attach_defaults ( child_8.el , 0,1,4,5 );
1194 var child_9 = new Xcls_priority_id( _this );
1196 this.el.attach_defaults ( child_9.el , 0,1,5,6 );
1197 var child_10 = new Xcls_Label41( _this );
1199 this.el.attach_defaults ( child_10.el , 0,1,6,7 );
1200 var child_11 = new Xcls_severity_id( _this );
1202 this.el.attach_defaults ( child_11.el , 0,1,7,8 );
1203 var child_12 = new Xcls_Label44( _this );
1205 this.el.attach_defaults ( child_12.el , 0,1,8,9 );
1206 var child_13 = new Xcls_classification_id( _this );
1208 this.el.attach_defaults ( child_13.el , 0,1,9,10 );
1209 var child_14 = new Xcls_Label47( _this );
1211 this.el.attach_defaults ( child_14.el , 0,1,10,11 );
1212 var child_15 = new Xcls_developer_id( _this );
1214 this.el.attach_defaults ( child_15.el , 0,1,11,12 );
1215 var child_16 = new Xcls_Button50( _this );
1217 this.el.attach_defaults ( child_16.el , 0,4,13,14 );
1220 // user defined functions
1222 public class Xcls_Label27 : Object
1224 public Gtk.Label el;
1225 private NewBranch _this;
1231 public Xcls_Label27(NewBranch _owner )
1234 this.el = new Gtk.Label( "Project" );
1238 // set gobject values
1239 this.el.halign = Gtk.Align.START;
1240 this.el.visible = true;
1243 // user defined functions
1246 public class Xcls_Label28 : Object
1248 public Gtk.Label el;
1249 private NewBranch _this;
1255 public Xcls_Label28(NewBranch _owner )
1258 this.el = new Gtk.Label( "Summary" );
1262 // set gobject values
1263 this.el.halign = Gtk.Align.START;
1264 this.el.visible = true;
1267 // user defined functions
1270 public class Xcls_project_id : Object
1272 public Gtk.ComboBox el;
1273 private NewBranch _this;
1277 public bool loading;
1280 public Xcls_project_id(NewBranch _owner )
1283 _this.project_id = this;
1284 this.el = new Gtk.ComboBox.with_entry();
1287 this.loading = false;
1289 // set gobject values
1290 var child_0 = new Xcls_tprcellrenderer( _this );
1292 this.el.pack_start ( child_0.el , true );
1293 var child_1 = new Xcls_tprmodel( _this );
1295 this.el.set_model ( child_1.el );
1299 this.el.set_entry_text_column(1);
1302 this.el.changed.connect( () => {
1306 var project_id = this.selectedProjectId();
1308 var rt = RooTicket.singleton();
1309 rt.loadProjectOptions(project_id);
1311 _this.msmodel.loadMilestones();
1312 _this.primodel.loadPriorities();
1313 _this.sevmodel.loadSeverities();
1314 _this.clmodel.loadClassifications();
1315 _this.devmodel.loadDevelopers();
1317 // affects projects and milestones..
1320 /*if (this.loading) {
1323 var ticket_id = this.selectedTicketId();
1325 var name = RooTicket.singleton().usernameLocal();
1327 if (ticket_id == "" || ticket_id == null) {
1329 var dt = new DateTime.now_local();
1330 _this.name.el.set_text("wip_%s_%s".printf(name,dt.format("%Y_%b_%d")));
1335 var ticket = RooTicket.singleton().getById(ticket_id);
1337 _this.name.el.set_text("wip_%s_T%s_%s".printf(name,ticket.id, ticket.summaryToBranchName()));
1339 //GLib.debug (//"Selection: %s, %s\n", (string) val1, (string) val2);
1344 // user defined functions
1345 public string selectedProjectId () {
1350 this.el.get_active_iter (out iter);
1351 _this.tprmodel.el.get_value (iter, 0, out val1);
1354 return (string) val1;
1361 public class Xcls_tprcellrenderer : Object
1363 public Gtk.CellRendererText el;
1364 private NewBranch _this;
1370 public Xcls_tprcellrenderer(NewBranch _owner )
1373 _this.tprcellrenderer = this;
1374 this.el = new Gtk.CellRendererText();
1378 // set gobject values
1381 // user defined functions
1384 public class Xcls_tprmodel : Object
1386 public Gtk.ListStore el;
1387 private NewBranch _this;
1393 public Xcls_tprmodel(NewBranch _owner )
1396 _this.tprmodel = this;
1397 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
1401 // set gobject values
1404 // user defined functions
1405 public void loadProjects (string id) {
1408 _this.project_id.loading = true;
1414 el.append(out iter);
1417 el.set_value(iter, 0, "");
1418 el.set_value(iter, 1, "-- select a project --");
1420 _this.project_id.el.set_active_iter(iter);
1423 foreach(var project in RooProject.projects()) {
1425 el.append(out iter);
1427 el.set_value(iter, 0, project.id);
1428 el.set_value(iter, 1, project.name );
1429 if (id == project.id) {
1430 _this.project_id.el.set_active_iter(iter);
1435 _this.project_id.loading = false;
1436 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
1442 public class Xcls_summary : Object
1444 public Gtk.Entry el;
1445 private NewBranch _this;
1451 public Xcls_summary(NewBranch _owner )
1454 _this.summary = this;
1455 this.el = new Gtk.Entry();
1459 // set gobject values
1460 this.el.visible = true;
1463 // user defined functions
1466 public class Xcls_Label33 : Object
1468 public Gtk.Label el;
1469 private NewBranch _this;
1475 public Xcls_Label33(NewBranch _owner )
1478 this.el = new Gtk.Label( "Milestone" );
1482 // set gobject values
1483 this.el.halign = Gtk.Align.START;
1484 this.el.justify = Gtk.Justification.RIGHT;
1485 this.el.xalign = 0.900000f;
1488 // user defined functions
1491 public class Xcls_milestone_id : Object
1493 public Gtk.ComboBox el;
1494 private NewBranch _this;
1498 public bool loading;
1501 public Xcls_milestone_id(NewBranch _owner )
1504 _this.milestone_id = this;
1505 this.el = new Gtk.ComboBox.with_entry();
1508 this.loading = false;
1510 // set gobject values
1511 var child_0 = new Xcls_msmodel( _this );
1513 this.el.set_model ( child_0.el );
1517 this.el.set_entry_text_column(1);
1520 // user defined functions
1521 public string selectedMilestoneId () {
1526 this.el.get_active_iter (out iter);
1527 _this.msmodel.el.get_value (iter, 0, out val1);
1530 return (string) val1;
1537 public class Xcls_msmodel : Object
1539 public Gtk.ListStore el;
1540 private NewBranch _this;
1546 public Xcls_msmodel(NewBranch _owner )
1549 _this.msmodel = this;
1550 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
1554 // set gobject values
1557 // user defined functions
1558 public void loadMilestones ( ) {
1560 var rt = RooTicket.singleton();
1561 // rt.loadProjects();
1563 _this.milestone_id.loading = true;
1569 el.append(out iter);
1572 el.set_value(iter, 0, "");
1573 el.set_value(iter, 1, "-- select a milestone --");
1574 _this.milestone_id.el.set_active_iter(iter);
1576 var projects = rt.milestones;
1577 foreach(var project in projects) {
1579 el.append(out iter);
1581 el.set_value(iter, 0, project.id);
1582 el.set_value(iter, 1, project.display_name );
1583 // if (id == project.id) {
1584 // _this.milestone.el.set_active_iter(iter);
1590 _this.milestone_id.loading = false;
1591 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
1597 public class Xcls_Label36 : Object
1599 public Gtk.Label el;
1600 private NewBranch _this;
1606 public Xcls_Label36(NewBranch _owner )
1609 this.el = new Gtk.Label( "Description" );
1613 // set gobject values
1614 this.el.halign = Gtk.Align.START;
1617 // user defined functions
1620 public class Xcls_description : Object
1622 public Gtk.TextView el;
1623 private NewBranch _this;
1629 public Xcls_description(NewBranch _owner )
1632 _this.description = this;
1633 this.el = new Gtk.TextView();
1637 // set gobject values
1638 this.el.border_width = 1;
1641 // user defined functions
1644 public class Xcls_Label38 : Object
1646 public Gtk.Label el;
1647 private NewBranch _this;
1653 public Xcls_Label38(NewBranch _owner )
1656 this.el = new Gtk.Label( "Priority" );
1660 // set gobject values
1661 this.el.halign = Gtk.Align.START;
1662 this.el.xalign = 0.900000f;
1665 // user defined functions
1668 public class Xcls_priority_id : Object
1670 public Gtk.ComboBox el;
1671 private NewBranch _this;
1675 public bool loading;
1678 public Xcls_priority_id(NewBranch _owner )
1681 _this.priority_id = this;
1682 this.el = new Gtk.ComboBox.with_entry();
1685 this.loading = false;
1687 // set gobject values
1688 var child_0 = new Xcls_primodel( _this );
1690 this.el.set_model ( child_0.el );
1694 this.el.set_entry_text_column(1);
1697 // user defined functions
1698 public string selectedPriorityId () {
1703 this.el.get_active_iter (out iter);
1704 _this.primodel.el.get_value (iter, 0, out val1);
1707 return (string) val1;
1714 public class Xcls_primodel : Object
1716 public Gtk.ListStore el;
1717 private NewBranch _this;
1723 public Xcls_primodel(NewBranch _owner )
1726 _this.primodel = this;
1727 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
1731 // set gobject values
1734 // user defined functions
1735 public void loadPriorities ( ) {
1737 var rt = RooTicket.singleton();
1738 // rt.loadProjects();
1740 _this.priority_id.loading = true;
1747 var projects = rt.priorities;
1748 foreach(var project in projects) {
1750 el.append(out iter);
1752 el.set_value(iter, 0, project.id);
1753 el.set_value(iter, 1, project.display_name );
1754 if ("normal" == project.name) {
1755 _this.priority_id.el.set_active_iter(iter);
1760 _this.priority_id.loading = false;
1767 public class Xcls_Label41 : Object
1769 public Gtk.Label el;
1770 private NewBranch _this;
1776 public Xcls_Label41(NewBranch _owner )
1779 this.el = new Gtk.Label( "Severity" );
1783 // set gobject values
1784 this.el.halign = Gtk.Align.START;
1787 // user defined functions
1790 public class Xcls_severity_id : Object
1792 public Gtk.ComboBox el;
1793 private NewBranch _this;
1797 public bool loading;
1800 public Xcls_severity_id(NewBranch _owner )
1803 _this.severity_id = this;
1804 this.el = new Gtk.ComboBox.with_entry();
1807 this.loading = false;
1809 // set gobject values
1810 var child_0 = new Xcls_sevmodel( _this );
1812 this.el.set_model ( child_0.el );
1816 this.el.set_entry_text_column(1);
1819 // user defined functions
1820 public string selectedSeverityId () {
1825 this.el.get_active_iter (out iter);
1826 _this.sevmodel.el.get_value (iter, 0, out val1);
1829 return (string) val1;
1836 public class Xcls_sevmodel : Object
1838 public Gtk.ListStore el;
1839 private NewBranch _this;
1845 public Xcls_sevmodel(NewBranch _owner )
1848 _this.sevmodel = this;
1849 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
1853 // set gobject values
1856 // user defined functions
1857 public void loadSeverities () {
1859 var rt = RooTicket.singleton();
1860 //rt.loadProjects();
1862 _this.severity_id.loading = true;
1868 var projects = rt.serverities;
1869 foreach(var project in projects) {
1871 el.append(out iter);
1873 el.set_value(iter, 0, project.id);
1874 el.set_value(iter, 1, project.display_name );
1875 if ("normal" == project.name) {
1876 _this.severity_id.el.set_active_iter(iter);
1881 _this.severity_id.loading = false;
1882 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
1888 public class Xcls_Label44 : Object
1890 public Gtk.Label el;
1891 private NewBranch _this;
1897 public Xcls_Label44(NewBranch _owner )
1900 this.el = new Gtk.Label( "Classification" );
1904 // set gobject values
1905 this.el.halign = Gtk.Align.START;
1908 // user defined functions
1911 public class Xcls_classification_id : Object
1913 public Gtk.ComboBox el;
1914 private NewBranch _this;
1918 public bool loading;
1921 public Xcls_classification_id(NewBranch _owner )
1924 _this.classification_id = this;
1925 this.el = new Gtk.ComboBox.with_entry();
1928 this.loading = false;
1930 // set gobject values
1931 var child_0 = new Xcls_clmodel( _this );
1933 this.el.set_model ( child_0.el );
1937 this.el.set_entry_text_column(1);
1940 // user defined functions
1941 public string selectedClassificationId () {
1946 this.el.get_active_iter (out iter);
1947 _this.clmodel.el.get_value (iter, 0, out val1);
1950 return (string) val1;
1957 public class Xcls_clmodel : Object
1959 public Gtk.ListStore el;
1960 private NewBranch _this;
1966 public Xcls_clmodel(NewBranch _owner )
1969 _this.clmodel = this;
1970 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
1974 // set gobject values
1977 // user defined functions
1978 public void loadClassifications ( ) {
1980 var rt = RooTicket.singleton();
1981 // rt.loadProjects();
1983 _this.classification_id.loading = true;
1989 el.append(out iter);
1992 var projects = rt.classifications;
1993 foreach(var project in projects) {
1995 el.append(out iter);
1997 el.set_value(iter, 0, project.id);
1998 el.set_value(iter, 1, project.display_name );
1999 if ("bug" == project.name) {
2000 _this.classification_id.el.set_active_iter(iter);
2005 _this.classification_id.loading = false;
2006 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
2012 public class Xcls_Label47 : Object
2014 public Gtk.Label el;
2015 private NewBranch _this;
2021 public Xcls_Label47(NewBranch _owner )
2024 this.el = new Gtk.Label( "Assign to" );
2028 // set gobject values
2029 this.el.halign = Gtk.Align.START;
2032 // user defined functions
2035 public class Xcls_developer_id : Object
2037 public Gtk.ComboBox el;
2038 private NewBranch _this;
2042 public bool loading;
2045 public Xcls_developer_id(NewBranch _owner )
2048 _this.developer_id = this;
2049 this.el = new Gtk.ComboBox.with_entry();
2052 this.loading = false;
2054 // set gobject values
2055 var child_0 = new Xcls_devmodel( _this );
2057 this.el.set_model ( child_0.el );
2061 this.el.set_entry_text_column(1);
2064 // user defined functions
2065 public string selectedDeveloperId () {
2070 this.el.get_active_iter (out iter);
2071 _this.devmodel.el.get_value (iter, 0, out val1);
2074 return (string) val1;
2081 public class Xcls_devmodel : Object
2083 public Gtk.ListStore el;
2084 private NewBranch _this;
2090 public Xcls_devmodel(NewBranch _owner )
2093 _this.devmodel = this;
2094 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
2098 // set gobject values
2101 // user defined functions
2102 public void loadDevelopers ( ) {
2104 var rt = RooTicket.singleton();
2105 //rt.loadProjects();
2107 _this.developer_id.loading = true;
2113 el.append(out iter);
2116 el.set_value(iter, 0, "");
2117 el.set_value(iter, 1, "-- select a developer --");
2119 _this.developer_id.el.set_active_iter(iter);
2122 var peps = rt.developers;
2123 foreach(var p in peps) {
2125 el.append(out iter);
2127 el.set_value(iter, 0, p.id);
2128 el.set_value(iter, 1, p.display_name );
2129 if (rt.authuser_id == p.id) {
2130 _this.developer_id.el.set_active_iter(iter);
2134 _this.developer_id.loading = false;
2135 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
2141 public class Xcls_Button50 : Object
2143 public Gtk.Button el;
2144 private NewBranch _this;
2150 public Xcls_Button50(NewBranch _owner )
2153 this.el = new Gtk.Button();
2157 // set gobject values
2158 this.el.label = "Create Ticket & Branch";
2163 this.el.get_style_context().add_class("suggested-action");
2167 this.el.clicked.connect( () => {
2168 GLib.debug("fire response = 1");
2171 var invalid = false;
2173 // validate first...
2174 _this.project_id.el.get_child().get_style_context().remove_class("warning");
2175 if (_this.project_id.selectedProjectId() == "") {
2176 _this.project_id.el.get_child().get_style_context().add_class("warning");
2180 _this.milestone_id.el.get_child().get_style_context().remove_class("warning");
2182 _this.priority_id.el.get_child().get_style_context().remove_class("warning");
2183 if (_this.priority_id.selectedPriorityId() == "") {
2184 _this.priority_id.el.get_child().get_style_context().add_class("warning");
2188 _this.classification_id.el.get_child().get_style_context().remove_class("warning");
2189 if (_this.classification_id.selectedClassificationId() == "") {
2190 _this.classification_id.el.get_child().get_style_context().add_class("warning");
2194 _this.developer_id.el.get_child().get_style_context().remove_class("warning");
2195 if (_this.developer_id.selectedDeveloperId() == "") {
2196 _this.developer_id.el.get_child().get_style_context().add_class("warning");
2200 _this.summary.el.get_style_context().remove_class("warning");
2201 if (_this.summary.el.get_text() == "") {
2202 _this.summary.el.get_style_context().add_class("warning");
2206 _this.description.el.get_style_context().remove_class("warning");
2211 GLib.debug("for is valid");
2213 _this.el.response(1);
2217 // user defined functions
2222 public class Xcls_quick_commit_tab : Object
2225 private NewBranch _this;
2231 public Xcls_quick_commit_tab(NewBranch _owner )
2234 _this.quick_commit_tab = this;
2235 this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
2239 // set gobject values
2240 this.el.homogeneous = false;
2241 var child_0 = new Xcls_Table52( _this );
2243 this.el.pack_start ( child_0.el , false,false,0 );
2244 var child_1 = new Xcls_ScrolledWindow56( _this );
2246 this.el.add ( child_1.el );
2249 // user defined functions
2250 public void load_data () {
2251 _this.commit_message.el.set_text("");
2255 public class Xcls_Table52 : Object
2257 public Gtk.Table el;
2258 private NewBranch _this;
2264 public Xcls_Table52(NewBranch _owner )
2267 this.el = new Gtk.Table( 2, 5, true );
2271 // set gobject values
2272 this.el.expand = false;
2274 this.el.column_spacing = 4;
2275 this.el.vexpand = false;
2276 var child_0 = new Xcls_Label53( _this );
2278 this.el.attach_defaults ( child_0.el , 0,1,0,1 );
2279 var child_1 = new Xcls_commit_message( _this );
2281 this.el.attach_defaults ( child_1.el , 0,4,1,2 );
2282 var child_2 = new Xcls_createbtn( _this );
2284 this.el.attach_defaults ( child_2.el , 4,5,1,2 );
2287 // user defined functions
2289 public class Xcls_Label53 : Object
2291 public Gtk.Label el;
2292 private NewBranch _this;
2298 public Xcls_Label53(NewBranch _owner )
2301 this.el = new Gtk.Label( "Just commit with this comment" );
2305 // set gobject values
2306 this.el.halign = Gtk.Align.START;
2307 this.el.justify = Gtk.Justification.RIGHT;
2308 this.el.xalign = 0.900000f;
2311 // user defined functions
2314 public class Xcls_commit_message : Object
2316 public Gtk.Entry el;
2317 private NewBranch _this;
2323 public Xcls_commit_message(NewBranch _owner )
2326 _this.commit_message = this;
2327 this.el = new Gtk.Entry();
2331 // set gobject values
2332 this.el.visible = true;
2335 // user defined functions
2338 public class Xcls_createbtn : Object
2340 public Gtk.Button el;
2341 private NewBranch _this;
2347 public Xcls_createbtn(NewBranch _owner )
2350 _this.createbtn = this;
2351 this.el = new Gtk.Button();
2355 // set gobject values
2356 this.el.label = "Commit Changes";
2361 this.el.get_style_context().add_class("suggested-action");
2365 this.el.clicked.connect( () => {
2367 GLib.debug("fire response = 1");
2369 var ticket_id = _this.ticketsel.selectedTicketId();
2371 if (ticket_id == "") {
2372 _this.ticketsel.el.get_child().get_style_context().add_class("warning");
2376 _this.el.response(1);
2380 // user defined functions
2381 public void updateState () {
2383 var ticket_id = _this.ticketsel.selectedTicketId();
2385 if (ticket_id == "") {
2386 this.el.set_sensitive(false);
2390 this.el.set_sensitive(true);
2396 public class Xcls_ScrolledWindow56 : Object
2398 public Gtk.ScrolledWindow el;
2399 private NewBranch _this;
2405 public Xcls_ScrolledWindow56(NewBranch _owner )
2408 this.el = new Gtk.ScrolledWindow( null, null );
2412 // set gobject values
2413 this.el.height_request = 400;
2414 this.el.vexpand = true;
2415 var child_0 = new Xcls_diff_view( _this );
2417 this.el.add ( child_0.el );
2420 // user defined functions
2422 public class Xcls_diff_view : Object
2424 public Gtk.SourceView el;
2425 private NewBranch _this;
2431 public Xcls_diff_view(NewBranch _owner )
2434 _this.diff_view = this;
2435 this.el = new Gtk.SourceView();
2441 var description = Pango.FontDescription.from_string("monospace");
2442 description.set_size(9000);
2443 this.el.override_font(description);
2444 var lm = Gtk.SourceLanguageManager.get_default();
2446 ((Gtk.SourceBuffer)(this.el.get_buffer())).set_language(
2447 lm.get_language("diff")
2451 // user defined functions