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;
50 public Gee.ArrayList<GitMonitorQueue> queue;
56 this.el = new Gtk.Dialog();
64 this.el.title = "Create a working branch ";
65 this.el.default_height = 500;
66 this.el.default_width = 500;
67 this.el.deletable = true;
69 var child_0 = new Xcls_Notebook2( _this );
71 this.el.get_content_area().add ( child_0.el );
74 this.el.delete_event.connect( (self, event) => {
79 this.el.response.connect( (self, response_id) => {
81 GLib.debug("got %d", (int) response_id);
86 // have they selected a ticket..
87 // make that the current active ticket?
88 // we really need to store locally what ticket is being worked on..
89 // in theory we could be working on multiple project and not merging..
90 // -- each repo would have their active ticket (only one per repo)
91 // -- so we could just store that in there
92 // -- initial load can check the contents of the ticket files on first scan.
95 if (response_id < 1) {
101 var ticket_id = _this.ticketsel.selectedTicketId();
103 if (this.repo != null) {
104 var bn = _this.name.el.get_text();
106 var res = this.repo.setActiveTicket(
107 RooTicket.singleton().getById(ticket_id != "" ? ticket_id : "-1"), bn
110 // start the monitoring..
111 GitMonitor.gitmonitor.start();
117 this.running = false;
127 // user defined functions
128 public void show ( GitRepo repo, Gee.ArrayList<GitMonitorQueue> queue, string tid = "" )
130 // this.el.set_gravity(Gdk.Gravity.NORTH);
131 if (this.running) { // should not happen!!
132 GLib.error("new branch show called, when already being displayed?");
137 GitMonitor.gitmonitor.stop();
143 this.el.move((Gdk.Screen.width() / 2)- 250 ,0);
144 this.el.set_default_size( 500,200); // not sure why it grows..
145 GLib.debug("Loading tickets");
149 this.el.set_keep_above(true);
152 var curproj = RooProject.getProjectByRepo(this.repo);
153 _this.prmodel.loadProjects(curproj == null ? "" : curproj.id);
155 _this.dbmodel.loadTickets(curproj == null ? "": curproj.id, tid);
156 _this.createbtn.updateState();
158 _this.ticketsel.el.get_child().get_style_context().remove_class("warning");
160 var name = RooTicket.singleton().usernameLocal();
161 var ticket = RooTicket.singleton().getById(tid);
162 _this.name.el.set_text("wip_%s_T%s_%s".printf(name,ticket.id, ticket.summaryToBranchName()));
164 _this.ticketsel.el.get_child().get_style_context().add_class("warning");
166 _this.view.loadTicket(tid);
170 public class Xcls_Notebook2 : Object
172 public Gtk.Notebook el;
173 private NewBranch _this;
179 public Xcls_Notebook2(NewBranch _owner )
182 this.el = new Gtk.Notebook();
186 // set gobject values
187 this.el.vexpand = true;
188 var child_0 = new Xcls_label_select_ticket( _this );
190 var child_1 = new Xcls_label_create_ticket( _this );
192 var child_2 = new Xcls_label_quick_commit( _this );
194 var child_3 = new Xcls_Box6( _this );
196 this.el.append_page ( child_3.el , _this.label_select_ticket.el );
197 var child_4 = new Xcls_Box26( _this );
199 this.el.append_page ( child_4.el , _this.label_create_ticket.el );
200 var child_5 = new Xcls_Box52( _this );
202 this.el.append_page ( child_5.el , _this.label_quick_commit.el );
205 // user defined functions
207 public class Xcls_label_select_ticket : Object
210 private NewBranch _this;
216 public Xcls_label_select_ticket(NewBranch _owner )
219 _this.label_select_ticket = this;
220 this.el = new Gtk.Label( "Select Existing Ticket to work on" );
224 // set gobject values
227 // user defined functions
230 public class Xcls_label_create_ticket : Object
233 private NewBranch _this;
239 public Xcls_label_create_ticket(NewBranch _owner )
242 _this.label_create_ticket = this;
243 this.el = new Gtk.Label( "Create a New Ticket" );
247 // set gobject values
250 // user defined functions
253 public class Xcls_label_quick_commit : Object
256 private NewBranch _this;
262 public Xcls_label_quick_commit(NewBranch _owner )
265 _this.label_quick_commit = this;
266 this.el = new Gtk.Label( "Quick Commit" );
270 // set gobject values
273 // user defined functions
276 public class Xcls_Box6 : Object
279 private NewBranch _this;
285 public Xcls_Box6(NewBranch _owner )
288 this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
292 // set gobject values
293 this.el.homogeneous = false;
294 var child_0 = new Xcls_Table7( _this );
296 this.el.pack_start ( child_0.el , false,false,0 );
297 var child_1 = new Xcls_scrolled_window( _this );
299 this.el.add ( child_1.el );
302 // user defined functions
304 public class Xcls_Table7 : Object
307 private NewBranch _this;
313 public Xcls_Table7(NewBranch _owner )
316 this.el = new Gtk.Table( 5, 5, true );
320 // set gobject values
321 this.el.expand = false;
323 this.el.column_spacing = 4;
324 this.el.vexpand = false;
325 var child_0 = new Xcls_Label8( _this );
327 this.el.attach_defaults ( child_0.el , 0,1,0,1 );
328 var child_1 = new Xcls_Label9( _this );
330 this.el.attach_defaults ( child_1.el , 1,2,0,1 );
331 var child_2 = new Xcls_projectsel( _this );
333 this.el.attach_defaults ( child_2.el , 0,1,1,2 );
334 var child_3 = new Xcls_ticketsel( _this );
336 this.el.attach_defaults ( child_3.el , 1,4,1,2 );
337 var child_4 = new Xcls_Button16( _this );
339 this.el.attach_defaults ( child_4.el , 4,5,1,2 );
340 var child_5 = new Xcls_Label17( _this );
342 this.el.attach_defaults ( child_5.el , 0,1,3,4 );
343 var child_6 = new Xcls_name( _this );
345 this.el.attach_defaults ( child_6.el , 0,4,4,5 );
346 var child_7 = new Xcls_createbtn( _this );
348 this.el.attach_defaults ( child_7.el , 4,5,4,5 );
349 var child_8 = new Xcls_Box20( _this );
351 this.el.attach_defaults ( child_8.el , 0,5,2,3 );
354 // user defined functions
356 public class Xcls_Label8 : Object
359 private NewBranch _this;
365 public Xcls_Label8(NewBranch _owner )
368 this.el = new Gtk.Label( "Project" );
372 // set gobject values
373 this.el.halign = Gtk.Align.START;
374 this.el.justify = Gtk.Justification.RIGHT;
375 this.el.visible = true;
378 // user defined functions
381 public class Xcls_Label9 : Object
384 private NewBranch _this;
390 public Xcls_Label9(NewBranch _owner )
393 this.el = new Gtk.Label( "Ticket" );
397 // set gobject values
398 this.el.halign = Gtk.Align.START;
399 this.el.visible = true;
402 // user defined functions
405 public class Xcls_projectsel : Object
407 public Gtk.ComboBox el;
408 private NewBranch _this;
415 public Xcls_projectsel(NewBranch _owner )
418 _this.projectsel = this;
419 this.el = new Gtk.ComboBox.with_entry();
422 this.loading = false;
424 // set gobject values
425 var child_0 = new Xcls_prcellrenderer( _this );
427 this.el.pack_start ( child_0.el , true );
428 var child_1 = new Xcls_prmodel( _this );
430 this.el.set_model ( child_1.el );
434 this.el.set_entry_text_column(1);
437 this.el.changed.connect( () => {
441 var project_id = this.selectedProjectId();
442 _this.dbmodel.loadTickets(project_id);
445 /*if (this.loading) {
448 var ticket_id = this.selectedTicketId();
450 var name = RooTicket.singleton().usernameLocal();
452 if (ticket_id == "" || ticket_id == null) {
454 var dt = new DateTime.now_local();
455 _this.name.el.set_text("wip_%s_%s".printf(name,dt.format("%Y_%b_%d")));
460 var ticket = RooTicket.singleton().getById(ticket_id);
462 _this.name.el.set_text("wip_%s_T%s_%s".printf(name,ticket.id, ticket.summaryToBranchName()));
464 //GLib.debug (//"Selection: %s, %s\n", (string) val1, (string) val2);
469 // user defined functions
470 public string selectedProjectId () {
475 this.el.get_active_iter (out iter);
476 _this.prmodel.el.get_value (iter, 0, out val1);
479 return (string) val1;
486 public class Xcls_prcellrenderer : Object
488 public Gtk.CellRendererText el;
489 private NewBranch _this;
495 public Xcls_prcellrenderer(NewBranch _owner )
498 _this.prcellrenderer = this;
499 this.el = new Gtk.CellRendererText();
503 // set gobject values
506 // user defined functions
509 public class Xcls_prmodel : Object
511 public Gtk.ListStore el;
512 private NewBranch _this;
518 public Xcls_prmodel(NewBranch _owner )
521 _this.prmodel = this;
522 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
526 // set gobject values
529 // user defined functions
530 public void loadProjects (string id) {
534 _this.projectsel.loading = true;
543 el.set_value(iter, 0, "");
544 el.set_value(iter, 1, "-- select a project --");
546 _this.projectsel.el.set_active_iter(iter);
549 foreach(var project in RooProject.projects()) {
553 el.set_value(iter, 0, project.id);
554 el.set_value(iter, 1, project.name );
555 if (id == project.id) {
556 _this.projectsel.el.set_active_iter(iter);
561 _this.projectsel.loading = false;
562 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
568 public class Xcls_ticketsel : Object
570 public Gtk.ComboBox el;
571 private NewBranch _this;
578 public Xcls_ticketsel(NewBranch _owner )
581 _this.ticketsel = this;
582 this.el = new Gtk.ComboBox.with_entry();
585 this.loading = false;
587 // set gobject values
588 var child_0 = new Xcls_dbcellrenderer( _this );
590 this.el.pack_start ( child_0.el , true );
591 var child_1 = new Xcls_dbmodel( _this );
593 this.el.set_model ( child_1.el );
597 //this.el.add_attribute(_this.dbcellrenderer.el , "markup", 1 );
598 this.el.set_entry_text_column(1);
599 this.el.get_child().set_sensitive(false);
602 this.el.changed.connect( () => {
606 var ticket_id = this.selectedTicketId();
608 var name = RooTicket.singleton().usernameLocal();
610 this.el.get_child().get_style_context().remove_class("warning");
611 if (ticket_id == "" || ticket_id == null) {
613 var dt = new DateTime.now_local();
614 _this.name.el.set_text("wip_%s_%s".printf(name,dt.format("%Y_%b_%d")));
615 _this.view.loadTicket("");
617 this.el.get_child().get_style_context().add_class("warning");
618 _this.createbtn.updateState();
623 var ticket = RooTicket.singleton().getById(ticket_id);
625 _this.name.el.set_text("wip_%s_T%s_%s".printf(name,ticket.id, ticket.summaryToBranchName()));
626 _this.scrolled_window.el.show();
628 _this.view.loadTicket(ticket.id);
629 _this.createbtn.updateState();
631 //GLib.debug (//"Selection: %s, %s\n", (string) val1, (string) val2);
635 // user defined functions
636 public string selectedTicketId () {
641 this.el.get_active_iter (out iter);
642 _this.dbmodel.el.get_value (iter, 0, out val1);
645 return (string) val1;
652 public class Xcls_dbcellrenderer : Object
654 public Gtk.CellRendererText el;
655 private NewBranch _this;
661 public Xcls_dbcellrenderer(NewBranch _owner )
664 _this.dbcellrenderer = this;
665 this.el = new Gtk.CellRendererText();
669 // set gobject values
672 // user defined functions
675 public class Xcls_dbmodel : Object
677 public Gtk.ListStore el;
678 private NewBranch _this;
684 public Xcls_dbmodel(NewBranch _owner )
687 _this.dbmodel = this;
688 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
692 // set gobject values
695 // user defined functions
696 public void loadTickets (string project_id , string tid = "") {
700 // fixme .. get project id from selection..
702 RooTicket.singleton().loadTickets(
704 _this.btn_not_me.el.active ? RooTicket.Who.ANYBODY : RooTicket.Who.ME,
705 _this.btn_closed.el.active ? RooTicket.Status.ALL : RooTicket.Status.ACTIVE
708 _this.ticketsel.loading = true;
717 el.set_value(iter, 0, "");
718 el.set_value(iter, 1, "-- select a ticket --");
720 _this.ticketsel.el.set_active_iter(iter);
721 var tickets = RooTicket.singleton().tickets;
722 foreach(var ticket in tickets) {
726 el.set_value(iter, 0, ticket.id);
727 el.set_value(iter, 1, "#%s %s".printf( ticket.id, ticket.summary));
729 if (ticket.id == tid) {
730 _this.ticketsel.el.set_active_iter(iter);
735 _this.ticketsel.loading = false;
736 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
742 public class Xcls_Button16 : Object
744 public Gtk.Button el;
745 private NewBranch _this;
751 public Xcls_Button16(NewBranch _owner )
754 this.el = new Gtk.Button();
758 // set gobject values
759 this.el.expand = false;
760 this.el.label = "New Ticket";
763 this.el.clicked.connect( () => {
764 _this.el.response(-1);
765 Ticket.singleton().show(_this.repo);
770 // user defined functions
773 public class Xcls_Label17 : Object
776 private NewBranch _this;
782 public Xcls_Label17(NewBranch _owner )
785 this.el = new Gtk.Label( "Use this as branch name" );
789 // set gobject values
790 this.el.halign = Gtk.Align.START;
791 this.el.justify = Gtk.Justification.RIGHT;
792 this.el.xalign = 0.900000f;
795 // user defined functions
798 public class Xcls_name : Object
801 private NewBranch _this;
807 public Xcls_name(NewBranch _owner )
811 this.el = new Gtk.Entry();
815 // set gobject values
816 this.el.visible = true;
819 // user defined functions
822 public class Xcls_createbtn : Object
824 public Gtk.Button el;
825 private NewBranch _this;
831 public Xcls_createbtn(NewBranch _owner )
834 _this.createbtn = this;
835 this.el = new Gtk.Button();
839 // set gobject values
840 this.el.label = "Create Branch";
845 this.el.get_style_context().add_class("suggested-action");
849 this.el.clicked.connect( () => {
851 GLib.debug("fire response = 1");
853 var ticket_id = _this.ticketsel.selectedTicketId();
855 if (ticket_id == "") {
856 _this.ticketsel.el.get_child().get_style_context().add_class("warning");
860 _this.el.response(1);
864 // user defined functions
865 public void updateState () {
867 var ticket_id = _this.ticketsel.selectedTicketId();
869 if (ticket_id == "") {
870 this.el.set_sensitive(false);
874 this.el.set_sensitive(true);
879 public class Xcls_Box20 : Object
882 private NewBranch _this;
888 public Xcls_Box20(NewBranch _owner )
891 this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
895 // set gobject values
896 var child_0 = new Xcls_btn_not_me( _this );
898 this.el.add ( child_0.el );
899 var child_1 = new Xcls_btn_closed( _this );
901 this.el.add ( child_1.el );
902 var child_2 = new Xcls_Label23( _this );
904 this.el.add ( child_2.el );
907 // user defined functions
909 public class Xcls_btn_not_me : Object
911 public Gtk.CheckButton el;
912 private NewBranch _this;
918 public Xcls_btn_not_me(NewBranch _owner )
921 _this.btn_not_me = this;
922 this.el = new Gtk.CheckButton();
926 // set gobject values
927 this.el.label = "Show tickets not assigned to me";
930 this.el.toggled.connect( () => {
931 var project_id = _this.projectsel.selectedProjectId();
932 _this.dbmodel.loadTickets(project_id);
936 // user defined functions
939 public class Xcls_btn_closed : Object
941 public Gtk.CheckButton el;
942 private NewBranch _this;
948 public Xcls_btn_closed(NewBranch _owner )
951 _this.btn_closed = this;
952 this.el = new Gtk.CheckButton();
956 // set gobject values
957 this.el.label = "Show closed Tickets";
960 this.el.toggled.connect( () => {
961 var project_id = _this.projectsel.selectedProjectId();
962 _this.dbmodel.loadTickets(project_id);
967 // user defined functions
970 public class Xcls_Label23 : Object
973 private NewBranch _this;
979 public Xcls_Label23(NewBranch _owner )
982 this.el = new Gtk.Label( "<a href=\"refresh\">Refresh Ticket list</a>" );
986 // set gobject values
987 this.el.halign = Gtk.Align.END;
988 this.el.hexpand = true;
989 this.el.use_markup = true;
992 this.el.activate_link.connect( (uri) => {
993 if (uri == "refresh") {
995 var curproj = RooProject.getProjectByRepo(_this.repo);
996 _this.prmodel.loadProjects(curproj == null ? "": curproj.id);
998 _this.dbmodel.loadTickets(curproj == null ? "": curproj.id);
1004 // user defined functions
1009 public class Xcls_scrolled_window : Object
1011 public Gtk.ScrolledWindow el;
1012 private NewBranch _this;
1018 public Xcls_scrolled_window(NewBranch _owner )
1021 _this.scrolled_window = this;
1022 this.el = new Gtk.ScrolledWindow( null, null );
1026 // set gobject values
1027 this.el.height_request = 500;
1028 this.el.vexpand = true;
1029 var child_0 = new Xcls_view( _this );
1031 this.el.add ( child_0.el );
1036 this.el.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);
1040 // user defined functions
1042 public class Xcls_view : Object
1044 public WebKit.WebView el;
1045 private NewBranch _this;
1051 public Xcls_view(NewBranch _owner )
1055 this.el = new WebKit.WebView();
1059 // set gobject values
1062 // user defined functions
1063 public void loadTicket (string tid) {
1065 _this.el.get_size(out w, out h);
1068 _this.scrolled_window.el.hide();
1069 _this.el.resize(w, 150);
1071 _this.scrolled_window.el.show();
1072 _this.el.resize(w, 800);
1075 var rs = RooTicket.singleton();
1076 var uri = new WebKit.URIRequest("https://roojs.com/admin.php/MTrack/View/" + tid);
1077 var hd = uri.get_http_headers();
1078 var authCode = Base64.encode ("%s:%s".printf(rs.username, rs.password).data);
1079 hd.append("Authorization", "Basic %s".printf(authCode));
1081 this.el.load_request(uri);
1087 public class Xcls_Box26 : Object
1090 private NewBranch _this;
1096 public Xcls_Box26(NewBranch _owner )
1099 this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
1103 // set gobject values
1104 this.el.homogeneous = false;
1105 var child_0 = new Xcls_table( _this );
1107 this.el.pack_start ( child_0.el , false,false,0 );
1110 // user defined functions
1112 public class Xcls_table : Object
1114 public Gtk.Table el;
1115 private NewBranch _this;
1121 public Xcls_table(NewBranch _owner )
1125 this.el = new Gtk.Table( 14, 4, true );
1129 // set gobject values
1130 this.el.expand = false;
1132 this.el.column_spacing = 4;
1133 this.el.vexpand = false;
1134 var child_0 = new Xcls_Label28( _this );
1136 this.el.attach_defaults ( child_0.el , 0,1,0,1 );
1137 var child_1 = new Xcls_Label29( _this );
1139 this.el.attach_defaults ( child_1.el , 1,2,0,1 );
1140 var child_2 = new Xcls_project_id( _this );
1142 this.el.attach_defaults ( child_2.el , 0,1,1,2 );
1143 var child_3 = new Xcls_summary( _this );
1145 this.el.attach_defaults ( child_3.el , 1,4,1,2 );
1146 var child_4 = new Xcls_Label34( _this );
1148 this.el.attach_defaults ( child_4.el , 0,1,2,3 );
1149 var child_5 = new Xcls_milestone_id( _this );
1151 this.el.attach_defaults ( child_5.el , 0,1,3,4 );
1152 var child_6 = new Xcls_Label37( _this );
1154 this.el.attach_defaults ( child_6.el , 1,4,2,3 );
1155 var child_7 = new Xcls_description( _this );
1157 this.el.attach_defaults ( child_7.el , 1,4,3,12 );
1158 var child_8 = new Xcls_Label39( _this );
1160 this.el.attach_defaults ( child_8.el , 0,1,4,5 );
1161 var child_9 = new Xcls_priority_id( _this );
1163 this.el.attach_defaults ( child_9.el , 0,1,5,6 );
1164 var child_10 = new Xcls_Label42( _this );
1166 this.el.attach_defaults ( child_10.el , 0,1,6,7 );
1167 var child_11 = new Xcls_severity_id( _this );
1169 this.el.attach_defaults ( child_11.el , 0,1,7,8 );
1170 var child_12 = new Xcls_Label45( _this );
1172 this.el.attach_defaults ( child_12.el , 0,1,8,9 );
1173 var child_13 = new Xcls_classification_id( _this );
1175 this.el.attach_defaults ( child_13.el , 0,1,9,10 );
1176 var child_14 = new Xcls_Label48( _this );
1178 this.el.attach_defaults ( child_14.el , 0,1,10,11 );
1179 var child_15 = new Xcls_developer_id( _this );
1181 this.el.attach_defaults ( child_15.el , 0,1,11,12 );
1182 var child_16 = new Xcls_Button51( _this );
1184 this.el.attach_defaults ( child_16.el , 0,4,13,14 );
1187 // user defined functions
1189 public class Xcls_Label28 : Object
1191 public Gtk.Label el;
1192 private NewBranch _this;
1198 public Xcls_Label28(NewBranch _owner )
1201 this.el = new Gtk.Label( "Project" );
1205 // set gobject values
1206 this.el.halign = Gtk.Align.START;
1207 this.el.visible = true;
1210 // user defined functions
1213 public class Xcls_Label29 : Object
1215 public Gtk.Label el;
1216 private NewBranch _this;
1222 public Xcls_Label29(NewBranch _owner )
1225 this.el = new Gtk.Label( "Summary" );
1229 // set gobject values
1230 this.el.halign = Gtk.Align.START;
1231 this.el.visible = true;
1234 // user defined functions
1237 public class Xcls_project_id : Object
1239 public Gtk.ComboBox el;
1240 private NewBranch _this;
1244 public bool loading;
1247 public Xcls_project_id(NewBranch _owner )
1250 _this.project_id = this;
1251 this.el = new Gtk.ComboBox.with_entry();
1254 this.loading = false;
1256 // set gobject values
1257 var child_0 = new Xcls_prcellrenderer( _this );
1259 this.el.pack_start ( child_0.el , true );
1260 var child_1 = new Xcls_prmodel( _this );
1262 this.el.set_model ( child_1.el );
1266 this.el.set_entry_text_column(1);
1269 this.el.changed.connect( () => {
1273 var project_id = this.selectedProjectId();
1275 var rt = RooTicket.singleton();
1276 rt.loadProjectOptions(project_id);
1278 _this.msmodel.loadMilestones();
1279 _this.primodel.loadPriorities();
1280 _this.sevmodel.loadSeverities();
1281 _this.clmodel.loadClassifications();
1282 _this.devmodel.loadDevelopers();
1284 // affects projects and milestones..
1287 /*if (this.loading) {
1290 var ticket_id = this.selectedTicketId();
1292 var name = RooTicket.singleton().usernameLocal();
1294 if (ticket_id == "" || ticket_id == null) {
1296 var dt = new DateTime.now_local();
1297 _this.name.el.set_text("wip_%s_%s".printf(name,dt.format("%Y_%b_%d")));
1302 var ticket = RooTicket.singleton().getById(ticket_id);
1304 _this.name.el.set_text("wip_%s_T%s_%s".printf(name,ticket.id, ticket.summaryToBranchName()));
1306 //GLib.debug (//"Selection: %s, %s\n", (string) val1, (string) val2);
1311 // user defined functions
1312 public string selectedProjectId () {
1317 this.el.get_active_iter (out iter);
1318 _this.prmodel.el.get_value (iter, 0, out val1);
1321 return (string) val1;
1328 public class Xcls_prcellrenderer : Object
1330 public Gtk.CellRendererText el;
1331 private NewBranch _this;
1337 public Xcls_prcellrenderer(NewBranch _owner )
1340 _this.prcellrenderer = this;
1341 this.el = new Gtk.CellRendererText();
1345 // set gobject values
1348 // user defined functions
1351 public class Xcls_prmodel : Object
1353 public Gtk.ListStore el;
1354 private NewBranch _this;
1360 public Xcls_prmodel(NewBranch _owner )
1363 _this.prmodel = this;
1364 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
1368 // set gobject values
1371 // user defined functions
1372 public void loadProjects (string id) {
1375 _this.project_id.loading = true;
1381 el.append(out iter);
1384 el.set_value(iter, 0, "");
1385 el.set_value(iter, 1, "-- select a project --");
1387 _this.project_id.el.set_active_iter(iter);
1390 foreach(var project in RooProject.projects()) {
1392 el.append(out iter);
1394 el.set_value(iter, 0, project.id);
1395 el.set_value(iter, 1, project.name );
1396 if (id == project.id) {
1397 _this.project_id.el.set_active_iter(iter);
1402 _this.project_id.loading = false;
1403 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
1409 public class Xcls_summary : Object
1411 public Gtk.Entry el;
1412 private NewBranch _this;
1418 public Xcls_summary(NewBranch _owner )
1421 _this.summary = this;
1422 this.el = new Gtk.Entry();
1426 // set gobject values
1427 this.el.visible = true;
1430 // user defined functions
1433 public class Xcls_Label34 : Object
1435 public Gtk.Label el;
1436 private NewBranch _this;
1442 public Xcls_Label34(NewBranch _owner )
1445 this.el = new Gtk.Label( "Milestone" );
1449 // set gobject values
1450 this.el.halign = Gtk.Align.START;
1451 this.el.justify = Gtk.Justification.RIGHT;
1452 this.el.xalign = 0.900000f;
1455 // user defined functions
1458 public class Xcls_milestone_id : Object
1460 public Gtk.ComboBox el;
1461 private NewBranch _this;
1465 public bool loading;
1468 public Xcls_milestone_id(NewBranch _owner )
1471 _this.milestone_id = this;
1472 this.el = new Gtk.ComboBox.with_entry();
1475 this.loading = false;
1477 // set gobject values
1478 var child_0 = new Xcls_msmodel( _this );
1480 this.el.set_model ( child_0.el );
1484 this.el.set_entry_text_column(1);
1487 // user defined functions
1488 public string selectedMilestoneId () {
1493 this.el.get_active_iter (out iter);
1494 _this.msmodel.el.get_value (iter, 0, out val1);
1497 return (string) val1;
1504 public class Xcls_msmodel : Object
1506 public Gtk.ListStore el;
1507 private NewBranch _this;
1513 public Xcls_msmodel(NewBranch _owner )
1516 _this.msmodel = this;
1517 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
1521 // set gobject values
1524 // user defined functions
1525 public void loadMilestones ( ) {
1527 var rt = RooTicket.singleton();
1528 // rt.loadProjects();
1530 _this.milestone_id.loading = true;
1536 el.append(out iter);
1539 el.set_value(iter, 0, "");
1540 el.set_value(iter, 1, "-- select a milestone --");
1541 _this.milestone_id.el.set_active_iter(iter);
1543 var projects = rt.milestones;
1544 foreach(var project in projects) {
1546 el.append(out iter);
1548 el.set_value(iter, 0, project.id);
1549 el.set_value(iter, 1, project.display_name );
1550 // if (id == project.id) {
1551 // _this.milestone.el.set_active_iter(iter);
1557 _this.milestone_id.loading = false;
1558 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
1564 public class Xcls_Label37 : Object
1566 public Gtk.Label el;
1567 private NewBranch _this;
1573 public Xcls_Label37(NewBranch _owner )
1576 this.el = new Gtk.Label( "Description" );
1580 // set gobject values
1581 this.el.halign = Gtk.Align.START;
1584 // user defined functions
1587 public class Xcls_description : Object
1589 public Gtk.TextView el;
1590 private NewBranch _this;
1596 public Xcls_description(NewBranch _owner )
1599 _this.description = this;
1600 this.el = new Gtk.TextView();
1604 // set gobject values
1605 this.el.border_width = 1;
1608 // user defined functions
1611 public class Xcls_Label39 : Object
1613 public Gtk.Label el;
1614 private NewBranch _this;
1620 public Xcls_Label39(NewBranch _owner )
1623 this.el = new Gtk.Label( "Priority" );
1627 // set gobject values
1628 this.el.halign = Gtk.Align.START;
1629 this.el.xalign = 0.900000f;
1632 // user defined functions
1635 public class Xcls_priority_id : Object
1637 public Gtk.ComboBox el;
1638 private NewBranch _this;
1642 public bool loading;
1645 public Xcls_priority_id(NewBranch _owner )
1648 _this.priority_id = this;
1649 this.el = new Gtk.ComboBox.with_entry();
1652 this.loading = false;
1654 // set gobject values
1655 var child_0 = new Xcls_primodel( _this );
1657 this.el.set_model ( child_0.el );
1661 this.el.set_entry_text_column(1);
1664 // user defined functions
1665 public string selectedPriorityId () {
1670 this.el.get_active_iter (out iter);
1671 _this.primodel.el.get_value (iter, 0, out val1);
1674 return (string) val1;
1681 public class Xcls_primodel : Object
1683 public Gtk.ListStore el;
1684 private NewBranch _this;
1690 public Xcls_primodel(NewBranch _owner )
1693 _this.primodel = this;
1694 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
1698 // set gobject values
1701 // user defined functions
1702 public void loadPriorities ( ) {
1704 var rt = RooTicket.singleton();
1705 // rt.loadProjects();
1707 _this.priority_id.loading = true;
1714 var projects = rt.priorities;
1715 foreach(var project in projects) {
1717 el.append(out iter);
1719 el.set_value(iter, 0, project.id);
1720 el.set_value(iter, 1, project.display_name );
1721 if ("normal" == project.name) {
1722 _this.priority_id.el.set_active_iter(iter);
1727 _this.priority_id.loading = false;
1734 public class Xcls_Label42 : Object
1736 public Gtk.Label el;
1737 private NewBranch _this;
1743 public Xcls_Label42(NewBranch _owner )
1746 this.el = new Gtk.Label( "Severity" );
1750 // set gobject values
1751 this.el.halign = Gtk.Align.START;
1754 // user defined functions
1757 public class Xcls_severity_id : Object
1759 public Gtk.ComboBox el;
1760 private NewBranch _this;
1764 public bool loading;
1767 public Xcls_severity_id(NewBranch _owner )
1770 _this.severity_id = this;
1771 this.el = new Gtk.ComboBox.with_entry();
1774 this.loading = false;
1776 // set gobject values
1777 var child_0 = new Xcls_sevmodel( _this );
1779 this.el.set_model ( child_0.el );
1783 this.el.set_entry_text_column(1);
1786 // user defined functions
1787 public string selectedSeverityId () {
1792 this.el.get_active_iter (out iter);
1793 _this.sevmodel.el.get_value (iter, 0, out val1);
1796 return (string) val1;
1803 public class Xcls_sevmodel : Object
1805 public Gtk.ListStore el;
1806 private NewBranch _this;
1812 public Xcls_sevmodel(NewBranch _owner )
1815 _this.sevmodel = this;
1816 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
1820 // set gobject values
1823 // user defined functions
1824 public void loadSeverities () {
1826 var rt = RooTicket.singleton();
1827 //rt.loadProjects();
1829 _this.severity_id.loading = true;
1835 var projects = rt.serverities;
1836 foreach(var project in projects) {
1838 el.append(out iter);
1840 el.set_value(iter, 0, project.id);
1841 el.set_value(iter, 1, project.display_name );
1842 if ("normal" == project.name) {
1843 _this.severity_id.el.set_active_iter(iter);
1848 _this.severity_id.loading = false;
1849 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
1855 public class Xcls_Label45 : Object
1857 public Gtk.Label el;
1858 private NewBranch _this;
1864 public Xcls_Label45(NewBranch _owner )
1867 this.el = new Gtk.Label( "Classification" );
1871 // set gobject values
1872 this.el.halign = Gtk.Align.START;
1875 // user defined functions
1878 public class Xcls_classification_id : Object
1880 public Gtk.ComboBox el;
1881 private NewBranch _this;
1885 public bool loading;
1888 public Xcls_classification_id(NewBranch _owner )
1891 _this.classification_id = this;
1892 this.el = new Gtk.ComboBox.with_entry();
1895 this.loading = false;
1897 // set gobject values
1898 var child_0 = new Xcls_clmodel( _this );
1900 this.el.set_model ( child_0.el );
1904 this.el.set_entry_text_column(1);
1907 // user defined functions
1908 public string selectedClassificationId () {
1913 this.el.get_active_iter (out iter);
1914 _this.clmodel.el.get_value (iter, 0, out val1);
1917 return (string) val1;
1924 public class Xcls_clmodel : Object
1926 public Gtk.ListStore el;
1927 private NewBranch _this;
1933 public Xcls_clmodel(NewBranch _owner )
1936 _this.clmodel = this;
1937 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
1941 // set gobject values
1944 // user defined functions
1945 public void loadClassifications ( ) {
1947 var rt = RooTicket.singleton();
1948 // rt.loadProjects();
1950 _this.classification_id.loading = true;
1956 el.append(out iter);
1959 var projects = rt.classifications;
1960 foreach(var project in projects) {
1962 el.append(out iter);
1964 el.set_value(iter, 0, project.id);
1965 el.set_value(iter, 1, project.display_name );
1966 if ("bug" == project.name) {
1967 _this.classification_id.el.set_active_iter(iter);
1972 _this.classification_id.loading = false;
1973 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
1979 public class Xcls_Label48 : Object
1981 public Gtk.Label el;
1982 private NewBranch _this;
1988 public Xcls_Label48(NewBranch _owner )
1991 this.el = new Gtk.Label( "Assign to" );
1995 // set gobject values
1996 this.el.halign = Gtk.Align.START;
1999 // user defined functions
2002 public class Xcls_developer_id : Object
2004 public Gtk.ComboBox el;
2005 private NewBranch _this;
2009 public bool loading;
2012 public Xcls_developer_id(NewBranch _owner )
2015 _this.developer_id = this;
2016 this.el = new Gtk.ComboBox.with_entry();
2019 this.loading = false;
2021 // set gobject values
2022 var child_0 = new Xcls_devmodel( _this );
2024 this.el.set_model ( child_0.el );
2028 this.el.set_entry_text_column(1);
2031 // user defined functions
2032 public string selectedDeveloperId () {
2037 this.el.get_active_iter (out iter);
2038 _this.devmodel.el.get_value (iter, 0, out val1);
2041 return (string) val1;
2048 public class Xcls_devmodel : Object
2050 public Gtk.ListStore el;
2051 private NewBranch _this;
2057 public Xcls_devmodel(NewBranch _owner )
2060 _this.devmodel = this;
2061 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
2065 // set gobject values
2068 // user defined functions
2069 public void loadDevelopers ( ) {
2071 var rt = RooTicket.singleton();
2072 //rt.loadProjects();
2074 _this.developer_id.loading = true;
2080 el.append(out iter);
2083 el.set_value(iter, 0, "");
2084 el.set_value(iter, 1, "-- select a developer --");
2086 _this.developer_id.el.set_active_iter(iter);
2089 var peps = rt.developers;
2090 foreach(var p in peps) {
2092 el.append(out iter);
2094 el.set_value(iter, 0, p.id);
2095 el.set_value(iter, 1, p.display_name );
2096 if (rt.authuser_id == p.id) {
2097 _this.developer_id.el.set_active_iter(iter);
2101 _this.developer_id.loading = false;
2102 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
2108 public class Xcls_Button51 : Object
2110 public Gtk.Button el;
2111 private NewBranch _this;
2117 public Xcls_Button51(NewBranch _owner )
2120 this.el = new Gtk.Button();
2124 // set gobject values
2125 this.el.label = "Create Ticket & Branch";
2130 this.el.get_style_context().add_class("suggested-action");
2134 this.el.clicked.connect( () => {
2135 GLib.debug("fire response = 1");
2138 var invalid = false;
2140 // validate first...
2141 _this.project_id.el.get_child().get_style_context().remove_class("warning");
2142 if (_this.project_id.selectedProjectId() == "") {
2143 _this.project_id.el.get_child().get_style_context().add_class("warning");
2147 _this.milestone_id.el.get_child().get_style_context().remove_class("warning");
2149 _this.priority_id.el.get_child().get_style_context().remove_class("warning");
2150 if (_this.priority_id.selectedPriorityId() == "") {
2151 _this.priority_id.el.get_child().get_style_context().add_class("warning");
2155 _this.classification_id.el.get_child().get_style_context().remove_class("warning");
2156 if (_this.classification_id.selectedClassificationId() == "") {
2157 _this.classification_id.el.get_child().get_style_context().add_class("warning");
2161 _this.developer_id.el.get_child().get_style_context().remove_class("warning");
2162 if (_this.developer_id.selectedDeveloperId() == "") {
2163 _this.developer_id.el.get_child().get_style_context().add_class("warning");
2167 _this.summary.el.get_style_context().remove_class("warning");
2168 if (_this.summary.el.get_text() == "") {
2169 _this.summary.el.get_style_context().add_class("warning");
2173 _this.description.el.get_style_context().remove_class("warning");
2178 GLib.debug("for is valid");
2180 _this.el.response(1);
2184 // user defined functions
2189 public class Xcls_Box52 : Object
2192 private NewBranch _this;
2198 public Xcls_Box52(NewBranch _owner )
2201 this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
2205 // set gobject values
2206 this.el.homogeneous = false;
2209 // user defined functions