MergeBranch.bjs
[gitlive] / Ticket.vala
1 static Ticket  _Ticket;
2
3 public class Ticket : Object
4 {
5     public Gtk.Dialog el;
6     private Ticket  _this;
7
8     public static Ticket singleton()
9     {
10         if (_Ticket == null) {
11             _Ticket= new Ticket();
12         }
13         return _Ticket;
14     }
15     public Xcls_table table;
16     public Xcls_project_id project_id;
17     public Xcls_prcellrenderer prcellrenderer;
18     public Xcls_prmodel prmodel;
19     public Xcls_summary summary;
20     public Xcls_milestone_id milestone_id;
21     public Xcls_msmodel msmodel;
22     public Xcls_description description;
23     public Xcls_priority_id priority_id;
24     public Xcls_primodel primodel;
25     public Xcls_severity_id severity_id;
26     public Xcls_sevmodel sevmodel;
27     public Xcls_classification_id classification_id;
28     public Xcls_clmodel clmodel;
29     public Xcls_developer_id developer_id;
30     public Xcls_devmodel devmodel;
31     public Xcls_spinner spinner;
32
33         // my vars (def)
34     public GitRepo? repo;
35     public bool running;
36
37     // ctor
38     public Ticket()
39     {
40         _this = this;
41         this.el = new Gtk.Dialog();
42
43         // my vars (dec)
44         this.repo = null;
45         this.running = false;
46
47         // set gobject values
48         this.el.title = "Create a Ticket";
49         this.el.default_height = 200;
50         this.el.default_width = 500;
51         this.el.deletable = true;
52         this.el.modal = true;
53         var child_0 = new Xcls_Box2( _this );
54         child_0.ref();
55         this.el.get_content_area().add (  child_0.el  );
56
57         //listeners
58         this.el.delete_event.connect( (self, event) => {
59             this.el.hide();
60             return true; 
61             //test  
62         });
63         this.el.response.connect( (self, response_id) =>  { 
64           
65                 GLib.debug("got %d", (int) response_id);
66                 if (response_id < 1) {
67                     _this.el.hide();    
68                     this.running = false; 
69                         return;
70                 }
71                  
72                  
73                 var tid = RooTicket.singleton().createTicket(
74                 
75                         _this.project_id.selectedProjectId(),
76                 
77                         _this.milestone_id.selectedMilestoneId(),
78                         _this.priority_id.selectedPriorityId() ,
79                         _this.classification_id.selectedClassificationId() ,
80                         _this.developer_id.selectedDeveloperId(),
81                         _this.summary.el.get_text() ,
82                         _this.description.el.buffer.text 
83                 );
84                 this.el.hide();
85             this.running = false; 
86                 if (this.repo != null) {
87                         NewBranch.singleton().show(this.repo, new Gee.ArrayList<GitMonitorQueue>(), tid);
88                 }
89         
90         
91                  
92         });
93     }
94
95     // user defined functions
96     public   void show ( GitRepo? repo   ) 
97     {
98          // this.el.set_gravity(Gdk.Gravity.NORTH);
99         if (this.running) { // should not happen!!
100                 GLib.error("new branch show called, when already being displayed?");
101         }
102         this.running  = true;
103      
104         _this.el.show_all();
105         
106         _this.table.el.hide();
107     
108         _this.spinner.el.show();
109         _this.spinner.el.start();       
110         this.el.set_keep_above(true);    
111         this.el.move((Gdk.Screen.width() / 2)- 250 ,0);
112         this.el.set_default_size( 500,200); // not sure why it grows..
113         
114         GLib.debug("Showing dialog?"); 
115         Timeout.add_seconds(1, () => {
116                 
117                 
118                 
119     
120                 //GitMonitor.gitmonitor.stop();
121                 
122                 this.repo = repo;
123                 
124                 
125                 
126                 
127         //    GLib.debug("Loading tickets"); 
128                  
129     
130     
131                 RooProject? curproj = null;
132                 if (this.repo != null) {
133                         curproj = RooProject.getProjectByRepo(this.repo);
134                 }
135                 _this.prmodel.loadProjects(curproj == null ? "" : curproj.id);
136                 if (curproj != null) {
137          
138                         
139                         var rt = RooTicket.singleton();
140                         rt.loadProjectOptions(curproj.id);
141                         
142                         _this.msmodel.loadMilestones();
143                         _this.primodel.loadPriorities();
144                         _this.sevmodel.loadSeverities();
145                         _this.clmodel.loadClassifications();    
146                         _this.devmodel.loadDevelopers();        
147                         
148                 }
149                 _this.summary.el.set_text("");
150                 _this.description.el.buffer.text = ""; 
151                 _this.spinner.el.stop();
152                 _this.spinner.el.hide();        
153     
154                 this.table.el.show();
155          
156     
157            
158     
159          
160                 
161                 return false;
162         });
163         this.el.run();
164         
165     
166     }
167     public class Xcls_Box2 : Object
168     {
169         public Gtk.Box el;
170         private Ticket  _this;
171
172
173             // my vars (def)
174
175         // ctor
176         public Xcls_Box2(Ticket _owner )
177         {
178             _this = _owner;
179             this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
180
181             // my vars (dec)
182
183             // set gobject values
184             var child_0 = new Xcls_table( _this );
185             child_0.ref();
186             this.el.pack_start (  child_0.el , false,false,0 );
187             var child_1 = new Xcls_spinner( _this );
188             child_1.ref();
189             this.el.add (  child_1.el  );
190         }
191
192         // user defined functions
193     }
194     public class Xcls_table : Object
195     {
196         public Gtk.Table el;
197         private Ticket  _this;
198
199
200             // my vars (def)
201
202         // ctor
203         public Xcls_table(Ticket _owner )
204         {
205             _this = _owner;
206             _this.table = this;
207             this.el = new Gtk.Table( 14, 4, true );
208
209             // my vars (dec)
210
211             // set gobject values
212             this.el.expand = false;
213             this.el.margin = 2;
214             this.el.column_spacing = 4;
215             this.el.vexpand = false;
216             var child_0 = new Xcls_Label4( _this );
217             child_0.ref();
218             this.el.attach_defaults (  child_0.el , 0,1,0,1 );
219             var child_1 = new Xcls_Label5( _this );
220             child_1.ref();
221             this.el.attach_defaults (  child_1.el , 1,2,0,1 );
222             var child_2 = new Xcls_project_id( _this );
223             child_2.ref();
224             this.el.attach_defaults (  child_2.el , 0,1,1,2 );
225             var child_3 = new Xcls_summary( _this );
226             child_3.ref();
227             this.el.attach_defaults (  child_3.el , 1,4,1,2 );
228             var child_4 = new Xcls_Label10( _this );
229             child_4.ref();
230             this.el.attach_defaults (  child_4.el , 0,1,2,3 );
231             var child_5 = new Xcls_milestone_id( _this );
232             child_5.ref();
233             this.el.attach_defaults (  child_5.el , 0,1,3,4 );
234             var child_6 = new Xcls_Label13( _this );
235             child_6.ref();
236             this.el.attach_defaults (  child_6.el , 1,4,2,3 );
237             var child_7 = new Xcls_description( _this );
238             child_7.ref();
239             this.el.attach_defaults (  child_7.el , 1,4,3,12 );
240             var child_8 = new Xcls_Label15( _this );
241             child_8.ref();
242             this.el.attach_defaults (  child_8.el , 0,1,4,5 );
243             var child_9 = new Xcls_priority_id( _this );
244             child_9.ref();
245             this.el.attach_defaults (  child_9.el , 0,1,5,6 );
246             var child_10 = new Xcls_Label18( _this );
247             child_10.ref();
248             this.el.attach_defaults (  child_10.el , 0,1,6,7 );
249             var child_11 = new Xcls_severity_id( _this );
250             child_11.ref();
251             this.el.attach_defaults (  child_11.el , 0,1,7,8 );
252             var child_12 = new Xcls_Label21( _this );
253             child_12.ref();
254             this.el.attach_defaults (  child_12.el , 0,1,8,9 );
255             var child_13 = new Xcls_classification_id( _this );
256             child_13.ref();
257             this.el.attach_defaults (  child_13.el , 0,1,9,10 );
258             var child_14 = new Xcls_Label24( _this );
259             child_14.ref();
260             this.el.attach_defaults (  child_14.el , 0,1,10,11 );
261             var child_15 = new Xcls_developer_id( _this );
262             child_15.ref();
263             this.el.attach_defaults (  child_15.el , 0,1,11,12 );
264             var child_16 = new Xcls_Button27( _this );
265             child_16.ref();
266             this.el.attach_defaults (  child_16.el , 0,4,13,14 );
267         }
268
269         // user defined functions
270     }
271     public class Xcls_Label4 : Object
272     {
273         public Gtk.Label el;
274         private Ticket  _this;
275
276
277             // my vars (def)
278
279         // ctor
280         public Xcls_Label4(Ticket _owner )
281         {
282             _this = _owner;
283             this.el = new Gtk.Label( "Project" );
284
285             // my vars (dec)
286
287             // set gobject values
288             this.el.halign = Gtk.Align.START;
289             this.el.visible = true;
290         }
291
292         // user defined functions
293     }
294
295     public class Xcls_Label5 : Object
296     {
297         public Gtk.Label el;
298         private Ticket  _this;
299
300
301             // my vars (def)
302
303         // ctor
304         public Xcls_Label5(Ticket _owner )
305         {
306             _this = _owner;
307             this.el = new Gtk.Label( "Summary" );
308
309             // my vars (dec)
310
311             // set gobject values
312             this.el.halign = Gtk.Align.START;
313             this.el.visible = true;
314         }
315
316         // user defined functions
317     }
318
319     public class Xcls_project_id : Object
320     {
321         public Gtk.ComboBox el;
322         private Ticket  _this;
323
324
325             // my vars (def)
326         public bool loading;
327
328         // ctor
329         public Xcls_project_id(Ticket _owner )
330         {
331             _this = _owner;
332             _this.project_id = this;
333             this.el = new Gtk.ComboBox.with_entry();
334
335             // my vars (dec)
336             this.loading = false;
337
338             // set gobject values
339             var child_0 = new Xcls_prcellrenderer( _this );
340             child_0.ref();
341             this.el.pack_start (  child_0.el , true );
342             var child_1 = new Xcls_prmodel( _this );
343             child_1.ref();
344             this.el.set_model (  child_1.el  );
345
346             // init method
347
348             this.el.set_entry_text_column(1);
349
350             //listeners
351             this.el.changed.connect( () => {
352                 if (this.loading) {
353                         return;
354                 }
355                 var project_id = this.selectedProjectId();
356                 
357                 var rt = RooTicket.singleton();
358                 rt.loadProjectOptions(project_id);
359                 
360                 _this.msmodel.loadMilestones();
361                 _this.primodel.loadPriorities();
362                 _this.sevmodel.loadSeverities();
363                 _this.clmodel.loadClassifications();    
364                 _this.devmodel.loadDevelopers();        
365                 
366                 // affects projects and milestones..
367                 
368                 
369                 /*if (this.loading) {
370                         return;
371                 }
372                 var ticket_id = this.selectedTicketId();
373                 
374                 var name = RooTicket.singleton().usernameLocal();
375                 
376                 if (ticket_id == "" || ticket_id == null) {
377                 
378                         var dt = new  DateTime.now_local();
379                         _this.name.el.set_text("wip_%s_%s".printf(name,dt.format("%Y_%b_%d")));
380                         return;
381                 }
382                 
383                 
384                 var ticket = RooTicket.singleton().getById(ticket_id);
385                
386                 _this.name.el.set_text("wip_%s_T%s_%s".printf(name,ticket.id, ticket.summaryToBranchName()));
387                 
388                 //GLib.debug (//"Selection: %s, %s\n", (string) val1, (string) val2);
389                 */
390             });
391         }
392
393         // user defined functions
394         public string selectedProjectId () {
395                 Gtk.TreeIter iter;
396                 Value val1;
397          
398          
399                 this.el.get_active_iter (out iter);
400                 _this.prmodel.el.get_value (iter, 0, out val1);
401          
402         
403                 return  (string) val1;
404                 
405                 
406                 
407                 
408         }
409     }
410     public class Xcls_prcellrenderer : Object
411     {
412         public Gtk.CellRendererText el;
413         private Ticket  _this;
414
415
416             // my vars (def)
417
418         // ctor
419         public Xcls_prcellrenderer(Ticket _owner )
420         {
421             _this = _owner;
422             _this.prcellrenderer = this;
423             this.el = new Gtk.CellRendererText();
424
425             // my vars (dec)
426
427             // set gobject values
428         }
429
430         // user defined functions
431     }
432
433     public class Xcls_prmodel : Object
434     {
435         public Gtk.ListStore el;
436         private Ticket  _this;
437
438
439             // my vars (def)
440
441         // ctor
442         public Xcls_prmodel(Ticket _owner )
443         {
444             _this = _owner;
445             _this.prmodel = this;
446             this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
447
448             // my vars (dec)
449
450             // set gobject values
451         }
452
453         // user defined functions
454         public void loadProjects (string id) {
455         
456             
457             _this.project_id.loading = true;
458         
459             this.el.clear();                                    
460             Gtk.TreeIter iter;
461             var el = this.el;
462             
463             el.append(out iter);
464         
465             
466             el.set_value(iter, 0, "");
467             el.set_value(iter, 1, "-- select a project --");
468             if (id == "") {
469                     _this.project_id.el.set_active_iter(iter);
470             }
471         
472             foreach(var project in RooProject.projects()) {
473             
474                 el.append(out iter);
475                 
476                 el.set_value(iter, 0, project.id);
477                 el.set_value(iter, 1,  project.name );
478                 if (id == project.id) {
479                            _this.project_id.el.set_active_iter(iter);
480                     }   
481                 
482             }
483             
484             _this.project_id.loading = false;
485              //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);          
486                                              
487         }
488     }
489
490
491     public class Xcls_summary : Object
492     {
493         public Gtk.Entry el;
494         private Ticket  _this;
495
496
497             // my vars (def)
498
499         // ctor
500         public Xcls_summary(Ticket _owner )
501         {
502             _this = _owner;
503             _this.summary = this;
504             this.el = new Gtk.Entry();
505
506             // my vars (dec)
507
508             // set gobject values
509             this.el.visible = true;
510         }
511
512         // user defined functions
513     }
514
515     public class Xcls_Label10 : Object
516     {
517         public Gtk.Label el;
518         private Ticket  _this;
519
520
521             // my vars (def)
522
523         // ctor
524         public Xcls_Label10(Ticket _owner )
525         {
526             _this = _owner;
527             this.el = new Gtk.Label( "Milestone" );
528
529             // my vars (dec)
530
531             // set gobject values
532             this.el.halign = Gtk.Align.START;
533             this.el.justify = Gtk.Justification.RIGHT;
534             this.el.xalign = 0.900000f;
535         }
536
537         // user defined functions
538     }
539
540     public class Xcls_milestone_id : Object
541     {
542         public Gtk.ComboBox el;
543         private Ticket  _this;
544
545
546             // my vars (def)
547         public bool loading;
548
549         // ctor
550         public Xcls_milestone_id(Ticket _owner )
551         {
552             _this = _owner;
553             _this.milestone_id = this;
554             this.el = new Gtk.ComboBox.with_entry();
555
556             // my vars (dec)
557             this.loading = false;
558
559             // set gobject values
560             var child_0 = new Xcls_msmodel( _this );
561             child_0.ref();
562             this.el.set_model (  child_0.el  );
563
564             // init method
565
566             this.el.set_entry_text_column(1);
567         }
568
569         // user defined functions
570         public string selectedMilestoneId () {
571                 Gtk.TreeIter iter;
572                 Value val1;
573          
574          
575                 this.el.get_active_iter (out iter);
576                 _this.msmodel.el.get_value (iter, 0, out val1);
577          
578         
579                 return  (string) val1;
580                 
581                 
582                 
583                 
584         }
585     }
586     public class Xcls_msmodel : Object
587     {
588         public Gtk.ListStore el;
589         private Ticket  _this;
590
591
592             // my vars (def)
593
594         // ctor
595         public Xcls_msmodel(Ticket _owner )
596         {
597             _this = _owner;
598             _this.msmodel = this;
599             this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
600
601             // my vars (dec)
602
603             // set gobject values
604         }
605
606         // user defined functions
607         public void loadMilestones ( ) {
608         
609             var rt = RooTicket.singleton();
610            // rt.loadProjects();
611             
612             _this.milestone_id.loading = true;
613         
614             this.el.clear();                                    
615             Gtk.TreeIter iter;
616             var el = this.el;
617             
618             el.append(out iter);
619         
620             
621             el.set_value(iter, 0, "");
622             el.set_value(iter, 1, "-- select a milestone --");
623             _this.milestone_id.el.set_active_iter(iter);    
624              
625             var projects = rt.milestones;
626             foreach(var project in projects) {
627             
628                 el.append(out iter);
629                 
630                 el.set_value(iter, 0, project.id);
631                 el.set_value(iter, 1,  project.display_name );
632               //  if (id == project.id) {
633                  //        _this.milestone.el.set_active_iter(iter);
634                  //   }   
635                 
636             }
637             
638             
639             _this.milestone_id.loading = false;
640              //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);          
641                                              
642         }
643     }
644
645
646     public class Xcls_Label13 : Object
647     {
648         public Gtk.Label el;
649         private Ticket  _this;
650
651
652             // my vars (def)
653
654         // ctor
655         public Xcls_Label13(Ticket _owner )
656         {
657             _this = _owner;
658             this.el = new Gtk.Label( "Description" );
659
660             // my vars (dec)
661
662             // set gobject values
663             this.el.halign = Gtk.Align.START;
664         }
665
666         // user defined functions
667     }
668
669     public class Xcls_description : Object
670     {
671         public Gtk.TextView el;
672         private Ticket  _this;
673
674
675             // my vars (def)
676
677         // ctor
678         public Xcls_description(Ticket _owner )
679         {
680             _this = _owner;
681             _this.description = this;
682             this.el = new Gtk.TextView();
683
684             // my vars (dec)
685
686             // set gobject values
687             this.el.border_width = 1;
688         }
689
690         // user defined functions
691     }
692
693     public class Xcls_Label15 : Object
694     {
695         public Gtk.Label el;
696         private Ticket  _this;
697
698
699             // my vars (def)
700
701         // ctor
702         public Xcls_Label15(Ticket _owner )
703         {
704             _this = _owner;
705             this.el = new Gtk.Label( "Priority" );
706
707             // my vars (dec)
708
709             // set gobject values
710             this.el.halign = Gtk.Align.START;
711             this.el.xalign = 0.900000f;
712         }
713
714         // user defined functions
715     }
716
717     public class Xcls_priority_id : Object
718     {
719         public Gtk.ComboBox el;
720         private Ticket  _this;
721
722
723             // my vars (def)
724         public bool loading;
725
726         // ctor
727         public Xcls_priority_id(Ticket _owner )
728         {
729             _this = _owner;
730             _this.priority_id = this;
731             this.el = new Gtk.ComboBox.with_entry();
732
733             // my vars (dec)
734             this.loading = false;
735
736             // set gobject values
737             var child_0 = new Xcls_primodel( _this );
738             child_0.ref();
739             this.el.set_model (  child_0.el  );
740
741             // init method
742
743             this.el.set_entry_text_column(1);
744         }
745
746         // user defined functions
747         public string selectedPriorityId () {
748                 Gtk.TreeIter iter;
749                 Value val1;
750          
751          
752                 this.el.get_active_iter (out iter);
753                 _this.primodel.el.get_value (iter, 0, out val1);
754          
755         
756                 return  (string) val1;
757                 
758                 
759                 
760                 
761         }
762     }
763     public class Xcls_primodel : Object
764     {
765         public Gtk.ListStore el;
766         private Ticket  _this;
767
768
769             // my vars (def)
770
771         // ctor
772         public Xcls_primodel(Ticket _owner )
773         {
774             _this = _owner;
775             _this.primodel = this;
776             this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
777
778             // my vars (dec)
779
780             // set gobject values
781         }
782
783         // user defined functions
784         public void loadPriorities ( ) {
785         
786             var rt = RooTicket.singleton();
787            // rt.loadProjects();
788             
789             _this.priority_id.loading = true;
790         
791             this.el.clear();                                    
792             Gtk.TreeIter iter;
793             var el = this.el;
794             
795             
796            var projects = rt.priorities;
797             foreach(var project in projects) {
798             
799                 el.append(out iter);
800                 
801                 el.set_value(iter, 0, project.id);
802                 el.set_value(iter, 1,  project.display_name );
803                 if ("normal" == project.name) {
804                            _this.priority_id.el.set_active_iter(iter);
805                     }   
806                 
807             }
808             
809             _this.priority_id.loading = false;
810                    
811                                              
812         }
813     }
814
815
816     public class Xcls_Label18 : Object
817     {
818         public Gtk.Label el;
819         private Ticket  _this;
820
821
822             // my vars (def)
823
824         // ctor
825         public Xcls_Label18(Ticket _owner )
826         {
827             _this = _owner;
828             this.el = new Gtk.Label( "Severity" );
829
830             // my vars (dec)
831
832             // set gobject values
833             this.el.halign = Gtk.Align.START;
834         }
835
836         // user defined functions
837     }
838
839     public class Xcls_severity_id : Object
840     {
841         public Gtk.ComboBox el;
842         private Ticket  _this;
843
844
845             // my vars (def)
846         public bool loading;
847
848         // ctor
849         public Xcls_severity_id(Ticket _owner )
850         {
851             _this = _owner;
852             _this.severity_id = this;
853             this.el = new Gtk.ComboBox.with_entry();
854
855             // my vars (dec)
856             this.loading = false;
857
858             // set gobject values
859             var child_0 = new Xcls_sevmodel( _this );
860             child_0.ref();
861             this.el.set_model (  child_0.el  );
862
863             // init method
864
865             this.el.set_entry_text_column(1);
866         }
867
868         // user defined functions
869         public string selectedSeverityId () {
870                 Gtk.TreeIter iter;
871                 Value val1;
872          
873          
874                 this.el.get_active_iter (out iter);
875                 _this.sevmodel.el.get_value (iter, 0, out val1);
876          
877         
878                 return  (string) val1;
879                 
880                 
881                 
882                 
883         }
884     }
885     public class Xcls_sevmodel : Object
886     {
887         public Gtk.ListStore el;
888         private Ticket  _this;
889
890
891             // my vars (def)
892
893         // ctor
894         public Xcls_sevmodel(Ticket _owner )
895         {
896             _this = _owner;
897             _this.sevmodel = this;
898             this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
899
900             // my vars (dec)
901
902             // set gobject values
903         }
904
905         // user defined functions
906         public void loadSeverities () {
907         
908             var rt = RooTicket.singleton();
909             //rt.loadProjects();
910             
911             _this.severity_id.loading = true;
912         
913             this.el.clear();                                    
914             Gtk.TreeIter iter;
915             var el = this.el;
916              
917             var projects = rt.serverities;
918             foreach(var project in projects) {
919             
920                 el.append(out iter);
921                 
922                 el.set_value(iter, 0, project.id);
923                 el.set_value(iter, 1,  project.display_name );
924                 if ("normal" == project.name) {
925                            _this.severity_id.el.set_active_iter(iter);
926                     }   
927                 
928             }
929            
930             _this.severity_id.loading = false;
931              //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);          
932                                              
933         }
934     }
935
936
937     public class Xcls_Label21 : Object
938     {
939         public Gtk.Label el;
940         private Ticket  _this;
941
942
943             // my vars (def)
944
945         // ctor
946         public Xcls_Label21(Ticket _owner )
947         {
948             _this = _owner;
949             this.el = new Gtk.Label( "Classification" );
950
951             // my vars (dec)
952
953             // set gobject values
954             this.el.halign = Gtk.Align.START;
955         }
956
957         // user defined functions
958     }
959
960     public class Xcls_classification_id : Object
961     {
962         public Gtk.ComboBox el;
963         private Ticket  _this;
964
965
966             // my vars (def)
967         public bool loading;
968
969         // ctor
970         public Xcls_classification_id(Ticket _owner )
971         {
972             _this = _owner;
973             _this.classification_id = this;
974             this.el = new Gtk.ComboBox.with_entry();
975
976             // my vars (dec)
977             this.loading = false;
978
979             // set gobject values
980             var child_0 = new Xcls_clmodel( _this );
981             child_0.ref();
982             this.el.set_model (  child_0.el  );
983
984             // init method
985
986             this.el.set_entry_text_column(1);
987         }
988
989         // user defined functions
990         public string selectedClassificationId () {
991                 Gtk.TreeIter iter;
992                 Value val1;
993          
994          
995                 this.el.get_active_iter (out iter);
996                 _this.clmodel.el.get_value (iter, 0, out val1);
997          
998         
999                 return  (string) val1;
1000                 
1001                 
1002                 
1003                 
1004         }
1005     }
1006     public class Xcls_clmodel : Object
1007     {
1008         public Gtk.ListStore el;
1009         private Ticket  _this;
1010
1011
1012             // my vars (def)
1013
1014         // ctor
1015         public Xcls_clmodel(Ticket _owner )
1016         {
1017             _this = _owner;
1018             _this.clmodel = this;
1019             this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
1020
1021             // my vars (dec)
1022
1023             // set gobject values
1024         }
1025
1026         // user defined functions
1027         public void loadClassifications ( ) {
1028         
1029             var rt = RooTicket.singleton();
1030             // rt.loadProjects();
1031             
1032             _this.classification_id.loading = true;
1033         
1034             this.el.clear();                                    
1035             Gtk.TreeIter iter;
1036             var el = this.el;
1037             
1038             el.append(out iter);
1039         
1040              
1041             var projects = rt.classifications;
1042             foreach(var project in projects) {
1043             
1044                 el.append(out iter);
1045                 
1046                 el.set_value(iter, 0, project.id);
1047                 el.set_value(iter, 1,  project.display_name );
1048                 if ("bug" == project.name) {
1049                            _this.classification_id.el.set_active_iter(iter);
1050                     }   
1051                 
1052             }
1053             
1054             _this.classification_id.loading = false;
1055              //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);          
1056                                              
1057         }
1058     }
1059
1060
1061     public class Xcls_Label24 : Object
1062     {
1063         public Gtk.Label el;
1064         private Ticket  _this;
1065
1066
1067             // my vars (def)
1068
1069         // ctor
1070         public Xcls_Label24(Ticket _owner )
1071         {
1072             _this = _owner;
1073             this.el = new Gtk.Label( "Assign to" );
1074
1075             // my vars (dec)
1076
1077             // set gobject values
1078             this.el.halign = Gtk.Align.START;
1079         }
1080
1081         // user defined functions
1082     }
1083
1084     public class Xcls_developer_id : Object
1085     {
1086         public Gtk.ComboBox el;
1087         private Ticket  _this;
1088
1089
1090             // my vars (def)
1091         public bool loading;
1092
1093         // ctor
1094         public Xcls_developer_id(Ticket _owner )
1095         {
1096             _this = _owner;
1097             _this.developer_id = this;
1098             this.el = new Gtk.ComboBox.with_entry();
1099
1100             // my vars (dec)
1101             this.loading = false;
1102
1103             // set gobject values
1104             var child_0 = new Xcls_devmodel( _this );
1105             child_0.ref();
1106             this.el.set_model (  child_0.el  );
1107
1108             // init method
1109
1110             this.el.set_entry_text_column(1);
1111         }
1112
1113         // user defined functions
1114         public string selectedDeveloperId () {
1115                 Gtk.TreeIter iter;
1116                 Value val1;
1117          
1118          
1119                 this.el.get_active_iter (out iter);
1120                 _this.devmodel.el.get_value (iter, 0, out val1);
1121          
1122         
1123                 return  (string) val1;
1124                 
1125                 
1126                 
1127                 
1128         }
1129     }
1130     public class Xcls_devmodel : Object
1131     {
1132         public Gtk.ListStore el;
1133         private Ticket  _this;
1134
1135
1136             // my vars (def)
1137
1138         // ctor
1139         public Xcls_devmodel(Ticket _owner )
1140         {
1141             _this = _owner;
1142             _this.devmodel = this;
1143             this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
1144
1145             // my vars (dec)
1146
1147             // set gobject values
1148         }
1149
1150         // user defined functions
1151         public void loadDevelopers ( ) {
1152         
1153             var rt = RooTicket.singleton();
1154             //rt.loadProjects();
1155             
1156             _this.developer_id.loading = true;
1157         
1158             this.el.clear();                                    
1159             Gtk.TreeIter iter;
1160             var el = this.el;
1161             
1162             el.append(out iter);
1163         
1164             
1165             el.set_value(iter, 0, "");
1166             el.set_value(iter, 1, "-- select a developer --");
1167           //  if (id == "") {
1168                     _this.developer_id.el.set_active_iter(iter);
1169            // }
1170             
1171             var projects = rt.developers;
1172             foreach(var project in projects) {
1173             
1174                 el.append(out iter);
1175                 
1176                 el.set_value(iter, 0, project.id);
1177                 el.set_value(iter, 1,  project.display_name );
1178         //        if (id == project.id) {
1179                 //         _this.projectsel.el.set_active_iter(iter);
1180         //          }   
1181                 
1182             }
1183          
1184             _this.developer_id.loading = false;
1185              //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);          
1186                                              
1187         }
1188     }
1189
1190
1191     public class Xcls_Button27 : Object
1192     {
1193         public Gtk.Button el;
1194         private Ticket  _this;
1195
1196
1197             // my vars (def)
1198
1199         // ctor
1200         public Xcls_Button27(Ticket _owner )
1201         {
1202             _this = _owner;
1203             this.el = new Gtk.Button();
1204
1205             // my vars (dec)
1206
1207             // set gobject values
1208             this.el.label = "Create Ticket";
1209
1210             // init method
1211
1212             {
1213                this.el.get_style_context().add_class("suggested-action");
1214             }
1215
1216             //listeners
1217             this.el.clicked.connect( () => {
1218                 GLib.debug("fire response = 1");
1219                 
1220                 
1221                 var invalid = false;
1222                 
1223                 // validate first...
1224                 _this.project_id.el.get_child().get_style_context().remove_class("warning");    
1225                 if (_this.project_id.selectedProjectId() == "") {
1226                         _this.project_id.el.get_child().get_style_context().add_class("warning");
1227                         invalid = true;
1228                 }
1229                 
1230                 _this.milestone_id.el.get_child().get_style_context().remove_class("warning");  
1231                 if (_this.milestone_id.selectedMilestoneId() == "") {
1232                         _this.milestone_id.el.get_child().get_style_context().add_class("warning");
1233                         invalid = true;
1234                 }
1235             
1236                 _this.priority_id.el.get_child().get_style_context().remove_class("warning");   
1237                 if (_this.priority_id.selectedPriorityId() == "") {
1238                         _this.priority_id.el.get_child().get_style_context().add_class("warning");
1239                         invalid = true;
1240                 }
1241                 
1242                 _this.classification_id.el.get_child().get_style_context().remove_class("warning");     
1243                 if (_this.classification_id.selectedClassificationId() == "") {
1244                         _this.classification_id.el.get_child().get_style_context().add_class("warning");
1245                         invalid = true;
1246                 }
1247                 
1248                 _this.developer_id.el.get_child().get_style_context().remove_class("warning");  
1249                 if (_this.developer_id.selectedDeveloperId() == "") {
1250                         _this.developer_id.el.get_child().get_style_context().add_class("warning");
1251                         invalid = true;
1252                 }
1253                 
1254                 _this.summary.el.get_style_context().remove_class("warning");   
1255                 if (_this.summary.el.get_text() == "") {
1256                         _this.summary.el.get_style_context().add_class("warning");
1257                         invalid = true;
1258                 }
1259                 
1260                 _this.description.el.get_style_context().remove_class("warning");       
1261                 if (_this.description.el.buffer.text == "") {
1262                         _this.description.el.get_style_context().add_class("warning");
1263                         invalid = true;
1264                 }
1265                 
1266                 
1267                 if (invalid) {
1268                         return;
1269                 }
1270                 GLib.debug("for is valid");
1271                 
1272                 _this.el.response(1);
1273             });
1274         }
1275
1276         // user defined functions
1277     }
1278
1279
1280     public class Xcls_spinner : Object
1281     {
1282         public Gtk.Spinner el;
1283         private Ticket  _this;
1284
1285
1286             // my vars (def)
1287
1288         // ctor
1289         public Xcls_spinner(Ticket _owner )
1290         {
1291             _this = _owner;
1292             _this.spinner = this;
1293             this.el = new Gtk.Spinner();
1294
1295             // my vars (dec)
1296
1297             // set gobject values
1298             this.el.hexpand = true;
1299             this.el.vexpand = true;
1300         }
1301
1302         // user defined functions
1303     }
1304
1305
1306 }