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