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