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