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