NewBranch.bjs
[gitlive] / NewBranch.vala
1 static NewBranch  _NewBranch;
2
3 public class NewBranch : Object
4 {
5     public Gtk.Dialog el;
6     private NewBranch  _this;
7
8     public static NewBranch singleton()
9     {
10         if (_NewBranch == null) {
11             _NewBranch= new NewBranch();
12         }
13         return _NewBranch;
14     }
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
49         // my vars (def)
50     public GitRepo? repo;
51     public bool running;
52     public Gee.ArrayList<GitMonitorQueue> queue;
53
54     // ctor
55     public NewBranch()
56     {
57         _this = this;
58         this.el = new Gtk.Dialog();
59
60         // my vars (dec)
61         this.repo = null;
62         this.running = false;
63         this.queue = null;
64
65         // set gobject values
66         this.el.title = "Create a working branch ";
67         this.el.default_height = 500;
68         this.el.default_width = 500;
69         this.el.deletable = true;
70         this.el.modal = true;
71         var child_0 = new Xcls_Notebook2( _this );
72         child_0.ref();
73         this.el.get_content_area().add (  child_0.el  );
74
75         //listeners
76         this.el.delete_event.connect( (self, event) => {
77             this.el.hide();
78             return true; 
79             //test  
80         });
81         this.el.response.connect( (self, response_id) =>  { 
82           
83                 GLib.debug("got %d", (int) response_id);
84                 
85                  
86                 
87                  
88                 // have they selected a ticket..
89                 // make that the current active ticket?
90                 // we really need to store locally what ticket is being worked on..
91                 // in theory we could be working on multiple project and not merging..
92                 // -- each repo would have their active ticket (only one per repo)
93                 // -- so we could just store that in there
94                 // -- initial load can check the contents of the ticket files on first scan.
95         
96                  
97                 if (response_id < 1) {
98                     _this.el.hide();    
99                     this.running = false; 
100                         return;
101                 }
102                 
103                 var ticket_id = _this.ticketsel.selectedTicketId();
104                 
105             if (this.repo != null) {
106                 var bn = _this.name.el.get_text();
107         
108                         var res = this.repo.setActiveTicket(                    
109                                  RooTicket.singleton().getById(ticket_id != "" ? ticket_id : "-1"), bn
110                          );
111                          if (res) {
112                                 // start the monitoring..
113                                  GitMonitor.gitmonitor.start();
114                                  
115                          }
116             }
117              
118         
119             this.running = false; 
120         
121                 this.el.hide();
122                  
123                  
124         
125                  
126         });
127     }
128
129     // user defined functions
130     public   void show ( GitRepo repo, Gee.ArrayList<GitMonitorQueue> queue, string tid = "" ) 
131     {
132          // this.el.set_gravity(Gdk.Gravity.NORTH);
133         if (this.running) { // should not happen!!
134                 GLib.error("new branch show called, when already being displayed?");
135         }
136         this.queue = queue;
137         
138         this.running  = true;
139         GitMonitor.gitmonitor.stop();
140         
141         this.repo = repo;
142         
143          
144         
145         this.el.move((Gdk.Screen.width() / 2)- 250 ,0);
146         this.el.set_default_size( 500,200); // not sure why it grows..
147         GLib.debug("Loading tickets"); 
148          
149     
150         this.el.show_all();
151         this.el.set_keep_above(true);
152        
153         
154         var curproj = RooProject.getProjectByRepo(this.repo);
155          _this.prmodel.loadProjects(curproj == null ? "" : curproj.id);
156         
157         _this.dbmodel.loadTickets(curproj == null ? "": curproj.id, tid);
158         _this.createbtn.updateState();
159         
160         _this.ticketsel.el.get_child().get_style_context().remove_class("warning");
161         if (tid != "") { 
162                 var name = RooTicket.singleton().usernameLocal();
163                 var ticket = RooTicket.singleton().getById(tid);
164                 _this.name.el.set_text("wip_%s_T%s_%s".printf(name,ticket.id, ticket.summaryToBranchName()));
165         } else {
166                 _this.ticketsel.el.get_child().get_style_context().add_class("warning");
167         }
168         _this.view.loadTicket(tid);
169         this.el.run();
170     
171     }
172     public class Xcls_Notebook2 : Object
173     {
174         public Gtk.Notebook el;
175         private NewBranch  _this;
176
177
178             // my vars (def)
179
180         // ctor
181         public Xcls_Notebook2(NewBranch _owner )
182         {
183             _this = _owner;
184             this.el = new Gtk.Notebook();
185
186             // my vars (dec)
187
188             // set gobject values
189             this.el.vexpand = true;
190             var child_0 = new Xcls_label_select_ticket( _this );
191             child_0.ref();
192             var child_1 = new Xcls_label_create_ticket( _this );
193             child_1.ref();
194             var child_2 = new Xcls_label_quick_commit( _this );
195             child_2.ref();
196             var child_3 = new Xcls_Box6( _this );
197             child_3.ref();
198             this.el.append_page (  child_3.el , _this.label_select_ticket.el );
199             var child_4 = new Xcls_Box25( _this );
200             child_4.ref();
201             this.el.append_page (  child_4.el , _this.label_create_ticket.el );
202             var child_5 = new Xcls_Box51( _this );
203             child_5.ref();
204             this.el.append_page (  child_5.el , _this.label_quick_commit.el );
205         }
206
207         // user defined functions
208     }
209     public class Xcls_label_select_ticket : Object
210     {
211         public Gtk.Label el;
212         private NewBranch  _this;
213
214
215             // my vars (def)
216
217         // ctor
218         public Xcls_label_select_ticket(NewBranch _owner )
219         {
220             _this = _owner;
221             _this.label_select_ticket = this;
222             this.el = new Gtk.Label( "Select Existing Ticket to work on" );
223
224             // my vars (dec)
225
226             // set gobject values
227         }
228
229         // user defined functions
230     }
231
232     public class Xcls_label_create_ticket : Object
233     {
234         public Gtk.Label el;
235         private NewBranch  _this;
236
237
238             // my vars (def)
239
240         // ctor
241         public Xcls_label_create_ticket(NewBranch _owner )
242         {
243             _this = _owner;
244             _this.label_create_ticket = this;
245             this.el = new Gtk.Label( "Create a New Ticket" );
246
247             // my vars (dec)
248
249             // set gobject values
250         }
251
252         // user defined functions
253     }
254
255     public class Xcls_label_quick_commit : Object
256     {
257         public Gtk.Label el;
258         private NewBranch  _this;
259
260
261             // my vars (def)
262
263         // ctor
264         public Xcls_label_quick_commit(NewBranch _owner )
265         {
266             _this = _owner;
267             _this.label_quick_commit = this;
268             this.el = new Gtk.Label( "Quick Commit" );
269
270             // my vars (dec)
271
272             // set gobject values
273         }
274
275         // user defined functions
276     }
277
278     public class Xcls_Box6 : Object
279     {
280         public Gtk.Box el;
281         private NewBranch  _this;
282
283
284             // my vars (def)
285
286         // ctor
287         public Xcls_Box6(NewBranch _owner )
288         {
289             _this = _owner;
290             this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
291
292             // my vars (dec)
293
294             // set gobject values
295             this.el.homogeneous = false;
296             var child_0 = new Xcls_Table7( _this );
297             child_0.ref();
298             this.el.pack_start (  child_0.el , false,false,0 );
299             var child_1 = new Xcls_scrolled_window( _this );
300             child_1.ref();
301             this.el.add (  child_1.el  );
302         }
303
304         // user defined functions
305     }
306     public class Xcls_Table7 : Object
307     {
308         public Gtk.Table el;
309         private NewBranch  _this;
310
311
312             // my vars (def)
313
314         // ctor
315         public Xcls_Table7(NewBranch _owner )
316         {
317             _this = _owner;
318             this.el = new Gtk.Table( 5, 5, true );
319
320             // my vars (dec)
321
322             // set gobject values
323             this.el.expand = false;
324             this.el.margin = 2;
325             this.el.column_spacing = 4;
326             this.el.vexpand = false;
327             var child_0 = new Xcls_Label8( _this );
328             child_0.ref();
329             this.el.attach_defaults (  child_0.el , 0,1,0,1 );
330             var child_1 = new Xcls_Label9( _this );
331             child_1.ref();
332             this.el.attach_defaults (  child_1.el , 1,2,0,1 );
333             var child_2 = new Xcls_projectsel( _this );
334             child_2.ref();
335             this.el.attach_defaults (  child_2.el , 0,1,1,2 );
336             var child_3 = new Xcls_ticketsel( _this );
337             child_3.ref();
338             this.el.attach_defaults (  child_3.el , 1,5,1,2 );
339             var child_4 = new Xcls_Label16( _this );
340             child_4.ref();
341             this.el.attach_defaults (  child_4.el , 0,1,3,4 );
342             var child_5 = new Xcls_name( _this );
343             child_5.ref();
344             this.el.attach_defaults (  child_5.el , 0,4,4,5 );
345             var child_6 = new Xcls_createbtn( _this );
346             child_6.ref();
347             this.el.attach_defaults (  child_6.el , 4,5,4,5 );
348             var child_7 = new Xcls_Box19( _this );
349             child_7.ref();
350             this.el.attach_defaults (  child_7.el , 0,5,2,3 );
351         }
352
353         // user defined functions
354     }
355     public class Xcls_Label8 : Object
356     {
357         public Gtk.Label el;
358         private NewBranch  _this;
359
360
361             // my vars (def)
362
363         // ctor
364         public Xcls_Label8(NewBranch _owner )
365         {
366             _this = _owner;
367             this.el = new Gtk.Label( "Project" );
368
369             // my vars (dec)
370
371             // set gobject values
372             this.el.halign = Gtk.Align.START;
373             this.el.justify = Gtk.Justification.RIGHT;
374             this.el.visible = true;
375         }
376
377         // user defined functions
378     }
379
380     public class Xcls_Label9 : Object
381     {
382         public Gtk.Label el;
383         private NewBranch  _this;
384
385
386             // my vars (def)
387
388         // ctor
389         public Xcls_Label9(NewBranch _owner )
390         {
391             _this = _owner;
392             this.el = new Gtk.Label( "Ticket" );
393
394             // my vars (dec)
395
396             // set gobject values
397             this.el.halign = Gtk.Align.START;
398             this.el.visible = true;
399         }
400
401         // user defined functions
402     }
403
404     public class Xcls_projectsel : Object
405     {
406         public Gtk.ComboBox el;
407         private NewBranch  _this;
408
409
410             // my vars (def)
411         public bool loading;
412
413         // ctor
414         public Xcls_projectsel(NewBranch _owner )
415         {
416             _this = _owner;
417             _this.projectsel = this;
418             this.el = new Gtk.ComboBox.with_entry();
419
420             // my vars (dec)
421             this.loading = false;
422
423             // set gobject values
424             var child_0 = new Xcls_prcellrenderer( _this );
425             child_0.ref();
426             this.el.pack_start (  child_0.el , true );
427             var child_1 = new Xcls_prmodel( _this );
428             child_1.ref();
429             this.el.set_model (  child_1.el  );
430
431             // init method
432
433             this.el.set_entry_text_column(1);
434
435             //listeners
436             this.el.changed.connect( () => {
437                 if (this.loading) {
438                         return;
439                 }
440                 var project_id = this.selectedProjectId();
441                 _this.dbmodel.loadTickets(project_id);
442                 
443                 
444                 /*if (this.loading) {
445                         return;
446                 }
447                 var ticket_id = this.selectedTicketId();
448                 
449                 var name = RooTicket.singleton().usernameLocal();
450                 
451                 if (ticket_id == "" || ticket_id == null) {
452                 
453                         var dt = new  DateTime.now_local();
454                         _this.name.el.set_text("wip_%s_%s".printf(name,dt.format("%Y_%b_%d")));
455                         return;
456                 }
457                 
458                 
459                 var ticket = RooTicket.singleton().getById(ticket_id);
460                
461                 _this.name.el.set_text("wip_%s_T%s_%s".printf(name,ticket.id, ticket.summaryToBranchName()));
462                 
463                 //GLib.debug (//"Selection: %s, %s\n", (string) val1, (string) val2);
464                 */
465             });
466         }
467
468         // user defined functions
469         public string selectedProjectId () {
470                 Gtk.TreeIter iter;
471                 Value val1;
472          
473          
474                 this.el.get_active_iter (out iter);
475                 _this.prmodel.el.get_value (iter, 0, out val1);
476          
477         
478                 return  (string) val1;
479                 
480                 
481                 
482                 
483         }
484     }
485     public class Xcls_prcellrenderer : Object
486     {
487         public Gtk.CellRendererText el;
488         private NewBranch  _this;
489
490
491             // my vars (def)
492
493         // ctor
494         public Xcls_prcellrenderer(NewBranch _owner )
495         {
496             _this = _owner;
497             _this.prcellrenderer = this;
498             this.el = new Gtk.CellRendererText();
499
500             // my vars (dec)
501
502             // set gobject values
503         }
504
505         // user defined functions
506     }
507
508     public class Xcls_prmodel : Object
509     {
510         public Gtk.ListStore el;
511         private NewBranch  _this;
512
513
514             // my vars (def)
515
516         // ctor
517         public Xcls_prmodel(NewBranch _owner )
518         {
519             _this = _owner;
520             _this.prmodel = this;
521             this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
522
523             // my vars (dec)
524
525             // set gobject values
526         }
527
528         // user defined functions
529         public void loadProjects (string id) {
530         
531         
532             
533             _this.projectsel.loading = true;
534         
535             this.el.clear();                                    
536             Gtk.TreeIter iter;
537             var el = this.el;
538             
539             el.append(out iter);
540         
541             
542             el.set_value(iter, 0, "");
543             el.set_value(iter, 1, "-- select a project --");
544             if (id == "") {
545                     _this.projectsel.el.set_active_iter(iter);
546             }
547           
548             foreach(var project in RooProject.projects()) {
549             
550                 el.append(out iter);
551                 
552                 el.set_value(iter, 0, project.id);
553                 el.set_value(iter, 1,  project.name );
554                 if (id == project.id) {
555                            _this.projectsel.el.set_active_iter(iter);
556                     }   
557                 
558             }
559             
560             _this.projectsel.loading = false;
561              //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);          
562                                              
563         }
564     }
565
566
567     public class Xcls_ticketsel : Object
568     {
569         public Gtk.ComboBox el;
570         private NewBranch  _this;
571
572
573             // my vars (def)
574         public bool loading;
575
576         // ctor
577         public Xcls_ticketsel(NewBranch _owner )
578         {
579             _this = _owner;
580             _this.ticketsel = this;
581             this.el = new Gtk.ComboBox.with_entry();
582
583             // my vars (dec)
584             this.loading = false;
585
586             // set gobject values
587             var child_0 = new Xcls_dbcellrenderer( _this );
588             child_0.ref();
589             this.el.pack_start (  child_0.el , true );
590             var child_1 = new Xcls_dbmodel( _this );
591             child_1.ref();
592             this.el.set_model (  child_1.el  );
593
594             // init method
595
596             //this.el.add_attribute(_this.dbcellrenderer.el , "markup", 1 );
597             this.el.set_entry_text_column(1);
598             this.el.get_child().set_sensitive(false);
599
600             //listeners
601             this.el.changed.connect( () => {
602                 if (this.loading) {
603                         return;
604                 }
605                 var ticket_id = this.selectedTicketId();
606                 
607                 var name = RooTicket.singleton().usernameLocal();
608                 
609                 this.el.get_child().get_style_context().remove_class("warning");
610                 if (ticket_id == "" || ticket_id == null) {
611                 
612                         var dt = new  DateTime.now_local();
613                         _this.name.el.set_text("wip_%s_%s".printf(name,dt.format("%Y_%b_%d")));
614                         _this.view.loadTicket("");              
615                         
616                         this.el.get_child().get_style_context().add_class("warning");
617                         _this.createbtn.updateState();
618                         return;
619                 }
620                 
621                 
622                 var ticket = RooTicket.singleton().getById(ticket_id);
623                
624                 _this.name.el.set_text("wip_%s_T%s_%s".printf(name,ticket.id, ticket.summaryToBranchName()));
625                 _this.scrolled_window.el.show();
626                  
627                 _this.view.loadTicket(ticket.id);
628                 _this.createbtn.updateState();
629                 
630                 //GLib.debug (//"Selection: %s, %s\n", (string) val1, (string) val2);
631             });
632         }
633
634         // user defined functions
635         public string selectedTicketId () {
636         Gtk.TreeIter iter;
637                 Value val1;
638          
639          
640                 this.el.get_active_iter (out iter);
641                 _this.dbmodel.el.get_value (iter, 0, out val1);
642          
643         
644                 return  (string) val1;
645                 
646                 
647                 
648                 
649         }
650     }
651     public class Xcls_dbcellrenderer : Object
652     {
653         public Gtk.CellRendererText el;
654         private NewBranch  _this;
655
656
657             // my vars (def)
658
659         // ctor
660         public Xcls_dbcellrenderer(NewBranch _owner )
661         {
662             _this = _owner;
663             _this.dbcellrenderer = this;
664             this.el = new Gtk.CellRendererText();
665
666             // my vars (dec)
667
668             // set gobject values
669         }
670
671         // user defined functions
672     }
673
674     public class Xcls_dbmodel : Object
675     {
676         public Gtk.ListStore el;
677         private NewBranch  _this;
678
679
680             // my vars (def)
681
682         // ctor
683         public Xcls_dbmodel(NewBranch _owner )
684         {
685             _this = _owner;
686             _this.dbmodel = this;
687             this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
688
689             // my vars (dec)
690
691             // set gobject values
692         }
693
694         // user defined functions
695         public void loadTickets (string project_id , string tid = "") {
696         
697         
698             
699             // fixme .. get project id from selection..
700             
701              RooTicket.singleton().loadTickets(
702                                 project_id,
703                                 _this.btn_not_me.el.active ? RooTicket.Who.ANYBODY :  RooTicket.Who.ME,
704                                  _this.btn_closed.el.active ? RooTicket.Status.ALL :  RooTicket.Status.ACTIVE
705                          );
706                 
707             _this.ticketsel.loading = true;
708         
709             this.el.clear();                                    
710             Gtk.TreeIter iter;
711             var el = this.el;
712             
713             el.append(out iter);
714         
715             
716             el.set_value(iter, 0, "");
717             el.set_value(iter, 1, "-- select a ticket --");
718             
719             _this.ticketsel.el.set_active_iter(iter);
720             var tickets = RooTicket.singleton().tickets;
721             foreach(var ticket in tickets) {
722             
723                 el.append(out iter);
724                 
725                 el.set_value(iter, 0, ticket.id);
726                 el.set_value(iter, 1, "#%s %s".printf( ticket.id, ticket.summary));
727                 
728                 if (ticket.id == tid) {
729                             _this.ticketsel.el.set_active_iter(iter);
730                 }
731                 
732             }
733             
734             _this.ticketsel.loading = false;
735              //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);          
736                                              
737         }
738     }
739
740
741     public class Xcls_Label16 : Object
742     {
743         public Gtk.Label el;
744         private NewBranch  _this;
745
746
747             // my vars (def)
748
749         // ctor
750         public Xcls_Label16(NewBranch _owner )
751         {
752             _this = _owner;
753             this.el = new Gtk.Label( "Use this as branch name" );
754
755             // my vars (dec)
756
757             // set gobject values
758             this.el.halign = Gtk.Align.START;
759             this.el.justify = Gtk.Justification.RIGHT;
760             this.el.xalign = 0.900000f;
761         }
762
763         // user defined functions
764     }
765
766     public class Xcls_name : Object
767     {
768         public Gtk.Entry el;
769         private NewBranch  _this;
770
771
772             // my vars (def)
773
774         // ctor
775         public Xcls_name(NewBranch _owner )
776         {
777             _this = _owner;
778             _this.name = this;
779             this.el = new Gtk.Entry();
780
781             // my vars (dec)
782
783             // set gobject values
784             this.el.visible = true;
785         }
786
787         // user defined functions
788     }
789
790     public class Xcls_createbtn : Object
791     {
792         public Gtk.Button el;
793         private NewBranch  _this;
794
795
796             // my vars (def)
797
798         // ctor
799         public Xcls_createbtn(NewBranch _owner )
800         {
801             _this = _owner;
802             _this.createbtn = this;
803             this.el = new Gtk.Button();
804
805             // my vars (dec)
806
807             // set gobject values
808             this.el.label = "Create Branch";
809
810             // init method
811
812             {
813                this.el.get_style_context().add_class("suggested-action");
814             }
815
816             //listeners
817             this.el.clicked.connect( () => {
818             
819                 GLib.debug("fire response = 1");
820                 
821                 var ticket_id = _this.ticketsel.selectedTicketId();
822                 
823                 if (ticket_id == "") {
824                         _this.ticketsel.el.get_child().get_style_context().add_class("warning");
825                         return;
826                 }
827                  
828                 _this.el.response(1);
829             });
830         }
831
832         // user defined functions
833         public void updateState () {
834         
835                 var ticket_id = _this.ticketsel.selectedTicketId();
836                 
837                 if (ticket_id == "") {
838                         this.el.set_sensitive(false);
839                         return;
840                 }
841          
842                 this.el.set_sensitive(true);
843          
844         }
845     }
846
847     public class Xcls_Box19 : Object
848     {
849         public Gtk.Box el;
850         private NewBranch  _this;
851
852
853             // my vars (def)
854
855         // ctor
856         public Xcls_Box19(NewBranch _owner )
857         {
858             _this = _owner;
859             this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
860
861             // my vars (dec)
862
863             // set gobject values
864             var child_0 = new Xcls_btn_not_me( _this );
865             child_0.ref();
866             this.el.add (  child_0.el  );
867             var child_1 = new Xcls_btn_closed( _this );
868             child_1.ref();
869             this.el.add (  child_1.el  );
870             var child_2 = new Xcls_Label22( _this );
871             child_2.ref();
872             this.el.add (  child_2.el  );
873         }
874
875         // user defined functions
876     }
877     public class Xcls_btn_not_me : Object
878     {
879         public Gtk.CheckButton el;
880         private NewBranch  _this;
881
882
883             // my vars (def)
884
885         // ctor
886         public Xcls_btn_not_me(NewBranch _owner )
887         {
888             _this = _owner;
889             _this.btn_not_me = this;
890             this.el = new Gtk.CheckButton();
891
892             // my vars (dec)
893
894             // set gobject values
895             this.el.label = "Show tickets not assigned to me";
896
897             //listeners
898             this.el.toggled.connect( () => {
899                 var project_id = _this.projectsel.selectedProjectId();
900                 _this.dbmodel.loadTickets(project_id);  
901             });
902         }
903
904         // user defined functions
905     }
906
907     public class Xcls_btn_closed : Object
908     {
909         public Gtk.CheckButton el;
910         private NewBranch  _this;
911
912
913             // my vars (def)
914
915         // ctor
916         public Xcls_btn_closed(NewBranch _owner )
917         {
918             _this = _owner;
919             _this.btn_closed = this;
920             this.el = new Gtk.CheckButton();
921
922             // my vars (dec)
923
924             // set gobject values
925             this.el.label = "Show closed Tickets";
926
927             //listeners
928             this.el.toggled.connect( () => {
929                 var project_id = _this.projectsel.selectedProjectId();
930                 _this.dbmodel.loadTickets(project_id);  
931                  
932             });
933         }
934
935         // user defined functions
936     }
937
938     public class Xcls_Label22 : Object
939     {
940         public Gtk.Label el;
941         private NewBranch  _this;
942
943
944             // my vars (def)
945
946         // ctor
947         public Xcls_Label22(NewBranch _owner )
948         {
949             _this = _owner;
950             this.el = new Gtk.Label( "<a href=\"refresh\">Refresh Ticket list</a>" );
951
952             // my vars (dec)
953
954             // set gobject values
955             this.el.halign = Gtk.Align.END;
956             this.el.hexpand = true;
957             this.el.use_markup = true;
958
959             //listeners
960             this.el.activate_link.connect( (uri) => {
961                 if (uri == "refresh") {
962                         RooProject.reload();
963                         var curproj = RooProject.getProjectByRepo(_this.repo);
964                          _this.prmodel.loadProjects(curproj == null ? "": curproj.id);
965             
966                         _this.dbmodel.loadTickets(curproj == null ? "": curproj.id);            
967                 }
968                 return true;
969             });
970         }
971
972         // user defined functions
973     }
974
975
976
977     public class Xcls_scrolled_window : Object
978     {
979         public Gtk.ScrolledWindow el;
980         private NewBranch  _this;
981
982
983             // my vars (def)
984
985         // ctor
986         public Xcls_scrolled_window(NewBranch _owner )
987         {
988             _this = _owner;
989             _this.scrolled_window = this;
990             this.el = new Gtk.ScrolledWindow( null, null );
991
992             // my vars (dec)
993
994             // set gobject values
995             this.el.height_request = 500;
996             this.el.vexpand = true;
997             var child_0 = new Xcls_view( _this );
998             child_0.ref();
999             this.el.add (  child_0.el  );
1000
1001             // init method
1002
1003             {
1004                 this.el.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);
1005             }
1006         }
1007
1008         // user defined functions
1009     }
1010     public class Xcls_view : Object
1011     {
1012         public WebKit.WebView el;
1013         private NewBranch  _this;
1014
1015
1016             // my vars (def)
1017
1018         // ctor
1019         public Xcls_view(NewBranch _owner )
1020         {
1021             _this = _owner;
1022             _this.view = this;
1023             this.el = new WebKit.WebView();
1024
1025             // my vars (dec)
1026
1027             // set gobject values
1028         }
1029
1030         // user defined functions
1031         public void loadTicket (string tid) {
1032                 int h,w;
1033                 _this.el.get_size(out w, out h);
1034                 
1035                 if (tid == "") {
1036                         _this.scrolled_window.el.hide();
1037                         _this.el.resize(w, 150);
1038                 } else {
1039                         _this.scrolled_window.el.show();
1040                         _this.el.resize(w, 800);
1041                 }
1042                 
1043                 var rs =  RooTicket.singleton();                
1044                 var uri = new WebKit.URIRequest("https://roojs.com/admin.php/MTrack/View/" + tid);
1045                 var hd = uri.get_http_headers();
1046                 var authCode = Base64.encode ("%s:%s".printf(rs.username, rs.password).data);
1047                 hd.append("Authorization", "Basic %s".printf(authCode));
1048                 
1049                  this.el.load_request(uri);
1050         }
1051     }
1052
1053
1054
1055     public class Xcls_Box25 : Object
1056     {
1057         public Gtk.Box el;
1058         private NewBranch  _this;
1059
1060
1061             // my vars (def)
1062
1063         // ctor
1064         public Xcls_Box25(NewBranch _owner )
1065         {
1066             _this = _owner;
1067             this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
1068
1069             // my vars (dec)
1070
1071             // set gobject values
1072             this.el.homogeneous = false;
1073             var child_0 = new Xcls_table( _this );
1074             child_0.ref();
1075             this.el.pack_start (  child_0.el , false,false,0 );
1076         }
1077
1078         // user defined functions
1079     }
1080     public class Xcls_table : Object
1081     {
1082         public Gtk.Table el;
1083         private NewBranch  _this;
1084
1085
1086             // my vars (def)
1087
1088         // ctor
1089         public Xcls_table(NewBranch _owner )
1090         {
1091             _this = _owner;
1092             _this.table = this;
1093             this.el = new Gtk.Table( 14, 4, true );
1094
1095             // my vars (dec)
1096
1097             // set gobject values
1098             this.el.expand = false;
1099             this.el.margin = 2;
1100             this.el.column_spacing = 4;
1101             this.el.vexpand = false;
1102             var child_0 = new Xcls_Label27( _this );
1103             child_0.ref();
1104             this.el.attach_defaults (  child_0.el , 0,1,0,1 );
1105             var child_1 = new Xcls_Label28( _this );
1106             child_1.ref();
1107             this.el.attach_defaults (  child_1.el , 1,2,0,1 );
1108             var child_2 = new Xcls_project_id( _this );
1109             child_2.ref();
1110             this.el.attach_defaults (  child_2.el , 0,1,1,2 );
1111             var child_3 = new Xcls_summary( _this );
1112             child_3.ref();
1113             this.el.attach_defaults (  child_3.el , 1,4,1,2 );
1114             var child_4 = new Xcls_Label33( _this );
1115             child_4.ref();
1116             this.el.attach_defaults (  child_4.el , 0,1,2,3 );
1117             var child_5 = new Xcls_milestone_id( _this );
1118             child_5.ref();
1119             this.el.attach_defaults (  child_5.el , 0,1,3,4 );
1120             var child_6 = new Xcls_Label36( _this );
1121             child_6.ref();
1122             this.el.attach_defaults (  child_6.el , 1,4,2,3 );
1123             var child_7 = new Xcls_description( _this );
1124             child_7.ref();
1125             this.el.attach_defaults (  child_7.el , 1,4,3,12 );
1126             var child_8 = new Xcls_Label38( _this );
1127             child_8.ref();
1128             this.el.attach_defaults (  child_8.el , 0,1,4,5 );
1129             var child_9 = new Xcls_priority_id( _this );
1130             child_9.ref();
1131             this.el.attach_defaults (  child_9.el , 0,1,5,6 );
1132             var child_10 = new Xcls_Label41( _this );
1133             child_10.ref();
1134             this.el.attach_defaults (  child_10.el , 0,1,6,7 );
1135             var child_11 = new Xcls_severity_id( _this );
1136             child_11.ref();
1137             this.el.attach_defaults (  child_11.el , 0,1,7,8 );
1138             var child_12 = new Xcls_Label44( _this );
1139             child_12.ref();
1140             this.el.attach_defaults (  child_12.el , 0,1,8,9 );
1141             var child_13 = new Xcls_classification_id( _this );
1142             child_13.ref();
1143             this.el.attach_defaults (  child_13.el , 0,1,9,10 );
1144             var child_14 = new Xcls_Label47( _this );
1145             child_14.ref();
1146             this.el.attach_defaults (  child_14.el , 0,1,10,11 );
1147             var child_15 = new Xcls_developer_id( _this );
1148             child_15.ref();
1149             this.el.attach_defaults (  child_15.el , 0,1,11,12 );
1150             var child_16 = new Xcls_Button50( _this );
1151             child_16.ref();
1152             this.el.attach_defaults (  child_16.el , 0,4,13,14 );
1153         }
1154
1155         // user defined functions
1156     }
1157     public class Xcls_Label27 : Object
1158     {
1159         public Gtk.Label el;
1160         private NewBranch  _this;
1161
1162
1163             // my vars (def)
1164
1165         // ctor
1166         public Xcls_Label27(NewBranch _owner )
1167         {
1168             _this = _owner;
1169             this.el = new Gtk.Label( "Project" );
1170
1171             // my vars (dec)
1172
1173             // set gobject values
1174             this.el.halign = Gtk.Align.START;
1175             this.el.visible = true;
1176         }
1177
1178         // user defined functions
1179     }
1180
1181     public class Xcls_Label28 : Object
1182     {
1183         public Gtk.Label el;
1184         private NewBranch  _this;
1185
1186
1187             // my vars (def)
1188
1189         // ctor
1190         public Xcls_Label28(NewBranch _owner )
1191         {
1192             _this = _owner;
1193             this.el = new Gtk.Label( "Summary" );
1194
1195             // my vars (dec)
1196
1197             // set gobject values
1198             this.el.halign = Gtk.Align.START;
1199             this.el.visible = true;
1200         }
1201
1202         // user defined functions
1203     }
1204
1205     public class Xcls_project_id : Object
1206     {
1207         public Gtk.ComboBox el;
1208         private NewBranch  _this;
1209
1210
1211             // my vars (def)
1212         public bool loading;
1213
1214         // ctor
1215         public Xcls_project_id(NewBranch _owner )
1216         {
1217             _this = _owner;
1218             _this.project_id = this;
1219             this.el = new Gtk.ComboBox.with_entry();
1220
1221             // my vars (dec)
1222             this.loading = false;
1223
1224             // set gobject values
1225             var child_0 = new Xcls_prcellrenderer( _this );
1226             child_0.ref();
1227             this.el.pack_start (  child_0.el , true );
1228             var child_1 = new Xcls_prmodel( _this );
1229             child_1.ref();
1230             this.el.set_model (  child_1.el  );
1231
1232             // init method
1233
1234             this.el.set_entry_text_column(1);
1235
1236             //listeners
1237             this.el.changed.connect( () => {
1238                 if (this.loading) {
1239                         return;
1240                 }
1241                 var project_id = this.selectedProjectId();
1242                 
1243                 var rt = RooTicket.singleton();
1244                 rt.loadProjectOptions(project_id);
1245                 
1246                 _this.msmodel.loadMilestones();
1247                 _this.primodel.loadPriorities();
1248                 _this.sevmodel.loadSeverities();
1249                 _this.clmodel.loadClassifications();    
1250                 _this.devmodel.loadDevelopers();        
1251                 
1252                 // affects projects and milestones..
1253                 
1254                 
1255                 /*if (this.loading) {
1256                         return;
1257                 }
1258                 var ticket_id = this.selectedTicketId();
1259                 
1260                 var name = RooTicket.singleton().usernameLocal();
1261                 
1262                 if (ticket_id == "" || ticket_id == null) {
1263                 
1264                         var dt = new  DateTime.now_local();
1265                         _this.name.el.set_text("wip_%s_%s".printf(name,dt.format("%Y_%b_%d")));
1266                         return;
1267                 }
1268                 
1269                 
1270                 var ticket = RooTicket.singleton().getById(ticket_id);
1271                
1272                 _this.name.el.set_text("wip_%s_T%s_%s".printf(name,ticket.id, ticket.summaryToBranchName()));
1273                 
1274                 //GLib.debug (//"Selection: %s, %s\n", (string) val1, (string) val2);
1275                 */
1276             });
1277         }
1278
1279         // user defined functions
1280         public string selectedProjectId () {
1281                 Gtk.TreeIter iter;
1282                 Value val1;
1283          
1284          
1285                 this.el.get_active_iter (out iter);
1286                 _this.prmodel.el.get_value (iter, 0, out val1);
1287          
1288         
1289                 return  (string) val1;
1290                 
1291                 
1292                 
1293                 
1294         }
1295     }
1296     public class Xcls_prcellrenderer : Object
1297     {
1298         public Gtk.CellRendererText el;
1299         private NewBranch  _this;
1300
1301
1302             // my vars (def)
1303
1304         // ctor
1305         public Xcls_prcellrenderer(NewBranch _owner )
1306         {
1307             _this = _owner;
1308             _this.prcellrenderer = this;
1309             this.el = new Gtk.CellRendererText();
1310
1311             // my vars (dec)
1312
1313             // set gobject values
1314         }
1315
1316         // user defined functions
1317     }
1318
1319     public class Xcls_prmodel : Object
1320     {
1321         public Gtk.ListStore el;
1322         private NewBranch  _this;
1323
1324
1325             // my vars (def)
1326
1327         // ctor
1328         public Xcls_prmodel(NewBranch _owner )
1329         {
1330             _this = _owner;
1331             _this.prmodel = this;
1332             this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
1333
1334             // my vars (dec)
1335
1336             // set gobject values
1337         }
1338
1339         // user defined functions
1340         public void loadProjects (string id) {
1341         
1342             
1343             _this.project_id.loading = true;
1344         
1345             this.el.clear();                                    
1346             Gtk.TreeIter iter;
1347             var el = this.el;
1348             
1349             el.append(out iter);
1350         
1351             
1352             el.set_value(iter, 0, "");
1353             el.set_value(iter, 1, "-- select a project --");
1354             if (id == "") {
1355                     _this.project_id.el.set_active_iter(iter);
1356             }
1357         
1358             foreach(var project in RooProject.projects()) {
1359             
1360                 el.append(out iter);
1361                 
1362                 el.set_value(iter, 0, project.id);
1363                 el.set_value(iter, 1,  project.name );
1364                 if (id == project.id) {
1365                            _this.project_id.el.set_active_iter(iter);
1366                     }   
1367                 
1368             }
1369             
1370             _this.project_id.loading = false;
1371              //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);          
1372                                              
1373         }
1374     }
1375
1376
1377     public class Xcls_summary : Object
1378     {
1379         public Gtk.Entry el;
1380         private NewBranch  _this;
1381
1382
1383             // my vars (def)
1384
1385         // ctor
1386         public Xcls_summary(NewBranch _owner )
1387         {
1388             _this = _owner;
1389             _this.summary = this;
1390             this.el = new Gtk.Entry();
1391
1392             // my vars (dec)
1393
1394             // set gobject values
1395             this.el.visible = true;
1396         }
1397
1398         // user defined functions
1399     }
1400
1401     public class Xcls_Label33 : Object
1402     {
1403         public Gtk.Label el;
1404         private NewBranch  _this;
1405
1406
1407             // my vars (def)
1408
1409         // ctor
1410         public Xcls_Label33(NewBranch _owner )
1411         {
1412             _this = _owner;
1413             this.el = new Gtk.Label( "Milestone" );
1414
1415             // my vars (dec)
1416
1417             // set gobject values
1418             this.el.halign = Gtk.Align.START;
1419             this.el.justify = Gtk.Justification.RIGHT;
1420             this.el.xalign = 0.900000f;
1421         }
1422
1423         // user defined functions
1424     }
1425
1426     public class Xcls_milestone_id : Object
1427     {
1428         public Gtk.ComboBox el;
1429         private NewBranch  _this;
1430
1431
1432             // my vars (def)
1433         public bool loading;
1434
1435         // ctor
1436         public Xcls_milestone_id(NewBranch _owner )
1437         {
1438             _this = _owner;
1439             _this.milestone_id = this;
1440             this.el = new Gtk.ComboBox.with_entry();
1441
1442             // my vars (dec)
1443             this.loading = false;
1444
1445             // set gobject values
1446             var child_0 = new Xcls_msmodel( _this );
1447             child_0.ref();
1448             this.el.set_model (  child_0.el  );
1449
1450             // init method
1451
1452             this.el.set_entry_text_column(1);
1453         }
1454
1455         // user defined functions
1456         public string selectedMilestoneId () {
1457                 Gtk.TreeIter iter;
1458                 Value val1;
1459          
1460          
1461                 this.el.get_active_iter (out iter);
1462                 _this.msmodel.el.get_value (iter, 0, out val1);
1463          
1464         
1465                 return  (string) val1;
1466                 
1467                 
1468                 
1469                 
1470         }
1471     }
1472     public class Xcls_msmodel : Object
1473     {
1474         public Gtk.ListStore el;
1475         private NewBranch  _this;
1476
1477
1478             // my vars (def)
1479
1480         // ctor
1481         public Xcls_msmodel(NewBranch _owner )
1482         {
1483             _this = _owner;
1484             _this.msmodel = this;
1485             this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
1486
1487             // my vars (dec)
1488
1489             // set gobject values
1490         }
1491
1492         // user defined functions
1493         public void loadMilestones ( ) {
1494         
1495             var rt = RooTicket.singleton();
1496            // rt.loadProjects();
1497             
1498             _this.milestone_id.loading = true;
1499         
1500             this.el.clear();                                    
1501             Gtk.TreeIter iter;
1502             var el = this.el;
1503             
1504             el.append(out iter);
1505         
1506             
1507             el.set_value(iter, 0, "");
1508             el.set_value(iter, 1, "-- select a milestone --");
1509             _this.milestone_id.el.set_active_iter(iter);    
1510              
1511             var projects = rt.milestones;
1512             foreach(var project in projects) {
1513             
1514                 el.append(out iter);
1515                 
1516                 el.set_value(iter, 0, project.id);
1517                 el.set_value(iter, 1,  project.display_name );
1518               //  if (id == project.id) {
1519                  //        _this.milestone.el.set_active_iter(iter);
1520                  //   }   
1521                 
1522             }
1523             
1524             
1525             _this.milestone_id.loading = false;
1526              //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);          
1527                                              
1528         }
1529     }
1530
1531
1532     public class Xcls_Label36 : Object
1533     {
1534         public Gtk.Label el;
1535         private NewBranch  _this;
1536
1537
1538             // my vars (def)
1539
1540         // ctor
1541         public Xcls_Label36(NewBranch _owner )
1542         {
1543             _this = _owner;
1544             this.el = new Gtk.Label( "Description" );
1545
1546             // my vars (dec)
1547
1548             // set gobject values
1549             this.el.halign = Gtk.Align.START;
1550         }
1551
1552         // user defined functions
1553     }
1554
1555     public class Xcls_description : Object
1556     {
1557         public Gtk.TextView el;
1558         private NewBranch  _this;
1559
1560
1561             // my vars (def)
1562
1563         // ctor
1564         public Xcls_description(NewBranch _owner )
1565         {
1566             _this = _owner;
1567             _this.description = this;
1568             this.el = new Gtk.TextView();
1569
1570             // my vars (dec)
1571
1572             // set gobject values
1573             this.el.border_width = 1;
1574         }
1575
1576         // user defined functions
1577     }
1578
1579     public class Xcls_Label38 : Object
1580     {
1581         public Gtk.Label el;
1582         private NewBranch  _this;
1583
1584
1585             // my vars (def)
1586
1587         // ctor
1588         public Xcls_Label38(NewBranch _owner )
1589         {
1590             _this = _owner;
1591             this.el = new Gtk.Label( "Priority" );
1592
1593             // my vars (dec)
1594
1595             // set gobject values
1596             this.el.halign = Gtk.Align.START;
1597             this.el.xalign = 0.900000f;
1598         }
1599
1600         // user defined functions
1601     }
1602
1603     public class Xcls_priority_id : Object
1604     {
1605         public Gtk.ComboBox el;
1606         private NewBranch  _this;
1607
1608
1609             // my vars (def)
1610         public bool loading;
1611
1612         // ctor
1613         public Xcls_priority_id(NewBranch _owner )
1614         {
1615             _this = _owner;
1616             _this.priority_id = this;
1617             this.el = new Gtk.ComboBox.with_entry();
1618
1619             // my vars (dec)
1620             this.loading = false;
1621
1622             // set gobject values
1623             var child_0 = new Xcls_primodel( _this );
1624             child_0.ref();
1625             this.el.set_model (  child_0.el  );
1626
1627             // init method
1628
1629             this.el.set_entry_text_column(1);
1630         }
1631
1632         // user defined functions
1633         public string selectedPriorityId () {
1634                 Gtk.TreeIter iter;
1635                 Value val1;
1636          
1637          
1638                 this.el.get_active_iter (out iter);
1639                 _this.primodel.el.get_value (iter, 0, out val1);
1640          
1641         
1642                 return  (string) val1;
1643                 
1644                 
1645                 
1646                 
1647         }
1648     }
1649     public class Xcls_primodel : Object
1650     {
1651         public Gtk.ListStore el;
1652         private NewBranch  _this;
1653
1654
1655             // my vars (def)
1656
1657         // ctor
1658         public Xcls_primodel(NewBranch _owner )
1659         {
1660             _this = _owner;
1661             _this.primodel = this;
1662             this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
1663
1664             // my vars (dec)
1665
1666             // set gobject values
1667         }
1668
1669         // user defined functions
1670         public void loadPriorities ( ) {
1671         
1672             var rt = RooTicket.singleton();
1673            // rt.loadProjects();
1674             
1675             _this.priority_id.loading = true;
1676         
1677             this.el.clear();                                    
1678             Gtk.TreeIter iter;
1679             var el = this.el;
1680             
1681             
1682            var projects = rt.priorities;
1683             foreach(var project in projects) {
1684             
1685                 el.append(out iter);
1686                 
1687                 el.set_value(iter, 0, project.id);
1688                 el.set_value(iter, 1,  project.display_name );
1689                 if ("normal" == project.name) {
1690                            _this.priority_id.el.set_active_iter(iter);
1691                     }   
1692                 
1693             }
1694             
1695             _this.priority_id.loading = false;
1696                    
1697                                              
1698         }
1699     }
1700
1701
1702     public class Xcls_Label41 : Object
1703     {
1704         public Gtk.Label el;
1705         private NewBranch  _this;
1706
1707
1708             // my vars (def)
1709
1710         // ctor
1711         public Xcls_Label41(NewBranch _owner )
1712         {
1713             _this = _owner;
1714             this.el = new Gtk.Label( "Severity" );
1715
1716             // my vars (dec)
1717
1718             // set gobject values
1719             this.el.halign = Gtk.Align.START;
1720         }
1721
1722         // user defined functions
1723     }
1724
1725     public class Xcls_severity_id : Object
1726     {
1727         public Gtk.ComboBox el;
1728         private NewBranch  _this;
1729
1730
1731             // my vars (def)
1732         public bool loading;
1733
1734         // ctor
1735         public Xcls_severity_id(NewBranch _owner )
1736         {
1737             _this = _owner;
1738             _this.severity_id = this;
1739             this.el = new Gtk.ComboBox.with_entry();
1740
1741             // my vars (dec)
1742             this.loading = false;
1743
1744             // set gobject values
1745             var child_0 = new Xcls_sevmodel( _this );
1746             child_0.ref();
1747             this.el.set_model (  child_0.el  );
1748
1749             // init method
1750
1751             this.el.set_entry_text_column(1);
1752         }
1753
1754         // user defined functions
1755         public string selectedSeverityId () {
1756                 Gtk.TreeIter iter;
1757                 Value val1;
1758          
1759          
1760                 this.el.get_active_iter (out iter);
1761                 _this.sevmodel.el.get_value (iter, 0, out val1);
1762          
1763         
1764                 return  (string) val1;
1765                 
1766                 
1767                 
1768                 
1769         }
1770     }
1771     public class Xcls_sevmodel : Object
1772     {
1773         public Gtk.ListStore el;
1774         private NewBranch  _this;
1775
1776
1777             // my vars (def)
1778
1779         // ctor
1780         public Xcls_sevmodel(NewBranch _owner )
1781         {
1782             _this = _owner;
1783             _this.sevmodel = this;
1784             this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
1785
1786             // my vars (dec)
1787
1788             // set gobject values
1789         }
1790
1791         // user defined functions
1792         public void loadSeverities () {
1793         
1794             var rt = RooTicket.singleton();
1795             //rt.loadProjects();
1796             
1797             _this.severity_id.loading = true;
1798         
1799             this.el.clear();                                    
1800             Gtk.TreeIter iter;
1801             var el = this.el;
1802              
1803             var projects = rt.serverities;
1804             foreach(var project in projects) {
1805             
1806                 el.append(out iter);
1807                 
1808                 el.set_value(iter, 0, project.id);
1809                 el.set_value(iter, 1,  project.display_name );
1810                 if ("normal" == project.name) {
1811                            _this.severity_id.el.set_active_iter(iter);
1812                     }   
1813                 
1814             }
1815            
1816             _this.severity_id.loading = false;
1817              //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);          
1818                                              
1819         }
1820     }
1821
1822
1823     public class Xcls_Label44 : Object
1824     {
1825         public Gtk.Label el;
1826         private NewBranch  _this;
1827
1828
1829             // my vars (def)
1830
1831         // ctor
1832         public Xcls_Label44(NewBranch _owner )
1833         {
1834             _this = _owner;
1835             this.el = new Gtk.Label( "Classification" );
1836
1837             // my vars (dec)
1838
1839             // set gobject values
1840             this.el.halign = Gtk.Align.START;
1841         }
1842
1843         // user defined functions
1844     }
1845
1846     public class Xcls_classification_id : Object
1847     {
1848         public Gtk.ComboBox el;
1849         private NewBranch  _this;
1850
1851
1852             // my vars (def)
1853         public bool loading;
1854
1855         // ctor
1856         public Xcls_classification_id(NewBranch _owner )
1857         {
1858             _this = _owner;
1859             _this.classification_id = this;
1860             this.el = new Gtk.ComboBox.with_entry();
1861
1862             // my vars (dec)
1863             this.loading = false;
1864
1865             // set gobject values
1866             var child_0 = new Xcls_clmodel( _this );
1867             child_0.ref();
1868             this.el.set_model (  child_0.el  );
1869
1870             // init method
1871
1872             this.el.set_entry_text_column(1);
1873         }
1874
1875         // user defined functions
1876         public string selectedClassificationId () {
1877                 Gtk.TreeIter iter;
1878                 Value val1;
1879          
1880          
1881                 this.el.get_active_iter (out iter);
1882                 _this.clmodel.el.get_value (iter, 0, out val1);
1883          
1884         
1885                 return  (string) val1;
1886                 
1887                 
1888                 
1889                 
1890         }
1891     }
1892     public class Xcls_clmodel : Object
1893     {
1894         public Gtk.ListStore el;
1895         private NewBranch  _this;
1896
1897
1898             // my vars (def)
1899
1900         // ctor
1901         public Xcls_clmodel(NewBranch _owner )
1902         {
1903             _this = _owner;
1904             _this.clmodel = this;
1905             this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
1906
1907             // my vars (dec)
1908
1909             // set gobject values
1910         }
1911
1912         // user defined functions
1913         public void loadClassifications ( ) {
1914         
1915             var rt = RooTicket.singleton();
1916             // rt.loadProjects();
1917             
1918             _this.classification_id.loading = true;
1919         
1920             this.el.clear();                                    
1921             Gtk.TreeIter iter;
1922             var el = this.el;
1923             
1924             el.append(out iter);
1925         
1926              
1927             var projects = rt.classifications;
1928             foreach(var project in projects) {
1929             
1930                 el.append(out iter);
1931                 
1932                 el.set_value(iter, 0, project.id);
1933                 el.set_value(iter, 1,  project.display_name );
1934                 if ("bug" == project.name) {
1935                            _this.classification_id.el.set_active_iter(iter);
1936                     }   
1937                 
1938             }
1939             
1940             _this.classification_id.loading = false;
1941              //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);          
1942                                              
1943         }
1944     }
1945
1946
1947     public class Xcls_Label47 : Object
1948     {
1949         public Gtk.Label el;
1950         private NewBranch  _this;
1951
1952
1953             // my vars (def)
1954
1955         // ctor
1956         public Xcls_Label47(NewBranch _owner )
1957         {
1958             _this = _owner;
1959             this.el = new Gtk.Label( "Assign to" );
1960
1961             // my vars (dec)
1962
1963             // set gobject values
1964             this.el.halign = Gtk.Align.START;
1965         }
1966
1967         // user defined functions
1968     }
1969
1970     public class Xcls_developer_id : Object
1971     {
1972         public Gtk.ComboBox el;
1973         private NewBranch  _this;
1974
1975
1976             // my vars (def)
1977         public bool loading;
1978
1979         // ctor
1980         public Xcls_developer_id(NewBranch _owner )
1981         {
1982             _this = _owner;
1983             _this.developer_id = this;
1984             this.el = new Gtk.ComboBox.with_entry();
1985
1986             // my vars (dec)
1987             this.loading = false;
1988
1989             // set gobject values
1990             var child_0 = new Xcls_devmodel( _this );
1991             child_0.ref();
1992             this.el.set_model (  child_0.el  );
1993
1994             // init method
1995
1996             this.el.set_entry_text_column(1);
1997         }
1998
1999         // user defined functions
2000         public string selectedDeveloperId () {
2001                 Gtk.TreeIter iter;
2002                 Value val1;
2003          
2004          
2005                 this.el.get_active_iter (out iter);
2006                 _this.devmodel.el.get_value (iter, 0, out val1);
2007          
2008         
2009                 return  (string) val1;
2010                 
2011                 
2012                 
2013                 
2014         }
2015     }
2016     public class Xcls_devmodel : Object
2017     {
2018         public Gtk.ListStore el;
2019         private NewBranch  _this;
2020
2021
2022             // my vars (def)
2023
2024         // ctor
2025         public Xcls_devmodel(NewBranch _owner )
2026         {
2027             _this = _owner;
2028             _this.devmodel = this;
2029             this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
2030
2031             // my vars (dec)
2032
2033             // set gobject values
2034         }
2035
2036         // user defined functions
2037         public void loadDevelopers ( ) {
2038         
2039             var rt = RooTicket.singleton();
2040             //rt.loadProjects();
2041             
2042             _this.developer_id.loading = true;
2043         
2044             this.el.clear();                                    
2045             Gtk.TreeIter iter;
2046             var el = this.el;
2047             
2048             el.append(out iter);
2049         
2050             
2051             el.set_value(iter, 0, "");
2052             el.set_value(iter, 1, "-- select a developer --");
2053           //  if (id == "") {
2054                     _this.developer_id.el.set_active_iter(iter);
2055            // }
2056             
2057             var peps = rt.developers;
2058             foreach(var p in peps) {
2059             
2060                 el.append(out iter);
2061                 
2062                 el.set_value(iter, 0, p.id);
2063                 el.set_value(iter, 1,  p.display_name );
2064                 if (rt.authuser_id == p.id) {
2065                            _this.developer_id.el.set_active_iter(iter);
2066                     }   
2067             }
2068          
2069             _this.developer_id.loading = false;
2070              //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);          
2071                                              
2072         }
2073     }
2074
2075
2076     public class Xcls_Button50 : Object
2077     {
2078         public Gtk.Button el;
2079         private NewBranch  _this;
2080
2081
2082             // my vars (def)
2083
2084         // ctor
2085         public Xcls_Button50(NewBranch _owner )
2086         {
2087             _this = _owner;
2088             this.el = new Gtk.Button();
2089
2090             // my vars (dec)
2091
2092             // set gobject values
2093             this.el.label = "Create Ticket & Branch";
2094
2095             // init method
2096
2097             {
2098                this.el.get_style_context().add_class("suggested-action");
2099             }
2100
2101             //listeners
2102             this.el.clicked.connect( () => {
2103                 GLib.debug("fire response = 1");
2104                 
2105                 
2106                 var invalid = false;
2107                 
2108                 // validate first...
2109                 _this.project_id.el.get_child().get_style_context().remove_class("warning");    
2110                 if (_this.project_id.selectedProjectId() == "") {
2111                         _this.project_id.el.get_child().get_style_context().add_class("warning");
2112                         invalid = true;
2113                 }
2114                 
2115                 _this.milestone_id.el.get_child().get_style_context().remove_class("warning");  
2116             
2117                 _this.priority_id.el.get_child().get_style_context().remove_class("warning");   
2118                 if (_this.priority_id.selectedPriorityId() == "") {
2119                         _this.priority_id.el.get_child().get_style_context().add_class("warning");
2120                         invalid = true;
2121                 }
2122                 
2123                 _this.classification_id.el.get_child().get_style_context().remove_class("warning");     
2124                 if (_this.classification_id.selectedClassificationId() == "") {
2125                         _this.classification_id.el.get_child().get_style_context().add_class("warning");
2126                         invalid = true;
2127                 }
2128                 
2129                 _this.developer_id.el.get_child().get_style_context().remove_class("warning");  
2130                 if (_this.developer_id.selectedDeveloperId() == "") {
2131                         _this.developer_id.el.get_child().get_style_context().add_class("warning");
2132                         invalid = true;
2133                 }
2134                 
2135                 _this.summary.el.get_style_context().remove_class("warning");   
2136                 if (_this.summary.el.get_text() == "") {
2137                         _this.summary.el.get_style_context().add_class("warning");
2138                         invalid = true;
2139                 }
2140                 
2141                 _this.description.el.get_style_context().remove_class("warning");       
2142              
2143                 if (invalid) {
2144                         return;
2145                 }
2146                 GLib.debug("for is valid");
2147                 
2148                 _this.el.response(1);
2149             });
2150         }
2151
2152         // user defined functions
2153     }
2154
2155
2156
2157     public class Xcls_Box51 : Object
2158     {
2159         public Gtk.Box el;
2160         private NewBranch  _this;
2161
2162
2163             // my vars (def)
2164
2165         // ctor
2166         public Xcls_Box51(NewBranch _owner )
2167         {
2168             _this = _owner;
2169             this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
2170
2171             // my vars (dec)
2172
2173             // set gobject values
2174             this.el.homogeneous = false;
2175             var child_0 = new Xcls_Table52( _this );
2176             child_0.ref();
2177             this.el.pack_start (  child_0.el , false,false,0 );
2178         }
2179
2180         // user defined functions
2181     }
2182     public class Xcls_Table52 : Object
2183     {
2184         public Gtk.Table el;
2185         private NewBranch  _this;
2186
2187
2188             // my vars (def)
2189
2190         // ctor
2191         public Xcls_Table52(NewBranch _owner )
2192         {
2193             _this = _owner;
2194             this.el = new Gtk.Table( 5, 5, true );
2195
2196             // my vars (dec)
2197
2198             // set gobject values
2199             this.el.expand = false;
2200             this.el.margin = 2;
2201             this.el.column_spacing = 4;
2202             this.el.vexpand = false;
2203             var child_0 = new Xcls_Label53( _this );
2204             child_0.ref();
2205             this.el.attach_defaults (  child_0.el , 0,1,0,1 );
2206             var child_1 = new Xcls_commit_message( _this );
2207             child_1.ref();
2208             this.el.attach_defaults (  child_1.el , 0,4,1,2 );
2209             var child_2 = new Xcls_createbtn( _this );
2210             child_2.ref();
2211             this.el.attach_defaults (  child_2.el , 4,5,4,5 );
2212         }
2213
2214         // user defined functions
2215     }
2216     public class Xcls_Label53 : Object
2217     {
2218         public Gtk.Label el;
2219         private NewBranch  _this;
2220
2221
2222             // my vars (def)
2223
2224         // ctor
2225         public Xcls_Label53(NewBranch _owner )
2226         {
2227             _this = _owner;
2228             this.el = new Gtk.Label( "Commit Message" );
2229
2230             // my vars (dec)
2231
2232             // set gobject values
2233             this.el.halign = Gtk.Align.START;
2234             this.el.justify = Gtk.Justification.RIGHT;
2235             this.el.xalign = 0.900000f;
2236         }
2237
2238         // user defined functions
2239     }
2240
2241     public class Xcls_commit_message : Object
2242     {
2243         public Gtk.Entry el;
2244         private NewBranch  _this;
2245
2246
2247             // my vars (def)
2248
2249         // ctor
2250         public Xcls_commit_message(NewBranch _owner )
2251         {
2252             _this = _owner;
2253             _this.commit_message = this;
2254             this.el = new Gtk.Entry();
2255
2256             // my vars (dec)
2257
2258             // set gobject values
2259             this.el.visible = true;
2260         }
2261
2262         // user defined functions
2263     }
2264
2265     public class Xcls_createbtn : Object
2266     {
2267         public Gtk.Button el;
2268         private NewBranch  _this;
2269
2270
2271             // my vars (def)
2272
2273         // ctor
2274         public Xcls_createbtn(NewBranch _owner )
2275         {
2276             _this = _owner;
2277             _this.createbtn = this;
2278             this.el = new Gtk.Button();
2279
2280             // my vars (dec)
2281
2282             // set gobject values
2283             this.el.label = "Commit Changes";
2284
2285             // init method
2286
2287             {
2288                this.el.get_style_context().add_class("suggested-action");
2289             }
2290
2291             //listeners
2292             this.el.clicked.connect( () => {
2293             
2294                 GLib.debug("fire response = 1");
2295                 
2296                 var ticket_id = _this.ticketsel.selectedTicketId();
2297                 
2298                 if (ticket_id == "") {
2299                         _this.ticketsel.el.get_child().get_style_context().add_class("warning");
2300                         return;
2301                 }
2302                  
2303                 _this.el.response(1);
2304             });
2305         }
2306
2307         // user defined functions
2308         public void updateState () {
2309         
2310                 var ticket_id = _this.ticketsel.selectedTicketId();
2311                 
2312                 if (ticket_id == "") {
2313                         this.el.set_sensitive(false);
2314                         return;
2315                 }
2316          
2317                 this.el.set_sensitive(true);
2318          
2319         }
2320     }
2321
2322
2323
2324
2325 }