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