NewBranch.bjs
[gitlive] / NewBranch.vala
1 static NewBranch  _NewBranch;
2
3 public class NewBranch : Object
4 {
5     public Gtk.Dialog el;
6     private NewBranch  _this;
7
8     public static NewBranch singleton()
9     {
10         if (_NewBranch == null) {
11             _NewBranch= new NewBranch();
12         }
13         return _NewBranch;
14     }
15     public Xcls_label_select_ticket label_select_ticket;
16     public Xcls_label_create_ticket label_create_ticket;
17     public Xcls_label_quick_commit label_quick_commit;
18     public Xcls_projectsel projectsel;
19     public Xcls_prcellrenderer prcellrenderer;
20     public Xcls_prmodel prmodel;
21     public Xcls_ticketsel ticketsel;
22     public Xcls_dbcellrenderer dbcellrenderer;
23     public Xcls_dbmodel dbmodel;
24     public Xcls_name name;
25     public Xcls_createbtn createbtn;
26     public Xcls_btn_not_me btn_not_me;
27     public Xcls_btn_closed btn_closed;
28     public Xcls_scrolled_window scrolled_window;
29     public Xcls_view view;
30     public Xcls_table table;
31     public Xcls_project_id project_id;
32     public Xcls_prcellrenderer prcellrenderer;
33     public Xcls_prmodel prmodel;
34     public Xcls_summary summary;
35     public Xcls_milestone_id milestone_id;
36     public Xcls_msmodel msmodel;
37     public Xcls_description description;
38     public Xcls_priority_id priority_id;
39     public Xcls_primodel primodel;
40     public Xcls_severity_id severity_id;
41     public Xcls_sevmodel sevmodel;
42     public Xcls_classification_id classification_id;
43     public Xcls_clmodel clmodel;
44     public Xcls_developer_id developer_id;
45     public Xcls_devmodel devmodel;
46
47         // my vars (def)
48     public GitRepo? repo;
49     public bool running;
50     public Gee.ArrayList<GitMonitorQueue> queue;
51
52     // ctor
53     public NewBranch()
54     {
55         _this = this;
56         this.el = new Gtk.Dialog();
57
58         // my vars (dec)
59         this.repo = null;
60         this.running = false;
61         this.queue = null;
62
63         // set gobject values
64         this.el.title = "Create a working branch ";
65         this.el.default_height = 500;
66         this.el.default_width = 500;
67         this.el.deletable = true;
68         this.el.modal = true;
69         var child_0 = new Xcls_Notebook2( _this );
70         child_0.ref();
71         this.el.get_content_area().add (  child_0.el  );
72
73         //listeners
74         this.el.delete_event.connect( (self, event) => {
75             this.el.hide();
76             return true; 
77             //test  
78         });
79         this.el.response.connect( (self, response_id) =>  { 
80           
81                 GLib.debug("got %d", (int) response_id);
82                 
83                  
84                 
85                  
86                 // have they selected a ticket..
87                 // make that the current active ticket?
88                 // we really need to store locally what ticket is being worked on..
89                 // in theory we could be working on multiple project and not merging..
90                 // -- each repo would have their active ticket (only one per repo)
91                 // -- so we could just store that in there
92                 // -- initial load can check the contents of the ticket files on first scan.
93         
94                  
95                 if (response_id < 1) {
96                     _this.el.hide();    
97                     this.running = false; 
98                         return;
99                 }
100                 
101                 var ticket_id = _this.ticketsel.selectedTicketId();
102                 
103             if (this.repo != null) {
104                 var bn = _this.name.el.get_text();
105         
106                         var res = this.repo.setActiveTicket(                    
107                                  RooTicket.singleton().getById(ticket_id != "" ? ticket_id : "-1"), bn
108                          );
109                          if (res) {
110                                 // start the monitoring..
111                                  GitMonitor.gitmonitor.start();
112                                  
113                          }
114             }
115              
116         
117             this.running = false; 
118         
119                 this.el.hide();
120                  
121                  
122         
123                  
124         });
125     }
126
127     // user defined functions
128     public   void show ( GitRepo repo, Gee.ArrayList<GitMonitorQueue> queue, string tid = "" ) 
129     {
130          // this.el.set_gravity(Gdk.Gravity.NORTH);
131         if (this.running) { // should not happen!!
132                 GLib.error("new branch show called, when already being displayed?");
133         }
134         this.queue = queue;
135         
136         this.running  = true;
137         GitMonitor.gitmonitor.stop();
138         
139         this.repo = repo;
140         
141          
142         
143         this.el.move((Gdk.Screen.width() / 2)- 250 ,0);
144         this.el.set_default_size( 500,200); // not sure why it grows..
145         GLib.debug("Loading tickets"); 
146          
147     
148         this.el.show_all();
149         this.el.set_keep_above(true);
150        
151         
152         var curproj = RooProject.getProjectByRepo(this.repo);
153          _this.prmodel.loadProjects(curproj == null ? "" : curproj.id);
154         
155         _this.dbmodel.loadTickets(curproj == null ? "": curproj.id, tid);
156         _this.createbtn.updateState();
157         
158         _this.ticketsel.el.get_child().get_style_context().remove_class("warning");
159         if (tid != "") { 
160                 var name = RooTicket.singleton().usernameLocal();
161                 var ticket = RooTicket.singleton().getById(tid);
162                 _this.name.el.set_text("wip_%s_T%s_%s".printf(name,ticket.id, ticket.summaryToBranchName()));
163         } else {
164                 _this.ticketsel.el.get_child().get_style_context().add_class("warning");
165         }
166         _this.view.loadTicket(tid);
167         this.el.run();
168     
169     }
170     public class Xcls_Notebook2 : Object
171     {
172         public Gtk.Notebook el;
173         private NewBranch  _this;
174
175
176             // my vars (def)
177
178         // ctor
179         public Xcls_Notebook2(NewBranch _owner )
180         {
181             _this = _owner;
182             this.el = new Gtk.Notebook();
183
184             // my vars (dec)
185
186             // set gobject values
187             this.el.vexpand = true;
188             var child_0 = new Xcls_label_select_ticket( _this );
189             child_0.ref();
190             var child_1 = new Xcls_label_create_ticket( _this );
191             child_1.ref();
192             var child_2 = new Xcls_label_quick_commit( _this );
193             child_2.ref();
194             var child_3 = new Xcls_Box6( _this );
195             child_3.ref();
196             this.el.append_page (  child_3.el , _this.label_select_ticket.el );
197             var child_4 = new Xcls_Box25( _this );
198             child_4.ref();
199             this.el.append_page (  child_4.el , _this.label_create_ticket.el );
200             var child_5 = new Xcls_Box51( _this );
201             child_5.ref();
202             this.el.append_page (  child_5.el , _this.label_quick_commit.el );
203         }
204
205         // user defined functions
206     }
207     public class Xcls_label_select_ticket : Object
208     {
209         public Gtk.Label el;
210         private NewBranch  _this;
211
212
213             // my vars (def)
214
215         // ctor
216         public Xcls_label_select_ticket(NewBranch _owner )
217         {
218             _this = _owner;
219             _this.label_select_ticket = this;
220             this.el = new Gtk.Label( "Select Existing Ticket to work on" );
221
222             // my vars (dec)
223
224             // set gobject values
225         }
226
227         // user defined functions
228     }
229
230     public class Xcls_label_create_ticket : Object
231     {
232         public Gtk.Label el;
233         private NewBranch  _this;
234
235
236             // my vars (def)
237
238         // ctor
239         public Xcls_label_create_ticket(NewBranch _owner )
240         {
241             _this = _owner;
242             _this.label_create_ticket = this;
243             this.el = new Gtk.Label( "Create a New Ticket" );
244
245             // my vars (dec)
246
247             // set gobject values
248         }
249
250         // user defined functions
251     }
252
253     public class Xcls_label_quick_commit : Object
254     {
255         public Gtk.Label el;
256         private NewBranch  _this;
257
258
259             // my vars (def)
260
261         // ctor
262         public Xcls_label_quick_commit(NewBranch _owner )
263         {
264             _this = _owner;
265             _this.label_quick_commit = this;
266             this.el = new Gtk.Label( "Quick Commit" );
267
268             // my vars (dec)
269
270             // set gobject values
271         }
272
273         // user defined functions
274     }
275
276     public class Xcls_Box6 : Object
277     {
278         public Gtk.Box el;
279         private NewBranch  _this;
280
281
282             // my vars (def)
283
284         // ctor
285         public Xcls_Box6(NewBranch _owner )
286         {
287             _this = _owner;
288             this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
289
290             // my vars (dec)
291
292             // set gobject values
293             this.el.homogeneous = false;
294             var child_0 = new Xcls_Table7( _this );
295             child_0.ref();
296             this.el.pack_start (  child_0.el , false,false,0 );
297             var child_1 = new Xcls_scrolled_window( _this );
298             child_1.ref();
299             this.el.add (  child_1.el  );
300         }
301
302         // user defined functions
303     }
304     public class Xcls_Table7 : Object
305     {
306         public Gtk.Table el;
307         private NewBranch  _this;
308
309
310             // my vars (def)
311
312         // ctor
313         public Xcls_Table7(NewBranch _owner )
314         {
315             _this = _owner;
316             this.el = new Gtk.Table( 5, 5, true );
317
318             // my vars (dec)
319
320             // set gobject values
321             this.el.expand = false;
322             this.el.margin = 2;
323             this.el.column_spacing = 4;
324             this.el.vexpand = false;
325             var child_0 = new Xcls_Label8( _this );
326             child_0.ref();
327             this.el.attach_defaults (  child_0.el , 0,1,0,1 );
328             var child_1 = new Xcls_Label9( _this );
329             child_1.ref();
330             this.el.attach_defaults (  child_1.el , 1,2,0,1 );
331             var child_2 = new Xcls_projectsel( _this );
332             child_2.ref();
333             this.el.attach_defaults (  child_2.el , 0,1,1,2 );
334             var child_3 = new Xcls_ticketsel( _this );
335             child_3.ref();
336             this.el.attach_defaults (  child_3.el , 1,4,1,2 );
337             var child_4 = new Xcls_Label16( _this );
338             child_4.ref();
339             this.el.attach_defaults (  child_4.el , 0,1,3,4 );
340             var child_5 = new Xcls_name( _this );
341             child_5.ref();
342             this.el.attach_defaults (  child_5.el , 0,4,4,5 );
343             var child_6 = new Xcls_createbtn( _this );
344             child_6.ref();
345             this.el.attach_defaults (  child_6.el , 4,5,4,5 );
346             var child_7 = new Xcls_Box19( _this );
347             child_7.ref();
348             this.el.attach_defaults (  child_7.el , 0,5,2,3 );
349         }
350
351         // user defined functions
352     }
353     public class Xcls_Label8 : Object
354     {
355         public Gtk.Label el;
356         private NewBranch  _this;
357
358
359             // my vars (def)
360
361         // ctor
362         public Xcls_Label8(NewBranch _owner )
363         {
364             _this = _owner;
365             this.el = new Gtk.Label( "Project" );
366
367             // my vars (dec)
368
369             // set gobject values
370             this.el.halign = Gtk.Align.START;
371             this.el.justify = Gtk.Justification.RIGHT;
372             this.el.visible = true;
373         }
374
375         // user defined functions
376     }
377
378     public class Xcls_Label9 : Object
379     {
380         public Gtk.Label el;
381         private NewBranch  _this;
382
383
384             // my vars (def)
385
386         // ctor
387         public Xcls_Label9(NewBranch _owner )
388         {
389             _this = _owner;
390             this.el = new Gtk.Label( "Ticket" );
391
392             // my vars (dec)
393
394             // set gobject values
395             this.el.halign = Gtk.Align.START;
396             this.el.visible = true;
397         }
398
399         // user defined functions
400     }
401
402     public class Xcls_projectsel : Object
403     {
404         public Gtk.ComboBox el;
405         private NewBranch  _this;
406
407
408             // my vars (def)
409         public bool loading;
410
411         // ctor
412         public Xcls_projectsel(NewBranch _owner )
413         {
414             _this = _owner;
415             _this.projectsel = this;
416             this.el = new Gtk.ComboBox.with_entry();
417
418             // my vars (dec)
419             this.loading = false;
420
421             // set gobject values
422             var child_0 = new Xcls_prcellrenderer( _this );
423             child_0.ref();
424             this.el.pack_start (  child_0.el , true );
425             var child_1 = new Xcls_prmodel( _this );
426             child_1.ref();
427             this.el.set_model (  child_1.el  );
428
429             // init method
430
431             this.el.set_entry_text_column(1);
432
433             //listeners
434             this.el.changed.connect( () => {
435                 if (this.loading) {
436                         return;
437                 }
438                 var project_id = this.selectedProjectId();
439                 _this.dbmodel.loadTickets(project_id);
440                 
441                 
442                 /*if (this.loading) {
443                         return;
444                 }
445                 var ticket_id = this.selectedTicketId();
446                 
447                 var name = RooTicket.singleton().usernameLocal();
448                 
449                 if (ticket_id == "" || ticket_id == null) {
450                 
451                         var dt = new  DateTime.now_local();
452                         _this.name.el.set_text("wip_%s_%s".printf(name,dt.format("%Y_%b_%d")));
453                         return;
454                 }
455                 
456                 
457                 var ticket = RooTicket.singleton().getById(ticket_id);
458                
459                 _this.name.el.set_text("wip_%s_T%s_%s".printf(name,ticket.id, ticket.summaryToBranchName()));
460                 
461                 //GLib.debug (//"Selection: %s, %s\n", (string) val1, (string) val2);
462                 */
463             });
464         }
465
466         // user defined functions
467         public string selectedProjectId () {
468                 Gtk.TreeIter iter;
469                 Value val1;
470          
471          
472                 this.el.get_active_iter (out iter);
473                 _this.prmodel.el.get_value (iter, 0, out val1);
474          
475         
476                 return  (string) val1;
477                 
478                 
479                 
480                 
481         }
482     }
483     public class Xcls_prcellrenderer : Object
484     {
485         public Gtk.CellRendererText el;
486         private NewBranch  _this;
487
488
489             // my vars (def)
490
491         // ctor
492         public Xcls_prcellrenderer(NewBranch _owner )
493         {
494             _this = _owner;
495             _this.prcellrenderer = this;
496             this.el = new Gtk.CellRendererText();
497
498             // my vars (dec)
499
500             // set gobject values
501         }
502
503         // user defined functions
504     }
505
506     public class Xcls_prmodel : Object
507     {
508         public Gtk.ListStore el;
509         private NewBranch  _this;
510
511
512             // my vars (def)
513
514         // ctor
515         public Xcls_prmodel(NewBranch _owner )
516         {
517             _this = _owner;
518             _this.prmodel = this;
519             this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
520
521             // my vars (dec)
522
523             // set gobject values
524         }
525
526         // user defined functions
527         public void loadProjects (string id) {
528         
529         
530             
531             _this.projectsel.loading = true;
532         
533             this.el.clear();                                    
534             Gtk.TreeIter iter;
535             var el = this.el;
536             
537             el.append(out iter);
538         
539             
540             el.set_value(iter, 0, "");
541             el.set_value(iter, 1, "-- select a project --");
542             if (id == "") {
543                     _this.projectsel.el.set_active_iter(iter);
544             }
545           
546             foreach(var project in RooProject.projects()) {
547             
548                 el.append(out iter);
549                 
550                 el.set_value(iter, 0, project.id);
551                 el.set_value(iter, 1,  project.name );
552                 if (id == project.id) {
553                            _this.projectsel.el.set_active_iter(iter);
554                     }   
555                 
556             }
557             
558             _this.projectsel.loading = false;
559              //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);          
560                                              
561         }
562     }
563
564
565     public class Xcls_ticketsel : Object
566     {
567         public Gtk.ComboBox el;
568         private NewBranch  _this;
569
570
571             // my vars (def)
572         public bool loading;
573
574         // ctor
575         public Xcls_ticketsel(NewBranch _owner )
576         {
577             _this = _owner;
578             _this.ticketsel = this;
579             this.el = new Gtk.ComboBox.with_entry();
580
581             // my vars (dec)
582             this.loading = false;
583
584             // set gobject values
585             var child_0 = new Xcls_dbcellrenderer( _this );
586             child_0.ref();
587             this.el.pack_start (  child_0.el , true );
588             var child_1 = new Xcls_dbmodel( _this );
589             child_1.ref();
590             this.el.set_model (  child_1.el  );
591
592             // init method
593
594             //this.el.add_attribute(_this.dbcellrenderer.el , "markup", 1 );
595             this.el.set_entry_text_column(1);
596             this.el.get_child().set_sensitive(false);
597
598             //listeners
599             this.el.changed.connect( () => {
600                 if (this.loading) {
601                         return;
602                 }
603                 var ticket_id = this.selectedTicketId();
604                 
605                 var name = RooTicket.singleton().usernameLocal();
606                 
607                 this.el.get_child().get_style_context().remove_class("warning");
608                 if (ticket_id == "" || ticket_id == null) {
609                 
610                         var dt = new  DateTime.now_local();
611                         _this.name.el.set_text("wip_%s_%s".printf(name,dt.format("%Y_%b_%d")));
612                         _this.view.loadTicket("");              
613                         
614                         this.el.get_child().get_style_context().add_class("warning");
615                         _this.createbtn.updateState();
616                         return;
617                 }
618                 
619                 
620                 var ticket = RooTicket.singleton().getById(ticket_id);
621                
622                 _this.name.el.set_text("wip_%s_T%s_%s".printf(name,ticket.id, ticket.summaryToBranchName()));
623                 _this.scrolled_window.el.show();
624                  
625                 _this.view.loadTicket(ticket.id);
626                 _this.createbtn.updateState();
627                 
628                 //GLib.debug (//"Selection: %s, %s\n", (string) val1, (string) val2);
629             });
630         }
631
632         // user defined functions
633         public string selectedTicketId () {
634         Gtk.TreeIter iter;
635                 Value val1;
636          
637          
638                 this.el.get_active_iter (out iter);
639                 _this.dbmodel.el.get_value (iter, 0, out val1);
640          
641         
642                 return  (string) val1;
643                 
644                 
645                 
646                 
647         }
648     }
649     public class Xcls_dbcellrenderer : Object
650     {
651         public Gtk.CellRendererText el;
652         private NewBranch  _this;
653
654
655             // my vars (def)
656
657         // ctor
658         public Xcls_dbcellrenderer(NewBranch _owner )
659         {
660             _this = _owner;
661             _this.dbcellrenderer = this;
662             this.el = new Gtk.CellRendererText();
663
664             // my vars (dec)
665
666             // set gobject values
667         }
668
669         // user defined functions
670     }
671
672     public class Xcls_dbmodel : Object
673     {
674         public Gtk.ListStore el;
675         private NewBranch  _this;
676
677
678             // my vars (def)
679
680         // ctor
681         public Xcls_dbmodel(NewBranch _owner )
682         {
683             _this = _owner;
684             _this.dbmodel = this;
685             this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
686
687             // my vars (dec)
688
689             // set gobject values
690         }
691
692         // user defined functions
693         public void loadTickets (string project_id , string tid = "") {
694         
695         
696             
697             // fixme .. get project id from selection..
698             
699              RooTicket.singleton().loadTickets(
700                                 project_id,
701                                 _this.btn_not_me.el.active ? RooTicket.Who.ANYBODY :  RooTicket.Who.ME,
702                                  _this.btn_closed.el.active ? RooTicket.Status.ALL :  RooTicket.Status.ACTIVE
703                          );
704                 
705             _this.ticketsel.loading = true;
706         
707             this.el.clear();                                    
708             Gtk.TreeIter iter;
709             var el = this.el;
710             
711             el.append(out iter);
712         
713             
714             el.set_value(iter, 0, "");
715             el.set_value(iter, 1, "-- select a ticket --");
716             
717             _this.ticketsel.el.set_active_iter(iter);
718             var tickets = RooTicket.singleton().tickets;
719             foreach(var ticket in tickets) {
720             
721                 el.append(out iter);
722                 
723                 el.set_value(iter, 0, ticket.id);
724                 el.set_value(iter, 1, "#%s %s".printf( ticket.id, ticket.summary));
725                 
726                 if (ticket.id == tid) {
727                             _this.ticketsel.el.set_active_iter(iter);
728                 }
729                 
730             }
731             
732             _this.ticketsel.loading = false;
733              //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);          
734                                              
735         }
736     }
737
738
739     public class Xcls_Label16 : Object
740     {
741         public Gtk.Label el;
742         private NewBranch  _this;
743
744
745             // my vars (def)
746
747         // ctor
748         public Xcls_Label16(NewBranch _owner )
749         {
750             _this = _owner;
751             this.el = new Gtk.Label( "Use this as branch name" );
752
753             // my vars (dec)
754
755             // set gobject values
756             this.el.halign = Gtk.Align.START;
757             this.el.justify = Gtk.Justification.RIGHT;
758             this.el.xalign = 0.900000f;
759         }
760
761         // user defined functions
762     }
763
764     public class Xcls_name : Object
765     {
766         public Gtk.Entry el;
767         private NewBranch  _this;
768
769
770             // my vars (def)
771
772         // ctor
773         public Xcls_name(NewBranch _owner )
774         {
775             _this = _owner;
776             _this.name = this;
777             this.el = new Gtk.Entry();
778
779             // my vars (dec)
780
781             // set gobject values
782             this.el.visible = true;
783         }
784
785         // user defined functions
786     }
787
788     public class Xcls_createbtn : Object
789     {
790         public Gtk.Button el;
791         private NewBranch  _this;
792
793
794             // my vars (def)
795
796         // ctor
797         public Xcls_createbtn(NewBranch _owner )
798         {
799             _this = _owner;
800             _this.createbtn = this;
801             this.el = new Gtk.Button();
802
803             // my vars (dec)
804
805             // set gobject values
806             this.el.label = "Create Branch";
807
808             // init method
809
810             {
811                this.el.get_style_context().add_class("suggested-action");
812             }
813
814             //listeners
815             this.el.clicked.connect( () => {
816             
817                 GLib.debug("fire response = 1");
818                 
819                 var ticket_id = _this.ticketsel.selectedTicketId();
820                 
821                 if (ticket_id == "") {
822                         _this.ticketsel.el.get_child().get_style_context().add_class("warning");
823                         return;
824                 }
825                  
826                 _this.el.response(1);
827             });
828         }
829
830         // user defined functions
831         public void updateState () {
832         
833                 var ticket_id = _this.ticketsel.selectedTicketId();
834                 
835                 if (ticket_id == "") {
836                         this.el.set_sensitive(false);
837                         return;
838                 }
839          
840                 this.el.set_sensitive(true);
841          
842         }
843     }
844
845     public class Xcls_Box19 : Object
846     {
847         public Gtk.Box el;
848         private NewBranch  _this;
849
850
851             // my vars (def)
852
853         // ctor
854         public Xcls_Box19(NewBranch _owner )
855         {
856             _this = _owner;
857             this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
858
859             // my vars (dec)
860
861             // set gobject values
862             var child_0 = new Xcls_btn_not_me( _this );
863             child_0.ref();
864             this.el.add (  child_0.el  );
865             var child_1 = new Xcls_btn_closed( _this );
866             child_1.ref();
867             this.el.add (  child_1.el  );
868             var child_2 = new Xcls_Label22( _this );
869             child_2.ref();
870             this.el.add (  child_2.el  );
871         }
872
873         // user defined functions
874     }
875     public class Xcls_btn_not_me : Object
876     {
877         public Gtk.CheckButton el;
878         private NewBranch  _this;
879
880
881             // my vars (def)
882
883         // ctor
884         public Xcls_btn_not_me(NewBranch _owner )
885         {
886             _this = _owner;
887             _this.btn_not_me = this;
888             this.el = new Gtk.CheckButton();
889
890             // my vars (dec)
891
892             // set gobject values
893             this.el.label = "Show tickets not assigned to me";
894
895             //listeners
896             this.el.toggled.connect( () => {
897                 var project_id = _this.projectsel.selectedProjectId();
898                 _this.dbmodel.loadTickets(project_id);  
899             });
900         }
901
902         // user defined functions
903     }
904
905     public class Xcls_btn_closed : Object
906     {
907         public Gtk.CheckButton el;
908         private NewBranch  _this;
909
910
911             // my vars (def)
912
913         // ctor
914         public Xcls_btn_closed(NewBranch _owner )
915         {
916             _this = _owner;
917             _this.btn_closed = this;
918             this.el = new Gtk.CheckButton();
919
920             // my vars (dec)
921
922             // set gobject values
923             this.el.label = "Show closed Tickets";
924
925             //listeners
926             this.el.toggled.connect( () => {
927                 var project_id = _this.projectsel.selectedProjectId();
928                 _this.dbmodel.loadTickets(project_id);  
929                  
930             });
931         }
932
933         // user defined functions
934     }
935
936     public class Xcls_Label22 : Object
937     {
938         public Gtk.Label el;
939         private NewBranch  _this;
940
941
942             // my vars (def)
943
944         // ctor
945         public Xcls_Label22(NewBranch _owner )
946         {
947             _this = _owner;
948             this.el = new Gtk.Label( "<a href=\"refresh\">Refresh Ticket list</a>" );
949
950             // my vars (dec)
951
952             // set gobject values
953             this.el.halign = Gtk.Align.END;
954             this.el.hexpand = true;
955             this.el.use_markup = true;
956
957             //listeners
958             this.el.activate_link.connect( (uri) => {
959                 if (uri == "refresh") {
960                         RooProject.reload();
961                         var curproj = RooProject.getProjectByRepo(_this.repo);
962                          _this.prmodel.loadProjects(curproj == null ? "": curproj.id);
963             
964                         _this.dbmodel.loadTickets(curproj == null ? "": curproj.id);            
965                 }
966                 return true;
967             });
968         }
969
970         // user defined functions
971     }
972
973
974
975     public class Xcls_scrolled_window : Object
976     {
977         public Gtk.ScrolledWindow el;
978         private NewBranch  _this;
979
980
981             // my vars (def)
982
983         // ctor
984         public Xcls_scrolled_window(NewBranch _owner )
985         {
986             _this = _owner;
987             _this.scrolled_window = this;
988             this.el = new Gtk.ScrolledWindow( null, null );
989
990             // my vars (dec)
991
992             // set gobject values
993             this.el.height_request = 500;
994             this.el.vexpand = true;
995             var child_0 = new Xcls_view( _this );
996             child_0.ref();
997             this.el.add (  child_0.el  );
998
999             // init method
1000
1001             {
1002                 this.el.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);
1003             }
1004         }
1005
1006         // user defined functions
1007     }
1008     public class Xcls_view : Object
1009     {
1010         public WebKit.WebView el;
1011         private NewBranch  _this;
1012
1013
1014             // my vars (def)
1015
1016         // ctor
1017         public Xcls_view(NewBranch _owner )
1018         {
1019             _this = _owner;
1020             _this.view = this;
1021             this.el = new WebKit.WebView();
1022
1023             // my vars (dec)
1024
1025             // set gobject values
1026         }
1027
1028         // user defined functions
1029         public void loadTicket (string tid) {
1030                 int h,w;
1031                 _this.el.get_size(out w, out h);
1032                 
1033                 if (tid == "") {
1034                         _this.scrolled_window.el.hide();
1035                         _this.el.resize(w, 150);
1036                 } else {
1037                         _this.scrolled_window.el.show();
1038                         _this.el.resize(w, 800);
1039                 }
1040                 
1041                 var rs =  RooTicket.singleton();                
1042                 var uri = new WebKit.URIRequest("https://roojs.com/admin.php/MTrack/View/" + tid);
1043                 var hd = uri.get_http_headers();
1044                 var authCode = Base64.encode ("%s:%s".printf(rs.username, rs.password).data);
1045                 hd.append("Authorization", "Basic %s".printf(authCode));
1046                 
1047                  this.el.load_request(uri);
1048         }
1049     }
1050
1051
1052
1053     public class Xcls_Box25 : Object
1054     {
1055         public Gtk.Box el;
1056         private NewBranch  _this;
1057
1058
1059             // my vars (def)
1060
1061         // ctor
1062         public Xcls_Box25(NewBranch _owner )
1063         {
1064             _this = _owner;
1065             this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
1066
1067             // my vars (dec)
1068
1069             // set gobject values
1070             this.el.homogeneous = false;
1071             var child_0 = new Xcls_table( _this );
1072             child_0.ref();
1073             this.el.pack_start (  child_0.el , false,false,0 );
1074         }
1075
1076         // user defined functions
1077     }
1078     public class Xcls_table : Object
1079     {
1080         public Gtk.Table el;
1081         private NewBranch  _this;
1082
1083
1084             // my vars (def)
1085
1086         // ctor
1087         public Xcls_table(NewBranch _owner )
1088         {
1089             _this = _owner;
1090             _this.table = this;
1091             this.el = new Gtk.Table( 14, 4, true );
1092
1093             // my vars (dec)
1094
1095             // set gobject values
1096             this.el.expand = false;
1097             this.el.margin = 2;
1098             this.el.column_spacing = 4;
1099             this.el.vexpand = false;
1100             var child_0 = new Xcls_Label27( _this );
1101             child_0.ref();
1102             this.el.attach_defaults (  child_0.el , 0,1,0,1 );
1103             var child_1 = new Xcls_Label28( _this );
1104             child_1.ref();
1105             this.el.attach_defaults (  child_1.el , 1,2,0,1 );
1106             var child_2 = new Xcls_project_id( _this );
1107             child_2.ref();
1108             this.el.attach_defaults (  child_2.el , 0,1,1,2 );
1109             var child_3 = new Xcls_summary( _this );
1110             child_3.ref();
1111             this.el.attach_defaults (  child_3.el , 1,4,1,2 );
1112             var child_4 = new Xcls_Label33( _this );
1113             child_4.ref();
1114             this.el.attach_defaults (  child_4.el , 0,1,2,3 );
1115             var child_5 = new Xcls_milestone_id( _this );
1116             child_5.ref();
1117             this.el.attach_defaults (  child_5.el , 0,1,3,4 );
1118             var child_6 = new Xcls_Label36( _this );
1119             child_6.ref();
1120             this.el.attach_defaults (  child_6.el , 1,4,2,3 );
1121             var child_7 = new Xcls_description( _this );
1122             child_7.ref();
1123             this.el.attach_defaults (  child_7.el , 1,4,3,12 );
1124             var child_8 = new Xcls_Label38( _this );
1125             child_8.ref();
1126             this.el.attach_defaults (  child_8.el , 0,1,4,5 );
1127             var child_9 = new Xcls_priority_id( _this );
1128             child_9.ref();
1129             this.el.attach_defaults (  child_9.el , 0,1,5,6 );
1130             var child_10 = new Xcls_Label41( _this );
1131             child_10.ref();
1132             this.el.attach_defaults (  child_10.el , 0,1,6,7 );
1133             var child_11 = new Xcls_severity_id( _this );
1134             child_11.ref();
1135             this.el.attach_defaults (  child_11.el , 0,1,7,8 );
1136             var child_12 = new Xcls_Label44( _this );
1137             child_12.ref();
1138             this.el.attach_defaults (  child_12.el , 0,1,8,9 );
1139             var child_13 = new Xcls_classification_id( _this );
1140             child_13.ref();
1141             this.el.attach_defaults (  child_13.el , 0,1,9,10 );
1142             var child_14 = new Xcls_Label47( _this );
1143             child_14.ref();
1144             this.el.attach_defaults (  child_14.el , 0,1,10,11 );
1145             var child_15 = new Xcls_developer_id( _this );
1146             child_15.ref();
1147             this.el.attach_defaults (  child_15.el , 0,1,11,12 );
1148             var child_16 = new Xcls_Button50( _this );
1149             child_16.ref();
1150             this.el.attach_defaults (  child_16.el , 0,4,13,14 );
1151         }
1152
1153         // user defined functions
1154     }
1155     public class Xcls_Label27 : Object
1156     {
1157         public Gtk.Label el;
1158         private NewBranch  _this;
1159
1160
1161             // my vars (def)
1162
1163         // ctor
1164         public Xcls_Label27(NewBranch _owner )
1165         {
1166             _this = _owner;
1167             this.el = new Gtk.Label( "Project" );
1168
1169             // my vars (dec)
1170
1171             // set gobject values
1172             this.el.halign = Gtk.Align.START;
1173             this.el.visible = true;
1174         }
1175
1176         // user defined functions
1177     }
1178
1179     public class Xcls_Label28 : Object
1180     {
1181         public Gtk.Label el;
1182         private NewBranch  _this;
1183
1184
1185             // my vars (def)
1186
1187         // ctor
1188         public Xcls_Label28(NewBranch _owner )
1189         {
1190             _this = _owner;
1191             this.el = new Gtk.Label( "Summary" );
1192
1193             // my vars (dec)
1194
1195             // set gobject values
1196             this.el.halign = Gtk.Align.START;
1197             this.el.visible = true;
1198         }
1199
1200         // user defined functions
1201     }
1202
1203     public class Xcls_project_id : Object
1204     {
1205         public Gtk.ComboBox el;
1206         private NewBranch  _this;
1207
1208
1209             // my vars (def)
1210         public bool loading;
1211
1212         // ctor
1213         public Xcls_project_id(NewBranch _owner )
1214         {
1215             _this = _owner;
1216             _this.project_id = this;
1217             this.el = new Gtk.ComboBox.with_entry();
1218
1219             // my vars (dec)
1220             this.loading = false;
1221
1222             // set gobject values
1223             var child_0 = new Xcls_prcellrenderer( _this );
1224             child_0.ref();
1225             this.el.pack_start (  child_0.el , true );
1226             var child_1 = new Xcls_prmodel( _this );
1227             child_1.ref();
1228             this.el.set_model (  child_1.el  );
1229
1230             // init method
1231
1232             this.el.set_entry_text_column(1);
1233
1234             //listeners
1235             this.el.changed.connect( () => {
1236                 if (this.loading) {
1237                         return;
1238                 }
1239                 var project_id = this.selectedProjectId();
1240                 
1241                 var rt = RooTicket.singleton();
1242                 rt.loadProjectOptions(project_id);
1243                 
1244                 _this.msmodel.loadMilestones();
1245                 _this.primodel.loadPriorities();
1246                 _this.sevmodel.loadSeverities();
1247                 _this.clmodel.loadClassifications();    
1248                 _this.devmodel.loadDevelopers();        
1249                 
1250                 // affects projects and milestones..
1251                 
1252                 
1253                 /*if (this.loading) {
1254                         return;
1255                 }
1256                 var ticket_id = this.selectedTicketId();
1257                 
1258                 var name = RooTicket.singleton().usernameLocal();
1259                 
1260                 if (ticket_id == "" || ticket_id == null) {
1261                 
1262                         var dt = new  DateTime.now_local();
1263                         _this.name.el.set_text("wip_%s_%s".printf(name,dt.format("%Y_%b_%d")));
1264                         return;
1265                 }
1266                 
1267                 
1268                 var ticket = RooTicket.singleton().getById(ticket_id);
1269                
1270                 _this.name.el.set_text("wip_%s_T%s_%s".printf(name,ticket.id, ticket.summaryToBranchName()));
1271                 
1272                 //GLib.debug (//"Selection: %s, %s\n", (string) val1, (string) val2);
1273                 */
1274             });
1275         }
1276
1277         // user defined functions
1278         public string selectedProjectId () {
1279                 Gtk.TreeIter iter;
1280                 Value val1;
1281          
1282          
1283                 this.el.get_active_iter (out iter);
1284                 _this.prmodel.el.get_value (iter, 0, out val1);
1285          
1286         
1287                 return  (string) val1;
1288                 
1289                 
1290                 
1291                 
1292         }
1293     }
1294     public class Xcls_prcellrenderer : Object
1295     {
1296         public Gtk.CellRendererText el;
1297         private NewBranch  _this;
1298
1299
1300             // my vars (def)
1301
1302         // ctor
1303         public Xcls_prcellrenderer(NewBranch _owner )
1304         {
1305             _this = _owner;
1306             _this.prcellrenderer = this;
1307             this.el = new Gtk.CellRendererText();
1308
1309             // my vars (dec)
1310
1311             // set gobject values
1312         }
1313
1314         // user defined functions
1315     }
1316
1317     public class Xcls_prmodel : Object
1318     {
1319         public Gtk.ListStore el;
1320         private NewBranch  _this;
1321
1322
1323             // my vars (def)
1324
1325         // ctor
1326         public Xcls_prmodel(NewBranch _owner )
1327         {
1328             _this = _owner;
1329             _this.prmodel = this;
1330             this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
1331
1332             // my vars (dec)
1333
1334             // set gobject values
1335         }
1336
1337         // user defined functions
1338         public void loadProjects (string id) {
1339         
1340             
1341             _this.project_id.loading = true;
1342         
1343             this.el.clear();                                    
1344             Gtk.TreeIter iter;
1345             var el = this.el;
1346             
1347             el.append(out iter);
1348         
1349             
1350             el.set_value(iter, 0, "");
1351             el.set_value(iter, 1, "-- select a project --");
1352             if (id == "") {
1353                     _this.project_id.el.set_active_iter(iter);
1354             }
1355         
1356             foreach(var project in RooProject.projects()) {
1357             
1358                 el.append(out iter);
1359                 
1360                 el.set_value(iter, 0, project.id);
1361                 el.set_value(iter, 1,  project.name );
1362                 if (id == project.id) {
1363                            _this.project_id.el.set_active_iter(iter);
1364                     }   
1365                 
1366             }
1367             
1368             _this.project_id.loading = false;
1369              //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);          
1370                                              
1371         }
1372     }
1373
1374
1375     public class Xcls_summary : Object
1376     {
1377         public Gtk.Entry el;
1378         private NewBranch  _this;
1379
1380
1381             // my vars (def)
1382
1383         // ctor
1384         public Xcls_summary(NewBranch _owner )
1385         {
1386             _this = _owner;
1387             _this.summary = this;
1388             this.el = new Gtk.Entry();
1389
1390             // my vars (dec)
1391
1392             // set gobject values
1393             this.el.visible = true;
1394         }
1395
1396         // user defined functions
1397     }
1398
1399     public class Xcls_Label33 : Object
1400     {
1401         public Gtk.Label el;
1402         private NewBranch  _this;
1403
1404
1405             // my vars (def)
1406
1407         // ctor
1408         public Xcls_Label33(NewBranch _owner )
1409         {
1410             _this = _owner;
1411             this.el = new Gtk.Label( "Milestone" );
1412
1413             // my vars (dec)
1414
1415             // set gobject values
1416             this.el.halign = Gtk.Align.START;
1417             this.el.justify = Gtk.Justification.RIGHT;
1418             this.el.xalign = 0.900000f;
1419         }
1420
1421         // user defined functions
1422     }
1423
1424     public class Xcls_milestone_id : Object
1425     {
1426         public Gtk.ComboBox el;
1427         private NewBranch  _this;
1428
1429
1430             // my vars (def)
1431         public bool loading;
1432
1433         // ctor
1434         public Xcls_milestone_id(NewBranch _owner )
1435         {
1436             _this = _owner;
1437             _this.milestone_id = this;
1438             this.el = new Gtk.ComboBox.with_entry();
1439
1440             // my vars (dec)
1441             this.loading = false;
1442
1443             // set gobject values
1444             var child_0 = new Xcls_msmodel( _this );
1445             child_0.ref();
1446             this.el.set_model (  child_0.el  );
1447
1448             // init method
1449
1450             this.el.set_entry_text_column(1);
1451         }
1452
1453         // user defined functions
1454         public string selectedMilestoneId () {
1455                 Gtk.TreeIter iter;
1456                 Value val1;
1457          
1458          
1459                 this.el.get_active_iter (out iter);
1460                 _this.msmodel.el.get_value (iter, 0, out val1);
1461          
1462         
1463                 return  (string) val1;
1464                 
1465                 
1466                 
1467                 
1468         }
1469     }
1470     public class Xcls_msmodel : Object
1471     {
1472         public Gtk.ListStore el;
1473         private NewBranch  _this;
1474
1475
1476             // my vars (def)
1477
1478         // ctor
1479         public Xcls_msmodel(NewBranch _owner )
1480         {
1481             _this = _owner;
1482             _this.msmodel = this;
1483             this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
1484
1485             // my vars (dec)
1486
1487             // set gobject values
1488         }
1489
1490         // user defined functions
1491         public void loadMilestones ( ) {
1492         
1493             var rt = RooTicket.singleton();
1494            // rt.loadProjects();
1495             
1496             _this.milestone_id.loading = true;
1497         
1498             this.el.clear();                                    
1499             Gtk.TreeIter iter;
1500             var el = this.el;
1501             
1502             el.append(out iter);
1503         
1504             
1505             el.set_value(iter, 0, "");
1506             el.set_value(iter, 1, "-- select a milestone --");
1507             _this.milestone_id.el.set_active_iter(iter);    
1508              
1509             var projects = rt.milestones;
1510             foreach(var project in projects) {
1511             
1512                 el.append(out iter);
1513                 
1514                 el.set_value(iter, 0, project.id);
1515                 el.set_value(iter, 1,  project.display_name );
1516               //  if (id == project.id) {
1517                  //        _this.milestone.el.set_active_iter(iter);
1518                  //   }   
1519                 
1520             }
1521             
1522             
1523             _this.milestone_id.loading = false;
1524              //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);          
1525                                              
1526         }
1527     }
1528
1529
1530     public class Xcls_Label36 : Object
1531     {
1532         public Gtk.Label el;
1533         private NewBranch  _this;
1534
1535
1536             // my vars (def)
1537
1538         // ctor
1539         public Xcls_Label36(NewBranch _owner )
1540         {
1541             _this = _owner;
1542             this.el = new Gtk.Label( "Description" );
1543
1544             // my vars (dec)
1545
1546             // set gobject values
1547             this.el.halign = Gtk.Align.START;
1548         }
1549
1550         // user defined functions
1551     }
1552
1553     public class Xcls_description : Object
1554     {
1555         public Gtk.TextView el;
1556         private NewBranch  _this;
1557
1558
1559             // my vars (def)
1560
1561         // ctor
1562         public Xcls_description(NewBranch _owner )
1563         {
1564             _this = _owner;
1565             _this.description = this;
1566             this.el = new Gtk.TextView();
1567
1568             // my vars (dec)
1569
1570             // set gobject values
1571             this.el.border_width = 1;
1572         }
1573
1574         // user defined functions
1575     }
1576
1577     public class Xcls_Label38 : Object
1578     {
1579         public Gtk.Label el;
1580         private NewBranch  _this;
1581
1582
1583             // my vars (def)
1584
1585         // ctor
1586         public Xcls_Label38(NewBranch _owner )
1587         {
1588             _this = _owner;
1589             this.el = new Gtk.Label( "Priority" );
1590
1591             // my vars (dec)
1592
1593             // set gobject values
1594             this.el.halign = Gtk.Align.START;
1595             this.el.xalign = 0.900000f;
1596         }
1597
1598         // user defined functions
1599     }
1600
1601     public class Xcls_priority_id : Object
1602     {
1603         public Gtk.ComboBox el;
1604         private NewBranch  _this;
1605
1606
1607             // my vars (def)
1608         public bool loading;
1609
1610         // ctor
1611         public Xcls_priority_id(NewBranch _owner )
1612         {
1613             _this = _owner;
1614             _this.priority_id = this;
1615             this.el = new Gtk.ComboBox.with_entry();
1616
1617             // my vars (dec)
1618             this.loading = false;
1619
1620             // set gobject values
1621             var child_0 = new Xcls_primodel( _this );
1622             child_0.ref();
1623             this.el.set_model (  child_0.el  );
1624
1625             // init method
1626
1627             this.el.set_entry_text_column(1);
1628         }
1629
1630         // user defined functions
1631         public string selectedPriorityId () {
1632                 Gtk.TreeIter iter;
1633                 Value val1;
1634          
1635          
1636                 this.el.get_active_iter (out iter);
1637                 _this.primodel.el.get_value (iter, 0, out val1);
1638          
1639         
1640                 return  (string) val1;
1641                 
1642                 
1643                 
1644                 
1645         }
1646     }
1647     public class Xcls_primodel : Object
1648     {
1649         public Gtk.ListStore el;
1650         private NewBranch  _this;
1651
1652
1653             // my vars (def)
1654
1655         // ctor
1656         public Xcls_primodel(NewBranch _owner )
1657         {
1658             _this = _owner;
1659             _this.primodel = this;
1660             this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
1661
1662             // my vars (dec)
1663
1664             // set gobject values
1665         }
1666
1667         // user defined functions
1668         public void loadPriorities ( ) {
1669         
1670             var rt = RooTicket.singleton();
1671            // rt.loadProjects();
1672             
1673             _this.priority_id.loading = true;
1674         
1675             this.el.clear();                                    
1676             Gtk.TreeIter iter;
1677             var el = this.el;
1678             
1679             
1680            var projects = rt.priorities;
1681             foreach(var project in projects) {
1682             
1683                 el.append(out iter);
1684                 
1685                 el.set_value(iter, 0, project.id);
1686                 el.set_value(iter, 1,  project.display_name );
1687                 if ("normal" == project.name) {
1688                            _this.priority_id.el.set_active_iter(iter);
1689                     }   
1690                 
1691             }
1692             
1693             _this.priority_id.loading = false;
1694                    
1695                                              
1696         }
1697     }
1698
1699
1700     public class Xcls_Label41 : Object
1701     {
1702         public Gtk.Label el;
1703         private NewBranch  _this;
1704
1705
1706             // my vars (def)
1707
1708         // ctor
1709         public Xcls_Label41(NewBranch _owner )
1710         {
1711             _this = _owner;
1712             this.el = new Gtk.Label( "Severity" );
1713
1714             // my vars (dec)
1715
1716             // set gobject values
1717             this.el.halign = Gtk.Align.START;
1718         }
1719
1720         // user defined functions
1721     }
1722
1723     public class Xcls_severity_id : Object
1724     {
1725         public Gtk.ComboBox el;
1726         private NewBranch  _this;
1727
1728
1729             // my vars (def)
1730         public bool loading;
1731
1732         // ctor
1733         public Xcls_severity_id(NewBranch _owner )
1734         {
1735             _this = _owner;
1736             _this.severity_id = this;
1737             this.el = new Gtk.ComboBox.with_entry();
1738
1739             // my vars (dec)
1740             this.loading = false;
1741
1742             // set gobject values
1743             var child_0 = new Xcls_sevmodel( _this );
1744             child_0.ref();
1745             this.el.set_model (  child_0.el  );
1746
1747             // init method
1748
1749             this.el.set_entry_text_column(1);
1750         }
1751
1752         // user defined functions
1753         public string selectedSeverityId () {
1754                 Gtk.TreeIter iter;
1755                 Value val1;
1756          
1757          
1758                 this.el.get_active_iter (out iter);
1759                 _this.sevmodel.el.get_value (iter, 0, out val1);
1760          
1761         
1762                 return  (string) val1;
1763                 
1764                 
1765                 
1766                 
1767         }
1768     }
1769     public class Xcls_sevmodel : Object
1770     {
1771         public Gtk.ListStore el;
1772         private NewBranch  _this;
1773
1774
1775             // my vars (def)
1776
1777         // ctor
1778         public Xcls_sevmodel(NewBranch _owner )
1779         {
1780             _this = _owner;
1781             _this.sevmodel = this;
1782             this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
1783
1784             // my vars (dec)
1785
1786             // set gobject values
1787         }
1788
1789         // user defined functions
1790         public void loadSeverities () {
1791         
1792             var rt = RooTicket.singleton();
1793             //rt.loadProjects();
1794             
1795             _this.severity_id.loading = true;
1796         
1797             this.el.clear();                                    
1798             Gtk.TreeIter iter;
1799             var el = this.el;
1800              
1801             var projects = rt.serverities;
1802             foreach(var project in projects) {
1803             
1804                 el.append(out iter);
1805                 
1806                 el.set_value(iter, 0, project.id);
1807                 el.set_value(iter, 1,  project.display_name );
1808                 if ("normal" == project.name) {
1809                            _this.severity_id.el.set_active_iter(iter);
1810                     }   
1811                 
1812             }
1813            
1814             _this.severity_id.loading = false;
1815              //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);          
1816                                              
1817         }
1818     }
1819
1820
1821     public class Xcls_Label44 : Object
1822     {
1823         public Gtk.Label el;
1824         private NewBranch  _this;
1825
1826
1827             // my vars (def)
1828
1829         // ctor
1830         public Xcls_Label44(NewBranch _owner )
1831         {
1832             _this = _owner;
1833             this.el = new Gtk.Label( "Classification" );
1834
1835             // my vars (dec)
1836
1837             // set gobject values
1838             this.el.halign = Gtk.Align.START;
1839         }
1840
1841         // user defined functions
1842     }
1843
1844     public class Xcls_classification_id : Object
1845     {
1846         public Gtk.ComboBox el;
1847         private NewBranch  _this;
1848
1849
1850             // my vars (def)
1851         public bool loading;
1852
1853         // ctor
1854         public Xcls_classification_id(NewBranch _owner )
1855         {
1856             _this = _owner;
1857             _this.classification_id = this;
1858             this.el = new Gtk.ComboBox.with_entry();
1859
1860             // my vars (dec)
1861             this.loading = false;
1862
1863             // set gobject values
1864             var child_0 = new Xcls_clmodel( _this );
1865             child_0.ref();
1866             this.el.set_model (  child_0.el  );
1867
1868             // init method
1869
1870             this.el.set_entry_text_column(1);
1871         }
1872
1873         // user defined functions
1874         public string selectedClassificationId () {
1875                 Gtk.TreeIter iter;
1876                 Value val1;
1877          
1878          
1879                 this.el.get_active_iter (out iter);
1880                 _this.clmodel.el.get_value (iter, 0, out val1);
1881          
1882         
1883                 return  (string) val1;
1884                 
1885                 
1886                 
1887                 
1888         }
1889     }
1890     public class Xcls_clmodel : Object
1891     {
1892         public Gtk.ListStore el;
1893         private NewBranch  _this;
1894
1895
1896             // my vars (def)
1897
1898         // ctor
1899         public Xcls_clmodel(NewBranch _owner )
1900         {
1901             _this = _owner;
1902             _this.clmodel = this;
1903             this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
1904
1905             // my vars (dec)
1906
1907             // set gobject values
1908         }
1909
1910         // user defined functions
1911         public void loadClassifications ( ) {
1912         
1913             var rt = RooTicket.singleton();
1914             // rt.loadProjects();
1915             
1916             _this.classification_id.loading = true;
1917         
1918             this.el.clear();                                    
1919             Gtk.TreeIter iter;
1920             var el = this.el;
1921             
1922             el.append(out iter);
1923         
1924              
1925             var projects = rt.classifications;
1926             foreach(var project in projects) {
1927             
1928                 el.append(out iter);
1929                 
1930                 el.set_value(iter, 0, project.id);
1931                 el.set_value(iter, 1,  project.display_name );
1932                 if ("bug" == project.name) {
1933                            _this.classification_id.el.set_active_iter(iter);
1934                     }   
1935                 
1936             }
1937             
1938             _this.classification_id.loading = false;
1939              //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);          
1940                                              
1941         }
1942     }
1943
1944
1945     public class Xcls_Label47 : Object
1946     {
1947         public Gtk.Label el;
1948         private NewBranch  _this;
1949
1950
1951             // my vars (def)
1952
1953         // ctor
1954         public Xcls_Label47(NewBranch _owner )
1955         {
1956             _this = _owner;
1957             this.el = new Gtk.Label( "Assign to" );
1958
1959             // my vars (dec)
1960
1961             // set gobject values
1962             this.el.halign = Gtk.Align.START;
1963         }
1964
1965         // user defined functions
1966     }
1967
1968     public class Xcls_developer_id : Object
1969     {
1970         public Gtk.ComboBox el;
1971         private NewBranch  _this;
1972
1973
1974             // my vars (def)
1975         public bool loading;
1976
1977         // ctor
1978         public Xcls_developer_id(NewBranch _owner )
1979         {
1980             _this = _owner;
1981             _this.developer_id = this;
1982             this.el = new Gtk.ComboBox.with_entry();
1983
1984             // my vars (dec)
1985             this.loading = false;
1986
1987             // set gobject values
1988             var child_0 = new Xcls_devmodel( _this );
1989             child_0.ref();
1990             this.el.set_model (  child_0.el  );
1991
1992             // init method
1993
1994             this.el.set_entry_text_column(1);
1995         }
1996
1997         // user defined functions
1998         public string selectedDeveloperId () {
1999                 Gtk.TreeIter iter;
2000                 Value val1;
2001          
2002          
2003                 this.el.get_active_iter (out iter);
2004                 _this.devmodel.el.get_value (iter, 0, out val1);
2005          
2006         
2007                 return  (string) val1;
2008                 
2009                 
2010                 
2011                 
2012         }
2013     }
2014     public class Xcls_devmodel : Object
2015     {
2016         public Gtk.ListStore el;
2017         private NewBranch  _this;
2018
2019
2020             // my vars (def)
2021
2022         // ctor
2023         public Xcls_devmodel(NewBranch _owner )
2024         {
2025             _this = _owner;
2026             _this.devmodel = this;
2027             this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
2028
2029             // my vars (dec)
2030
2031             // set gobject values
2032         }
2033
2034         // user defined functions
2035         public void loadDevelopers ( ) {
2036         
2037             var rt = RooTicket.singleton();
2038             //rt.loadProjects();
2039             
2040             _this.developer_id.loading = true;
2041         
2042             this.el.clear();                                    
2043             Gtk.TreeIter iter;
2044             var el = this.el;
2045             
2046             el.append(out iter);
2047         
2048             
2049             el.set_value(iter, 0, "");
2050             el.set_value(iter, 1, "-- select a developer --");
2051           //  if (id == "") {
2052                     _this.developer_id.el.set_active_iter(iter);
2053            // }
2054             
2055             var peps = rt.developers;
2056             foreach(var p in peps) {
2057             
2058                 el.append(out iter);
2059                 
2060                 el.set_value(iter, 0, p.id);
2061                 el.set_value(iter, 1,  p.display_name );
2062                 if (rt.authuser_id == p.id) {
2063                            _this.developer_id.el.set_active_iter(iter);
2064                     }   
2065             }
2066          
2067             _this.developer_id.loading = false;
2068              //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);          
2069                                              
2070         }
2071     }
2072
2073
2074     public class Xcls_Button50 : Object
2075     {
2076         public Gtk.Button el;
2077         private NewBranch  _this;
2078
2079
2080             // my vars (def)
2081
2082         // ctor
2083         public Xcls_Button50(NewBranch _owner )
2084         {
2085             _this = _owner;
2086             this.el = new Gtk.Button();
2087
2088             // my vars (dec)
2089
2090             // set gobject values
2091             this.el.label = "Create Ticket & Branch";
2092
2093             // init method
2094
2095             {
2096                this.el.get_style_context().add_class("suggested-action");
2097             }
2098
2099             //listeners
2100             this.el.clicked.connect( () => {
2101                 GLib.debug("fire response = 1");
2102                 
2103                 
2104                 var invalid = false;
2105                 
2106                 // validate first...
2107                 _this.project_id.el.get_child().get_style_context().remove_class("warning");    
2108                 if (_this.project_id.selectedProjectId() == "") {
2109                         _this.project_id.el.get_child().get_style_context().add_class("warning");
2110                         invalid = true;
2111                 }
2112                 
2113                 _this.milestone_id.el.get_child().get_style_context().remove_class("warning");  
2114             
2115                 _this.priority_id.el.get_child().get_style_context().remove_class("warning");   
2116                 if (_this.priority_id.selectedPriorityId() == "") {
2117                         _this.priority_id.el.get_child().get_style_context().add_class("warning");
2118                         invalid = true;
2119                 }
2120                 
2121                 _this.classification_id.el.get_child().get_style_context().remove_class("warning");     
2122                 if (_this.classification_id.selectedClassificationId() == "") {
2123                         _this.classification_id.el.get_child().get_style_context().add_class("warning");
2124                         invalid = true;
2125                 }
2126                 
2127                 _this.developer_id.el.get_child().get_style_context().remove_class("warning");  
2128                 if (_this.developer_id.selectedDeveloperId() == "") {
2129                         _this.developer_id.el.get_child().get_style_context().add_class("warning");
2130                         invalid = true;
2131                 }
2132                 
2133                 _this.summary.el.get_style_context().remove_class("warning");   
2134                 if (_this.summary.el.get_text() == "") {
2135                         _this.summary.el.get_style_context().add_class("warning");
2136                         invalid = true;
2137                 }
2138                 
2139                 _this.description.el.get_style_context().remove_class("warning");       
2140              
2141                 if (invalid) {
2142                         return;
2143                 }
2144                 GLib.debug("for is valid");
2145                 
2146                 _this.el.response(1);
2147             });
2148         }
2149
2150         // user defined functions
2151     }
2152
2153
2154
2155     public class Xcls_Box51 : Object
2156     {
2157         public Gtk.Box el;
2158         private NewBranch  _this;
2159
2160
2161             // my vars (def)
2162
2163         // ctor
2164         public Xcls_Box51(NewBranch _owner )
2165         {
2166             _this = _owner;
2167             this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
2168
2169             // my vars (dec)
2170
2171             // set gobject values
2172             this.el.homogeneous = false;
2173         }
2174
2175         // user defined functions
2176     }
2177
2178
2179 }