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", page_num);
212 // user defined functions
214 public class Xcls_label_select_ticket : Object
217 private NewBranch _this;
223 public Xcls_label_select_ticket(NewBranch _owner )
226 _this.label_select_ticket = this;
227 this.el = new Gtk.Label( "Select Existing Ticket to work on" );
231 // set gobject values
234 // user defined functions
237 public class Xcls_label_create_ticket : Object
240 private NewBranch _this;
246 public Xcls_label_create_ticket(NewBranch _owner )
249 _this.label_create_ticket = this;
250 this.el = new Gtk.Label( "Create a New Ticket" );
254 // set gobject values
257 // user defined functions
260 public class Xcls_label_quick_commit : Object
263 private NewBranch _this;
269 public Xcls_label_quick_commit(NewBranch _owner )
272 _this.label_quick_commit = this;
273 this.el = new Gtk.Label( "Quick Commit" );
277 // set gobject values
280 // user defined functions
283 public class Xcls_select_ticket_tab : Object
286 private NewBranch _this;
292 public Xcls_select_ticket_tab(NewBranch _owner )
295 _this.select_ticket_tab = this;
296 this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
300 // set gobject values
301 this.el.homogeneous = false;
302 var child_0 = new Xcls_Table7( _this );
304 this.el.pack_start ( child_0.el , false,false,0 );
305 var child_1 = new Xcls_scrolled_window( _this );
307 this.el.add ( child_1.el );
310 // user defined functions
311 public void load_data (string tid = "") {
313 GLib.debug("Loading tickets");
315 var curproj = RooProject.getProjectByRepo(_this.repo);
316 _this.prmodel.loadProjects(curproj == null ? "" : curproj.id);
318 _this.dbmodel.loadTickets(curproj == null ? "": curproj.id, tid);
319 _this.branchbtn.updateState();
321 _this.ticketsel.el.get_child().get_style_context().remove_class("warning");
323 var name = RooTicket.singleton().usernameLocal();
324 var ticket = RooTicket.singleton().getById(tid);
325 _this.name.el.set_text("wip_%s_T%s_%s".printf(name,ticket.id, ticket.summaryToBranchName()));
327 _this.ticketsel.el.get_child().get_style_context().add_class("warning");
329 _this.view.loadTicket(tid);
334 public class Xcls_Table7 : Object
337 private NewBranch _this;
343 public Xcls_Table7(NewBranch _owner )
346 this.el = new Gtk.Table( 5, 5, true );
350 // set gobject values
351 this.el.expand = false;
353 this.el.column_spacing = 4;
354 this.el.vexpand = false;
355 var child_0 = new Xcls_Label8( _this );
357 this.el.attach_defaults ( child_0.el , 0,1,0,1 );
358 var child_1 = new Xcls_Label9( _this );
360 this.el.attach_defaults ( child_1.el , 1,2,0,1 );
361 var child_2 = new Xcls_projectsel( _this );
363 this.el.attach_defaults ( child_2.el , 0,1,1,2 );
364 var child_3 = new Xcls_ticketsel( _this );
366 this.el.attach_defaults ( child_3.el , 1,5,1,2 );
367 var child_4 = new Xcls_Label16( _this );
369 this.el.attach_defaults ( child_4.el , 0,1,3,4 );
370 var child_5 = new Xcls_name( _this );
372 this.el.attach_defaults ( child_5.el , 0,4,4,5 );
373 var child_6 = new Xcls_branchbtn( _this );
375 this.el.attach_defaults ( child_6.el , 4,5,4,5 );
376 var child_7 = new Xcls_Box19( _this );
378 this.el.attach_defaults ( child_7.el , 0,5,2,3 );
381 // user defined functions
383 public class Xcls_Label8 : Object
386 private NewBranch _this;
392 public Xcls_Label8(NewBranch _owner )
395 this.el = new Gtk.Label( "Project" );
399 // set gobject values
400 this.el.halign = Gtk.Align.START;
401 this.el.justify = Gtk.Justification.RIGHT;
402 this.el.visible = true;
405 // user defined functions
408 public class Xcls_Label9 : Object
411 private NewBranch _this;
417 public Xcls_Label9(NewBranch _owner )
420 this.el = new Gtk.Label( "Ticket" );
424 // set gobject values
425 this.el.halign = Gtk.Align.START;
426 this.el.visible = true;
429 // user defined functions
432 public class Xcls_projectsel : Object
434 public Gtk.ComboBox el;
435 private NewBranch _this;
442 public Xcls_projectsel(NewBranch _owner )
445 _this.projectsel = this;
446 this.el = new Gtk.ComboBox.with_entry();
449 this.loading = false;
451 // set gobject values
452 var child_0 = new Xcls_prcellrenderer( _this );
454 this.el.pack_start ( child_0.el , true );
455 var child_1 = new Xcls_prmodel( _this );
457 this.el.set_model ( child_1.el );
461 this.el.set_entry_text_column(1);
464 this.el.changed.connect( () => {
468 var project_id = this.selectedProjectId();
469 _this.dbmodel.loadTickets(project_id);
472 /*if (this.loading) {
475 var ticket_id = this.selectedTicketId();
477 var name = RooTicket.singleton().usernameLocal();
479 if (ticket_id == "" || ticket_id == null) {
481 var dt = new DateTime.now_local();
482 _this.name.el.set_text("wip_%s_%s".printf(name,dt.format("%Y_%b_%d")));
487 var ticket = RooTicket.singleton().getById(ticket_id);
489 _this.name.el.set_text("wip_%s_T%s_%s".printf(name,ticket.id, ticket.summaryToBranchName()));
491 //GLib.debug (//"Selection: %s, %s\n", (string) val1, (string) val2);
496 // user defined functions
497 public string selectedProjectId () {
502 this.el.get_active_iter (out iter);
503 _this.prmodel.el.get_value (iter, 0, out val1);
506 return (string) val1;
513 public class Xcls_prcellrenderer : Object
515 public Gtk.CellRendererText el;
516 private NewBranch _this;
522 public Xcls_prcellrenderer(NewBranch _owner )
525 _this.prcellrenderer = this;
526 this.el = new Gtk.CellRendererText();
530 // set gobject values
533 // user defined functions
536 public class Xcls_prmodel : Object
538 public Gtk.ListStore el;
539 private NewBranch _this;
545 public Xcls_prmodel(NewBranch _owner )
548 _this.prmodel = this;
549 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
553 // set gobject values
556 // user defined functions
557 public void loadProjects (string id) {
561 _this.projectsel.loading = true;
570 el.set_value(iter, 0, "");
571 el.set_value(iter, 1, "-- select a project --");
573 _this.projectsel.el.set_active_iter(iter);
576 foreach(var project in RooProject.projects()) {
580 el.set_value(iter, 0, project.id);
581 el.set_value(iter, 1, project.name );
582 if (id == project.id) {
583 _this.projectsel.el.set_active_iter(iter);
588 _this.projectsel.loading = false;
589 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
595 public class Xcls_ticketsel : Object
597 public Gtk.ComboBox el;
598 private NewBranch _this;
605 public Xcls_ticketsel(NewBranch _owner )
608 _this.ticketsel = this;
609 this.el = new Gtk.ComboBox.with_entry();
612 this.loading = false;
614 // set gobject values
615 var child_0 = new Xcls_dbcellrenderer( _this );
617 this.el.pack_start ( child_0.el , true );
618 var child_1 = new Xcls_dbmodel( _this );
620 this.el.set_model ( child_1.el );
624 //this.el.add_attribute(_this.dbcellrenderer.el , "markup", 1 );
625 this.el.set_entry_text_column(1);
626 this.el.get_child().set_sensitive(false);
629 this.el.changed.connect( () => {
633 var ticket_id = this.selectedTicketId();
635 var name = RooTicket.singleton().usernameLocal();
637 this.el.get_child().get_style_context().remove_class("warning");
638 if (ticket_id == "" || ticket_id == null) {
640 var dt = new DateTime.now_local();
641 _this.name.el.set_text("wip_%s_%s".printf(name,dt.format("%Y_%b_%d")));
642 _this.view.loadTicket("");
644 this.el.get_child().get_style_context().add_class("warning");
645 _this.createbtn.updateState();
650 var ticket = RooTicket.singleton().getById(ticket_id);
652 _this.name.el.set_text("wip_%s_T%s_%s".printf(name,ticket.id, ticket.summaryToBranchName()));
653 _this.scrolled_window.el.show();
655 _this.view.loadTicket(ticket.id);
656 _this.branchbtn.updateState();
658 //GLib.debug (//"Selection: %s, %s\n", (string) val1, (string) val2);
662 // user defined functions
663 public string selectedTicketId () {
668 this.el.get_active_iter (out iter);
669 _this.dbmodel.el.get_value (iter, 0, out val1);
672 return (string) val1;
679 public class Xcls_dbcellrenderer : Object
681 public Gtk.CellRendererText el;
682 private NewBranch _this;
688 public Xcls_dbcellrenderer(NewBranch _owner )
691 _this.dbcellrenderer = this;
692 this.el = new Gtk.CellRendererText();
696 // set gobject values
699 // user defined functions
702 public class Xcls_dbmodel : Object
704 public Gtk.ListStore el;
705 private NewBranch _this;
711 public Xcls_dbmodel(NewBranch _owner )
714 _this.dbmodel = this;
715 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
719 // set gobject values
722 // user defined functions
723 public void loadTickets (string project_id , string tid = "") {
727 // fixme .. get project id from selection..
729 RooTicket.singleton().loadTickets(
731 _this.btn_not_me.el.active ? RooTicket.Who.ANYBODY : RooTicket.Who.ME,
732 _this.btn_closed.el.active ? RooTicket.Status.ALL : RooTicket.Status.ACTIVE
735 _this.ticketsel.loading = true;
744 el.set_value(iter, 0, "");
745 el.set_value(iter, 1, "-- select a ticket --");
747 _this.ticketsel.el.set_active_iter(iter);
748 var tickets = RooTicket.singleton().tickets;
749 foreach(var ticket in tickets) {
753 el.set_value(iter, 0, ticket.id);
754 el.set_value(iter, 1, "#%s %s".printf( ticket.id, ticket.summary));
756 if (ticket.id == tid) {
757 _this.ticketsel.el.set_active_iter(iter);
762 _this.ticketsel.loading = false;
763 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
769 public class Xcls_Label16 : Object
772 private NewBranch _this;
778 public Xcls_Label16(NewBranch _owner )
781 this.el = new Gtk.Label( "Use this as branch name" );
785 // set gobject values
786 this.el.halign = Gtk.Align.START;
787 this.el.justify = Gtk.Justification.RIGHT;
788 this.el.xalign = 0.900000f;
791 // user defined functions
794 public class Xcls_name : Object
797 private NewBranch _this;
803 public Xcls_name(NewBranch _owner )
807 this.el = new Gtk.Entry();
811 // set gobject values
812 this.el.visible = true;
815 // user defined functions
818 public class Xcls_branchbtn : Object
820 public Gtk.Button el;
821 private NewBranch _this;
827 public Xcls_branchbtn(NewBranch _owner )
830 _this.branchbtn = this;
831 this.el = new Gtk.Button();
835 // set gobject values
836 this.el.label = "Create Branch";
841 this.el.get_style_context().add_class("suggested-action");
845 this.el.clicked.connect( () => {
847 GLib.debug("fire response = 1");
849 var ticket_id = _this.ticketsel.selectedTicketId();
851 if (ticket_id == "") {
852 _this.ticketsel.el.get_child().get_style_context().add_class("warning");
856 _this.el.response(1);
860 // user defined functions
861 public void updateState () {
863 var ticket_id = _this.ticketsel.selectedTicketId();
865 if (ticket_id == "") {
866 this.el.set_sensitive(false);
870 this.el.set_sensitive(true);
875 public class Xcls_Box19 : Object
878 private NewBranch _this;
884 public Xcls_Box19(NewBranch _owner )
887 this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
891 // set gobject values
892 var child_0 = new Xcls_btn_not_me( _this );
894 this.el.add ( child_0.el );
895 var child_1 = new Xcls_btn_closed( _this );
897 this.el.add ( child_1.el );
898 var child_2 = new Xcls_Label22( _this );
900 this.el.add ( child_2.el );
903 // user defined functions
905 public class Xcls_btn_not_me : Object
907 public Gtk.CheckButton el;
908 private NewBranch _this;
914 public Xcls_btn_not_me(NewBranch _owner )
917 _this.btn_not_me = this;
918 this.el = new Gtk.CheckButton();
922 // set gobject values
923 this.el.label = "Show tickets not assigned to me";
926 this.el.toggled.connect( () => {
927 var project_id = _this.projectsel.selectedProjectId();
928 _this.dbmodel.loadTickets(project_id);
932 // user defined functions
935 public class Xcls_btn_closed : Object
937 public Gtk.CheckButton el;
938 private NewBranch _this;
944 public Xcls_btn_closed(NewBranch _owner )
947 _this.btn_closed = this;
948 this.el = new Gtk.CheckButton();
952 // set gobject values
953 this.el.label = "Show closed Tickets";
956 this.el.toggled.connect( () => {
957 var project_id = _this.projectsel.selectedProjectId();
958 _this.dbmodel.loadTickets(project_id);
963 // user defined functions
966 public class Xcls_Label22 : Object
969 private NewBranch _this;
975 public Xcls_Label22(NewBranch _owner )
978 this.el = new Gtk.Label( "<a href=\"refresh\">Refresh Ticket list</a>" );
982 // set gobject values
983 this.el.halign = Gtk.Align.END;
984 this.el.hexpand = true;
985 this.el.use_markup = true;
988 this.el.activate_link.connect( (uri) => {
989 if (uri == "refresh") {
991 var curproj = RooProject.getProjectByRepo(_this.repo);
992 _this.prmodel.loadProjects(curproj == null ? "": curproj.id);
994 _this.dbmodel.loadTickets(curproj == null ? "": curproj.id);
1000 // user defined functions
1005 public class Xcls_scrolled_window : Object
1007 public Gtk.ScrolledWindow el;
1008 private NewBranch _this;
1014 public Xcls_scrolled_window(NewBranch _owner )
1017 _this.scrolled_window = this;
1018 this.el = new Gtk.ScrolledWindow( null, null );
1022 // set gobject values
1023 this.el.height_request = 500;
1024 this.el.vexpand = true;
1025 var child_0 = new Xcls_view( _this );
1027 this.el.add ( child_0.el );
1032 this.el.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);
1036 // user defined functions
1038 public class Xcls_view : Object
1040 public WebKit.WebView el;
1041 private NewBranch _this;
1047 public Xcls_view(NewBranch _owner )
1051 this.el = new WebKit.WebView();
1055 // set gobject values
1058 // user defined functions
1059 public void loadTicket (string tid) {
1061 _this.el.get_size(out w, out h);
1064 _this.scrolled_window.el.hide();
1065 _this.el.resize(w, 150);
1067 _this.scrolled_window.el.show();
1068 _this.el.resize(w, 800);
1071 var rs = RooTicket.singleton();
1072 var uri = new WebKit.URIRequest("https://roojs.com/admin.php/MTrack/View/" + tid);
1073 var hd = uri.get_http_headers();
1074 var authCode = Base64.encode ("%s:%s".printf(rs.username, rs.password).data);
1075 hd.append("Authorization", "Basic %s".printf(authCode));
1077 this.el.load_request(uri);
1083 public class Xcls_create_ticket_tab : Object
1086 private NewBranch _this;
1092 public Xcls_create_ticket_tab(NewBranch _owner )
1095 _this.create_ticket_tab = this;
1096 this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
1100 // set gobject values
1101 this.el.homogeneous = false;
1102 var child_0 = new Xcls_table( _this );
1104 this.el.pack_start ( child_0.el , false,false,0 );
1107 // user defined functions
1108 public void load_data () {
1112 Timeout.add_seconds(1, () => {
1114 RooProject? curproj = null;
1115 if (_this.repo != null) {
1116 curproj = RooProject.getProjectByRepo(_this.repo);
1118 _this.prmodel.loadProjects(curproj == null ? "" : curproj.id);
1119 if (curproj != null) {
1122 var rt = RooTicket.singleton();
1123 rt.loadProjectOptions(curproj.id);
1125 _this.msmodel.loadMilestones();
1126 _this.primodel.loadPriorities();
1127 _this.sevmodel.loadSeverities();
1128 _this.clmodel.loadClassifications();
1129 _this.devmodel.loadDevelopers();
1132 _this.summary.el.set_text("");
1133 _this.description.el.buffer.text = "";
1134 //_this.spinner.el.stop();
1135 //_this.spinner.el.hide();
1137 _this.table.el.show();
1138 //_this.summary.el.grab_focus();
1144 public class Xcls_table : Object
1146 public Gtk.Table el;
1147 private NewBranch _this;
1153 public Xcls_table(NewBranch _owner )
1157 this.el = new Gtk.Table( 14, 4, true );
1161 // set gobject values
1162 this.el.expand = false;
1164 this.el.column_spacing = 4;
1165 this.el.vexpand = false;
1166 var child_0 = new Xcls_Label27( _this );
1168 this.el.attach_defaults ( child_0.el , 0,1,0,1 );
1169 var child_1 = new Xcls_Label28( _this );
1171 this.el.attach_defaults ( child_1.el , 1,2,0,1 );
1172 var child_2 = new Xcls_project_id( _this );
1174 this.el.attach_defaults ( child_2.el , 0,1,1,2 );
1175 var child_3 = new Xcls_summary( _this );
1177 this.el.attach_defaults ( child_3.el , 1,4,1,2 );
1178 var child_4 = new Xcls_Label33( _this );
1180 this.el.attach_defaults ( child_4.el , 0,1,2,3 );
1181 var child_5 = new Xcls_milestone_id( _this );
1183 this.el.attach_defaults ( child_5.el , 0,1,3,4 );
1184 var child_6 = new Xcls_Label36( _this );
1186 this.el.attach_defaults ( child_6.el , 1,4,2,3 );
1187 var child_7 = new Xcls_description( _this );
1189 this.el.attach_defaults ( child_7.el , 1,4,3,12 );
1190 var child_8 = new Xcls_Label38( _this );
1192 this.el.attach_defaults ( child_8.el , 0,1,4,5 );
1193 var child_9 = new Xcls_priority_id( _this );
1195 this.el.attach_defaults ( child_9.el , 0,1,5,6 );
1196 var child_10 = new Xcls_Label41( _this );
1198 this.el.attach_defaults ( child_10.el , 0,1,6,7 );
1199 var child_11 = new Xcls_severity_id( _this );
1201 this.el.attach_defaults ( child_11.el , 0,1,7,8 );
1202 var child_12 = new Xcls_Label44( _this );
1204 this.el.attach_defaults ( child_12.el , 0,1,8,9 );
1205 var child_13 = new Xcls_classification_id( _this );
1207 this.el.attach_defaults ( child_13.el , 0,1,9,10 );
1208 var child_14 = new Xcls_Label47( _this );
1210 this.el.attach_defaults ( child_14.el , 0,1,10,11 );
1211 var child_15 = new Xcls_developer_id( _this );
1213 this.el.attach_defaults ( child_15.el , 0,1,11,12 );
1214 var child_16 = new Xcls_Button50( _this );
1216 this.el.attach_defaults ( child_16.el , 0,4,13,14 );
1219 // user defined functions
1221 public class Xcls_Label27 : Object
1223 public Gtk.Label el;
1224 private NewBranch _this;
1230 public Xcls_Label27(NewBranch _owner )
1233 this.el = new Gtk.Label( "Project" );
1237 // set gobject values
1238 this.el.halign = Gtk.Align.START;
1239 this.el.visible = true;
1242 // user defined functions
1245 public class Xcls_Label28 : Object
1247 public Gtk.Label el;
1248 private NewBranch _this;
1254 public Xcls_Label28(NewBranch _owner )
1257 this.el = new Gtk.Label( "Summary" );
1261 // set gobject values
1262 this.el.halign = Gtk.Align.START;
1263 this.el.visible = true;
1266 // user defined functions
1269 public class Xcls_project_id : Object
1271 public Gtk.ComboBox el;
1272 private NewBranch _this;
1276 public bool loading;
1279 public Xcls_project_id(NewBranch _owner )
1282 _this.project_id = this;
1283 this.el = new Gtk.ComboBox.with_entry();
1286 this.loading = false;
1288 // set gobject values
1289 var child_0 = new Xcls_tprcellrenderer( _this );
1291 this.el.pack_start ( child_0.el , true );
1292 var child_1 = new Xcls_tprmodel( _this );
1294 this.el.set_model ( child_1.el );
1298 this.el.set_entry_text_column(1);
1301 this.el.changed.connect( () => {
1305 var project_id = this.selectedProjectId();
1307 var rt = RooTicket.singleton();
1308 rt.loadProjectOptions(project_id);
1310 _this.msmodel.loadMilestones();
1311 _this.primodel.loadPriorities();
1312 _this.sevmodel.loadSeverities();
1313 _this.clmodel.loadClassifications();
1314 _this.devmodel.loadDevelopers();
1316 // affects projects and milestones..
1319 /*if (this.loading) {
1322 var ticket_id = this.selectedTicketId();
1324 var name = RooTicket.singleton().usernameLocal();
1326 if (ticket_id == "" || ticket_id == null) {
1328 var dt = new DateTime.now_local();
1329 _this.name.el.set_text("wip_%s_%s".printf(name,dt.format("%Y_%b_%d")));
1334 var ticket = RooTicket.singleton().getById(ticket_id);
1336 _this.name.el.set_text("wip_%s_T%s_%s".printf(name,ticket.id, ticket.summaryToBranchName()));
1338 //GLib.debug (//"Selection: %s, %s\n", (string) val1, (string) val2);
1343 // user defined functions
1344 public string selectedProjectId () {
1349 this.el.get_active_iter (out iter);
1350 _this.tprmodel.el.get_value (iter, 0, out val1);
1353 return (string) val1;
1360 public class Xcls_tprcellrenderer : Object
1362 public Gtk.CellRendererText el;
1363 private NewBranch _this;
1369 public Xcls_tprcellrenderer(NewBranch _owner )
1372 _this.tprcellrenderer = this;
1373 this.el = new Gtk.CellRendererText();
1377 // set gobject values
1380 // user defined functions
1383 public class Xcls_tprmodel : Object
1385 public Gtk.ListStore el;
1386 private NewBranch _this;
1392 public Xcls_tprmodel(NewBranch _owner )
1395 _this.tprmodel = this;
1396 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
1400 // set gobject values
1403 // user defined functions
1404 public void loadProjects (string id) {
1407 _this.project_id.loading = true;
1413 el.append(out iter);
1416 el.set_value(iter, 0, "");
1417 el.set_value(iter, 1, "-- select a project --");
1419 _this.project_id.el.set_active_iter(iter);
1422 foreach(var project in RooProject.projects()) {
1424 el.append(out iter);
1426 el.set_value(iter, 0, project.id);
1427 el.set_value(iter, 1, project.name );
1428 if (id == project.id) {
1429 _this.project_id.el.set_active_iter(iter);
1434 _this.project_id.loading = false;
1435 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
1441 public class Xcls_summary : Object
1443 public Gtk.Entry el;
1444 private NewBranch _this;
1450 public Xcls_summary(NewBranch _owner )
1453 _this.summary = this;
1454 this.el = new Gtk.Entry();
1458 // set gobject values
1459 this.el.visible = true;
1462 // user defined functions
1465 public class Xcls_Label33 : Object
1467 public Gtk.Label el;
1468 private NewBranch _this;
1474 public Xcls_Label33(NewBranch _owner )
1477 this.el = new Gtk.Label( "Milestone" );
1481 // set gobject values
1482 this.el.halign = Gtk.Align.START;
1483 this.el.justify = Gtk.Justification.RIGHT;
1484 this.el.xalign = 0.900000f;
1487 // user defined functions
1490 public class Xcls_milestone_id : Object
1492 public Gtk.ComboBox el;
1493 private NewBranch _this;
1497 public bool loading;
1500 public Xcls_milestone_id(NewBranch _owner )
1503 _this.milestone_id = this;
1504 this.el = new Gtk.ComboBox.with_entry();
1507 this.loading = false;
1509 // set gobject values
1510 var child_0 = new Xcls_msmodel( _this );
1512 this.el.set_model ( child_0.el );
1516 this.el.set_entry_text_column(1);
1519 // user defined functions
1520 public string selectedMilestoneId () {
1525 this.el.get_active_iter (out iter);
1526 _this.msmodel.el.get_value (iter, 0, out val1);
1529 return (string) val1;
1536 public class Xcls_msmodel : Object
1538 public Gtk.ListStore el;
1539 private NewBranch _this;
1545 public Xcls_msmodel(NewBranch _owner )
1548 _this.msmodel = this;
1549 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
1553 // set gobject values
1556 // user defined functions
1557 public void loadMilestones ( ) {
1559 var rt = RooTicket.singleton();
1560 // rt.loadProjects();
1562 _this.milestone_id.loading = true;
1568 el.append(out iter);
1571 el.set_value(iter, 0, "");
1572 el.set_value(iter, 1, "-- select a milestone --");
1573 _this.milestone_id.el.set_active_iter(iter);
1575 var projects = rt.milestones;
1576 foreach(var project in projects) {
1578 el.append(out iter);
1580 el.set_value(iter, 0, project.id);
1581 el.set_value(iter, 1, project.display_name );
1582 // if (id == project.id) {
1583 // _this.milestone.el.set_active_iter(iter);
1589 _this.milestone_id.loading = false;
1590 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
1596 public class Xcls_Label36 : Object
1598 public Gtk.Label el;
1599 private NewBranch _this;
1605 public Xcls_Label36(NewBranch _owner )
1608 this.el = new Gtk.Label( "Description" );
1612 // set gobject values
1613 this.el.halign = Gtk.Align.START;
1616 // user defined functions
1619 public class Xcls_description : Object
1621 public Gtk.TextView el;
1622 private NewBranch _this;
1628 public Xcls_description(NewBranch _owner )
1631 _this.description = this;
1632 this.el = new Gtk.TextView();
1636 // set gobject values
1637 this.el.border_width = 1;
1640 // user defined functions
1643 public class Xcls_Label38 : Object
1645 public Gtk.Label el;
1646 private NewBranch _this;
1652 public Xcls_Label38(NewBranch _owner )
1655 this.el = new Gtk.Label( "Priority" );
1659 // set gobject values
1660 this.el.halign = Gtk.Align.START;
1661 this.el.xalign = 0.900000f;
1664 // user defined functions
1667 public class Xcls_priority_id : Object
1669 public Gtk.ComboBox el;
1670 private NewBranch _this;
1674 public bool loading;
1677 public Xcls_priority_id(NewBranch _owner )
1680 _this.priority_id = this;
1681 this.el = new Gtk.ComboBox.with_entry();
1684 this.loading = false;
1686 // set gobject values
1687 var child_0 = new Xcls_primodel( _this );
1689 this.el.set_model ( child_0.el );
1693 this.el.set_entry_text_column(1);
1696 // user defined functions
1697 public string selectedPriorityId () {
1702 this.el.get_active_iter (out iter);
1703 _this.primodel.el.get_value (iter, 0, out val1);
1706 return (string) val1;
1713 public class Xcls_primodel : Object
1715 public Gtk.ListStore el;
1716 private NewBranch _this;
1722 public Xcls_primodel(NewBranch _owner )
1725 _this.primodel = this;
1726 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
1730 // set gobject values
1733 // user defined functions
1734 public void loadPriorities ( ) {
1736 var rt = RooTicket.singleton();
1737 // rt.loadProjects();
1739 _this.priority_id.loading = true;
1746 var projects = rt.priorities;
1747 foreach(var project in projects) {
1749 el.append(out iter);
1751 el.set_value(iter, 0, project.id);
1752 el.set_value(iter, 1, project.display_name );
1753 if ("normal" == project.name) {
1754 _this.priority_id.el.set_active_iter(iter);
1759 _this.priority_id.loading = false;
1766 public class Xcls_Label41 : Object
1768 public Gtk.Label el;
1769 private NewBranch _this;
1775 public Xcls_Label41(NewBranch _owner )
1778 this.el = new Gtk.Label( "Severity" );
1782 // set gobject values
1783 this.el.halign = Gtk.Align.START;
1786 // user defined functions
1789 public class Xcls_severity_id : Object
1791 public Gtk.ComboBox el;
1792 private NewBranch _this;
1796 public bool loading;
1799 public Xcls_severity_id(NewBranch _owner )
1802 _this.severity_id = this;
1803 this.el = new Gtk.ComboBox.with_entry();
1806 this.loading = false;
1808 // set gobject values
1809 var child_0 = new Xcls_sevmodel( _this );
1811 this.el.set_model ( child_0.el );
1815 this.el.set_entry_text_column(1);
1818 // user defined functions
1819 public string selectedSeverityId () {
1824 this.el.get_active_iter (out iter);
1825 _this.sevmodel.el.get_value (iter, 0, out val1);
1828 return (string) val1;
1835 public class Xcls_sevmodel : Object
1837 public Gtk.ListStore el;
1838 private NewBranch _this;
1844 public Xcls_sevmodel(NewBranch _owner )
1847 _this.sevmodel = this;
1848 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
1852 // set gobject values
1855 // user defined functions
1856 public void loadSeverities () {
1858 var rt = RooTicket.singleton();
1859 //rt.loadProjects();
1861 _this.severity_id.loading = true;
1867 var projects = rt.serverities;
1868 foreach(var project in projects) {
1870 el.append(out iter);
1872 el.set_value(iter, 0, project.id);
1873 el.set_value(iter, 1, project.display_name );
1874 if ("normal" == project.name) {
1875 _this.severity_id.el.set_active_iter(iter);
1880 _this.severity_id.loading = false;
1881 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
1887 public class Xcls_Label44 : Object
1889 public Gtk.Label el;
1890 private NewBranch _this;
1896 public Xcls_Label44(NewBranch _owner )
1899 this.el = new Gtk.Label( "Classification" );
1903 // set gobject values
1904 this.el.halign = Gtk.Align.START;
1907 // user defined functions
1910 public class Xcls_classification_id : Object
1912 public Gtk.ComboBox el;
1913 private NewBranch _this;
1917 public bool loading;
1920 public Xcls_classification_id(NewBranch _owner )
1923 _this.classification_id = this;
1924 this.el = new Gtk.ComboBox.with_entry();
1927 this.loading = false;
1929 // set gobject values
1930 var child_0 = new Xcls_clmodel( _this );
1932 this.el.set_model ( child_0.el );
1936 this.el.set_entry_text_column(1);
1939 // user defined functions
1940 public string selectedClassificationId () {
1945 this.el.get_active_iter (out iter);
1946 _this.clmodel.el.get_value (iter, 0, out val1);
1949 return (string) val1;
1956 public class Xcls_clmodel : Object
1958 public Gtk.ListStore el;
1959 private NewBranch _this;
1965 public Xcls_clmodel(NewBranch _owner )
1968 _this.clmodel = this;
1969 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
1973 // set gobject values
1976 // user defined functions
1977 public void loadClassifications ( ) {
1979 var rt = RooTicket.singleton();
1980 // rt.loadProjects();
1982 _this.classification_id.loading = true;
1988 el.append(out iter);
1991 var projects = rt.classifications;
1992 foreach(var project in projects) {
1994 el.append(out iter);
1996 el.set_value(iter, 0, project.id);
1997 el.set_value(iter, 1, project.display_name );
1998 if ("bug" == project.name) {
1999 _this.classification_id.el.set_active_iter(iter);
2004 _this.classification_id.loading = false;
2005 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
2011 public class Xcls_Label47 : Object
2013 public Gtk.Label el;
2014 private NewBranch _this;
2020 public Xcls_Label47(NewBranch _owner )
2023 this.el = new Gtk.Label( "Assign to" );
2027 // set gobject values
2028 this.el.halign = Gtk.Align.START;
2031 // user defined functions
2034 public class Xcls_developer_id : Object
2036 public Gtk.ComboBox el;
2037 private NewBranch _this;
2041 public bool loading;
2044 public Xcls_developer_id(NewBranch _owner )
2047 _this.developer_id = this;
2048 this.el = new Gtk.ComboBox.with_entry();
2051 this.loading = false;
2053 // set gobject values
2054 var child_0 = new Xcls_devmodel( _this );
2056 this.el.set_model ( child_0.el );
2060 this.el.set_entry_text_column(1);
2063 // user defined functions
2064 public string selectedDeveloperId () {
2069 this.el.get_active_iter (out iter);
2070 _this.devmodel.el.get_value (iter, 0, out val1);
2073 return (string) val1;
2080 public class Xcls_devmodel : Object
2082 public Gtk.ListStore el;
2083 private NewBranch _this;
2089 public Xcls_devmodel(NewBranch _owner )
2092 _this.devmodel = this;
2093 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
2097 // set gobject values
2100 // user defined functions
2101 public void loadDevelopers ( ) {
2103 var rt = RooTicket.singleton();
2104 //rt.loadProjects();
2106 _this.developer_id.loading = true;
2112 el.append(out iter);
2115 el.set_value(iter, 0, "");
2116 el.set_value(iter, 1, "-- select a developer --");
2118 _this.developer_id.el.set_active_iter(iter);
2121 var peps = rt.developers;
2122 foreach(var p in peps) {
2124 el.append(out iter);
2126 el.set_value(iter, 0, p.id);
2127 el.set_value(iter, 1, p.display_name );
2128 if (rt.authuser_id == p.id) {
2129 _this.developer_id.el.set_active_iter(iter);
2133 _this.developer_id.loading = false;
2134 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
2140 public class Xcls_Button50 : Object
2142 public Gtk.Button el;
2143 private NewBranch _this;
2149 public Xcls_Button50(NewBranch _owner )
2152 this.el = new Gtk.Button();
2156 // set gobject values
2157 this.el.label = "Create Ticket & Branch";
2162 this.el.get_style_context().add_class("suggested-action");
2166 this.el.clicked.connect( () => {
2167 GLib.debug("fire response = 1");
2170 var invalid = false;
2172 // validate first...
2173 _this.project_id.el.get_child().get_style_context().remove_class("warning");
2174 if (_this.project_id.selectedProjectId() == "") {
2175 _this.project_id.el.get_child().get_style_context().add_class("warning");
2179 _this.milestone_id.el.get_child().get_style_context().remove_class("warning");
2181 _this.priority_id.el.get_child().get_style_context().remove_class("warning");
2182 if (_this.priority_id.selectedPriorityId() == "") {
2183 _this.priority_id.el.get_child().get_style_context().add_class("warning");
2187 _this.classification_id.el.get_child().get_style_context().remove_class("warning");
2188 if (_this.classification_id.selectedClassificationId() == "") {
2189 _this.classification_id.el.get_child().get_style_context().add_class("warning");
2193 _this.developer_id.el.get_child().get_style_context().remove_class("warning");
2194 if (_this.developer_id.selectedDeveloperId() == "") {
2195 _this.developer_id.el.get_child().get_style_context().add_class("warning");
2199 _this.summary.el.get_style_context().remove_class("warning");
2200 if (_this.summary.el.get_text() == "") {
2201 _this.summary.el.get_style_context().add_class("warning");
2205 _this.description.el.get_style_context().remove_class("warning");
2210 GLib.debug("for is valid");
2212 _this.el.response(1);
2216 // user defined functions
2221 public class Xcls_quick_commit_tab : Object
2224 private NewBranch _this;
2230 public Xcls_quick_commit_tab(NewBranch _owner )
2233 _this.quick_commit_tab = this;
2234 this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
2238 // set gobject values
2239 this.el.homogeneous = false;
2240 var child_0 = new Xcls_Table52( _this );
2242 this.el.pack_start ( child_0.el , false,false,0 );
2243 var child_1 = new Xcls_ScrolledWindow56( _this );
2245 this.el.add ( child_1.el );
2248 // user defined functions
2249 public void load_data () {
2250 _this.commit_message.el.set_text("");
2254 public class Xcls_Table52 : Object
2256 public Gtk.Table el;
2257 private NewBranch _this;
2263 public Xcls_Table52(NewBranch _owner )
2266 this.el = new Gtk.Table( 2, 5, true );
2270 // set gobject values
2271 this.el.expand = false;
2273 this.el.column_spacing = 4;
2274 this.el.vexpand = false;
2275 var child_0 = new Xcls_Label53( _this );
2277 this.el.attach_defaults ( child_0.el , 0,1,0,1 );
2278 var child_1 = new Xcls_commit_message( _this );
2280 this.el.attach_defaults ( child_1.el , 0,4,1,2 );
2281 var child_2 = new Xcls_createbtn( _this );
2283 this.el.attach_defaults ( child_2.el , 4,5,1,2 );
2286 // user defined functions
2288 public class Xcls_Label53 : Object
2290 public Gtk.Label el;
2291 private NewBranch _this;
2297 public Xcls_Label53(NewBranch _owner )
2300 this.el = new Gtk.Label( "Just commit with this comment" );
2304 // set gobject values
2305 this.el.halign = Gtk.Align.START;
2306 this.el.justify = Gtk.Justification.RIGHT;
2307 this.el.xalign = 0.900000f;
2310 // user defined functions
2313 public class Xcls_commit_message : Object
2315 public Gtk.Entry el;
2316 private NewBranch _this;
2322 public Xcls_commit_message(NewBranch _owner )
2325 _this.commit_message = this;
2326 this.el = new Gtk.Entry();
2330 // set gobject values
2331 this.el.visible = true;
2334 // user defined functions
2337 public class Xcls_createbtn : Object
2339 public Gtk.Button el;
2340 private NewBranch _this;
2346 public Xcls_createbtn(NewBranch _owner )
2349 _this.createbtn = this;
2350 this.el = new Gtk.Button();
2354 // set gobject values
2355 this.el.label = "Commit Changes";
2360 this.el.get_style_context().add_class("suggested-action");
2364 this.el.clicked.connect( () => {
2366 GLib.debug("fire response = 1");
2368 var ticket_id = _this.ticketsel.selectedTicketId();
2370 if (ticket_id == "") {
2371 _this.ticketsel.el.get_child().get_style_context().add_class("warning");
2375 _this.el.response(1);
2379 // user defined functions
2380 public void updateState () {
2382 var ticket_id = _this.ticketsel.selectedTicketId();
2384 if (ticket_id == "") {
2385 this.el.set_sensitive(false);
2389 this.el.set_sensitive(true);
2395 public class Xcls_ScrolledWindow56 : Object
2397 public Gtk.ScrolledWindow el;
2398 private NewBranch _this;
2404 public Xcls_ScrolledWindow56(NewBranch _owner )
2407 this.el = new Gtk.ScrolledWindow( null, null );
2411 // set gobject values
2412 this.el.height_request = 400;
2413 this.el.vexpand = true;
2414 var child_0 = new Xcls_diff_view( _this );
2416 this.el.add ( child_0.el );
2419 // user defined functions
2421 public class Xcls_diff_view : Object
2423 public Gtk.SourceView el;
2424 private NewBranch _this;
2430 public Xcls_diff_view(NewBranch _owner )
2433 _this.diff_view = this;
2434 this.el = new Gtk.SourceView();
2440 var description = Pango.FontDescription.from_string("monospace");
2441 description.set_size(9000);
2442 this.el.override_font(description);
2443 var lm = Gtk.SourceLanguageManager.get_default();
2445 ((Gtk.SourceBuffer)(this.el.get_buffer())).set_language(
2446 lm.get_language("diff")
2450 // user defined functions