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