1 static NewBranch _NewBranch;
3 public class NewBranch : Object
6 private NewBranch _this;
8 public static NewBranch singleton()
10 if (_NewBranch == null) {
11 _NewBranch= new NewBranch();
15 public Xcls_label_select_ticket label_select_ticket;
16 public Xcls_label_create_ticket label_create_ticket;
17 public Xcls_label_quick_commit label_quick_commit;
18 public Xcls_projectsel projectsel;
19 public Xcls_prcellrenderer prcellrenderer;
20 public Xcls_prmodel prmodel;
21 public Xcls_ticketsel ticketsel;
22 public Xcls_dbcellrenderer dbcellrenderer;
23 public Xcls_dbmodel dbmodel;
24 public Xcls_name name;
25 public Xcls_createbtn createbtn;
26 public Xcls_btn_not_me btn_not_me;
27 public Xcls_btn_closed btn_closed;
28 public Xcls_scrolled_window scrolled_window;
29 public Xcls_view view;
30 public Xcls_table table;
31 public Xcls_project_id project_id;
32 public Xcls_prcellrenderer prcellrenderer;
33 public Xcls_prmodel prmodel;
34 public Xcls_summary summary;
35 public Xcls_milestone_id milestone_id;
36 public Xcls_msmodel msmodel;
37 public Xcls_description description;
38 public Xcls_priority_id priority_id;
39 public Xcls_primodel primodel;
40 public Xcls_severity_id severity_id;
41 public Xcls_sevmodel sevmodel;
42 public Xcls_classification_id classification_id;
43 public Xcls_clmodel clmodel;
44 public Xcls_developer_id developer_id;
45 public Xcls_devmodel devmodel;
46 public Xcls_commit_message commit_message;
47 public Xcls_createbtn createbtn;
48 public Xcls_btn_not_me btn_not_me;
49 public Xcls_btn_closed btn_closed;
54 public Gee.ArrayList<GitMonitorQueue> queue;
60 this.el = new Gtk.Dialog();
68 this.el.title = "Create a working branch ";
69 this.el.default_height = 500;
70 this.el.default_width = 500;
71 this.el.deletable = true;
73 var child_0 = new Xcls_Notebook2( _this );
75 this.el.get_content_area().add ( child_0.el );
78 this.el.delete_event.connect( (self, event) => {
83 this.el.response.connect( (self, response_id) => {
85 GLib.debug("got %d", (int) response_id);
90 // have they selected a ticket..
91 // make that the current active ticket?
92 // we really need to store locally what ticket is being worked on..
93 // in theory we could be working on multiple project and not merging..
94 // -- each repo would have their active ticket (only one per repo)
95 // -- so we could just store that in there
96 // -- initial load can check the contents of the ticket files on first scan.
99 if (response_id < 1) {
101 this.running = false;
105 var ticket_id = _this.ticketsel.selectedTicketId();
107 if (this.repo != null) {
108 var bn = _this.name.el.get_text();
110 var res = this.repo.setActiveTicket(
111 RooTicket.singleton().getById(ticket_id != "" ? ticket_id : "-1"), bn
114 // start the monitoring..
115 GitMonitor.gitmonitor.start();
121 this.running = false;
131 // user defined functions
132 public void show ( GitRepo repo, Gee.ArrayList<GitMonitorQueue> queue, string tid = "" )
134 // this.el.set_gravity(Gdk.Gravity.NORTH);
135 if (this.running) { // should not happen!!
136 GLib.error("new branch show called, when already being displayed?");
141 GitMonitor.gitmonitor.stop();
147 this.el.move((Gdk.Screen.width() / 2)- 250 ,0);
148 this.el.set_default_size( 500,200); // not sure why it grows..
149 GLib.debug("Loading tickets");
153 this.el.set_keep_above(true);
156 var curproj = RooProject.getProjectByRepo(this.repo);
157 _this.prmodel.loadProjects(curproj == null ? "" : curproj.id);
159 _this.dbmodel.loadTickets(curproj == null ? "": curproj.id, tid);
160 _this.createbtn.updateState();
162 _this.ticketsel.el.get_child().get_style_context().remove_class("warning");
164 var name = RooTicket.singleton().usernameLocal();
165 var ticket = RooTicket.singleton().getById(tid);
166 _this.name.el.set_text("wip_%s_T%s_%s".printf(name,ticket.id, ticket.summaryToBranchName()));
168 _this.ticketsel.el.get_child().get_style_context().add_class("warning");
170 _this.view.loadTicket(tid);
174 public class Xcls_Notebook2 : Object
176 public Gtk.Notebook el;
177 private NewBranch _this;
183 public Xcls_Notebook2(NewBranch _owner )
186 this.el = new Gtk.Notebook();
190 // set gobject values
191 this.el.vexpand = true;
192 var child_0 = new Xcls_label_select_ticket( _this );
194 var child_1 = new Xcls_label_create_ticket( _this );
196 var child_2 = new Xcls_label_quick_commit( _this );
198 var child_3 = new Xcls_Box6( _this );
200 this.el.append_page ( child_3.el , _this.label_select_ticket.el );
201 var child_4 = new Xcls_Box25( _this );
203 this.el.append_page ( child_4.el , _this.label_create_ticket.el );
204 var child_5 = new Xcls_Box51( _this );
206 this.el.append_page ( child_5.el , _this.label_quick_commit.el );
209 // user defined functions
211 public class Xcls_label_select_ticket : Object
214 private NewBranch _this;
220 public Xcls_label_select_ticket(NewBranch _owner )
223 _this.label_select_ticket = this;
224 this.el = new Gtk.Label( "Select Existing Ticket to work on" );
228 // set gobject values
231 // user defined functions
234 public class Xcls_label_create_ticket : Object
237 private NewBranch _this;
243 public Xcls_label_create_ticket(NewBranch _owner )
246 _this.label_create_ticket = this;
247 this.el = new Gtk.Label( "Create a New Ticket" );
251 // set gobject values
254 // user defined functions
257 public class Xcls_label_quick_commit : Object
260 private NewBranch _this;
266 public Xcls_label_quick_commit(NewBranch _owner )
269 _this.label_quick_commit = this;
270 this.el = new Gtk.Label( "Quick Commit" );
274 // set gobject values
277 // user defined functions
280 public class Xcls_Box6 : Object
283 private NewBranch _this;
289 public Xcls_Box6(NewBranch _owner )
292 this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
296 // set gobject values
297 this.el.homogeneous = false;
298 var child_0 = new Xcls_Table7( _this );
300 this.el.pack_start ( child_0.el , false,false,0 );
301 var child_1 = new Xcls_scrolled_window( _this );
303 this.el.add ( child_1.el );
306 // user defined functions
308 public class Xcls_Table7 : Object
311 private NewBranch _this;
317 public Xcls_Table7(NewBranch _owner )
320 this.el = new Gtk.Table( 5, 5, true );
324 // set gobject values
325 this.el.expand = false;
327 this.el.column_spacing = 4;
328 this.el.vexpand = false;
329 var child_0 = new Xcls_Label8( _this );
331 this.el.attach_defaults ( child_0.el , 0,1,0,1 );
332 var child_1 = new Xcls_Label9( _this );
334 this.el.attach_defaults ( child_1.el , 1,2,0,1 );
335 var child_2 = new Xcls_projectsel( _this );
337 this.el.attach_defaults ( child_2.el , 0,1,1,2 );
338 var child_3 = new Xcls_ticketsel( _this );
340 this.el.attach_defaults ( child_3.el , 1,5,1,2 );
341 var child_4 = new Xcls_Label16( _this );
343 this.el.attach_defaults ( child_4.el , 0,1,3,4 );
344 var child_5 = new Xcls_name( _this );
346 this.el.attach_defaults ( child_5.el , 0,4,4,5 );
347 var child_6 = new Xcls_createbtn( _this );
349 this.el.attach_defaults ( child_6.el , 4,5,4,5 );
350 var child_7 = new Xcls_Box19( _this );
352 this.el.attach_defaults ( child_7.el , 0,5,2,3 );
355 // user defined functions
357 public class Xcls_Label8 : Object
360 private NewBranch _this;
366 public Xcls_Label8(NewBranch _owner )
369 this.el = new Gtk.Label( "Project" );
373 // set gobject values
374 this.el.halign = Gtk.Align.START;
375 this.el.justify = Gtk.Justification.RIGHT;
376 this.el.visible = true;
379 // user defined functions
382 public class Xcls_Label9 : Object
385 private NewBranch _this;
391 public Xcls_Label9(NewBranch _owner )
394 this.el = new Gtk.Label( "Ticket" );
398 // set gobject values
399 this.el.halign = Gtk.Align.START;
400 this.el.visible = true;
403 // user defined functions
406 public class Xcls_projectsel : Object
408 public Gtk.ComboBox el;
409 private NewBranch _this;
416 public Xcls_projectsel(NewBranch _owner )
419 _this.projectsel = this;
420 this.el = new Gtk.ComboBox.with_entry();
423 this.loading = false;
425 // set gobject values
426 var child_0 = new Xcls_prcellrenderer( _this );
428 this.el.pack_start ( child_0.el , true );
429 var child_1 = new Xcls_prmodel( _this );
431 this.el.set_model ( child_1.el );
435 this.el.set_entry_text_column(1);
438 this.el.changed.connect( () => {
442 var project_id = this.selectedProjectId();
443 _this.dbmodel.loadTickets(project_id);
446 /*if (this.loading) {
449 var ticket_id = this.selectedTicketId();
451 var name = RooTicket.singleton().usernameLocal();
453 if (ticket_id == "" || ticket_id == null) {
455 var dt = new DateTime.now_local();
456 _this.name.el.set_text("wip_%s_%s".printf(name,dt.format("%Y_%b_%d")));
461 var ticket = RooTicket.singleton().getById(ticket_id);
463 _this.name.el.set_text("wip_%s_T%s_%s".printf(name,ticket.id, ticket.summaryToBranchName()));
465 //GLib.debug (//"Selection: %s, %s\n", (string) val1, (string) val2);
470 // user defined functions
471 public string selectedProjectId () {
476 this.el.get_active_iter (out iter);
477 _this.prmodel.el.get_value (iter, 0, out val1);
480 return (string) val1;
487 public class Xcls_prcellrenderer : Object
489 public Gtk.CellRendererText el;
490 private NewBranch _this;
496 public Xcls_prcellrenderer(NewBranch _owner )
499 _this.prcellrenderer = this;
500 this.el = new Gtk.CellRendererText();
504 // set gobject values
507 // user defined functions
510 public class Xcls_prmodel : Object
512 public Gtk.ListStore el;
513 private NewBranch _this;
519 public Xcls_prmodel(NewBranch _owner )
522 _this.prmodel = this;
523 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
527 // set gobject values
530 // user defined functions
531 public void loadProjects (string id) {
535 _this.projectsel.loading = true;
544 el.set_value(iter, 0, "");
545 el.set_value(iter, 1, "-- select a project --");
547 _this.projectsel.el.set_active_iter(iter);
550 foreach(var project in RooProject.projects()) {
554 el.set_value(iter, 0, project.id);
555 el.set_value(iter, 1, project.name );
556 if (id == project.id) {
557 _this.projectsel.el.set_active_iter(iter);
562 _this.projectsel.loading = false;
563 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
569 public class Xcls_ticketsel : Object
571 public Gtk.ComboBox el;
572 private NewBranch _this;
579 public Xcls_ticketsel(NewBranch _owner )
582 _this.ticketsel = this;
583 this.el = new Gtk.ComboBox.with_entry();
586 this.loading = false;
588 // set gobject values
589 var child_0 = new Xcls_dbcellrenderer( _this );
591 this.el.pack_start ( child_0.el , true );
592 var child_1 = new Xcls_dbmodel( _this );
594 this.el.set_model ( child_1.el );
598 //this.el.add_attribute(_this.dbcellrenderer.el , "markup", 1 );
599 this.el.set_entry_text_column(1);
600 this.el.get_child().set_sensitive(false);
603 this.el.changed.connect( () => {
607 var ticket_id = this.selectedTicketId();
609 var name = RooTicket.singleton().usernameLocal();
611 this.el.get_child().get_style_context().remove_class("warning");
612 if (ticket_id == "" || ticket_id == null) {
614 var dt = new DateTime.now_local();
615 _this.name.el.set_text("wip_%s_%s".printf(name,dt.format("%Y_%b_%d")));
616 _this.view.loadTicket("");
618 this.el.get_child().get_style_context().add_class("warning");
619 _this.createbtn.updateState();
624 var ticket = RooTicket.singleton().getById(ticket_id);
626 _this.name.el.set_text("wip_%s_T%s_%s".printf(name,ticket.id, ticket.summaryToBranchName()));
627 _this.scrolled_window.el.show();
629 _this.view.loadTicket(ticket.id);
630 _this.createbtn.updateState();
632 //GLib.debug (//"Selection: %s, %s\n", (string) val1, (string) val2);
636 // user defined functions
637 public string selectedTicketId () {
642 this.el.get_active_iter (out iter);
643 _this.dbmodel.el.get_value (iter, 0, out val1);
646 return (string) val1;
653 public class Xcls_dbcellrenderer : Object
655 public Gtk.CellRendererText el;
656 private NewBranch _this;
662 public Xcls_dbcellrenderer(NewBranch _owner )
665 _this.dbcellrenderer = this;
666 this.el = new Gtk.CellRendererText();
670 // set gobject values
673 // user defined functions
676 public class Xcls_dbmodel : Object
678 public Gtk.ListStore el;
679 private NewBranch _this;
685 public Xcls_dbmodel(NewBranch _owner )
688 _this.dbmodel = this;
689 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
693 // set gobject values
696 // user defined functions
697 public void loadTickets (string project_id , string tid = "") {
701 // fixme .. get project id from selection..
703 RooTicket.singleton().loadTickets(
705 _this.btn_not_me.el.active ? RooTicket.Who.ANYBODY : RooTicket.Who.ME,
706 _this.btn_closed.el.active ? RooTicket.Status.ALL : RooTicket.Status.ACTIVE
709 _this.ticketsel.loading = true;
718 el.set_value(iter, 0, "");
719 el.set_value(iter, 1, "-- select a ticket --");
721 _this.ticketsel.el.set_active_iter(iter);
722 var tickets = RooTicket.singleton().tickets;
723 foreach(var ticket in tickets) {
727 el.set_value(iter, 0, ticket.id);
728 el.set_value(iter, 1, "#%s %s".printf( ticket.id, ticket.summary));
730 if (ticket.id == tid) {
731 _this.ticketsel.el.set_active_iter(iter);
736 _this.ticketsel.loading = false;
737 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
743 public class Xcls_Label16 : Object
746 private NewBranch _this;
752 public Xcls_Label16(NewBranch _owner )
755 this.el = new Gtk.Label( "Use this as branch name" );
759 // set gobject values
760 this.el.halign = Gtk.Align.START;
761 this.el.justify = Gtk.Justification.RIGHT;
762 this.el.xalign = 0.900000f;
765 // user defined functions
768 public class Xcls_name : Object
771 private NewBranch _this;
777 public Xcls_name(NewBranch _owner )
781 this.el = new Gtk.Entry();
785 // set gobject values
786 this.el.visible = true;
789 // user defined functions
792 public class Xcls_createbtn : Object
794 public Gtk.Button el;
795 private NewBranch _this;
801 public Xcls_createbtn(NewBranch _owner )
804 _this.createbtn = this;
805 this.el = new Gtk.Button();
809 // set gobject values
810 this.el.label = "Create Branch";
815 this.el.get_style_context().add_class("suggested-action");
819 this.el.clicked.connect( () => {
821 GLib.debug("fire response = 1");
823 var ticket_id = _this.ticketsel.selectedTicketId();
825 if (ticket_id == "") {
826 _this.ticketsel.el.get_child().get_style_context().add_class("warning");
830 _this.el.response(1);
834 // user defined functions
835 public void updateState () {
837 var ticket_id = _this.ticketsel.selectedTicketId();
839 if (ticket_id == "") {
840 this.el.set_sensitive(false);
844 this.el.set_sensitive(true);
849 public class Xcls_Box19 : Object
852 private NewBranch _this;
858 public Xcls_Box19(NewBranch _owner )
861 this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
865 // set gobject values
866 var child_0 = new Xcls_btn_not_me( _this );
868 this.el.add ( child_0.el );
869 var child_1 = new Xcls_btn_closed( _this );
871 this.el.add ( child_1.el );
872 var child_2 = new Xcls_Label22( _this );
874 this.el.add ( child_2.el );
877 // user defined functions
879 public class Xcls_btn_not_me : Object
881 public Gtk.CheckButton el;
882 private NewBranch _this;
888 public Xcls_btn_not_me(NewBranch _owner )
891 _this.btn_not_me = this;
892 this.el = new Gtk.CheckButton();
896 // set gobject values
897 this.el.label = "Show tickets not assigned to me";
900 this.el.toggled.connect( () => {
901 var project_id = _this.projectsel.selectedProjectId();
902 _this.dbmodel.loadTickets(project_id);
906 // user defined functions
909 public class Xcls_btn_closed : Object
911 public Gtk.CheckButton el;
912 private NewBranch _this;
918 public Xcls_btn_closed(NewBranch _owner )
921 _this.btn_closed = this;
922 this.el = new Gtk.CheckButton();
926 // set gobject values
927 this.el.label = "Show closed Tickets";
930 this.el.toggled.connect( () => {
931 var project_id = _this.projectsel.selectedProjectId();
932 _this.dbmodel.loadTickets(project_id);
937 // user defined functions
940 public class Xcls_Label22 : Object
943 private NewBranch _this;
949 public Xcls_Label22(NewBranch _owner )
952 this.el = new Gtk.Label( "<a href=\"refresh\">Refresh Ticket list</a>" );
956 // set gobject values
957 this.el.halign = Gtk.Align.END;
958 this.el.hexpand = true;
959 this.el.use_markup = true;
962 this.el.activate_link.connect( (uri) => {
963 if (uri == "refresh") {
965 var curproj = RooProject.getProjectByRepo(_this.repo);
966 _this.prmodel.loadProjects(curproj == null ? "": curproj.id);
968 _this.dbmodel.loadTickets(curproj == null ? "": curproj.id);
974 // user defined functions
979 public class Xcls_scrolled_window : Object
981 public Gtk.ScrolledWindow el;
982 private NewBranch _this;
988 public Xcls_scrolled_window(NewBranch _owner )
991 _this.scrolled_window = this;
992 this.el = new Gtk.ScrolledWindow( null, null );
996 // set gobject values
997 this.el.height_request = 500;
998 this.el.vexpand = true;
999 var child_0 = new Xcls_view( _this );
1001 this.el.add ( child_0.el );
1006 this.el.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);
1010 // user defined functions
1012 public class Xcls_view : Object
1014 public WebKit.WebView el;
1015 private NewBranch _this;
1021 public Xcls_view(NewBranch _owner )
1025 this.el = new WebKit.WebView();
1029 // set gobject values
1032 // user defined functions
1033 public void loadTicket (string tid) {
1035 _this.el.get_size(out w, out h);
1038 _this.scrolled_window.el.hide();
1039 _this.el.resize(w, 150);
1041 _this.scrolled_window.el.show();
1042 _this.el.resize(w, 800);
1045 var rs = RooTicket.singleton();
1046 var uri = new WebKit.URIRequest("https://roojs.com/admin.php/MTrack/View/" + tid);
1047 var hd = uri.get_http_headers();
1048 var authCode = Base64.encode ("%s:%s".printf(rs.username, rs.password).data);
1049 hd.append("Authorization", "Basic %s".printf(authCode));
1051 this.el.load_request(uri);
1057 public class Xcls_Box25 : Object
1060 private NewBranch _this;
1066 public Xcls_Box25(NewBranch _owner )
1069 this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
1073 // set gobject values
1074 this.el.homogeneous = false;
1075 var child_0 = new Xcls_table( _this );
1077 this.el.pack_start ( child_0.el , false,false,0 );
1080 // user defined functions
1082 public class Xcls_table : Object
1084 public Gtk.Table el;
1085 private NewBranch _this;
1091 public Xcls_table(NewBranch _owner )
1095 this.el = new Gtk.Table( 14, 4, true );
1099 // set gobject values
1100 this.el.expand = false;
1102 this.el.column_spacing = 4;
1103 this.el.vexpand = false;
1104 var child_0 = new Xcls_Label27( _this );
1106 this.el.attach_defaults ( child_0.el , 0,1,0,1 );
1107 var child_1 = new Xcls_Label28( _this );
1109 this.el.attach_defaults ( child_1.el , 1,2,0,1 );
1110 var child_2 = new Xcls_project_id( _this );
1112 this.el.attach_defaults ( child_2.el , 0,1,1,2 );
1113 var child_3 = new Xcls_summary( _this );
1115 this.el.attach_defaults ( child_3.el , 1,4,1,2 );
1116 var child_4 = new Xcls_Label33( _this );
1118 this.el.attach_defaults ( child_4.el , 0,1,2,3 );
1119 var child_5 = new Xcls_milestone_id( _this );
1121 this.el.attach_defaults ( child_5.el , 0,1,3,4 );
1122 var child_6 = new Xcls_Label36( _this );
1124 this.el.attach_defaults ( child_6.el , 1,4,2,3 );
1125 var child_7 = new Xcls_description( _this );
1127 this.el.attach_defaults ( child_7.el , 1,4,3,12 );
1128 var child_8 = new Xcls_Label38( _this );
1130 this.el.attach_defaults ( child_8.el , 0,1,4,5 );
1131 var child_9 = new Xcls_priority_id( _this );
1133 this.el.attach_defaults ( child_9.el , 0,1,5,6 );
1134 var child_10 = new Xcls_Label41( _this );
1136 this.el.attach_defaults ( child_10.el , 0,1,6,7 );
1137 var child_11 = new Xcls_severity_id( _this );
1139 this.el.attach_defaults ( child_11.el , 0,1,7,8 );
1140 var child_12 = new Xcls_Label44( _this );
1142 this.el.attach_defaults ( child_12.el , 0,1,8,9 );
1143 var child_13 = new Xcls_classification_id( _this );
1145 this.el.attach_defaults ( child_13.el , 0,1,9,10 );
1146 var child_14 = new Xcls_Label47( _this );
1148 this.el.attach_defaults ( child_14.el , 0,1,10,11 );
1149 var child_15 = new Xcls_developer_id( _this );
1151 this.el.attach_defaults ( child_15.el , 0,1,11,12 );
1152 var child_16 = new Xcls_Button50( _this );
1154 this.el.attach_defaults ( child_16.el , 0,4,13,14 );
1157 // user defined functions
1159 public class Xcls_Label27 : Object
1161 public Gtk.Label el;
1162 private NewBranch _this;
1168 public Xcls_Label27(NewBranch _owner )
1171 this.el = new Gtk.Label( "Project" );
1175 // set gobject values
1176 this.el.halign = Gtk.Align.START;
1177 this.el.visible = true;
1180 // user defined functions
1183 public class Xcls_Label28 : Object
1185 public Gtk.Label el;
1186 private NewBranch _this;
1192 public Xcls_Label28(NewBranch _owner )
1195 this.el = new Gtk.Label( "Summary" );
1199 // set gobject values
1200 this.el.halign = Gtk.Align.START;
1201 this.el.visible = true;
1204 // user defined functions
1207 public class Xcls_project_id : Object
1209 public Gtk.ComboBox el;
1210 private NewBranch _this;
1214 public bool loading;
1217 public Xcls_project_id(NewBranch _owner )
1220 _this.project_id = this;
1221 this.el = new Gtk.ComboBox.with_entry();
1224 this.loading = false;
1226 // set gobject values
1227 var child_0 = new Xcls_prcellrenderer( _this );
1229 this.el.pack_start ( child_0.el , true );
1230 var child_1 = new Xcls_prmodel( _this );
1232 this.el.set_model ( child_1.el );
1236 this.el.set_entry_text_column(1);
1239 this.el.changed.connect( () => {
1243 var project_id = this.selectedProjectId();
1245 var rt = RooTicket.singleton();
1246 rt.loadProjectOptions(project_id);
1248 _this.msmodel.loadMilestones();
1249 _this.primodel.loadPriorities();
1250 _this.sevmodel.loadSeverities();
1251 _this.clmodel.loadClassifications();
1252 _this.devmodel.loadDevelopers();
1254 // affects projects and milestones..
1257 /*if (this.loading) {
1260 var ticket_id = this.selectedTicketId();
1262 var name = RooTicket.singleton().usernameLocal();
1264 if (ticket_id == "" || ticket_id == null) {
1266 var dt = new DateTime.now_local();
1267 _this.name.el.set_text("wip_%s_%s".printf(name,dt.format("%Y_%b_%d")));
1272 var ticket = RooTicket.singleton().getById(ticket_id);
1274 _this.name.el.set_text("wip_%s_T%s_%s".printf(name,ticket.id, ticket.summaryToBranchName()));
1276 //GLib.debug (//"Selection: %s, %s\n", (string) val1, (string) val2);
1281 // user defined functions
1282 public string selectedProjectId () {
1287 this.el.get_active_iter (out iter);
1288 _this.prmodel.el.get_value (iter, 0, out val1);
1291 return (string) val1;
1298 public class Xcls_prcellrenderer : Object
1300 public Gtk.CellRendererText el;
1301 private NewBranch _this;
1307 public Xcls_prcellrenderer(NewBranch _owner )
1310 _this.prcellrenderer = this;
1311 this.el = new Gtk.CellRendererText();
1315 // set gobject values
1318 // user defined functions
1321 public class Xcls_prmodel : Object
1323 public Gtk.ListStore el;
1324 private NewBranch _this;
1330 public Xcls_prmodel(NewBranch _owner )
1333 _this.prmodel = this;
1334 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
1338 // set gobject values
1341 // user defined functions
1342 public void loadProjects (string id) {
1345 _this.project_id.loading = true;
1351 el.append(out iter);
1354 el.set_value(iter, 0, "");
1355 el.set_value(iter, 1, "-- select a project --");
1357 _this.project_id.el.set_active_iter(iter);
1360 foreach(var project in RooProject.projects()) {
1362 el.append(out iter);
1364 el.set_value(iter, 0, project.id);
1365 el.set_value(iter, 1, project.name );
1366 if (id == project.id) {
1367 _this.project_id.el.set_active_iter(iter);
1372 _this.project_id.loading = false;
1373 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
1379 public class Xcls_summary : Object
1381 public Gtk.Entry el;
1382 private NewBranch _this;
1388 public Xcls_summary(NewBranch _owner )
1391 _this.summary = this;
1392 this.el = new Gtk.Entry();
1396 // set gobject values
1397 this.el.visible = true;
1400 // user defined functions
1403 public class Xcls_Label33 : Object
1405 public Gtk.Label el;
1406 private NewBranch _this;
1412 public Xcls_Label33(NewBranch _owner )
1415 this.el = new Gtk.Label( "Milestone" );
1419 // set gobject values
1420 this.el.halign = Gtk.Align.START;
1421 this.el.justify = Gtk.Justification.RIGHT;
1422 this.el.xalign = 0.900000f;
1425 // user defined functions
1428 public class Xcls_milestone_id : Object
1430 public Gtk.ComboBox el;
1431 private NewBranch _this;
1435 public bool loading;
1438 public Xcls_milestone_id(NewBranch _owner )
1441 _this.milestone_id = this;
1442 this.el = new Gtk.ComboBox.with_entry();
1445 this.loading = false;
1447 // set gobject values
1448 var child_0 = new Xcls_msmodel( _this );
1450 this.el.set_model ( child_0.el );
1454 this.el.set_entry_text_column(1);
1457 // user defined functions
1458 public string selectedMilestoneId () {
1463 this.el.get_active_iter (out iter);
1464 _this.msmodel.el.get_value (iter, 0, out val1);
1467 return (string) val1;
1474 public class Xcls_msmodel : Object
1476 public Gtk.ListStore el;
1477 private NewBranch _this;
1483 public Xcls_msmodel(NewBranch _owner )
1486 _this.msmodel = this;
1487 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
1491 // set gobject values
1494 // user defined functions
1495 public void loadMilestones ( ) {
1497 var rt = RooTicket.singleton();
1498 // rt.loadProjects();
1500 _this.milestone_id.loading = true;
1506 el.append(out iter);
1509 el.set_value(iter, 0, "");
1510 el.set_value(iter, 1, "-- select a milestone --");
1511 _this.milestone_id.el.set_active_iter(iter);
1513 var projects = rt.milestones;
1514 foreach(var project in projects) {
1516 el.append(out iter);
1518 el.set_value(iter, 0, project.id);
1519 el.set_value(iter, 1, project.display_name );
1520 // if (id == project.id) {
1521 // _this.milestone.el.set_active_iter(iter);
1527 _this.milestone_id.loading = false;
1528 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
1534 public class Xcls_Label36 : Object
1536 public Gtk.Label el;
1537 private NewBranch _this;
1543 public Xcls_Label36(NewBranch _owner )
1546 this.el = new Gtk.Label( "Description" );
1550 // set gobject values
1551 this.el.halign = Gtk.Align.START;
1554 // user defined functions
1557 public class Xcls_description : Object
1559 public Gtk.TextView el;
1560 private NewBranch _this;
1566 public Xcls_description(NewBranch _owner )
1569 _this.description = this;
1570 this.el = new Gtk.TextView();
1574 // set gobject values
1575 this.el.border_width = 1;
1578 // user defined functions
1581 public class Xcls_Label38 : Object
1583 public Gtk.Label el;
1584 private NewBranch _this;
1590 public Xcls_Label38(NewBranch _owner )
1593 this.el = new Gtk.Label( "Priority" );
1597 // set gobject values
1598 this.el.halign = Gtk.Align.START;
1599 this.el.xalign = 0.900000f;
1602 // user defined functions
1605 public class Xcls_priority_id : Object
1607 public Gtk.ComboBox el;
1608 private NewBranch _this;
1612 public bool loading;
1615 public Xcls_priority_id(NewBranch _owner )
1618 _this.priority_id = this;
1619 this.el = new Gtk.ComboBox.with_entry();
1622 this.loading = false;
1624 // set gobject values
1625 var child_0 = new Xcls_primodel( _this );
1627 this.el.set_model ( child_0.el );
1631 this.el.set_entry_text_column(1);
1634 // user defined functions
1635 public string selectedPriorityId () {
1640 this.el.get_active_iter (out iter);
1641 _this.primodel.el.get_value (iter, 0, out val1);
1644 return (string) val1;
1651 public class Xcls_primodel : Object
1653 public Gtk.ListStore el;
1654 private NewBranch _this;
1660 public Xcls_primodel(NewBranch _owner )
1663 _this.primodel = this;
1664 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
1668 // set gobject values
1671 // user defined functions
1672 public void loadPriorities ( ) {
1674 var rt = RooTicket.singleton();
1675 // rt.loadProjects();
1677 _this.priority_id.loading = true;
1684 var projects = rt.priorities;
1685 foreach(var project in projects) {
1687 el.append(out iter);
1689 el.set_value(iter, 0, project.id);
1690 el.set_value(iter, 1, project.display_name );
1691 if ("normal" == project.name) {
1692 _this.priority_id.el.set_active_iter(iter);
1697 _this.priority_id.loading = false;
1704 public class Xcls_Label41 : Object
1706 public Gtk.Label el;
1707 private NewBranch _this;
1713 public Xcls_Label41(NewBranch _owner )
1716 this.el = new Gtk.Label( "Severity" );
1720 // set gobject values
1721 this.el.halign = Gtk.Align.START;
1724 // user defined functions
1727 public class Xcls_severity_id : Object
1729 public Gtk.ComboBox el;
1730 private NewBranch _this;
1734 public bool loading;
1737 public Xcls_severity_id(NewBranch _owner )
1740 _this.severity_id = this;
1741 this.el = new Gtk.ComboBox.with_entry();
1744 this.loading = false;
1746 // set gobject values
1747 var child_0 = new Xcls_sevmodel( _this );
1749 this.el.set_model ( child_0.el );
1753 this.el.set_entry_text_column(1);
1756 // user defined functions
1757 public string selectedSeverityId () {
1762 this.el.get_active_iter (out iter);
1763 _this.sevmodel.el.get_value (iter, 0, out val1);
1766 return (string) val1;
1773 public class Xcls_sevmodel : Object
1775 public Gtk.ListStore el;
1776 private NewBranch _this;
1782 public Xcls_sevmodel(NewBranch _owner )
1785 _this.sevmodel = this;
1786 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
1790 // set gobject values
1793 // user defined functions
1794 public void loadSeverities () {
1796 var rt = RooTicket.singleton();
1797 //rt.loadProjects();
1799 _this.severity_id.loading = true;
1805 var projects = rt.serverities;
1806 foreach(var project in projects) {
1808 el.append(out iter);
1810 el.set_value(iter, 0, project.id);
1811 el.set_value(iter, 1, project.display_name );
1812 if ("normal" == project.name) {
1813 _this.severity_id.el.set_active_iter(iter);
1818 _this.severity_id.loading = false;
1819 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
1825 public class Xcls_Label44 : Object
1827 public Gtk.Label el;
1828 private NewBranch _this;
1834 public Xcls_Label44(NewBranch _owner )
1837 this.el = new Gtk.Label( "Classification" );
1841 // set gobject values
1842 this.el.halign = Gtk.Align.START;
1845 // user defined functions
1848 public class Xcls_classification_id : Object
1850 public Gtk.ComboBox el;
1851 private NewBranch _this;
1855 public bool loading;
1858 public Xcls_classification_id(NewBranch _owner )
1861 _this.classification_id = this;
1862 this.el = new Gtk.ComboBox.with_entry();
1865 this.loading = false;
1867 // set gobject values
1868 var child_0 = new Xcls_clmodel( _this );
1870 this.el.set_model ( child_0.el );
1874 this.el.set_entry_text_column(1);
1877 // user defined functions
1878 public string selectedClassificationId () {
1883 this.el.get_active_iter (out iter);
1884 _this.clmodel.el.get_value (iter, 0, out val1);
1887 return (string) val1;
1894 public class Xcls_clmodel : Object
1896 public Gtk.ListStore el;
1897 private NewBranch _this;
1903 public Xcls_clmodel(NewBranch _owner )
1906 _this.clmodel = this;
1907 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
1911 // set gobject values
1914 // user defined functions
1915 public void loadClassifications ( ) {
1917 var rt = RooTicket.singleton();
1918 // rt.loadProjects();
1920 _this.classification_id.loading = true;
1926 el.append(out iter);
1929 var projects = rt.classifications;
1930 foreach(var project in projects) {
1932 el.append(out iter);
1934 el.set_value(iter, 0, project.id);
1935 el.set_value(iter, 1, project.display_name );
1936 if ("bug" == project.name) {
1937 _this.classification_id.el.set_active_iter(iter);
1942 _this.classification_id.loading = false;
1943 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
1949 public class Xcls_Label47 : Object
1951 public Gtk.Label el;
1952 private NewBranch _this;
1958 public Xcls_Label47(NewBranch _owner )
1961 this.el = new Gtk.Label( "Assign to" );
1965 // set gobject values
1966 this.el.halign = Gtk.Align.START;
1969 // user defined functions
1972 public class Xcls_developer_id : Object
1974 public Gtk.ComboBox el;
1975 private NewBranch _this;
1979 public bool loading;
1982 public Xcls_developer_id(NewBranch _owner )
1985 _this.developer_id = this;
1986 this.el = new Gtk.ComboBox.with_entry();
1989 this.loading = false;
1991 // set gobject values
1992 var child_0 = new Xcls_devmodel( _this );
1994 this.el.set_model ( child_0.el );
1998 this.el.set_entry_text_column(1);
2001 // user defined functions
2002 public string selectedDeveloperId () {
2007 this.el.get_active_iter (out iter);
2008 _this.devmodel.el.get_value (iter, 0, out val1);
2011 return (string) val1;
2018 public class Xcls_devmodel : Object
2020 public Gtk.ListStore el;
2021 private NewBranch _this;
2027 public Xcls_devmodel(NewBranch _owner )
2030 _this.devmodel = this;
2031 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
2035 // set gobject values
2038 // user defined functions
2039 public void loadDevelopers ( ) {
2041 var rt = RooTicket.singleton();
2042 //rt.loadProjects();
2044 _this.developer_id.loading = true;
2050 el.append(out iter);
2053 el.set_value(iter, 0, "");
2054 el.set_value(iter, 1, "-- select a developer --");
2056 _this.developer_id.el.set_active_iter(iter);
2059 var peps = rt.developers;
2060 foreach(var p in peps) {
2062 el.append(out iter);
2064 el.set_value(iter, 0, p.id);
2065 el.set_value(iter, 1, p.display_name );
2066 if (rt.authuser_id == p.id) {
2067 _this.developer_id.el.set_active_iter(iter);
2071 _this.developer_id.loading = false;
2072 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
2078 public class Xcls_Button50 : Object
2080 public Gtk.Button el;
2081 private NewBranch _this;
2087 public Xcls_Button50(NewBranch _owner )
2090 this.el = new Gtk.Button();
2094 // set gobject values
2095 this.el.label = "Create Ticket & Branch";
2100 this.el.get_style_context().add_class("suggested-action");
2104 this.el.clicked.connect( () => {
2105 GLib.debug("fire response = 1");
2108 var invalid = false;
2110 // validate first...
2111 _this.project_id.el.get_child().get_style_context().remove_class("warning");
2112 if (_this.project_id.selectedProjectId() == "") {
2113 _this.project_id.el.get_child().get_style_context().add_class("warning");
2117 _this.milestone_id.el.get_child().get_style_context().remove_class("warning");
2119 _this.priority_id.el.get_child().get_style_context().remove_class("warning");
2120 if (_this.priority_id.selectedPriorityId() == "") {
2121 _this.priority_id.el.get_child().get_style_context().add_class("warning");
2125 _this.classification_id.el.get_child().get_style_context().remove_class("warning");
2126 if (_this.classification_id.selectedClassificationId() == "") {
2127 _this.classification_id.el.get_child().get_style_context().add_class("warning");
2131 _this.developer_id.el.get_child().get_style_context().remove_class("warning");
2132 if (_this.developer_id.selectedDeveloperId() == "") {
2133 _this.developer_id.el.get_child().get_style_context().add_class("warning");
2137 _this.summary.el.get_style_context().remove_class("warning");
2138 if (_this.summary.el.get_text() == "") {
2139 _this.summary.el.get_style_context().add_class("warning");
2143 _this.description.el.get_style_context().remove_class("warning");
2148 GLib.debug("for is valid");
2150 _this.el.response(1);
2154 // user defined functions
2159 public class Xcls_Box51 : Object
2162 private NewBranch _this;
2168 public Xcls_Box51(NewBranch _owner )
2171 this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
2175 // set gobject values
2176 this.el.homogeneous = false;
2177 var child_0 = new Xcls_Table52( _this );
2179 this.el.pack_start ( child_0.el , false,false,0 );
2182 // user defined functions
2184 public class Xcls_Table52 : Object
2186 public Gtk.Table el;
2187 private NewBranch _this;
2193 public Xcls_Table52(NewBranch _owner )
2196 this.el = new Gtk.Table( 5, 5, true );
2200 // set gobject values
2201 this.el.expand = false;
2203 this.el.column_spacing = 4;
2204 this.el.vexpand = false;
2205 var child_0 = new Xcls_Label53( _this );
2207 this.el.attach_defaults ( child_0.el , 0,1,3,4 );
2208 var child_1 = new Xcls_commit_message( _this );
2210 this.el.attach_defaults ( child_1.el , 0,4,4,5 );
2211 var child_2 = new Xcls_createbtn( _this );
2213 this.el.attach_defaults ( child_2.el , 4,5,4,5 );
2214 var child_3 = new Xcls_Box56( _this );
2216 this.el.attach_defaults ( child_3.el , 0,5,2,3 );
2219 // user defined functions
2221 public class Xcls_Label53 : Object
2223 public Gtk.Label el;
2224 private NewBranch _this;
2230 public Xcls_Label53(NewBranch _owner )
2233 this.el = new Gtk.Label( "Commit Message" );
2237 // set gobject values
2238 this.el.halign = Gtk.Align.START;
2239 this.el.justify = Gtk.Justification.RIGHT;
2240 this.el.xalign = 0.900000f;
2243 // user defined functions
2246 public class Xcls_commit_message : Object
2248 public Gtk.Entry el;
2249 private NewBranch _this;
2255 public Xcls_commit_message(NewBranch _owner )
2258 _this.commit_message = this;
2259 this.el = new Gtk.Entry();
2263 // set gobject values
2264 this.el.visible = true;
2267 // user defined functions
2270 public class Xcls_createbtn : Object
2272 public Gtk.Button el;
2273 private NewBranch _this;
2279 public Xcls_createbtn(NewBranch _owner )
2282 _this.createbtn = this;
2283 this.el = new Gtk.Button();
2287 // set gobject values
2288 this.el.label = "Commit Changes";
2293 this.el.get_style_context().add_class("suggested-action");
2297 this.el.clicked.connect( () => {
2299 GLib.debug("fire response = 1");
2301 var ticket_id = _this.ticketsel.selectedTicketId();
2303 if (ticket_id == "") {
2304 _this.ticketsel.el.get_child().get_style_context().add_class("warning");
2308 _this.el.response(1);
2312 // user defined functions
2313 public void updateState () {
2315 var ticket_id = _this.ticketsel.selectedTicketId();
2317 if (ticket_id == "") {
2318 this.el.set_sensitive(false);
2322 this.el.set_sensitive(true);
2327 public class Xcls_Box56 : Object
2330 private NewBranch _this;
2336 public Xcls_Box56(NewBranch _owner )
2339 this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
2343 // set gobject values
2344 var child_0 = new Xcls_btn_not_me( _this );
2346 this.el.add ( child_0.el );
2347 var child_1 = new Xcls_btn_closed( _this );
2349 this.el.add ( child_1.el );
2350 var child_2 = new Xcls_Label59( _this );
2352 this.el.add ( child_2.el );
2355 // user defined functions
2357 public class Xcls_btn_not_me : Object
2359 public Gtk.CheckButton el;
2360 private NewBranch _this;
2366 public Xcls_btn_not_me(NewBranch _owner )
2369 _this.btn_not_me = this;
2370 this.el = new Gtk.CheckButton();
2374 // set gobject values
2375 this.el.label = "Show tickets not assigned to me";
2378 this.el.toggled.connect( () => {
2379 var project_id = _this.projectsel.selectedProjectId();
2380 _this.dbmodel.loadTickets(project_id);
2384 // user defined functions
2387 public class Xcls_btn_closed : Object
2389 public Gtk.CheckButton el;
2390 private NewBranch _this;
2396 public Xcls_btn_closed(NewBranch _owner )
2399 _this.btn_closed = this;
2400 this.el = new Gtk.CheckButton();
2404 // set gobject values
2405 this.el.label = "Show closed Tickets";
2408 this.el.toggled.connect( () => {
2409 var project_id = _this.projectsel.selectedProjectId();
2410 _this.dbmodel.loadTickets(project_id);
2415 // user defined functions
2418 public class Xcls_Label59 : Object
2420 public Gtk.Label el;
2421 private NewBranch _this;
2427 public Xcls_Label59(NewBranch _owner )
2430 this.el = new Gtk.Label( "<a href=\"refresh\">Refresh Ticket list</a>" );
2434 // set gobject values
2435 this.el.halign = Gtk.Align.END;
2436 this.el.hexpand = true;
2437 this.el.use_markup = true;
2440 this.el.activate_link.connect( (uri) => {
2441 if (uri == "refresh") {
2442 RooProject.reload();
2443 var curproj = RooProject.getProjectByRepo(_this.repo);
2444 _this.prmodel.loadProjects(curproj == null ? "": curproj.id);
2446 _this.dbmodel.loadTickets(curproj == null ? "": curproj.id);
2452 // user defined functions