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