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