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