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