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