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