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