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