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